Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp141078pxa; Thu, 13 Aug 2020 22:59:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi6R/cXtYQyofumg/xC/d/vWIoapfmZEcF9IocMiZzYhp+fha7313bd5IonbkVslHV2XqY X-Received: by 2002:a17:906:fa15:: with SMTP id lo21mr1003022ejb.42.1597384796411; Thu, 13 Aug 2020 22:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597384796; cv=none; d=google.com; s=arc-20160816; b=K5EbkbuWVX/8zOgk/Py+b13liFPM2BuN7ng/yVdXp4fSGD8Y6OFJbpa8LvHeZquA0Q cYI7I6VVDqoYzoHK8RrpkAYDayQQng3Bjc/y25cnpMUUYg9SNByis3xFwlM7/rJX1rcm rP4VBzIv7A0NydXAt4KUBLYcw6DOew3dQ4RTdruYfzKW3VT6+Yh5K5i1TuDwkDh9wmPE E25j2zZSEc0KJoqWrBwnZr+RSEwfu4ZOWePH0hMUBKhh+9Qy5cMl9SrtmgxK7wBSk2nj Ox5Zuv/eMDCNNeXQBw99FbeD48B/7/iq40B8L8TqosCBr0EOOFbDZd+ZPv35wJUzADWC KSoA== 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; bh=V4+Gw/jogdlLhJzjquQu1BHUUQnN4eLfcA+tadCmo4g=; b=NpP31eLa7zKASD/4NhUV/twh1BTWMzXIktxN8XQI5sdlk1ag71Rn9W/OfglDVCJk1J BY41i5yREeWWorbtIlbbNNRxJDuPQwOHbwPc2lkdgzW7FuCukTLd7GIPvugZ7evOPi+k gJ+vBi5sulV0ULO00/RG2Z2Xs3+BnJ3LbEYnb+l9mQUs7fhNm+pnkrZ3Q41Widr4zBhF 23t+tiDzSv2r+8PmbWsXLsyu+4Dn4/3yXLYu4SG8hxYsP/SjXlC7TXmXKLaIWIyoj9CM JT/J2JwpSfc8Wmf+rRwHJb46WFSt7oGQK+srHb4GG4+n1p7GUEvyszOD11ABMYzN+SvY MtNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si4521048eji.564.2020.08.13.22.59.33; Thu, 13 Aug 2020 22:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726606AbgHNF43 (ORCPT + 99 others); Fri, 14 Aug 2020 01:56:29 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:64419 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbgHNF43 (ORCPT ); Fri, 14 Aug 2020 01:56:29 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4BSXkL3hHWz9vD35; Fri, 14 Aug 2020 07:56:26 +0200 (CEST) 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 39fcw5CulY1A; Fri, 14 Aug 2020 07:56:26 +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 4BSXkL2pDvz9vD2y; Fri, 14 Aug 2020 07:56:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 54C328B775; Fri, 14 Aug 2020 07:56:27 +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 u7SJ9gmfX6zo; Fri, 14 Aug 2020 07:56:27 +0200 (CEST) Received: from po17688vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1AD118B767; Fri, 14 Aug 2020 07:56:27 +0200 (CEST) Received: by po17688vm.idsi0.si.c-s.fr (Postfix, from userid 0) id B950565C93; Fri, 14 Aug 2020 05:56:26 +0000 (UTC) Message-Id: <93d93fc69b4b3ad3ceba2fc0756333c0c0245bb7.1597384512.git.christophe.leroy@csgroup.eu> In-Reply-To: <50098f49877cea0f46730a9df82dcabf84160e4b.1597384512.git.christophe.leroy@csgroup.eu> References: <50098f49877cea0f46730a9df82dcabf84160e4b.1597384512.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH v2 3/4] powerpc: Rewrite 4xx flush_cache_instruction() in C To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , hch@infradead.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 14 Aug 2020 05:56:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nothing prevents flush_cache_instruction() from being writen in C. Do it to improve readability and maintainability. This function is very small and isn't called from assembly, make it static inline in asm/cacheflush.h Signed-off-by: Christophe Leroy --- v2: Written as a static inline instead of adding a new C file for this function alone. --- arch/powerpc/include/asm/cacheflush.h | 8 ++++++++ arch/powerpc/kernel/misc_32.S | 7 +------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h index 481877879fec..138e46d8c04e 100644 --- a/arch/powerpc/include/asm/cacheflush.h +++ b/arch/powerpc/include/asm/cacheflush.h @@ -98,7 +98,15 @@ static inline void invalidate_dcache_range(unsigned long start, mb(); /* sync */ } +#ifdef CONFIG_4xx +static inline void flush_instruction_cache(void) +{ + iccci((void *)KERNELBASE); + isync(); +} +#else void flush_instruction_cache(void); +#endif #include diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S index 5c074c2ff5b5..1bda207459a8 100644 --- a/arch/powerpc/kernel/misc_32.S +++ b/arch/powerpc/kernel/misc_32.S @@ -272,12 +272,8 @@ _ASM_NOKPROBE_SYMBOL(real_writeb) /* * Flush instruction cache. */ -#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC_BOOK3S_32) +#ifdef CONFIG_FSL_BOOKE _GLOBAL(flush_instruction_cache) -#if defined(CONFIG_4xx) - lis r3, KERNELBASE@h - iccci 0,r3 -#elif defined(CONFIG_FSL_BOOKE) #ifdef CONFIG_E200 mfspr r3,SPRN_L1CSR0 ori r3,r3,L1CSR0_CFI|L1CSR0_CLFC @@ -289,7 +285,6 @@ _GLOBAL(flush_instruction_cache) mfspr r3,SPRN_L1CSR1 ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR mtspr SPRN_L1CSR1,r3 -#endif /* CONFIG_4xx */ isync blr EXPORT_SYMBOL(flush_instruction_cache) -- 2.25.0