Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp560709pxf; Thu, 8 Apr 2021 08:31:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycr+1ATkKe7dcWNW3OyZuDTuT23sPQEHCAGTsrMOXPxThE6J7XPZVoUFcAIzYP1B/66GYh X-Received: by 2002:a17:902:8c92:b029:e6:60ad:6924 with SMTP id t18-20020a1709028c92b02900e660ad6924mr8131912plo.16.1617895911396; Thu, 08 Apr 2021 08:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617895911; cv=none; d=google.com; s=arc-20160816; b=cGSNwkiDiLOYu8ewySmv13srrfsa5QjdV7pbj++emOvLzcAYI2nirati5QATHSgf81 CkyP3AmbIi1k88v8zZ1G0Wx9DTRAMGzKZdGc8s70lmwZ2xQm1AKuVxMxyT9wKScN2fK/ GMzn/A1a8jEptXdU7wHeqgX6H/3Miku0qObl8GCyPdSv+eT5eg+6BfP+ATxZjfunvvSy 3FDDYpDFYxmUtvm80fzQGP0sGgvl+VYMgW+x8hO7ZDk4LaZIz+s721SGDBwObRocSr4J 4EX17ThqZn82JS97aoUdF9Z+nruMs7QUYXjHNB0ZAm2Lp4vknSugR3cQlYfet168M+PO B7+w== 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=zSbZHg8Vut4WeTToy2cQpNL6gTbhy05jOUjNwc3bgT8=; b=rCY1u6UUO/lu6lz6SsrGtk89991p/iFBuJDCZrk6tFZA2m25TBmsENkU/ovgyxpws5 kYtR4ZhNevzl7mP/auyxtStJee/sGl70jDJSg2om7ytjPio97kaa3z2KwJl3RVIWg/XR YMQ12tuEo0PqDcT9NJwwFFI3fXhYW8Oo5LNAf+Ze+TQYsWcJI8yln0mJf2LrL9pnWXe4 3C+T0TF41Ytkr5lw63dV2C6suSuQ+HruqQWkoxfZ4Cr0U9BYQSQisz/mGqFaqzaKz04f WH53KbHgjk1qZGI8Ja8h96ODSB+hZxrH8eruPZ7ZpjeCHsie0mPPZJH0xpB+qqsetuuC o7Zg== 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 s8si9209026plg.360.2021.04.08.08.31.39; Thu, 08 Apr 2021 08:31:51 -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 S232118AbhDHPbF (ORCPT + 99 others); Thu, 8 Apr 2021 11:31:05 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:2238 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231995AbhDHPak (ORCPT ); Thu, 8 Apr 2021 11:30:40 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FGQFG0w2Cz9txf6; Thu, 8 Apr 2021 17:30: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 VKW1_CQBERBC; Thu, 8 Apr 2021 17:30: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 4FGQFF6sg6z9txf2; Thu, 8 Apr 2021 17:30:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 73A148B7D1; Thu, 8 Apr 2021 17:30: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 2_8msCpD5GaA; Thu, 8 Apr 2021 17:30:27 +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 3C8668B7D4; Thu, 8 Apr 2021 17:30:27 +0200 (CEST) Received: by po16121vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 1A1EF679BA; Thu, 8 Apr 2021 15:30:27 +0000 (UTC) Message-Id: <742b6360ae4f344a1c6ecfadcf3b6645f443fa7a.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 3/9] powerpc/mem: Remove address argument to flush_coherent_icache() 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:27 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org flush_coherent_icache() can use any valid address as mentionned by the comment. Use PAGE_OFFSET as base address. This allows removing the user access stuff. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/cacheflush.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/mm/cacheflush.c b/arch/powerpc/mm/cacheflush.c index 742d3e0fb12f..dc2d39da6f63 100644 --- a/arch/powerpc/mm/cacheflush.c +++ b/arch/powerpc/mm/cacheflush.c @@ -5,10 +5,9 @@ /** * flush_coherent_icache() - if a CPU has a coherent icache, flush it - * @addr: The base address to use (can be any valid address, the whole cache will be flushed) * Return true if the cache was flushed, false otherwise */ -static inline bool flush_coherent_icache(unsigned long addr) +static inline bool flush_coherent_icache(void) { /* * For a snooping icache, we still need a dummy icbi to purge all the @@ -18,9 +17,7 @@ static inline bool flush_coherent_icache(unsigned long addr) */ if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) { mb(); /* sync */ - allow_read_from_user((const void __user *)addr, L1_CACHE_BYTES); - icbi((void *)addr); - prevent_read_from_user((const void __user *)addr, L1_CACHE_BYTES); + icbi((void *)PAGE_OFFSET); mb(); /* sync */ isync(); return true; @@ -60,7 +57,7 @@ static void invalidate_icache_range(unsigned long start, unsigned long stop) */ void flush_icache_range(unsigned long start, unsigned long stop) { - if (flush_coherent_icache(start)) + if (flush_coherent_icache()) return; clean_dcache_range(start, stop); @@ -146,7 +143,7 @@ static void __flush_dcache_icache(void *p) { unsigned long addr = (unsigned long)p; - if (flush_coherent_icache(addr)) + if (flush_coherent_icache()) return; clean_dcache_range(addr, addr + PAGE_SIZE); @@ -200,7 +197,7 @@ void flush_dcache_icache_page(struct page *page) } else { unsigned long addr = page_to_pfn(page) << PAGE_SHIFT; - if (flush_coherent_icache(addr)) + if (flush_coherent_icache()) return; flush_dcache_icache_phys(addr); } -- 2.25.0