Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp559343imm; Tue, 15 May 2018 05:56:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpqmdMj4L0EbDFz2XuxmwW6YCa2g/x7H/9VpEHpI/UvCZ90CtLmbbfKSCva4zlVesBt0S5O X-Received: by 2002:a65:5686:: with SMTP id v6-v6mr11732993pgs.92.1526389019717; Tue, 15 May 2018 05:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526389019; cv=none; d=google.com; s=arc-20160816; b=jaAjhsbw/KC/SSHnvyq9VfKhb6BTB02Xku43oIBTVV7g30lTdw4oRSr6QW3c2eY0Ze C29ksPmtoTcpfY6XHmb9bhOFAEK4Ud4c67ImJFhtVdFmvDi7FIplNIeL8a7+rjrtzw86 ymobxJBfte6d11dAs5htDZDhPTE7ZhA5yOmDEWk7X8LJcdVFioOSV/CoCZbz9TubxR/m +SF3U7gyGTKLqQUOdIrZ2+uJsMCoaqn65Amb+IeOAesw1v3ha24m7chxbSAiFRaBiMjb mcmsqdOD1nbmZvYiq6zsLucI0V/3VMFiYp1qV8xEAy8knqwpipDdD4Th0x9cGd8iQkPT 7tTw== 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=kRDz0a+PSsRcpTaOp4LBcy2/Op8JWSRC2K2xr6PWhxQ=; b=uV6gmFtPEkPGk4iZLi2ckT0jD2KHS/g8eoXzaq5Bi83CsZWPIMKWjBNyKxLL4iy0bw jVCLUwR20MBJa688r0mP4+2WE9fZVaG9b1Q+Za4mNZJtAI93O5gg3h6E6XGLtlbWztdu HhDdGPtJGAv3MSQRr/GjIVUVryI79nQYw52K2TfjVLFXTZbeXKztPoTXRQdGjzI1yOmY xVtF2sqLV9gGsKqlS2kMTO6rrW46KBLUmN2jULaOtm6JImB7iI69FvI0TPpD3XwGZOiw DjCt62jkfsKkCWXmK08mMW62i6+H0mGBNcWpTuPxdjBy0fmUi9IHT22Wepozj3pnRMiY Q4fg== 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 z26-v6si13056609pfl.209.2018.05.15.05.56.41; Tue, 15 May 2018 05:56:59 -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 S1753303AbeEOMxp (ORCPT + 99 others); Tue, 15 May 2018 08:53:45 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7254 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752170AbeEOMwv (ORCPT ); Tue, 15 May 2018 08:52:51 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 2B6DB4F399166; Tue, 15 May 2018 20:52:35 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Tue, 15 May 2018 20:52:28 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v12 3/4] ACPI / APEI: Add SEI notification type support for ARMv8 Date: Wed, 16 May 2018 04:58:06 +0800 Message-ID: <1526417887-25843-4-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526417887-25843-1-git-send-email-gengdongjiu@huawei.com> References: <1526417887-25843-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