From patchwork Wed Mar 8 04:09:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xie XiuQi X-Patchwork-Id: 9610321 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 493B860414 for ; Wed, 8 Mar 2017 04:15:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E87F285B9 for ; Wed, 8 Mar 2017 04:15:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FF9A285BD; Wed, 8 Mar 2017 04:15:11 +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=unavailable 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 CD71F285B7 for ; Wed, 8 Mar 2017 04:15:10 +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:References:In-Reply-To: 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: List-Owner; bh=V5tISDELlm/msmP9hoi4lgwehjMtxL4z7/wU1YTTDlc=; b=U/cJXXlu1LaqrM ngx30rRedzrwYMuinSkUb2vTwaYqTXcMSAfu8x8AWnAGQgL/+kBb45CJF/MgaQBr+3YfX8X/rHEwN VMHvk1DU2PEj63c/qiHG+x6fJqLRZYCkJZJWTiyZ0yiONr1hoexbrPv6vZjUI0aOi2h08E0uY7miJ gmnX4PkkID5FM84RxfsxtQw6R21p+W7awk8zEt/QjPwtryoAojslBmsnM6dpuakdmQ4nAzO6wmC2M F7KxSjqPKdJrCJEZflYiqAJx2IJ9AtPK62dkhLjMfPo9CxuBZ2hq/1/eeYCAK7bSBouAAQ4miMVQ+ oObPKt2bR9axhu5DslNw==; 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 1clT09-0005yf-Ne; Wed, 08 Mar 2017 04:15:01 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1clSyg-00053p-VX for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Mar 2017 04:13:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=78sXnjyvx23ypJmQMBJ5dPThwue1BjBXl2yjKOVIgI8=; b=rZU1R2uaQZgPcOiiqdl3PS0Y4 JUhpKsNiPBNg0kSasdj5GHiLo9lfChnyZrHzCXTzAq/w/4HjPdq2ao8nAkDW0AU+bMWn7FO7YQeSm 6ss21s+9deYUaySB8U3FmIIhIX7iWNWKlONuHWYkfnbuZxSExJf46VIgX8XuNo6Foehm2ZJ4NsWMn 7JiwKNiRYuxioe5VnuGNd4zREKPMXL9a/UiKgCO6A1/fhtu9NGh64tfxeen/dOOut38VMLzrxcdqs 3GZy0P5bH0MsEvmXzvTZLYfUyeS6O41rNK26KjISSALOlx7RducZN09xUj1tH53mnkqiBPdNCK0mt APUU6x5tQ==; Received: from [45.249.212.188] (helo=dggrg02-dlp.huawei.com) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1clSya-0003AW-Uo for linux-arm-kernel@lists.infradead.org; Wed, 08 Mar 2017 04:13:29 +0000 Received: from 172.30.72.53 (EHLO DGGEML401-HUB.china.huawei.com) ([172.30.72.53]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AJO85407; Wed, 08 Mar 2017 12:11:41 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEML401-HUB.china.huawei.com (10.3.17.32) with Microsoft SMTP Server id 14.3.301.0; Wed, 8 Mar 2017 12:11:34 +0800 From: Xie XiuQi To: , , , , , , , , , Subject: [PATCH v2 2/3] acpi: apei: handle SEI notification type for ARMv8 Date: Wed, 8 Mar 2017 12:09:40 +0800 Message-ID: <1488946181-130774-3-git-send-email-xiexiuqi@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488946181-130774-1-git-send-email-xiexiuqi@huawei.com> References: <1488946181-130774-1-git-send-email-xiexiuqi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.58BF847F.00D2, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 11172ef8c0a27bed61299ea4407458d2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170308_041326_459656_28681378 X-CRM114-Status: GOOD ( 20.20 ) 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: Xie XiuQi , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, guohanjun@huawei.com, linux-arm-kernel@lists.infradead.org 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 ARM APEI extension proposal added SEI (asynchronous SError interrupt) notification type for ARMv8. Add a new GHES error source handling function for SEI. In firmware first mode, if an error source's notification type is SEI. Then GHES could parse and report the detail error information. Signed-off-by: Xie XiuQi --- arch/arm64/kernel/traps.c | 13 +++++++++++ drivers/acpi/apei/Kconfig | 14 ++++++++++++ drivers/acpi/apei/ghes.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++- include/acpi/ghes.h | 1 + 4 files changed, 85 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index e52be6a..65dbfa9 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -47,6 +47,8 @@ #include #include +#include + static const char *handler[]= { "Synchronous Abort", "IRQ", @@ -625,6 +627,17 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr) handler[reason], smp_processor_id(), esr, esr_get_class_string(esr)); + /* + * Synchronous aborts may interrupt code which had interrupts masked. + * Before calling out into the wider kernel tell the interested + * subsystems. + */ + if (IS_ENABLED(CONFIG_ACPI_APEI_SEI) && ESR_ELx_EC(esr) == ESR_ELx_EC_SERROR) { + nmi_enter(); + ghes_notify_sei(); + nmi_exit(); + } + die("Oops - bad mode", regs, 0); local_irq_disable(); panic("bad mode"); diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 8ff0518..277deb8 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig @@ -55,6 +55,20 @@ config ACPI_APEI_SEA option allows the OS to look for such hardware error record, and take appropriate action. +config ACPI_APEI_SEI + bool "APEI Asynchronous SError Interrupt logging/recovering support" + depends on ARM64 && ACPI_APEI_GHES + help + This option should be enabled if the system supports + firmware first handling of SEI (asynchronous SError interrupt). + + SEI happens with invalid instruction access or asynchronous exceptions + on ARMv8 systems. If a system supports firmware first handling of SEI, + the platform analyzes and handles hardware error notifications from + SEI, and it may then form a HW error record for the OS to parse and + handle. This option allows the OS to look for such hardware error + record, and take appropriate action. + config ACPI_APEI_MEMORY_FAILURE bool "APEI memory error recovering support" depends on ACPI_APEI && MEMORY_FAILURE diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index ea5b118..251d7e0 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -851,6 +851,50 @@ static inline void ghes_sea_remove(struct ghes *ghes) } #endif /* CONFIG_ACPI_APEI_SEA */ +#ifdef CONFIG_ACPI_APEI_SEI +static LIST_HEAD(ghes_sei); + +void ghes_notify_sei(void) +{ + struct ghes *ghes; + + /* + * synchronize_rcu() will wait for nmi_exit(), so no need to + * rcu_read_lock(). + */ + list_for_each_entry_rcu(ghes, &ghes_sei, list) { + ghes_proc(ghes); + } +} + +static void ghes_sei_add(struct ghes *ghes) +{ + mutex_lock(&ghes_list_mutex); + list_add_rcu(&ghes->list, &ghes_sei); + mutex_unlock(&ghes_list_mutex); +} + +static void ghes_sei_remove(struct ghes *ghes) +{ + mutex_lock(&ghes_list_mutex); + list_del_rcu(&ghes->list); + mutex_unlock(&ghes_list_mutex); + synchronize_rcu(); +} +#else /* CONFIG_ACPI_APEI_SEI */ +static inline void ghes_sei_add(struct ghes *ghes) +{ + pr_err(GHES_PFX "ID: %d, trying to add SEI notification which is not supported\n", + ghes->generic->header.source_id); +} + +static inline void ghes_sei_remove(struct ghes *ghes) +{ + pr_err(GHES_PFX "ID: %d, trying to remove SEI notification which is not supported\n", + ghes->generic->header.source_id); +} +#endif /* CONFIG_HAVE_ACPI_APEI_SEI */ + #ifdef CONFIG_HAVE_ACPI_APEI_NMI /* * printk is not safe in NMI context. So in NMI handler, we allocate @@ -1100,6 +1144,13 @@ static int ghes_probe(struct platform_device *ghes_dev) goto err; } break; + case ACPI_HEST_NOTIFY_SEI: + if (!IS_ENABLED(CONFIG_HAVE_ACPI_APEI_SEI)) { + pr_warn(GHES_PFX "Generic hardware error source: %d notified via SEI is not supported!\n", + generic->header.source_id); + goto err; + } + break; case ACPI_HEST_NOTIFY_NMI: if (!IS_ENABLED(CONFIG_HAVE_ACPI_APEI_NMI)) { pr_warn(GHES_PFX "Generic hardware error source: %d notified via NMI interrupt is not supported!\n", @@ -1112,7 +1163,6 @@ static int ghes_probe(struct platform_device *ghes_dev) generic->header.source_id); goto err; case ACPI_HEST_NOTIFY_GPIO: - case ACPI_HEST_NOTIFY_SEI: case ACPI_HEST_NOTIFY_GSIV: pr_warn(GHES_PFX "Generic hardware error source: %d notified via notification type %u is not supported\n", generic->header.source_id, generic->header.source_id); @@ -1175,6 +1225,9 @@ static int ghes_probe(struct platform_device *ghes_dev) case ACPI_HEST_NOTIFY_SEA: ghes_sea_add(ghes); break; + case ACPI_HEST_NOTIFY_SEI: + ghes_sei_add(ghes); + break; case ACPI_HEST_NOTIFY_NMI: ghes_nmi_add(ghes); break; @@ -1220,6 +1273,9 @@ static int ghes_remove(struct platform_device *ghes_dev) case ACPI_HEST_NOTIFY_SEA: ghes_sea_remove(ghes); break; + case ACPI_HEST_NOTIFY_SEI: + ghes_sei_remove(ghes); + break; case ACPI_HEST_NOTIFY_NMI: ghes_nmi_remove(ghes); break; diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h index 18bc935..7554658 100644 --- a/include/acpi/ghes.h +++ b/include/acpi/ghes.h @@ -100,5 +100,6 @@ static inline void *acpi_hest_generic_data_payload(struct acpi_hest_generic_data } void ghes_notify_sea(void); +void ghes_notify_sei(void); #endif /* GHES_H */