Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp556123pxf; Thu, 8 Apr 2021 08:26:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWSFQp1Ckr50q4AGYfHPiDMHpjSn7h3/ODr7bzgFcpUqSX32BSsT3Zs/tCvMtOyggK4USV X-Received: by 2002:a17:902:6a87:b029:e6:6a3d:29e8 with SMTP id n7-20020a1709026a87b02900e66a3d29e8mr8111276plk.10.1617895607750; Thu, 08 Apr 2021 08:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617895607; cv=none; d=google.com; s=arc-20160816; b=CPGqOkwQDMyJUrdhNlyJvqwj4Yi6LTF0b9l1dlDciEcBGiLcxfuNGrtEFej5Smh5T8 DR4K7iOAch/vpFQVDtipTnVp85frGoNFBH3ne/z8yDE+ooakC/VXo25IOngu3K8Kqvpg cLwKQnDScg+BO/27R6SiRYyjvO/rpcISKnh4+F6SzAevJOPfF2vKpv0My8RVOa5XM1ME 4fqC9+0Lc9oABcusel3D/ztDwfy/uXoV6OBGsKVfPNmPImZJG4iZaql4c9E7GFNn4mel FSakb9wwx4C0bJdE9m5fPuZQtBHyMrb0o3CgWN2Dp5hy1bJ72RhyxWc0jXPMSIXb9s6r RWdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=A7iLU17rsu0F3JSbX0VGAwFdU2GtEp1XnYzvsj1Q+ms=; b=jr+JNzd+2PqeZuJ3HAIILHXT1Zn2a2nibVaGKEGr1nJzmYLisTHOMnT/LNBYBx68n0 RBd5h5RNn14EeDEnPru7K0jC2+zitrr0bi+Xze0GpWL1XeWjcsCik8ezGgrByLztExaQ ijGbbo/bvIm/oL/YU34V827qpirRUTbt80bqSEB/S3JGjPUQkUH4z/x7UXGypvMTNd2X +xQsKvAPxt2iWxZotButA4ZBbJIp+cOKWowffgdcj2328pRE+Yd7cw/Vben7YAtVxlXN +AsX+YSZig9EAuPq3MfQ8myvCfgtnCeMc7MerBKyEMXf7LIrJFhckXNoRjObhOBErF/H kMYg== 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 d18si27434996plg.180.2021.04.08.08.26.34; Thu, 08 Apr 2021 08:26:47 -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 S232082AbhDHPZx (ORCPT + 99 others); Thu, 8 Apr 2021 11:25:53 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:10345 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231785AbhDHPZr (ORCPT ); Thu, 8 Apr 2021 11:25:47 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FGQ7c23dGz9txdj; Thu, 8 Apr 2021 17:25:32 +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 zsF4pkh7DYuh; Thu, 8 Apr 2021 17:25:32 +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 4FGQ7c0v8Xz9txdh; Thu, 8 Apr 2021 17:25:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B4BD68B7D1; Thu, 8 Apr 2021 17:25:33 +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 qTLohSVjcwj3; Thu, 8 Apr 2021 17:25:33 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 120BE8B7D0; Thu, 8 Apr 2021 17:25:33 +0200 (CEST) Subject: Re: [PATCH v1 2/8] powerpc/mem: Remove address argument to flush_coherent_icache() To: "Aneesh Kumar K.V" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <311235752428dacbee81728767aacc2bf4222384.1617816138.git.christophe.leroy@csgroup.eu> <8cbdcfc4446154bd3323cc68827f114aa9bbc5e7.1617816138.git.christophe.leroy@csgroup.eu> <87k0pdb1n6.fsf@linux.ibm.com> From: Christophe Leroy Message-ID: <8fdbc753-4ed6-ee3f-3317-f0ea5b95bbc9@csgroup.eu> Date: Thu, 8 Apr 2021 17:25:20 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <87k0pdb1n6.fsf@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 08/04/2021 à 10:50, Aneesh Kumar K.V a écrit : > Christophe Leroy writes: > >> 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/mem.c | 13 +++++-------- >> 1 file changed, 5 insertions(+), 8 deletions(-) >> >> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c >> index ce6c81ce4362..19f807b87697 100644 >> --- a/arch/powerpc/mm/mem.c >> +++ b/arch/powerpc/mm/mem.c >> @@ -342,10 +342,9 @@ void free_initmem(void) >> >> /** >> * 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 >> @@ -355,9 +354,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; > > do we need that followup sync? Usermanual suggest sync; icbi(any address); > isync sequence. I don't know. The original implementation is here: https://github.com/linuxppc/linux/commit/0ce636700 Christophe