From patchwork Fri Feb 7 16:19:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrice Gasnier X-Patchwork-Id: 3606431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C7B2DBF418 for ; Fri, 7 Feb 2014 16:27:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B3442012F for ; Fri, 7 Feb 2014 16:27:58 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F56D2012B for ; Fri, 7 Feb 2014 16:27:57 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBoG3-0007lk-0V; Fri, 07 Feb 2014 16:26:27 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBoB8-0007cw-BN; Fri, 07 Feb 2014 16:21:22 +0000 Received: from eu1sys200aog105.obsmtp.com ([207.126.144.119]) by merlin.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBoAt-0007Yp-Mt for linux-arm-kernel@lists.infradead.org; Fri, 07 Feb 2014 16:21:09 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob105.postini.com ([207.126.147.11]) with SMTP ID DSNKUvUH0+u6beAYzlhwGXlCzSAT2gAlLT4X@postini.com; Fri, 07 Feb 2014 16:21:07 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0440CFC; Fri, 7 Feb 2014 16:20:21 +0000 (GMT) Received: from mail7.sgp.st.com (unknown [164.129.223.81]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B8A742CBE8; Fri, 7 Feb 2014 16:20:20 +0000 (GMT) Received: from lmenx291.st.com (lmenx291.lme.st.com [10.201.23.81] (may be forged)) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id BXQ00495 (AUTH fgasni00); Fri, 7 Feb 2014 17:20:19 +0100 From: Fabrice GASNIER To: linux@arm.linux.org.uk, u.kleine-koenig@pengutronix.de, jonathan.austin@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, nico@linaro.org, sboyd@codeaurora.org, marc.zyngier@arm.com, ben.dooks@codethink.co.uk, vgupta@synopsys.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] ARM: Add imprecise abort enable/disable macro Date: Fri, 7 Feb 2014 17:19:15 +0100 Message-Id: <1391789955-26927-2-git-send-email-fabrice.gasnier@st.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391789955-26927-1-git-send-email-fabrice.gasnier@st.com> References: <1391789955-26927-1-git-send-email-fabrice.gasnier@st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140207_112108_063791_0CB6ED3A X-CRM114-Status: GOOD ( 14.39 ) X-Spam-Score: -4.2 (----) Cc: maxime.coquelin@st.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds imprecise abort enable/disable macros. It also enables imprecise aborts when starting kernel. Signed-off-by: Fabrice Gasnier --- arch/arm/include/asm/irqflags.h | 33 +++++++++++++++++++++++++++++++++ arch/arm/kernel/smp.c | 1 + arch/arm/kernel/traps.c | 4 ++++ 3 files changed, 38 insertions(+) diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h index 3b763d6..82e3834 100644 --- a/arch/arm/include/asm/irqflags.h +++ b/arch/arm/include/asm/irqflags.h @@ -51,6 +51,9 @@ static inline void arch_local_irq_disable(void) #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc") #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc") + +#define local_abt_enable() __asm__("cpsie a @ __sta" : : : "memory", "cc") +#define local_abt_disable() __asm__("cpsid a @ __cla" : : : "memory", "cc") #else /* @@ -130,6 +133,36 @@ static inline void arch_local_irq_disable(void) : "memory", "cc"); \ }) +/* + * Enable Aborts + */ +#define local_abt_enable() \ + ({ \ + unsigned long temp; \ + __asm__ __volatile__( \ + "mrs %0, cpsr @ sta\n" \ +" bic %0, %0, %1\n" \ +" msr cpsr_c, %0" \ + : "=r" (temp) \ + : "r" (PSR_A_BIT) \ + : "memory", "cc"); \ + }) + +/* + * Disable Aborts + */ +#define local_abt_disable() \ + ({ \ + unsigned long temp; \ + __asm__ __volatile__( \ + "mrs %0, cpsr @ cla\n" \ +" orr %0, %0, %1\n" \ +" msr cpsr_c, %0" \ + : "=r" (temp) \ + : "r" (PSR_A_BIT) \ + : "memory", "cc"); \ + }) + #endif /* diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index dc894ab..c2093cb 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -377,6 +377,7 @@ asmlinkage void secondary_start_kernel(void) local_irq_enable(); local_fiq_enable(); + local_abt_enable(); /* * OK, it's off to the idle thread for us diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 4636d56..ef15709 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -900,6 +900,10 @@ void __init early_trap_init(void *vectors_base) flush_icache_range(vectors, vectors + PAGE_SIZE * 2); modify_domain(DOMAIN_USER, DOMAIN_CLIENT); + + /* Enable imprecise aborts */ + local_abt_enable(); + #else /* ifndef CONFIG_CPU_V7M */ /* * on V7-M there is no need to copy the vector table to a dedicated