einj.txt 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. APEI Error INJection
  2. ~~~~~~~~~~~~~~~~~~~~
  3. EINJ provides a hardware error injection mechanism
  4. It is very useful for debugging and testing of other APEI and RAS features.
  5. To use EINJ, make sure the following are enabled in your kernel
  6. configuration:
  7. CONFIG_DEBUG_FS
  8. CONFIG_ACPI_APEI
  9. CONFIG_ACPI_APEI_EINJ
  10. The user interface of EINJ is debug file system, under the
  11. directory apei/einj. The following files are provided.
  12. - available_error_type
  13. Reading this file returns the error injection capability of the
  14. platform, that is, which error types are supported. The error type
  15. definition is as follow, the left field is the error type value, the
  16. right field is error description.
  17. 0x00000001 Processor Correctable
  18. 0x00000002 Processor Uncorrectable non-fatal
  19. 0x00000004 Processor Uncorrectable fatal
  20. 0x00000008 Memory Correctable
  21. 0x00000010 Memory Uncorrectable non-fatal
  22. 0x00000020 Memory Uncorrectable fatal
  23. 0x00000040 PCI Express Correctable
  24. 0x00000080 PCI Express Uncorrectable fatal
  25. 0x00000100 PCI Express Uncorrectable non-fatal
  26. 0x00000200 Platform Correctable
  27. 0x00000400 Platform Uncorrectable non-fatal
  28. 0x00000800 Platform Uncorrectable fatal
  29. The format of file contents are as above, except there are only the
  30. available error type lines.
  31. - error_type
  32. This file is used to set the error type value. The error type value
  33. is defined in "available_error_type" description.
  34. - error_inject
  35. Write any integer to this file to trigger the error
  36. injection. Before this, please specify all necessary error
  37. parameters.
  38. - flags
  39. Present for kernel version 3.13 and above. Used to specify which
  40. of param{1..4} are valid and should be used by BIOS during injection.
  41. Value is a bitmask as specified in ACPI5.0 spec for the
  42. SET_ERROR_TYPE_WITH_ADDRESS data structure:
  43. Bit 0 - Processor APIC field valid (see param3 below)
  44. Bit 1 - Memory address and mask valid (param1 and param2)
  45. Bit 2 - PCIe (seg,bus,dev,fn) valid (param4 below)
  46. If set to zero, legacy behaviour is used where the type of injection
  47. specifies just one bit set, and param1 is multiplexed.
  48. - param1
  49. This file is used to set the first error parameter value. Effect of
  50. parameter depends on error_type specified. For example, if error
  51. type is memory related type, the param1 should be a valid physical
  52. memory address. [Unless "flag" is set - see above]
  53. - param2
  54. This file is used to set the second error parameter value. Effect of
  55. parameter depends on error_type specified. For example, if error
  56. type is memory related type, the param2 should be a physical memory
  57. address mask. Linux requires page or narrower granularity, say,
  58. 0xfffffffffffff000.
  59. - param3
  60. Used when the 0x1 bit is set in "flag" to specify the APIC id
  61. - param4
  62. Used when the 0x4 bit is set in "flag" to specify target PCIe device
  63. - notrigger
  64. The EINJ mechanism is a two step process. First inject the error, then
  65. perform some actions to trigger it. Setting "notrigger" to 1 skips the
  66. trigger phase, which *may* allow the user to cause the error in some other
  67. context by a simple access to the cpu, memory location, or device that is
  68. the target of the error injection. Whether this actually works depends
  69. on what operations the BIOS actually includes in the trigger phase.
  70. BIOS versions based in the ACPI 4.0 specification have limited options
  71. to control where the errors are injected. Your BIOS may support an
  72. extension (enabled with the param_extension=1 module parameter, or
  73. boot command line einj.param_extension=1). This allows the address
  74. and mask for memory injections to be specified by the param1 and
  75. param2 files in apei/einj.
  76. BIOS versions using the ACPI 5.0 specification have more control over
  77. the target of the injection. For processor related errors (type 0x1,
  78. 0x2 and 0x4) the APICID of the target should be provided using the
  79. param1 file in apei/einj. For memory errors (type 0x8, 0x10 and 0x20)
  80. the address is set using param1 with a mask in param2 (0x0 is equivalent
  81. to all ones). For PCI express errors (type 0x40, 0x80 and 0x100) the
  82. segment, bus, device and function are specified using param1:
  83. 31 24 23 16 15 11 10 8 7 0
  84. +-------------------------------------------------+
  85. | segment | bus | device | function | reserved |
  86. +-------------------------------------------------+
  87. An ACPI 5.0 BIOS may also allow vendor specific errors to be injected.
  88. In this case a file named vendor will contain identifying information
  89. from the BIOS that hopefully will allow an application wishing to use
  90. the vendor specific extension to tell that they are running on a BIOS
  91. that supports it. All vendor extensions have the 0x80000000 bit set in
  92. error_type. A file vendor_flags controls the interpretation of param1
  93. and param2 (1 = PROCESSOR, 2 = MEMORY, 4 = PCI). See your BIOS vendor
  94. documentation for details (and expect changes to this API if vendors
  95. creativity in using this feature expands beyond our expectations).
  96. Example:
  97. # cd /sys/kernel/debug/apei/einj
  98. # cat available_error_type # See which errors can be injected
  99. 0x00000002 Processor Uncorrectable non-fatal
  100. 0x00000008 Memory Correctable
  101. 0x00000010 Memory Uncorrectable non-fatal
  102. # echo 0x12345000 > param1 # Set memory address for injection
  103. # echo 0xfffffffffffff000 > param2 # Mask - anywhere in this page
  104. # echo 0x8 > error_type # Choose correctable memory error
  105. # echo 1 > error_inject # Inject now
  106. For more information about EINJ, please refer to ACPI specification
  107. version 4.0, section 17.5 and ACPI 5.0, section 18.6.