From patchwork Mon Feb 27 18:19:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiju Jose X-Patchwork-Id: 9593729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1825B601D7 for ; Mon, 27 Feb 2017 18:22:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D904279E0 for ; Mon, 27 Feb 2017 18:22:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 006B12848E; Mon, 27 Feb 2017 18:21:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 645EA279E0 for ; Mon, 27 Feb 2017 18:21:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=FO1QR8kDwMkSCG6BFWoFLKoIMwefW64w20pRaIWYDn8=; b=dgL5ql9r+U4009 /BzxETWhA/R3O4f+AjuprLMPyqCvS2oJ3lMj18Hk1MS6Rg0TGQEejQJtsWmpCW9vc1h5BzAOtt/bM WriAlL5Z7OwAT5IVN2ANIgZL3eQ8LibG/jTm+BVEmJzAiwI6xwQV1iyVAgyOW9Xyn1DaAX8PMiBdv u1GLHGtX9LPqoZ03EWruIkIbVjXdKrX5QTk8LcqaMU1uPk/PKRQoe1yW+/Uyeji49ghB93eJo8mLp O3AGi0r7G2T71OvI4e1vQerV62chxzzRbcqb6xV0ycR/ASJiRwAWda2QAaF38wjw/R2u9Fy68pd7J FWioYJHXQBfc15pFO+Ew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciPvh-0002gC-W9; Mon, 27 Feb 2017 18:21:50 +0000 Received: from lhrrgout.huawei.com ([194.213.3.17]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ciPvH-0002dc-Md for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2017 18:21:26 +0000 Received: from 172.18.7.190 (EHLO lhreml708-cah.china.huawei.com) ([172.18.7.190]) by lhrrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DBU67118; Mon, 27 Feb 2017 18:19:46 +0000 (GMT) Received: from LHREML502-MBS.china.huawei.com ([10.125.30.101]) by lhreml708-cah.china.huawei.com ([10.201.108.49]) with mapi id 14.03.0301.000; Mon, 27 Feb 2017 18:19:34 +0000 From: Shiju Jose To: "christoffer.dall@linaro.org" , "marc.zyngier@arm.com" , "pbonzini@redhat.com" , "rkrcmar@redhat.com" , "linux@armlinux.org.uk" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "rjw@rjwysocki.net" , "lenb@kernel.org" , "matt@codeblueprint.co.uk" , "robert.moore@intel.com" , "lv.zheng@intel.com" , "nkaje@codeaurora.org" , "zjzhang@codeaurora.org" , "mark.rutland@arm.com" , "james.morse@arm.com" , "akpm@linux-foundation.org" , "eun.taik.lee@samsung.com" , "sandeepa.s.prabhu@gmail.com" , "labbott@redhat.com" , "shijie.huang@arm.com" , "rruigrok@codeaurora.org" , "paul.gortmaker@windriver.com" , "tn@semihalf.com" , "fu.wei@linaro.org" , "rostedt@goodmis.org" , "bristot@redhat.com" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "linux-efi@vger.kernel.org" , "devel@acpica.org" , "Suzuki.Poulose@arm.com" , "punit.agrawal@arm.com" , "astone@redhat.com" , "harba@codeaurora.org" , "hanjun.guo@linaro.org" , Tyler Baicar , "joe@perches.com" , John Garry , Gabriele Paoloni , "Guohanjun (Hanjun Guo)" , "wangxiongfeng (C)" , "Zhengqiang (turing)" Subject: [RFC PATCH V1 v4.10-rc3 1/1] acpi: apei: handle GSIV notification type Thread-Topic: [RFC PATCH V1 v4.10-rc3 1/1] acpi: apei: handle GSIV notification type Thread-Index: AdKRJgy4Uo89+BFpSj66DnbcmjlGdw== Date: Mon, 27 Feb 2017 18:19:34 +0000 Message-ID: <86258A5CC0A3704780874CF6004BA8A62DCAB57E@lhreml502-mbs> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.92.204] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.58B46DC6.0215, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 2848e8d0fad49a0046fdb3fb324d1065 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_102124_236075_43782882 X-CRM114-Status: GOOD ( 13.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shiju Jose Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a new GHES error source handling function for GSIV(Global System Interrupt Vector). If an error source's notification type is GSIV, then this handling function can be registered into the GSIV handler and it can parse and report error information when they occur. Signed-off-by: Xiongfeng Wang Signed-off-by: Shiju Jose --- arch/arm64/Kconfig | 1 + drivers/acpi/apei/Kconfig | 9 +++++++ drivers/acpi/apei/ghes.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1117421..e41fdcf 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -53,6 +53,7 @@ config ARM64 select HANDLE_DOMAIN_IRQ select HARDIRQS_SW_RESEND select HAVE_ACPI_APEI if (ACPI && EFI) + select HAVE_ACPI_APEI_GSIV if (ACPI && EFI) select HAVE_ALIGNED_STRUCT_PAGE if SLUB select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_BITREVERSE diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index b0140c8..f45ddb5 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig @@ -1,6 +1,15 @@ config HAVE_ACPI_APEI bool +config HAVE_ACPI_APEI_GSIV + bool "APEI GSIV(Global System Interrupt) logging/recovering support" + depends on ACPI_APEI && ACPI_APEI_GHES + help + This option should be enabled if the system supports + firmware first handling of GSIV (Global System Interrupt) + for the hardware errors and allows OS to do error + recovery/logging. + config HAVE_ACPI_APEI_NMI bool diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index e53bef6..e1611d2 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -721,6 +721,58 @@ static struct notifier_block ghes_notifier_sci = { .notifier_call = ghes_notify_sci, }; +#ifdef CONFIG_HAVE_ACPI_APEI_GSIV +static LIST_HEAD(ghes_gsiv); + +static int ghes_notify_gsiv(struct notifier_block *this, + unsigned long event, void *data) +{ + struct ghes *ghes; + int ret = NOTIFY_DONE; + + rcu_read_lock(); + list_for_each_entry_rcu(ghes, &ghes_gsiv, list) { + if (!ghes_proc(ghes)) + ret = NOTIFY_OK; + } + rcu_read_unlock(); + return ret; +} +static struct notifier_block ghes_notifier_gsiv = { + .notifier_call = ghes_notify_gsiv, +}; + +static void ghes_gsiv_add(struct ghes *ghes) +{ + mutex_lock(&ghes_list_mutex); + if (list_empty(&ghes_gsiv)) + register_acpi_hed_notifier(&ghes_notifier_gsiv); + list_add_rcu(&ghes->list, &ghes_gsiv); + mutex_unlock(&ghes_list_mutex); +} + +static void ghes_gsiv_remove(struct ghes *ghes) +{ + mutex_lock(&ghes_list_mutex); + list_del_rcu(&ghes->list); + if (list_empty(&ghes_gsiv)) + unregister_acpi_hed_notifier(&ghes_notifier_gsiv); + mutex_unlock(&ghes_list_mutex); +} +#else /* CONFIG_HAVE_ACPI_APEI_GSIV */ +static inline void ghes_gsiv_add(struct ghes *ghes) +{ + pr_err(GHES_PFX "ID: %d, trying to add GSIV notification which is not supported\n", + ghes->generic->header.source_id); +} + +static inline void ghes_gsiv_remove(struct ghes *ghes) +{ + pr_err(GHES_PFX "ID: %d, trying to remove GSIV notification which is not supported\n", + ghes->generic->header.source_id); +} +#endif /* CONFIG_HAVE_ACPI_APEI_GSIV */ + #ifdef CONFIG_HAVE_ACPI_APEI_NMI /* * printk is not safe in NMI context. So in NMI handler, we allocate @@ -973,6 +1025,14 @@ static int ghes_probe(struct platform_device *ghes_dev) goto err; } break; + case ACPI_HEST_NOTIFY_GSIV: + if (!IS_ENABLED(CONFIG_HAVE_ACPI_APEI_GSIV)) { + pr_warn(GHES_PFX "Generic hardware error source: %d notified via notification GSIV is not supported\n", + generic->header.source_id); + rc = -ENOTSUPP; + goto err; + } + break; case ACPI_HEST_NOTIFY_LOCAL: pr_warning(GHES_PFX "Generic hardware error source: %d notified via local interrupt is not supported!\n", generic->header.source_id); @@ -1034,6 +1094,9 @@ static int ghes_probe(struct platform_device *ghes_dev) case ACPI_HEST_NOTIFY_NMI: ghes_nmi_add(ghes); break; + case ACPI_HEST_NOTIFY_GSIV: + ghes_gsiv_add(ghes); + break; default: BUG(); } @@ -1076,6 +1139,9 @@ static int ghes_remove(struct platform_device *ghes_dev) case ACPI_HEST_NOTIFY_NMI: ghes_nmi_remove(ghes); break; + case ACPI_HEST_NOTIFY_GSIV: + ghes_gsiv_remove(ghes); + break; default: BUG(); break;