[v2] ACPI: APEI: EINJ: warn on invalid argument when explicitly indicated by platform
Message ID | 20230323015357.8481-1-xueshuai@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2673258wrt; Wed, 22 Mar 2023 19:03:24 -0700 (PDT) X-Google-Smtp-Source: AK7set/9k55q1WGtXzcMKWzpZ2QhoFmKbOzrYHoFn2tJmh3/AMkV1NAEPqD1gAyzWFLGq2jSt0rv X-Received: by 2002:a17:90b:2245:b0:237:3f83:61f3 with SMTP id hk5-20020a17090b224500b002373f8361f3mr5923236pjb.16.1679537004018; Wed, 22 Mar 2023 19:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679537004; cv=none; d=google.com; s=arc-20160816; b=V9hafkgWr21/xQA1sCS5jFPt8P1gCtHnAyNCwmIcSahhytCUIKIc9Qnvd2Oox+Scgk dp9PhfJcPCZ/+8TWnIgxX8H6mCGM9CrxRROvKY48g0ysvihhTcvf/zbKqk3yic8xl5sm k9gJ/Qy16g01G51C0aBFUw5SjmTMyu6+X9M8fsCoK/IrSG/7D1Uq1m3S7Fr2UsekCWPU M/tHpaEGPXRYMyVJvbukwcF+IS9l9/5/6NQtaLV1qUBMcBdhKG+5S9notQsRbFHPP83L HqyzrtC0b34OIgbMeOj6EDTO7tEFK487kKb0EE3HKMkx07aewSENCe5dA82Qui59cpDA LD5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6TSebcT7TSfiZvg8ToKhEYdVS4xdZUb4WnqCK+vFpoU=; b=yhqS6qUxdlT1+r76C+RKGfgxSa41O6RahkGx8EuLJGpKuqSM9f5b5zfr5nLuWT81Th KRt9QeR7uBFdWce/Ocaxq6J91LeJxjDygQ5KZX0pYtbc3fHVeNTLMTu5cWP+4D6WeWZ1 Gk19gvbI3tvpoVyOhPNXu847102Mr4tZwZ25Xs7TgR9Jh0L2PTqjO82sTP0P9VOlE+51 Z+qFb5XRT84/7JjLUKFJ58+ZiSV6xgQf5benyP0BsYjNXgfA4gbCIRBXWpl/P15f/TMm 6zOB3BXcgQeitj15b0JutQiCXvhxTxgPTEcL2PZxSVjUdFOTaPljUbJ1diy1wBME89mK gtpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a17090a408c00b0023f5ee62c13si398954pjg.179.2023.03.22.19.03.10; Wed, 22 Mar 2023 19:03:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbjCWByL (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Wed, 22 Mar 2023 21:54:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbjCWByK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Mar 2023 21:54:10 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FCA735B5; Wed, 22 Mar 2023 18:54:08 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VeSOjFT_1679536441; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VeSOjFT_1679536441) by smtp.aliyun-inc.com; Thu, 23 Mar 2023 09:54:04 +0800 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 Message-Id: <20230323015357.8481-1-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230317073310.4237-1-xueshuai@linux.alibaba.com> References: <20230317073310.4237-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760599859992157544?= X-GMAIL-MSGID: =?utf-8?q?1761122193213389805?= |
Series |
[v2] ACPI: APEI: EINJ: warn on invalid argument when explicitly indicated by platform
|
|
Commit Message
Shuai Xue
March 23, 2023, 1:53 a.m. UTC
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(-)
Comments
On Thu, Mar 23, 2023 at 2:54 AM Shuai Xue <xueshuai@linux.alibaba.com> wrote: > > 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; > -- Applied as 6.4 material, thanks!
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;