Received: by 10.223.185.116 with SMTP id b49csp5726794wrg; Tue, 27 Feb 2018 20:00:03 -0800 (PST) X-Google-Smtp-Source: AH8x226RfE1Uc1rLMx5mBGl83Ujsuo7UDFmwTKGYW+NX+LHT8Q4vYNEsaaZcI6pF6JUyjNuJ4zCO X-Received: by 10.98.220.207 with SMTP id c76mr16151045pfl.159.1519790402941; Tue, 27 Feb 2018 20:00:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519790402; cv=none; d=google.com; s=arc-20160816; b=mGqbKkLGxqUo0L97GbZ1LFZ2zkDngwT4/Wi5xD9wVkRUD/KPaxcjR2/hNINMRIMwMM h6HKHNs7PsqEArPEbmHR7VW2ESVt/HAYlnbs8ksuA2zyD3kInAsFmcRqh0swjksOIYTr pTVwtpjWVrJhTOnRorluQ7Lvtqd7Jkx7Xv37/uG8E/qtv0mobG7wSs3wKI3c5d73/agx QWDR1DDmr/yYPEVrZt+By52/BVlHMycug0jVLbihb7QBg7FB3oNH4zdy7JFbPfjhp4Rk kQPfzCEK06R2g9t/xx86+QunODpKhryJ9NNIFhO0kAX6jifp6pM7OPJeAiSUAjoWs4PU 9QBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=A0pfV/DwY+7OHAPDaT2NCm9JaxY5uj5pHP+9/1OoPcU=; b=lG3P5fk6jVZtt7RmDZPblJ2pFIwaZ5JiST2XUDwRn0xhUSN1HciuFQ+dWJuyxooYKX 4/KmCBPA8zqpue7AZLNGRJ1T9KFW+f64TDYh+RDZ52gtu2KZXNDYaC67iaEWpjV8rMrf Q2GkGXIa1pmXpDDKQAX0p0kbV9ipGvYT0Mf0ht+UchKwDiXXMYAoU74oNuvx8/Pa1/N7 vGpJc9RlVtSxrflRBKLLG2BYvc/AdqnJb95qAoG4gp2TagQ5llB6LVv0doqWAq3y8p2H iZIPQREak7oQoVZcoDxilcjR9AkS8c41o414CFqKFPtS01zPcV5fD2X5yZ86PyJHEuYa 39Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LtDf4XA4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l71si457783pgd.501.2018.02.27.19.59.48; Tue, 27 Feb 2018 20:00:02 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=LtDf4XA4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752099AbeB1D61 (ORCPT + 99 others); Tue, 27 Feb 2018 22:58:27 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:39471 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbeB1D6Z (ORCPT ); Tue, 27 Feb 2018 22:58:25 -0500 Received: by mail-pl0-f68.google.com with SMTP id s13-v6so772311plq.6 for ; Tue, 27 Feb 2018 19:58:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A0pfV/DwY+7OHAPDaT2NCm9JaxY5uj5pHP+9/1OoPcU=; b=LtDf4XA4SNXxq8oIVHznFIsTr/jEO1OaospEOmJ72fplp7yhUm9pV0RWK7rhHTBHcJ 6XhPlXc+dIwqGt3iWTUSOu7cVzqub56pk7/HfDrwFKJ0O7vEOxEp4dRMceCHzGlxwj3F 1gRLcmfnz6IPqO8oJhq//YB8+Oq+dZIvpCBzE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A0pfV/DwY+7OHAPDaT2NCm9JaxY5uj5pHP+9/1OoPcU=; b=BicL1L1U9rS9vqYKdc5Ctn9Xd/TOV65rsHOgyffUozDHM/DAOjHt42wEcgj6H2yIIS Bs8gKmlsMH9CqxuLsMdAklt01RIk+ySdI3XTu3Rb1vwUuZsDOuaUFWzEZk+xZGYnVhdu UG7ColZ9mq9Cl97FPecBQh1Y3+emW92GRpEmz0PvoLhmH67daPtQltPRkSiECdc/pnay cmOAcV+RxLLJM24Bs6BpyQ4bNGV4Tc/n/H3URY1ouYBX5uGLKPhKrLbTkkzuqvCxWUie ELS4IBMaoyn+fAuGDzxkbAwgKqkOTikMKaGelxHwxdO8x5hAP//xhEvaAPySXlzeJgOm mnAw== X-Gm-Message-State: APf1xPB3TJHsWhpla03jLmiAzmwcvob2TYH2WpkHiVicyeEKwibyD/S9 mekBg4/RiK2MvFlCLR9euZs3qQ== X-Received: by 2002:a17:902:6b4c:: with SMTP id g12-v6mr16279012plt.363.1519790304486; Tue, 27 Feb 2018 19:58:24 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id q17sm739911pgt.7.2018.02.27.19.58.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 19:58:23 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Xie XiuQi , Wang Xiongfeng , James Morse , Alex Shi Subject: [PATCH 07/29] arm64: entry.S: move SError handling into a C function for future expansion Date: Wed, 28 Feb 2018 11:56:29 +0800 Message-Id: <1519790211-16582-8-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519790211-16582-1-git-send-email-alex.shi@linaro.org> References: <1519790211-16582-1-git-send-email-alex.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xie XiuQi commit a92d4d1454ab upstream. Today SError is taken using the inv_entry macro that ends up in bad_mode. SError can be used by the RAS Extensions to notify either the OS or firmware of CPU problems, some of which may have been corrected. To allow this handling to be added, add a do_serror() C function that just panic()s. Add the entry.S boiler plate to save/restore the CPU registers and unmask debug exceptions. Future patches may change do_serror() to return if the SError Interrupt was notification of a corrected error. Signed-off-by: Xie XiuQi Signed-off-by: Wang Xiongfeng [Split out of a bigger patch, added compat path, renamed, enabled debug exceptions] Signed-off-by: James Morse Reviewed-by: Catalin Marinas Signed-off-by: Will Deacon Signed-off-by: Alex Shi Conflicts: no vmap_stack in arch/arm64/kernel/traps.c using old enable_dbg_and_irq instead of enable_daif in arch/arm64/kernel/entry.S --- arch/arm64/kernel/entry.S | 36 +++++++++++++++++++++++++++++------- arch/arm64/kernel/traps.c | 14 ++++++++++++++ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index f5aa8f0..60b202a 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -270,18 +270,18 @@ ENTRY(vectors) kernel_ventry el1_sync // Synchronous EL1h kernel_ventry el1_irq // IRQ EL1h kernel_ventry el1_fiq_invalid // FIQ EL1h - kernel_ventry el1_error_invalid // Error EL1h + kernel_ventry el1_error // Error EL1h kernel_ventry el0_sync // Synchronous 64-bit EL0 kernel_ventry el0_irq // IRQ 64-bit EL0 kernel_ventry el0_fiq_invalid // FIQ 64-bit EL0 - kernel_ventry el0_error_invalid // Error 64-bit EL0 + kernel_ventry el0_error // Error 64-bit EL0 #ifdef CONFIG_COMPAT kernel_ventry el0_sync_compat // Synchronous 32-bit EL0 kernel_ventry el0_irq_compat // IRQ 32-bit EL0 kernel_ventry el0_fiq_invalid_compat // FIQ 32-bit EL0 - kernel_ventry el0_error_invalid_compat // Error 32-bit EL0 + kernel_ventry el0_error_compat // Error 32-bit EL0 #else kernel_ventry el0_sync_invalid // Synchronous 32-bit EL0 kernel_ventry el0_irq_invalid // IRQ 32-bit EL0 @@ -321,10 +321,6 @@ ENDPROC(el0_error_invalid) el0_fiq_invalid_compat: inv_entry 0, BAD_FIQ, 32 ENDPROC(el0_fiq_invalid_compat) - -el0_error_invalid_compat: - inv_entry 0, BAD_ERROR, 32 -ENDPROC(el0_error_invalid_compat) #endif el1_sync_invalid: @@ -532,6 +528,10 @@ el0_svc_compat: el0_irq_compat: kernel_entry 0, 32 b el0_irq_naked + +el0_error_compat: + kernel_entry 0, 32 + b el0_error_naked #endif el0_da: @@ -653,6 +653,28 @@ el0_irq_naked: b ret_to_user ENDPROC(el0_irq) +el1_error: + kernel_entry 1 + mrs x1, esr_el1 + enable_dbg + mov x0, sp + bl do_serror + kernel_exit 1 +ENDPROC(el1_error) + +el0_error: + kernel_entry 0 +el0_error_naked: + mrs x1, esr_el1 + enable_dbg + mov x0, sp + bl do_serror + enable_dbg_and_irq + ct_user_exit + b ret_to_user +ENDPROC(el0_error) + + /* * Register switch for AArch64. The callee-saved registers need to be saved * and restored. On entry: diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index c743d1f..2ef7e33 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -637,6 +637,20 @@ asmlinkage void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr) force_sig_info(info.si_signo, &info, current); } + +asmlinkage void do_serror(struct pt_regs *regs, unsigned int esr) +{ + nmi_enter(); + + console_verbose(); + + pr_crit("SError Interrupt on CPU%d, code 0x%08x -- %s\n", + smp_processor_id(), esr, esr_get_class_string(esr)); + __show_regs(regs); + + panic("Asynchronous SError Interrupt"); +} + void __pte_error(const char *file, int line, unsigned long val) { pr_err("%s:%d: bad pte %016lx.\n", file, line, val); -- 2.7.4