From patchwork Fri Sep 1 18:06:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 808887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YDrOnO+6"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xkRyZ0Kngz9t3F for ; Sat, 2 Sep 2017 04:06:45 +1000 (AEST) 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=lTzpy7kgLbSI+keqZdGr9iFrdWEdZ/HszlxXfhh7sL8=; b=YDrOnO+6WDG5kR HJgrVsa8/AvVWaY4MEs74VjTVVgiipSugLC28xoIAucUWtCc+B++BsQXdG9qKyo/85Vi2jYZE1pq4 897QUL4wAgXQ9OnF0K60Vr26qnWebjkeCHm4Sxte6+rNxOJmDuEoVsnhz0CgAo+zjJ/skhdxY4atU umLyWlMjd9n5WcLOJrG05QIEdkZlTH8ZIB9aZZBj/K7sfhQVSo6C4bRsrKppvIteCzh2LGf76oLyt dZx5JtdhnBVQbJWwWLiyI/ef+DraMibG7VU6tBeGZqgOwCrWKmy+pZW7YD5UBou+MWxvCz1pnH8hC 05HTdmV5kxAGISCzjr+w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dnqL6-0001Nf-EG; Fri, 01 Sep 2017 18:06:44 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dnqL3-0001LC-6r for linux-snps-arc@lists.infradead.org; Fri, 01 Sep 2017 18:06:42 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 16C5424E0C8A; Fri, 1 Sep 2017 11:06:20 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id F130CE7E; Fri, 1 Sep 2017 11:06:19 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id DB27CE74; Fri, 1 Sep 2017 11:06:19 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 1 Sep 2017 11:06:18 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 1 Sep 2017 23:36:16 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.12.196.101) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 1 Sep 2017 23:36:15 +0530 From: Vineet Gupta To: Subject: [PATCH] ARC: Machine Check Exception: enable MMU in single place Date: Fri, 1 Sep 2017 11:06:02 -0700 Message-ID: <1504289162-25977-1-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.12.196.101] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170901_110641_269639_6B7D9CF0 X-CRM114-Status: UNSURE ( 7.96 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jose.Abreu@synopsys.com, Vineet Gupta , linux-kernel@vger.kernel.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Machine check Exception is handled in distinc ways depending on cause - Duplicate TLB Entry (relevent mostly for ARC700) - everything else Currently we re-enable MMU seperately for each of these cases, which can be consolidated by dign this before we fork off the handling in low level handler. Signed-off-by: Vineet Gupta --- arch/arc/kernel/entry.S | 6 ++++++ arch/arc/kernel/traps.c | 6 ------ arch/arc/mm/tlb.c | 3 --- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S index 1eea99beecc3..85d9ea4a0acc 100644 --- a/arch/arc/kernel/entry.S +++ b/arch/arc/kernel/entry.S @@ -92,6 +92,12 @@ ENTRY(EV_MachineCheck) lr r0, [efa] mov r1, sp + ; hardware auto-disables MMU, re-enable it to allow kernel vaddr + ; access for say stack unwinding of modules for crash dumps + lr r3, [ARC_REG_PID] + or r3, r3, MMU_ENABLE + sr r3, [ARC_REG_PID] + lsr r3, r2, 8 bmsk r3, r3, 7 brne r3, ECR_C_MCHK_DUP_TLB, 1f diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c index b636dfe8ee9e..b03daa7a9a2b 100644 --- a/arch/arc/kernel/traps.c +++ b/arch/arc/kernel/traps.c @@ -105,12 +105,6 @@ int do_misaligned_access(unsigned long address, struct pt_regs *regs, */ void do_machine_check_fault(unsigned long address, struct pt_regs *regs) { - /* - * Hardware auto-disables MMU upon this exception hence re-enabled - * for ksym lookup in modules to work (in kernel vaddr space) - */ - write_aux_reg(ARC_REG_PID, MMU_ENABLE | read_aux_reg(ARC_REG_PID)); - die("Unhandled Machine Check Exception", regs, address); } diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c index edc59a0a9c9b..8ceefbf72fb0 100644 --- a/arch/arc/mm/tlb.c +++ b/arch/arc/mm/tlb.c @@ -908,9 +908,6 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address, local_irq_save(flags); - /* re-enable the MMU */ - write_aux_reg(ARC_REG_PID, MMU_ENABLE | read_aux_reg(ARC_REG_PID)); - /* loop thru all sets of TLB */ for (set = 0; set < mmu->sets; set++) {