Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp561986pxf; Thu, 8 Apr 2021 08:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1WDdC0Ru0qGb70duEMYWh/nJQAet75UjNCzeHIlucb1qACksAPZkQq7QPW39JUAiiO8/0 X-Received: by 2002:a17:903:228d:b029:e7:1f01:bab0 with SMTP id b13-20020a170903228db02900e71f01bab0mr8094522plh.80.1617895993808; Thu, 08 Apr 2021 08:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617895993; cv=none; d=google.com; s=arc-20160816; b=P7KEuryikiOY1QAzWD0ESRYRzz0XzeuM2rw0FgkLBBUfgc3M6fO1OhvzPPhyykyi+l U+dVkZkUFm+23ALK0Z1RX3p4TvUVCvxYe0BYxhYcanj1M4xIZeFCuj80CzqLx6UCiQKI HlFD0GORXfvq4/TIrrM+/oFROxp2Sc1URNwWr2g4fvVnBha5nPFc5q9jTj23/Zl1LasE VPV4HufCQtMxdJGF7YaqFwzDLGbgDR3H6Th2n60dcwdKvIj9xtMh44Yc2EumeEfGTjM1 2veybfTmqwQc6Yczzm2JD0pvQSXQdWK0S0LzTVuLrjmPoPdVv2NKYyF2dRRp9GmVXJ0Q uAcQ== 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=dNe+bseDGtwHPL2AVN0VTf0Ws07op0F/FyR53d42WAI=; b=eLup2Y/Go58Me6nXJ06/j+fbp95d8EfyM4vr6hBBIOO9O5VMPq+spaKNv3HzZyrV8M iobjjxrFkcFXYfs0H2vMj7Fjcp1w7BhhsC55IqNgH+a1kRWvn4d6hWdYR8PIj+4Wc4ke voHq3HZbKsrrSd02O7Sw/Uw8oZGvwoKI8UDZVDYCECXpipvV9XqccN0XXpKbZNjxCS9D 5BPeUvcxao4m5hSVX8cTDKpS54JarZ2dm5B1vWPTEDcAiG2JntRygTPtohIhuXeddBom Fym1zbqrDG/337N3eKtvj+srjP+e/mb/D8bPBmd6NoA+v2r1mT85+bsO0uOYyv/syyyO B5Zw== 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 q6si27016731pfu.281.2021.04.08.08.33.00; Thu, 08 Apr 2021 08:33:13 -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 S232187AbhDHPbQ (ORCPT + 99 others); Thu, 8 Apr 2021 11:31:16 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:12410 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbhDHPan (ORCPT ); Thu, 8 Apr 2021 11:30:43 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4FGQFK0HFqz9txf9; Thu, 8 Apr 2021 17:30:29 +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 lXprFdbGGVn2; Thu, 8 Apr 2021 17:30:28 +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 4FGQFJ6gD9z9txf2; Thu, 8 Apr 2021 17:30:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8DE278B7D5; Thu, 8 Apr 2021 17:30:30 +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 JAdTgvHRqjBc; Thu, 8 Apr 2021 17:30:30 +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 4D2C08B7D1; Thu, 8 Apr 2021 17:30:30 +0200 (CEST) Received: by po16121vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 2B790679BA; Thu, 8 Apr 2021 15:30:30 +0000 (UTC) Message-Id: <79ed5d7914f497cd5fcd681ca2f4d50a91719455.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 6/9] powerpc/mem: flush_dcache_icache_phys() is for HIGHMEM pages only 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:30 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __flush_dcache_icache() is usable for non HIGHMEM pages on every platform. It is only for HIGHMEM pages that BOOKE needs kmap() and BOOK3S needs flush_dcache_icache_phys(). So make flush_dcache_icache_phys() dependent on CONFIG_HIGHMEM and call it only when it is a HIGHMEM page. We could make flush_dcache_icache_phys() available at all time, but as it is declared NOKPROBE_SYMBOL(), GCC doesn't optimise it out when it is not used. So define a stub for !CONFIG_HIGHMEM in order to remove the #ifdef in flush_dcache_icache_page() and use IS_ENABLED() instead. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/cacheflush.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/mm/cacheflush.c b/arch/powerpc/mm/cacheflush.c index 3268a3e55c3f..2d92cb6bc423 100644 --- a/arch/powerpc/mm/cacheflush.c +++ b/arch/powerpc/mm/cacheflush.c @@ -76,7 +76,7 @@ void flush_icache_range(unsigned long start, unsigned long stop) } EXPORT_SYMBOL(flush_icache_range); -#if !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC64) +#ifdef CONFIG_HIGHMEM /** * flush_dcache_icache_phys() - Flush a page by it's physical address * @physaddr: the physical address of the page @@ -115,7 +115,11 @@ static void flush_dcache_icache_phys(unsigned long physaddr) : "ctr", "memory"); } NOKPROBE_SYMBOL(flush_dcache_icache_phys) -#endif // !defined(CONFIG_PPC_8xx) && !defined(CONFIG_PPC64) +#else +static void flush_dcache_icache_phys(unsigned long physaddr) +{ +} +#endif /* * This is called when a page has been modified by the kernel. @@ -185,18 +189,15 @@ void flush_dcache_icache_page(struct page *page) if (PageCompound(page)) return flush_dcache_icache_hugepage(page); -#if defined(CONFIG_PPC_8xx) || defined(CONFIG_PPC64) - /* On 8xx there is no need to kmap since highmem is not supported */ - __flush_dcache_icache(page_address(page)); -#else - if (IS_ENABLED(CONFIG_BOOKE) || sizeof(phys_addr_t) > sizeof(void *)) { + if (!PageHighMem(page)) { + __flush_dcache_icache(lowmem_page_address(page)); + } else if (IS_ENABLED(CONFIG_BOOKE) || sizeof(phys_addr_t) > sizeof(void *)) { void *start = kmap_atomic(page); __flush_dcache_icache(start); kunmap_atomic(start); } else { flush_dcache_icache_phys(page_to_phys(page)); } -#endif } EXPORT_SYMBOL(flush_dcache_icache_page); -- 2.25.0