Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5233473ybl; Tue, 27 Aug 2019 01:14:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTU8gDMAY9/D757rmeI1oZRwIdLMQa2W4gqDvU8TufsD4VVsLxmT+RVu2GPh1opLPLI+0x X-Received: by 2002:a62:65c7:: with SMTP id z190mr25560395pfb.9.1566893698699; Tue, 27 Aug 2019 01:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893698; cv=none; d=google.com; s=arc-20160816; b=pjNSC/bdZgwh6vSY/3vXy13OSsTUt9PfG9CMVbFrNCB2YaoqgHOc1pEVvMiXNeJT7h SBBCxLGKO0/M2qFY405+fxppxwlE5/2W3atsjJCVDZ3Uzl/hYxbXTzjRNDeWuVBjJytm haaMDbpsx/22W7UbqrPlpbj42GtvOyEJSNImC52vLq3PkoXXaQuzRaQRVO0VWz8MiEJm AMLqZeQUGJB3IpPtcWD3+dCuBg4PUVDxI7IEZiJ3gMGXkOokjEEUb8WePV3RffzyVCwd Zcprv43fz3oQR2PYipYAUECjgmoRInFnY3aO044tQBt4tvIMgEfmexYMFPhCo5pPqXgx cTBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=yekcWG/d0H4aoizUdD+G2UyFFVKONjNMIvJn30XRWwU=; b=pvoi9ykvAs0DLx6nbNA6ZIFBUBWK5FbmCJAqKZwHgeShz8WWgxX/HsyNDwa/hvsj7k d8pelFi2FjdVxym8wG4f8EYVNTdcfr+btVmeEi7Fg7Okj/w179MNtYda90LzT9MF8dpQ MK2AKsbT/kMkwzot5lF4pL4nQMoH7qNQv3wWYgDcbiVIfpsfi2FmR4lJRN4y/VfBavkV i0n+XPdfL1buQHQ1u419H9I7Mz/WFxb7CHq4iN2WxzHhOeEP/zptPvUSuSa52ceQfqsQ CSOsekDgj/Nz676zgKUyDFoVvW1WmNbmLhRWlUqalW2TzEjimdY9FwIt0DPNyNwFVBmN fU3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=jvkbNv9j; 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 7si12356611ple.224.2019.08.27.01.14.43; Tue, 27 Aug 2019 01:14:58 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=jvkbNv9j; 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 S1731700AbfH0INQ (ORCPT + 99 others); Tue, 27 Aug 2019 04:13:16 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:57857 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731007AbfH0INL (ORCPT ); Tue, 27 Aug 2019 04:13:11 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46HhT06QfmzB09Zv; Tue, 27 Aug 2019 10:13:08 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=jvkbNv9j; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 7eBVHiy23uDi; Tue, 27 Aug 2019 10:13:08 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 46HhT053zkzB09Zn; Tue, 27 Aug 2019 10:13:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1566893588; bh=yekcWG/d0H4aoizUdD+G2UyFFVKONjNMIvJn30XRWwU=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=jvkbNv9jN3Ov0/K9ifNJDh8Zpw0XKxesk5hWFsH7qYmmjxmeNZsgT6TRW8+9z3IXI n2uHEZ4mZW8KatCHUT601Dj3H+Te/qoJvZ8W2Nk77TKwxDo3qhEly8f0RE6aLYsyDR UXha5+UwGWkzEOLpHQDOlMLL90xYjniDirT0AH64= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BD2088B7F6; Tue, 27 Aug 2019 10:13:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id DhOBYalMqP8m; Tue, 27 Aug 2019 10:13:09 +0200 (CEST) Received: from pc16032vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7FEA88B74C; Tue, 27 Aug 2019 10:13:09 +0200 (CEST) Received: by pc16032vm.idsi0.si.c-s.fr (Postfix, from userid 0) id EC1CD696D8; Tue, 27 Aug 2019 08:13:08 +0000 (UTC) Message-Id: <81f39fa06ae582f4a783d26abd2b310204eba8f4.1566893505.git.christophe.leroy@c-s.fr> In-Reply-To: <0f7e164afb5d1b022441559fe5a999bb6d3c0a23.1566893505.git.christophe.leroy@c-s.fr> References: <0f7e164afb5d1b022441559fe5a999bb6d3c0a23.1566893505.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH 2/2] powerpc: cleanup hw_irq.h To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 27 Aug 2019 08:13:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SET_MSR_EE() is just use in this file and doesn't provide any added value compared to mtmsr(). Drop it. Add macros to use wrtee/wrteei insn. Replace #ifdefs by IS_ENABLED() Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/hw_irq.h | 57 ++++++++++++++++++--------------------- arch/powerpc/include/asm/reg.h | 2 ++ 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index 32a18f2f49bc..c25d57f25a8b 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h @@ -226,8 +226,8 @@ static inline bool arch_irqs_disabled(void) #endif /* CONFIG_PPC_BOOK3S */ #ifdef CONFIG_PPC_BOOK3E -#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory") -#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory") +#define __hard_irq_enable() wrteei(1) +#define __hard_irq_disable() wrteei(0) #else #define __hard_irq_enable() __mtmsrd(MSR_EE|MSR_RI, 1) #define __hard_irq_disable() __mtmsrd(MSR_RI, 1) @@ -280,8 +280,6 @@ extern void force_external_irq_replay(void); #else /* CONFIG_PPC64 */ -#define SET_MSR_EE(x) mtmsr(x) - static inline unsigned long arch_local_save_flags(void) { return mfmsr(); @@ -289,47 +287,44 @@ static inline unsigned long arch_local_save_flags(void) static inline void arch_local_irq_restore(unsigned long flags) { -#if defined(CONFIG_BOOKE) - asm volatile("wrtee %0" : : "r" (flags) : "memory"); -#else - mtmsr(flags); -#endif + if (IS_ENABLED(CONFIG_BOOKE)) + wrtee(flags); + else + mtmsr(flags); } static inline unsigned long arch_local_irq_save(void) { unsigned long flags = arch_local_save_flags(); -#ifdef CONFIG_BOOKE - asm volatile("wrteei 0" : : : "memory"); -#elif defined(CONFIG_PPC_8xx) - wrtspr(SPRN_EID); -#else - SET_MSR_EE(flags & ~MSR_EE); -#endif + + if (IS_ENABLED(CONFIG_BOOKE)) + wrteei(0); + else if (IS_ENABLED(CONFIG_PPC_8xx)) + wrtspr(SPRN_EID); + else + mtmsr(flags & ~MSR_EE); + return flags; } static inline void arch_local_irq_disable(void) { -#ifdef CONFIG_BOOKE - asm volatile("wrteei 0" : : : "memory"); -#elif defined(CONFIG_PPC_8xx) - wrtspr(SPRN_EID); -#else - arch_local_irq_save(); -#endif + if (IS_ENABLED(CONFIG_BOOKE)) + wrteei(0); + else if (IS_ENABLED(CONFIG_PPC_8xx)) + wrtspr(SPRN_EID); + else + mtmsr(mfmsr() & ~MSR_EE); } static inline void arch_local_irq_enable(void) { -#ifdef CONFIG_BOOKE - asm volatile("wrteei 1" : : : "memory"); -#elif defined(CONFIG_PPC_8xx) - wrtspr(SPRN_EIE); -#else - unsigned long msr = mfmsr(); - SET_MSR_EE(msr | MSR_EE); -#endif + if (IS_ENABLED(CONFIG_BOOKE)) + wrteei(1); + else if (IS_ENABLED(CONFIG_PPC_8xx)) + wrtspr(SPRN_EIE); + else + mtmsr(mfmsr() | MSR_EE); } static inline bool arch_irqs_disabled_flags(unsigned long flags) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index b17ee25df226..04896dd09455 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -1361,6 +1361,8 @@ static inline void mtmsr_isync(unsigned long val) #endif #define wrtspr(rn) asm volatile("mtspr " __stringify(rn) ",0" : \ : : "memory") +#define wrtee(val) asm volatile("wrtee %0" : : "r" (val) : "memory") +#define wrteei(val) asm volatile("wrteei %0" : : "i" (val) : "memory") extern unsigned long msr_check_and_set(unsigned long bits); extern bool strict_msr_control; -- 2.13.3