From patchwork Sat Jul 13 07:08:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13732359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3940C3DA42 for ; Sat, 13 Jul 2024 07:09:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 794046B0098; Sat, 13 Jul 2024 03:09:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71BEB6B0099; Sat, 13 Jul 2024 03:09:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E37F6B009A; Sat, 13 Jul 2024 03:09:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3C19B6B0098 for ; Sat, 13 Jul 2024 03:09:21 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EAD7FC0E14 for ; Sat, 13 Jul 2024 07:09:20 +0000 (UTC) X-FDA: 82333853280.05.C67F208 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf04.hostedemail.com (Postfix) with ESMTP id C58704001C for ; Sat, 13 Jul 2024 07:09:18 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720854532; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0jM7X5TZsVn0ONkhINl6fEm19w4e9X/koSgxpMBLVAc=; b=h/g8ttqm5pI4PCcxAJUxjW7hB3nDbuiNx4mgGIQGsJ8fRxGBCWEYy/jt2nwNlJUM/SCPuX Ou+WYObOfuNqp2pL+PweUHatQNs1JF8KqiorE1DeC1vzxYqoSFUzH/5Tycee1NgpYVZwoG 7RYpYeNj66EmSMheW9f5hxHZz3nfSB0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720854532; a=rsa-sha256; cv=none; b=HMLcNTUbhve7fI64xio7hUmLGpxrWrLVljlr3YDTfTkBbCHiXjjfocZUvxuRBt03DrlzvQ rTI3YV3gTGJJ4LEA3j+TNSHeefWDDaaFB0FiqN856893sRW0cFWQlKoIzAViWsaOcxi2ap lbdavi5z4oQbgKrvKgOlpAXDrP1q3V0= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WLfhZ1Ccnz9sSb; Sat, 13 Jul 2024 09:09:02 +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 rBAPNnN2erdv; Sat, 13 Jul 2024 09:09:02 +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 4WLfhY68WVz9sSS; Sat, 13 Jul 2024 09:09:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BCB5C8B764; Sat, 13 Jul 2024 09:09:01 +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 U1NlTXZ3sw-T; Sat, 13 Jul 2024 09:09:01 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.195]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B6F798B76C; Sat, 13 Jul 2024 09:09:00 +0200 (CEST) From: Christophe Leroy To: Andrew Morton Cc: Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Peter Xu Subject: [PATCH v3 5/5] mm: Add p{g/4}d_leaf() in asm-generic/pgtable-nop{4/u}d.h Date: Sat, 13 Jul 2024 09:08:27 +0200 Message-ID: <7b6f39f3cc9823e0a058b27f50ad4f47b2e10979.1720854135.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720854504; l=2504; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=9cGeujZtX2c/zEf05hq/l7o1WBt5GJFv+9LPfky90p8=; b=MN2/woF7LqGhnWnq57H61zGqJsMcmtZviZwr/m6VoCoVv5XepEx+34tqeLFna5lL+rtgkoHC6 84JnWQ04MY8AFTasVOBH1guX6oXN81IRpiabqc6NIYejAVLsU1O2E4y X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Stat-Signature: h7o1ui93w9qp9dykn7thnsspfpbtyuno X-Rspam-User: X-Rspamd-Queue-Id: C58704001C X-Rspamd-Server: rspam02 X-HE-Tag: 1720854558-19080 X-HE-Meta: U2FsdGVkX1/GFzHa6uH983jk9MZzI9R/qDIQxXTaVylHctKNixJXz1pVdtIXSAFcQEdZ1mY11mfjVyptjhN+l4nht5kYAk9fqsZFhSvid2G2mZr4prkA6fspF05lRgUbgq2BpK0Ug3VlkrS2jQIkHjZAtUA8l3gn9nsIZ6pEUeFOboPzGod3T1w+nUea1yrYIjO54XK848tcG1TvhP0/DTS/DcuGnk8ZPBIJ/bPc32/q5BFHapCJ0reD/M0ao1/vjHd/jzPgaTmOod/bLBmxeTqK0d7J927VdG4Zpy7ytkGzxbhpwGr4UDzK4KNCjxYxCGwuCWhqNCm9g+pwTK2Q7aQfiecWhlp8MmF+zPyKmBvMp6ZkAWYbk9oulTXj4UuCT1K46cZmSRAO4mvHxD+atTLdYdICqLZ6kYKkXPoivBGKvmhyP41ZvSww4yVFex/uoXNPIPimLf9FMmqak7STFdP2WIKF/NxLIPCr+fAHecQUrDClxUlEYCi2J4UjVxRlTOee3KVsFkL8IEeYw5ApyGO+ZFk8czHo2pOEELtDKREy2m7vGNq+CSMk27ekM7WYNLP49jdWOGhws8paUNTsECLZqhxgi2tRP4yQxYSkfCB2INViuSbRUf3UQisBbrXflD29oVzwAtHW/NB3swwzqw3OHQZC/Hn1fAhD38O2xSRcYCJeFzXKjdqS2AGfqecByoZULfdvqwom8bD3GI6GU0dFDtzqJavlm8l9HfechmlV4bpYmPqQBlqK7sno3Eun4iSUvd8on5qbNpVa4/W9sy5XSUv0MKvcyBw5l34s13uXkb13iyI8aRqdHQj0QXyJ2zndNEF2Uqf7U+ceBA1LuCwDAmY8uK6TqVADtkFn7kdckE87QO2vc2yAN7T8kLh9gvU9X9CpDohn6xN33l986ayxg8Z5udjNlh9hlupDhdTeyXfReoiZnDFOeCzMdo5RHxd7gTBdTyNKk5N8JUR jDlzR5qM /RugNNfnqbyCLCG87RBMAdjE8VJoe4GkNVoaL8zKuLuQ8sUaOav76cgBCV2oWQANnk5DWldIN0I/TXCW+NrHQ5K0hbh4wIRyysA7sSDC2FovDsav9s1o0EOLTq6SXNxY7hFuclPxg/thNsSTp1gcvqQHn72oAWFLcp7VvrcyUWBfYwu9K1jCMU96mjtiiMj4ySYCeGr66IpN3yaA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Commit 2c8a81dc0cc5 ("riscv/mm: fix two page table check related issues") added pud_leaf() in include/asm-generic/pgtable-nopmd.h Do the same for p4d_leaf() and pgd_leaf() to avoid getting them erroneously defined by architectures that do not implement the related page level. Signed-off-by: Christophe Leroy Reviewed-by: Peter Xu --- v2: Added pXd_leaf macro as well in asm-generic/pgtable-nopXd.h to cohabit with the fallback --- include/asm-generic/pgtable-nop4d.h | 2 ++ include/asm-generic/pgtable-nopmd.h | 1 + include/asm-generic/pgtable-nopud.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/include/asm-generic/pgtable-nop4d.h b/include/asm-generic/pgtable-nop4d.h index 03b7dae47dd4..ed7ba008469f 100644 --- a/include/asm-generic/pgtable-nop4d.h +++ b/include/asm-generic/pgtable-nop4d.h @@ -21,6 +21,8 @@ typedef struct { pgd_t pgd; } p4d_t; static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_leaf(pgd_t pgd) { return 0; } +#define pgd_leaf pgd_leaf static inline void pgd_clear(pgd_t *pgd) { } #define p4d_ERROR(p4d) (pgd_ERROR((p4d).pgd)) diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index b01349a312fa..e178ace2e23e 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -31,6 +31,7 @@ static inline int pud_none(pud_t pud) { return 0; } static inline int pud_bad(pud_t pud) { return 0; } static inline int pud_present(pud_t pud) { return 1; } static inline int pud_leaf(pud_t pud) { return 0; } +#define pud_leaf pud_leaf static inline void pud_clear(pud_t *pud) { } #define pmd_ERROR(pmd) (pud_ERROR((pmd).pud)) diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index eb70c6d7ceff..655dfebea91c 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h @@ -28,6 +28,8 @@ typedef struct { p4d_t p4d; } pud_t; static inline int p4d_none(p4d_t p4d) { return 0; } static inline int p4d_bad(p4d_t p4d) { return 0; } static inline int p4d_present(p4d_t p4d) { return 1; } +static inline int p4d_leaf(p4d_t p4d) { return 0; } +#define p4d_leaf p4d_leaf static inline void p4d_clear(p4d_t *p4d) { } #define pud_ERROR(pud) (p4d_ERROR((pud).p4d))