From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9919FC433FF for ; Wed, 7 Aug 2019 13:13:39 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id F09A721E6B for ; Wed, 7 Aug 2019 13:13:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F09A721E6B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-16750-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 17533 invoked by uid 550); 7 Aug 2019 13:13:32 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Received: (qmail 17497 invoked from network); 7 Aug 2019 13:13:31 -0000 From: Michael Ellerman To: Jason Yan , linuxppc-dev@lists.ozlabs.org, diana.craciun@nxp.com, christophe.leroy@c-s.fr, benh@kernel.crashing.org, paulus@samba.org, npiggin@gmail.com, keescook@chromium.org, kernel-hardening@lists.openwall.com Cc: linux-kernel@vger.kernel.org, wangkefeng.wang@huawei.com, yebin10@huawei.com, thunder.leizhen@huawei.com, jingxiangfeng@huawei.com, fanchengyang@huawei.com, zhaohongjiang@huawei.com, Jason Yan Subject: Re: [PATCH v5 01/10] powerpc: unify definition of M_IF_NEEDED In-Reply-To: <20190807065706.11411-2-yanaijie@huawei.com> References: <20190807065706.11411-1-yanaijie@huawei.com> <20190807065706.11411-2-yanaijie@huawei.com> Date: Wed, 07 Aug 2019 23:13:15 +1000 Message-ID: <87sgqdt8yc.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Jason Yan writes: > M_IF_NEEDED is defined too many times. Move it to a common place. The name is not great, can you call it MAS2_M_IF_NEEDED, which at least gives a clue what it's for? cheers > Signed-off-by: Jason Yan > Cc: Diana Craciun > Cc: Michael Ellerman > Cc: Christophe Leroy > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Nicholas Piggin > Cc: Kees Cook > Reviewed-by: Christophe Leroy > Reviewed-by: Diana Craciun > Tested-by: Diana Craciun > --- > arch/powerpc/include/asm/nohash/mmu-book3e.h | 10 ++++++++++ > arch/powerpc/kernel/exceptions-64e.S | 10 ---------- > arch/powerpc/kernel/fsl_booke_entry_mapping.S | 10 ---------- > arch/powerpc/kernel/misc_64.S | 5 ----- > 4 files changed, 10 insertions(+), 25 deletions(-) > > diff --git a/arch/powerpc/include/asm/nohash/mmu-book3e.h b/arch/powerpc/include/asm/nohash/mmu-book3e.h > index 4c9777d256fb..0877362e48fa 100644 > --- a/arch/powerpc/include/asm/nohash/mmu-book3e.h > +++ b/arch/powerpc/include/asm/nohash/mmu-book3e.h > @@ -221,6 +221,16 @@ > #define TLBILX_T_CLASS2 6 > #define TLBILX_T_CLASS3 7 > > +/* > + * The mapping only needs to be cache-coherent on SMP, except on > + * Freescale e500mc derivatives where it's also needed for coherent DMA. > + */ > +#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC) > +#define M_IF_NEEDED MAS2_M > +#else > +#define M_IF_NEEDED 0 > +#endif > + > #ifndef __ASSEMBLY__ > #include > > diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S > index 1cfb3da4a84a..fd49ec07ce4a 100644 > --- a/arch/powerpc/kernel/exceptions-64e.S > +++ b/arch/powerpc/kernel/exceptions-64e.S > @@ -1342,16 +1342,6 @@ skpinv: addi r6,r6,1 /* Increment */ > sync > isync > > -/* > - * The mapping only needs to be cache-coherent on SMP, except on > - * Freescale e500mc derivatives where it's also needed for coherent DMA. > - */ > -#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC) > -#define M_IF_NEEDED MAS2_M > -#else > -#define M_IF_NEEDED 0 > -#endif > - > /* 6. Setup KERNELBASE mapping in TLB[0] > * > * r3 = MAS0 w/TLBSEL & ESEL for the entry we started in > diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S b/arch/powerpc/kernel/fsl_booke_entry_mapping.S > index ea065282b303..de0980945510 100644 > --- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S > +++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S > @@ -153,16 +153,6 @@ skpinv: addi r6,r6,1 /* Increment */ > tlbivax 0,r9 > TLBSYNC > > -/* > - * The mapping only needs to be cache-coherent on SMP, except on > - * Freescale e500mc derivatives where it's also needed for coherent DMA. > - */ > -#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC) > -#define M_IF_NEEDED MAS2_M > -#else > -#define M_IF_NEEDED 0 > -#endif > - > #if defined(ENTRY_MAPPING_BOOT_SETUP) > > /* 6. Setup KERNELBASE mapping in TLB1[0] */ > diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S > index b55a7b4cb543..26074f92d4bc 100644 > --- a/arch/powerpc/kernel/misc_64.S > +++ b/arch/powerpc/kernel/misc_64.S > @@ -432,11 +432,6 @@ kexec_create_tlb: > rlwimi r9,r10,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r9) */ > > /* Set up a temp identity mapping v:0 to p:0 and return to it. */ > -#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC) > -#define M_IF_NEEDED MAS2_M > -#else > -#define M_IF_NEEDED 0 > -#endif > mtspr SPRN_MAS0,r9 > > lis r9,(MAS1_VALID|MAS1_IPROT)@h > -- > 2.17.2