Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp561519pxf; Thu, 8 Apr 2021 08:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUXdYTNATh0eqzWdFTz6OOGVtAjZSOdXdtZmIla2UbEJHSpyTBRXZBwqW/kM33ji2o4C36 X-Received: by 2002:a17:906:d9ca:: with SMTP id qk10mr10701370ejb.436.1617895961267; Thu, 08 Apr 2021 08:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617895961; cv=none; d=google.com; s=arc-20160816; b=gVnV5NZQ/6ayh0YNxRfQi1pf3hFApDM2XhS4MGcHbshTqo6IzStDA+ZXLk9W5h93A2 1eFQTitPgCojkf5YEuZLwuc2IqnT1AqKw36ugUEmrfJJ2mu7IVn0COLBa4AdehZpfVAz DfXbYs4X1e8okRRF0TyFOXfRMsanuYw/nZAmggOoZ1H55zmFu1G1YMyQyr0YQI4W7OGo ftn36BS7JgzvlCgBoGl3pMIN9zKituCTGx5IwNE4JpsjyL9O+t/I4UiEq4wNfm/dYvZy XJL4+J/5SNyJd7cfdS7Hbk+jmEzhJ4c3aeCEOz7bZxRFrE3hEFsGJXCCWgxp6dkzZ7cu cI8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=5FAwIgs1K4MbIeNJ9RjhRI4ZmMjLMAVXd17CRsR+ipA=; b=A+aWS1JOfmjEpT4IDvu33LU9/IUgQlmWpEX/DisyKdhLnguT+doIR0Dx4TwINQrD5j OOLm5CgaqeRz0rzIze0a8bMqtFqHR4tYZvxzZf3fT/MtwBvAj7OnG8/Mce7GWf5YwOqT o2kccsyHtX9PpdZ0fb2ap8lbhTLn6Wuc4J25BHVnczh8UrVBpt2pA3TnPAzmGGY4cAha uSO3pySArizTfXmG+qnabP20CNkQHMcEKz6yCNleR94PvR3L+tzg+ofnHHeKtrvDqpDS C9/NFaUtgdBckKb1NMcnvHSsFrn6tWvPRpQ+30sUfyukxHnsoTLiu6WYw3AHeP4QdD/4 +p8g== 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 jy21si1505186ejc.675.2021.04.08.08.32.13; Thu, 08 Apr 2021 08:32:41 -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 S232158AbhDHPbN (ORCPT + 99 others); Thu, 8 Apr 2021 11:31:13 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:58888 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232047AbhDHPap (ORCPT ); Thu, 8 Apr 2021 11:30:45 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FGQFL3L24z9txf4; Thu, 8 Apr 2021 17:30:30 +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 a1O7rQ9ikjG7; Thu, 8 Apr 2021 17:30:30 +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 4FGQFL2bzRz9txf2; Thu, 8 Apr 2021 17:30:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AB5628B7D4; Thu, 8 Apr 2021 17:30:31 +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 0-vyeLuL-FWw; Thu, 8 Apr 2021 17:30:31 +0200 (CEST) Received: from po16121vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5E3508B7D1; Thu, 8 Apr 2021 17:30:31 +0200 (CEST) Received: by po16121vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 35627679BA; Thu, 8 Apr 2021 15:30:31 +0000 (UTC) Message-Id: <23030822ea5cd0a122948b10226abe56602dc027.1617895813.git.christophe.leroy@csgroup.eu> In-Reply-To: <7bf6f1600acad146e541a4e220940062f2e5b03d.1617895813.git.christophe.leroy@csgroup.eu> References: <7bf6f1600acad146e541a4e220940062f2e5b03d.1617895813.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH v2 7/9] powerpc/mem: Help GCC realise __flush_dcache_icache() flushes single pages To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 8 Apr 2021 15:30:31 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'And' the given page address with PAGE_MASK to help GCC. With the patch: 00000024 <__flush_dcache_icache>: 24: 54 63 00 26 rlwinm r3,r3,0,0,19 28: 39 40 00 40 li r10,64 2c: 7c 69 1b 78 mr r9,r3 30: 7d 49 03 a6 mtctr r10 34: 7c 00 48 6c dcbst 0,r9 38: 39 29 00 20 addi r9,r9,32 3c: 7c 00 48 6c dcbst 0,r9 40: 39 29 00 20 addi r9,r9,32 44: 42 00 ff f0 bdnz 34 <__flush_dcache_icache+0x10> 48: 7c 00 04 ac hwsync 4c: 39 20 00 40 li r9,64 50: 7d 29 03 a6 mtctr r9 54: 7c 00 1f ac icbi 0,r3 58: 38 63 00 20 addi r3,r3,32 5c: 7c 00 1f ac icbi 0,r3 60: 38 63 00 20 addi r3,r3,32 64: 42 00 ff f0 bdnz 54 <__flush_dcache_icache+0x30> 68: 7c 00 04 ac hwsync 6c: 4c 00 01 2c isync 70: 4e 80 00 20 blr Without the patch: 00000024 <__flush_dcache_icache>: 24: 54 6a 00 34 rlwinm r10,r3,0,0,26 28: 39 23 10 1f addi r9,r3,4127 2c: 7d 2a 48 50 subf r9,r10,r9 30: 55 29 d9 7f rlwinm. r9,r9,27,5,31 34: 41 82 00 94 beq c8 <__flush_dcache_icache+0xa4> 38: 71 28 00 01 andi. r8,r9,1 3c: 38 c9 ff ff addi r6,r9,-1 40: 7d 48 53 78 mr r8,r10 44: 7d 27 4b 78 mr r7,r9 48: 40 82 00 6c bne b4 <__flush_dcache_icache+0x90> 4c: 54 e7 f8 7e rlwinm r7,r7,31,1,31 50: 7c e9 03 a6 mtctr r7 54: 7c 00 40 6c dcbst 0,r8 58: 39 08 00 20 addi r8,r8,32 5c: 7c 00 40 6c dcbst 0,r8 60: 39 08 00 20 addi r8,r8,32 64: 42 00 ff f0 bdnz 54 <__flush_dcache_icache+0x30> 68: 7c 00 04 ac hwsync 6c: 71 28 00 01 andi. r8,r9,1 70: 39 09 ff ff addi r8,r9,-1 74: 40 82 00 2c bne a0 <__flush_dcache_icache+0x7c> 78: 55 29 f8 7e rlwinm r9,r9,31,1,31 7c: 7d 29 03 a6 mtctr r9 80: 7c 00 57 ac icbi 0,r10 84: 39 4a 00 20 addi r10,r10,32 88: 7c 00 57 ac icbi 0,r10 8c: 39 4a 00 20 addi r10,r10,32 90: 42 00 ff f0 bdnz 80 <__flush_dcache_icache+0x5c> 94: 7c 00 04 ac hwsync 98: 4c 00 01 2c isync 9c: 4e 80 00 20 blr a0: 7c 00 57 ac icbi 0,r10 a4: 2c 08 00 00 cmpwi r8,0 a8: 39 4a 00 20 addi r10,r10,32 ac: 40 82 ff cc bne 78 <__flush_dcache_icache+0x54> b0: 4b ff ff e4 b 94 <__flush_dcache_icache+0x70> b4: 7c 00 50 6c dcbst 0,r10 b8: 2c 06 00 00 cmpwi r6,0 bc: 39 0a 00 20 addi r8,r10,32 c0: 40 82 ff 8c bne 4c <__flush_dcache_icache+0x28> c4: 4b ff ff a4 b 68 <__flush_dcache_icache+0x44> c8: 7c 00 04 ac hwsync cc: 7c 00 04 ac hwsync d0: 4c 00 01 2c isync d4: 4e 80 00 20 blr Signed-off-by: Christophe Leroy --- arch/powerpc/mm/cacheflush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/cacheflush.c b/arch/powerpc/mm/cacheflush.c index 2d92cb6bc423..abeef69ed4e4 100644 --- a/arch/powerpc/mm/cacheflush.c +++ b/arch/powerpc/mm/cacheflush.c @@ -145,7 +145,7 @@ EXPORT_SYMBOL(flush_dcache_page); */ static void __flush_dcache_icache(void *p) { - unsigned long addr = (unsigned long)p; + unsigned long addr = (unsigned long)p & PAGE_MASK; clean_dcache_range(addr, addr + PAGE_SIZE); -- 2.25.0