mirror-linux/drivers/acpi/apei
Jiaqi Yan 7d444f5099 ACPI: APEI: EINJ: Allow more types of addresses except MMIO
EINJ driver today only allows injection request to go through for two
kinds of IORESOURCE_MEM: IORES_DESC_PERSISTENT_MEMORY and
IORES_DESC_SOFT_RESERVED. This check prevents user of EINJ to test
memory corrupted in many interesting areas:

 - Legacy persistent memory
 - Memory claimed to be used by ACPI tables or NV storage
 - Kernel crash memory and others

There is need to test how kernel behaves when something consumes memory
errors in these memory regions. For example, if certain ACPI table is
corrupted, does kernel crash gracefully to prevent "silent data
corruption". For another example, legacy persistent memory, when managed
by Device DAX, does support recovering from Machine Check Exception
raised by memory failure, hence worth to be tested.

However, attempt to inject memory error via EINJ to legacy persistent
memory or ACPI owned memory fails with -EINVAL.

Allow EINJ to inject at address except it is MMIO. Leave it to the BIOS
or firmware to decide what is a legitimate injection target.

In addition to the test done in [1], on a machine having the following
iomem resources:

    ...
    01000000-08ffffff : Crash kernel
    768f0098-768f00a7 : APEI EINJ
    ...
  768f4000-77323fff : ACPI Non-volatile Storage
  77324000-777fefff : ACPI Tables
  777ff000-777fffff : System RAM
  77800000-7fffffff : Reserved
  80000000-8fffffff : PCI MMCONFIG 0000 [bus 00-ff]
  90040000-957fffff : PCI Bus 0000:00
  ...
  300000000-3ffffffff : Persistent Memory (legacy)
  ...

I commented __einj_error_inject during the test and just tested when
injecting a memory error at each start address shown above:
- 0x80000000 and 0x90040000 both failed with EINVAL
- request passed through for all other addresses

Link: https://lore.kernel.org/linux-acpi/20250825223348.3780279-1-jiaqiyan@google.com [1]
Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Link: https://patch.msgid.link/20250910044531.264043-1-jiaqiyan@google.com
[ rjw: Adding a link tag for the [1] reference ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2025-09-15 21:32:29 +02:00
..
Kconfig firmware: SDEI: Allow sdei initialization without ACPI_APEI_GHES 2025-05-08 13:35:22 +01:00
Makefile EINJ: Add CXL error type support 2024-03-12 23:08:29 -07:00
apei-base.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
apei-internal.h ACPI: APEI: EINJ: Enable the discovery of EINJv2 capabilities 2025-06-18 20:49:31 +02:00
bert.c ACPI: APEI: mark bert_disable as __initdata 2023-06-12 19:23:25 +02:00
einj-core.c ACPI: APEI: EINJ: Allow more types of addresses except MMIO 2025-09-15 21:32:29 +02:00
einj-cxl.c ACPI: APEI: EINJ: Enable the discovery of EINJv2 capabilities 2025-06-18 20:49:31 +02:00
erst-dbg.c ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}() 2025-09-15 21:21:57 +02:00
erst.c ACPI: APEI: Use ERST timeout for slow devices 2023-10-24 20:50:17 +02:00
ghes.c ACPI: APEI: handle synchronous exceptions in task work 2025-07-16 21:08:04 +02:00
hest.c ACPI: APEI: Skip initialization of GHES_ASSIST structures for Machine Check Architecture 2024-02-29 18:34:40 +01:00