Skip to contentSkip to conversation

ACPI: APEI: EINJ: Fix EINJv2 memory injection

PATCH Superseded Tony Luck 2 participants 2 messages Apr 15

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Tony Luck

author reviewer
#0 lore raw

PATCH 1/1 ACPI: APEI: EINJ: Fix EINJv2 memory injection

EINJ trigger actions for memory error injection often include access to the target injection address. This address does not need to special mapping.

The code to drop the target address from the resource list only checked for V1 injection signature.

Add a test for the EINJ V2 memory injection signature.

---
 drivers/acpi/apei/einj-core.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/acpi/apei/einj-core.c +12 -1
index a9248af078f6..ba0ce71b7adb 100644
@@ -401,6 +401,17 @@ static struct acpi_generic_address *einj_get_trigger_parameter_region(
 
 	return NULL;
 }
+
+static bool is_memory_injection(u32 type, u64 param2)
+{
+	if (is_v2)
+		return type & BIT(1);
+	else if (param_extension || acpi5)
+		return (type & MEM_ERROR_MASK) && param2;
+
+	return false;
+}
+
 /* Execute instructions in trigger error action table */
 static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 				u64 param1, u64 param2)
@@ -480,7 +491,7 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
 	 * This will cause resource conflict with regular memory.  So
 	 * remove it from trigger table resources.
 	 */
-	if ((param_extension || acpi5) && (type & MEM_ERROR_MASK) && param2) {
+	if (is_memory_injection(type, param2)) {
 		struct apei_resources addr_resources;
 
 		apei_resources_init(&addr_resources);
Signature · 1 line
2.53.0
#1 lore raw
Quoted 5 lines · Tony Luck

EINJ trigger actions for memory error injection often include access to the target injection address. This address does not need to special mapping.

Quoted 7 lines

The code to drop the target address from the resource list only checked for V1 injection signature.

Add a test for the EINJ V2 memory injection signature.

Can you please provide a Fixes: tag for this?

Quoted 39 lines
---
 drivers/acpi/apei/einj-core.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/acpi/apei/einj-core.c +12 -2
index a9248af078f6..ba0ce71b7adb 100644
@@ -401,6 +401,17 @@ static struct acpi_generic_address *einj_get_trigger_parameter_region(
 
        return NULL;
 }
+
+static bool is_memory_injection(u32 type, u64 param2)
+{
+       if (is_v2)
+               return type & BIT(1);
+       else if (param_extension || acpi5)
+               return (type & MEM_ERROR_MASK) && param2;
+
+       return false;
+}
+
 /* Execute instructions in trigger error action table */
 static int __einj_error_trigger(u64 trigger_paddr, u32 type,
                                u64 param1, u64 param2)
@@ -480,7 +491,7 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
         * This will cause resource conflict with regular memory.  So
         * remove it from trigger table resources.
         */
-       if ((param_extension || acpi5) && (type & MEM_ERROR_MASK) && param2) {
+       if (is_memory_injection(type, param2)) {
                struct apei_resources addr_resources;
 
                apei_resources_init(&addr_resources);
--

2.53.0