Received: by 10.213.65.68 with SMTP id h4csp2624861imn; Mon, 9 Apr 2018 06:35:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx48yLAnBuAhXMHEZPh9QT+9AnAP2w8xeaw4BU1lz1yzUYWgtBNDJVedrHrf+CezAe7gaiSlA X-Received: by 10.98.189.14 with SMTP id a14mr22819480pff.30.1523280952420; Mon, 09 Apr 2018 06:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523280952; cv=none; d=google.com; s=arc-20160816; b=dkLIJ7xXQEStBNtL7gFLm6d5nXnngrIuK9SmP/ey1fZaKz0Haw0CrV5U8Jt0JNK99d XY6eUJNg23EBc51ecDZw+nu0FGEhlUklXV0OlMX0yhm8j7tqpxeAfB0J4zxWW/50AlDi E1jNgRmeB1vhhS78URgM7v6Y5fYhcZCYKNbW/84q4+NbTX7kLkXL4b6qtBdjlIvvO+1o 3FONIE3p9qLVzQ0QJFdFMdPBfdcH9E6egx+OMU+qaHQc0pGWpkT7IlkFRw6UvLk9FELT GsGR+roVJxKcUeoyRTowpJPJ9Sln7Z65c327LTIsVHXm2p8xWJwKF21XswwefyMO/JWP mxFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=IH2LFaupZz6u/Mtg4ZbCyg7Um5DYtwzOzSo5k5fo3p8=; b=L05v5mnWpoV2UA6nmWCb+i9qHqVx4anmc+ZddpnkWAobydhjs50gmwezDjzkUqEwqr drrUkHbn8SUuiZD5TV0Xms2WmfgU/vXHSCgDPzrp4EGl7DpT58WxhMPdIXQB+lIzG/76 RnsAFBvIw00y2byshipzdPLvz3LE/1+a/QQP+y/RzJKhLI+gycEpV6iHBpj/7q2BaWKx xygsCuw/si2yoQZLFLHt47+XOClBDPSS0Z7V3LkcsocukzZCveYf9lZ3HwpYU1/D9tiS A+qxxneLhvw7Nzlgc05dJe1+4vqK77pSZwH55+sQGD09RKTQTsE2SwkmES2KaFqXF8IZ MeKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 197si260324pge.78.2018.04.09.06.35.15; Mon, 09 Apr 2018 06:35:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752517AbeDINbW (ORCPT + 99 others); Mon, 9 Apr 2018 09:31:22 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6729 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752275AbeDINbS (ORCPT ); Mon, 9 Apr 2018 09:31:18 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BA265DAE7384E; Mon, 9 Apr 2018 21:31:00 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Mon, 9 Apr 2018 21:30:54 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v11 3/4] ACPI / APEI: Add SEI notification type support for ARMv8 Date: Tue, 10 Apr 2018 05:36:35 +0800 Message-ID: <1523309796-36423-4-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523309796-36423-1-git-send-email-gengdongjiu@huawei.com> References: <1523309796-36423-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.143.28.90] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ACPI 6.x adds support for NOTIFY_SEI as a GHES notification mechanism, so add new GHES notification handling functions. Expose API ghes_notify_sei() to arch code, arch code will call this API when it gets this NOTIFY_SEI. Signed-off-by: Dongjiu Geng --- drivers/acpi/apei/Kconfig | 15 ++++++++++++++ drivers/acpi/apei/ghes.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++ include/acpi/ghes.h | 1 + 3 files changed, 69 insertions(+) diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 52ae543..ff4afc3 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig @@ -55,6 +55,21 @@ 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 SError(System Error) Interrupt logging/recovering support" + depends on ARM64 && ACPI_APEI_GHES + default y + help + This option should be enabled if the system supports + firmware first handling of SEI (SError interrupt). + + SEI happens with asynchronous external abort for errors on device + memory reads 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 hardware 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 1efefe9..33f77ae 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -827,6 +827,46 @@ static inline void ghes_sea_add(struct ghes *ghes) { } static inline void ghes_sea_remove(struct ghes *ghes) { } #endif /* CONFIG_ACPI_APEI_SEA */ +#ifdef CONFIG_ACPI_APEI_SEI +static LIST_HEAD(ghes_sei); + +/* + * Return 0 only if one of the SEI error sources successfully reported an error + * record sent from the firmware. + */ +int ghes_notify_sei(void) +{ + struct ghes *ghes; + int ret = -ENOENT; + + rcu_read_lock(); + list_for_each_entry_rcu(ghes, &ghes_sei, list) { + if (!ghes_proc(ghes)) + ret = 0; + } + rcu_read_unlock(); + return ret; +} + +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) { } +static inline void ghes_sei_remove(struct ghes *ghes) { } +#endif /* CONFIG_ACPI_APEI_SEI */ + #ifdef CONFIG_HAVE_ACPI_APEI_NMI /* * printk is not safe in NMI context. So in NMI handler, we allocate @@ -1055,6 +1095,13 @@ static int ghes_probe(struct platform_device *ghes_dev) goto err; } break; + case ACPI_HEST_NOTIFY_SEI: + if (!IS_ENABLED(CONFIG_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", @@ -1126,6 +1173,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; @@ -1179,6 +1229,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 8feb0c8..9ba59e2 100644 --- a/include/acpi/ghes.h +++ b/include/acpi/ghes.h @@ -120,5 +120,6 @@ static inline void *acpi_hest_get_next(struct acpi_hest_generic_data *gdata) section = acpi_hest_get_next(section)) int ghes_notify_sea(void); +int ghes_notify_sei(void); #endif /* GHES_H */ -- 1.9.1