From patchwork Fri May 14 11:08:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12257513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84DA4C433ED for ; Fri, 14 May 2021 11:10:43 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 487936127A for ; Fri, 14 May 2021 11:10:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 487936127A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Date:Cc:To:Subject:From:Message-Id:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Yi3kr/KlXQCi0GyGwDKIMdaYvyl5Kgm29zqL5nF/jZI=; b=Pha9oxmHr4NxB52g8sZTLgZ6dI rJYfWHfqJSIY/M0TeYIIsdgKU68W+tispcFtC/U6OdnZGR/mEhPTc8eWkU9BWVdL3t0vll4uDHPjG I17T7yjDEh/PJCxPzdFpZHzdt7tk++pxSpxkihLkPSSNvG6Q+p8HK7azIQd2xIUqe/vYZ1lsNm/ro eGiEGL86X46B3vb2DAzhelydPQ6abhAFHoo7QGVhyizpE2j0D02Rt6QYm7jMnC+3J+iDif1HMf/ue iwIlVSFK61oJgPKYtAwwixzh4fKvHnb2hoBZiKiU+/qVjXv5jhfmucY+l9FU+eWIIhrIUhJg3dPHT uFi8ALUQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lhVgo-007rN6-0a; Fri, 14 May 2021 11:09:06 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhVgl-007rMg-9q for linux-arm-kernel@desiato.infradead.org; Fri, 14 May 2021 11:09:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Date:Cc:To:Subject:From:Message-Id: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=F858tTvKFsTtnnfJoijDKYnuDFkZB/0J1YA5oeqy/3w=; b=bOzk3uPY9wz8clf5F9HBwn7yqB 4Obj89wqurgrCLT9Ib7wVGPj4S/Hijs3vsprTG1cerEGC7FrT+94LBF/HsM4craW21tj+ejmnRy07 OcSiaR31q3JYth7DlQ7y9Z43yDXAONEgkmj70bwMqnD4FE+bViYN6gUSdW3DJJue91+hjZ2Jtq7dZ wWRvsrWMHhFBP1Q54oVVVmA03zrCR5+WUcqhE92uE8bYIH35Llgspibd/abgDEB3LJK/0wk+eNVPL MlvAGFyBWhuZTJZsbDyxlWj9T0QTMu9d0/K3F5EqweTd8hDAujedgSkgaUZ5EV14/Gaf7M6Zk/QWo ZA1M2rgw==; Received: from pegase2.c-s.fr ([93.17.235.10]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lhVgh-00BvXf-UE for linux-arm-kernel@lists.infradead.org; Fri, 14 May 2021 11:09:01 +0000 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4FhQkt4qvLz9sbS; Fri, 14 May 2021 13:08:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wy2Elb8z9V1b; Fri, 14 May 2021 13:08:54 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4FhQkt3mpCz9sZb; Fri, 14 May 2021 13:08:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 64BFC8B7F8; Fri, 14 May 2021 13:08:54 +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 lWsu5EXndett; Fri, 14 May 2021 13:08:54 +0200 (CEST) Received: from po15610vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 28EEF8B7F6; Fri, 14 May 2021 13:08:54 +0200 (CEST) Received: by po15610vm.idsi0.si.c-s.fr (Postfix, from userid 0) id F3FB464956; Fri, 14 May 2021 11:08:53 +0000 (UTC) Message-Id: <73ec95f40cafbbb69bdfb43a7f53876fd845b0ce.1620990479.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH] arm64: Define only {pud/pmd}_{set/clear}_huge when usefull To: Andrew Morton , Nicholas Piggin , Mike Kravetz , Mike Rapoport , naresh.kamboju@linaro.org Cc: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, Date: Fri, 14 May 2021 11:08:53 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210514_040900_149346_E4E38ADD X-CRM114-Status: UNSURE ( 8.02 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When PUD and/or PMD are folded, those functions are useless and we now have a stub in linux/pgtable.h Reported-by: Naresh Kamboju Signed-off-by: Christophe Leroy --- arch/arm64/mm/mmu.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 6dd9369e3ea0..98af085afe90 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1337,6 +1337,7 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) return dt_virt; } +#if CONFIG_PGTABLE_LEVELS > 3 int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) { pud_t new_pud = pfn_pud(__phys_to_pfn(phys), mk_pud_sect_prot(prot)); @@ -1351,6 +1352,16 @@ int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) return 1; } +int pud_clear_huge(pud_t *pudp) +{ + if (!pud_sect(READ_ONCE(*pudp))) + return 0; + pud_clear(pudp); + return 1; +} +#endif + +#if CONFIG_PGTABLE_LEVELS > 2 int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) { pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), mk_pmd_sect_prot(prot)); @@ -1365,14 +1376,6 @@ int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) return 1; } -int pud_clear_huge(pud_t *pudp) -{ - if (!pud_sect(READ_ONCE(*pudp))) - return 0; - pud_clear(pudp); - return 1; -} - int pmd_clear_huge(pmd_t *pmdp) { if (!pmd_sect(READ_ONCE(*pmdp))) @@ -1380,6 +1383,7 @@ int pmd_clear_huge(pmd_t *pmdp) pmd_clear(pmdp); return 1; } +#endif int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr) {