From patchwork Sat Mar 3 16:09:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongjiu Geng X-Patchwork-Id: 10256015 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 DB807602B5 for ; Sat, 3 Mar 2018 08:05:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D03E828720 for ; Sat, 3 Mar 2018 08:05:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B290228723; Sat, 3 Mar 2018 08:05:22 +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=0.0 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_SIGNED,DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 5DF4B28720 for ; Sat, 3 Mar 2018 08:05:22 +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=Y1Yuit4vCaSagdDRSIxDZAK9Qaj8qfsmHJB3j0g/KLM=; b=lmdL6PFNqAkiKO Y0gFhZFU1eXOnUaNk1WBIoRDvzJvTDaPBptxbfJtlqsa5rkAqWVbyOdgHaaPrC/mz9iPsy1qWgL/a CHQ6UsbrQCjEENMvgdhKc8qL0fJZ+GCkBH1F0gXYcSKBeGiIFlSlOPE/fCEdvGu/3T9WeYmEIsxYY 1BrmWS7PtWu+/Y3asSqwBc8pwzlSqHngCU/MDPE1nxiuuCEgyfzjgkdgGkOSac6SRklk/oDx7uTo5 amvRDVPJgboqh6cepu3Aicfhfg6YwYDla/AGwPMqCpP7aQB8Q2RQbDvfK3AHv8DIbTfDiuPpp87S0 JApaeK4uL04/32IHlAfA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1es2AJ-0000gi-VI; Sat, 03 Mar 2018 08:05:12 +0000 Received: from [45.249.212.35] (helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1es29H-0008BH-3B for linux-arm-kernel@lists.infradead.org; Sat, 03 Mar 2018 08:04:10 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 57B98F08DD233; Sat, 3 Mar 2018 16:03:47 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.361.1; Sat, 3 Mar 2018 16:03:40 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , , , Subject: [PATCH v10 5/5] arm64: handle NOTIFY_SEI notification by the APEI driver Date: Sun, 4 Mar 2018 00:09:40 +0800 Message-ID: <1520093380-42577-6-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520093380-42577-1-git-send-email-gengdongjiu@huawei.com> References: <1520093380-42577-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.143.28.90] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180303_000408_060120_28942516 X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. 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: huangshaoyu@huawei.com, gengdongjiu@huawei.com 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 helper to handle the NOTIFY_SEI notification, when kernel gets the NOTIFY_SEI notification, call this helper and let APEI driver to handle this notification. Signed-off-by: Dongjiu Geng --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/traps.c | 4 ++++ arch/arm64/mm/fault.c | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h index 07aa8e3..9ee13ad 100644 --- a/arch/arm64/include/asm/system_misc.h +++ b/arch/arm64/include/asm/system_misc.h @@ -57,6 +57,7 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned int, }) int handle_guest_sea(phys_addr_t addr, unsigned int esr); +int handle_guest_sei(void); #endif /* __ASSEMBLY__ */ diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index e88096a..6cb280f 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -681,6 +681,10 @@ bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned int esr) { u32 aet = arm64_ras_serror_get_severity(esr); + /* The APEI driver may handle this RAS error. */ + if (!handle_guest_sei()) + return false; + switch (aet) { case ESR_ELx_AET_CE: /* corrected error */ case ESR_ELx_AET_UEO: /* restartable, not yet consumed */ diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index f76bb2c..8f29bd8 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -683,6 +683,16 @@ int handle_guest_sea(phys_addr_t addr, unsigned int esr) return ret; } +int handle_guest_sei(void) +{ + int ret = -ENOENT; + + if (IS_ENABLED(CONFIG_ACPI_APEI_SEI)) + ret = ghes_notify_sei(); + + return ret; +} + asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr, struct pt_regs *regs) {