Skip to content

Commit f1e6571

Browse files
axiqiarafaeljw
authored andcommitted
ACPI: APEI: EINJ: warn on invalid argument when explicitly indicated by platform
OSPM executes an EXECUTE_OPERATION action to instruct the platform to begin the injection operation, then executes a GET_COMMAND_STATUS action to determine the status of the completed operation. The ACPI Specification documented error codes[1] are: 0 = Success (Linux #define EINJ_STATUS_SUCCESS) 1 = Unknown failure (Linux #define EINJ_STATUS_FAIL) 2 = Invalid Access (Linux #define EINJ_STATUS_INVAL) The original code report -EBUSY for both "Unknown Failure" and "Invalid Access" cases. Actually, firmware could do some platform dependent sanity checks and returns different error codes, e.g. "Invalid Access" to indicate to the user that the parameters they supplied cannot be used for injection. To this end, fix to return -EINVAL in the __einj_error_inject() error handling case instead of always -EBUSY, when explicitly indicated by the platform in the status of the completed operation. [1] ACPI Specification 6.5 18.6.1. Error Injection Table Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent fe6603c commit f1e6571

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/acpi/apei/einj.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,15 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
489489
if (rc)
490490
return rc;
491491
val = apei_exec_ctx_get_output(&ctx);
492-
if (val != EINJ_STATUS_SUCCESS)
492+
if (val == EINJ_STATUS_FAIL)
493493
return -EBUSY;
494+
else if (val == EINJ_STATUS_INVAL)
495+
return -EINVAL;
494496

497+
/*
498+
* The error is injected into the platform successfully, then it needs
499+
* to trigger the error.
500+
*/
495501
rc = apei_exec_run(&ctx, ACPI_EINJ_GET_TRIGGER_TABLE);
496502
if (rc)
497503
return rc;

0 commit comments

Comments
 (0)