Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp201197imm; Wed, 30 May 2018 21:39:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL/iI7zVPK22WoYLTSYe/dG1vhVMn3VogMddQbBByV4mhK28E6aGLfPLOynb9vHqHwtdTZ+ X-Received: by 2002:a17:902:265:: with SMTP id 92-v6mr5373802plc.368.1527741549635; Wed, 30 May 2018 21:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527741549; cv=none; d=google.com; s=arc-20160816; b=PHVLl39gHmiqecIANnEwITCYEAYuDcR3IROIguKv5aN+vvzu/1QuqzfvLRj6vdiJwy FxNURcmx1MHCckd09Bd/8KN7pGTA65gi0QYvxR5ie77begWHXFIQu7+lAbI9ItuEolYO f99MAR3SKNElCLLZwxz39h1zr298n7JfqIPhTZ42A4K6M7YMZwAvLbrT4PUZlNX3n1yA Lz97SmHrAFdQ41w9CxkjRHA+fxanVaZrq8jluRx2bDn57ICB4ZALjtIh5ch4rbX9nnJd wJ2qC061LRY4N3XaYkvsOZY1I9msSdgsHrOu4tZLVHe7s40O2KffFVKjYY1jPjxaFAoY l5tw== 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:to:from:arc-authentication-results; bh=T0QoO18+/PcS+wvVMHjisZwNX5+ZEYm68+15ftS5toM=; b=iyx+Y8nFTgozwFzPuILWXLi6Bd/O2S+u2GPnXtczGs6a7snyoXia5MSbRjWfVs7kJA M1EpCetTHZVo4bvWdRZiyz45HVUftTizkHKCulEBBJwjHxdbHG2sthdanu9/LyH61GMc wmmM/3IrqQ0pT/Xsj+eQqfOLIcHhFfGNa0FNlwWK8Mib9nuQEtDFENfrsNJyGlxV6NRj d0ExeXCqx1WSacnaRLv+kRBeitU6oUkrpWD5nQthyrnDFm5/GsdwBB9GwywyGdfk0OqI xDA59N4hiWq0PEUY6QKk7JL4+zAx/tJOmOX1brAA1/0oM7hEmuQSSRmOQc72AMUJDWgt bxog== 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 x14-v6si10337188pll.37.2018.05.30.21.38.56; Wed, 30 May 2018 21:39:09 -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 S1753941AbeEaEg5 (ORCPT + 99 others); Thu, 31 May 2018 00:36:57 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43428 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751970AbeEaEgb (ORCPT ); Thu, 31 May 2018 00:36:31 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 132822A26528A; Thu, 31 May 2018 12:36:26 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.382.0; Thu, 31 May 2018 12:36:18 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , , Subject: [PATCH v1 1/2] ACPI / APEI: Add SEI notification type support for ARMv8 Date: Thu, 31 May 2018 20:41:45 +0800 Message-ID: <1527770506-8076-2-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527770506-8076-1-git-send-email-gengdongjiu@huawei.com> References: <1527770506-8076-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 --- Note: Firmware will follow the SError mask rule, if the SError is masked, the firmware will not deliver NOTIFY_SEI notification. --- 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