mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: tony.luck@intel.com
Cc: xueshuai@linux.alibaba.com, baolin.wang@linux.alibaba.com,
	benjamin.cheatham@amd.com, bp@alien8.de,
	dan.j.williams@intel.com, james.morse@arm.com, lenb@kernel.org,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	rafael@kernel.org, zhuo.song@linux.alibaba.com
Subject: [PATCH v2] ACPI: APEI: EINJ: warn on invalid argument when explicitly indicated by platform
Date: Thu, 23 Mar 2023 09:53:57 +0800	[thread overview]
Message-ID: <20230323015357.8481-1-xueshuai@linux.alibaba.com> (raw)
In-Reply-To: <20230317073310.4237-1-xueshuai@linux.alibaba.com>

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>
---
changelog since v1:
- elaborate commit log based on follow up discussion with Tony
- pick up Reviewed-by tag of Tony
---
 drivers/acpi/apei/einj.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index b4373e575660..fa0b4320312e 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -489,9 +489,15 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
 	if (rc)
 		return rc;
 	val = apei_exec_ctx_get_output(&ctx);
-	if (val != EINJ_STATUS_SUCCESS)
+	if (val == EINJ_STATUS_FAIL)
 		return -EBUSY;
+	else if (val == EINJ_STATUS_INVAL)
+		return -EINVAL;
 
+	/*
+	 * The error is injected into the platform successfully, then it needs
+	 * to trigger the error.
+	 */
 	rc = apei_exec_run(&ctx, ACPI_EINJ_GET_TRIGGER_TABLE);
 	if (rc)
 		return rc;
-- 
2.20.1.12.g72788fdb


  parent reply	other threads:[~2023-03-23  1:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  7:33 [PATCH] " Shuai Xue
2023-03-17 21:24 ` Luck, Tony
2023-03-20  2:25   ` Shuai Xue
2023-03-20 16:32     ` Luck, Tony
2023-03-21  2:00       ` Shuai Xue
2023-03-21 16:09         ` Luck, Tony
2023-03-22  2:37           ` Shuai Xue
2023-03-22 16:07 ` Luck, Tony
2023-03-22 16:52   ` Rafael J. Wysocki
2023-03-23  1:19     ` Shuai Xue
2023-03-23  1:18   ` Shuai Xue
2023-03-23  1:53 ` Shuai Xue [this message]
2023-03-27 18:47   ` [PATCH v2] " Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230323015357.8481-1-xueshuai@linux.alibaba.com \
    --to=xueshuai@linux.alibaba.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=benjamin.cheatham@amd.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=james.morse@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=zhuo.song@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®