Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp132385iob; Tue, 17 May 2022 21:19:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9w+UiVIox7h14Qyla+e/YffuFoK/8UkFGecJIvc5musWu/9H4cBEnKw6D1f5hHwgFf1Bl X-Received: by 2002:a63:d054:0:b0:3f2:50df:e008 with SMTP id s20-20020a63d054000000b003f250dfe008mr15044557pgi.317.1652847570351; Tue, 17 May 2022 21:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652847570; cv=none; d=google.com; s=arc-20160816; b=Fav3HRKv4oQ0dV2nkXxbfXySfac2Pd+Xf5wxnURhephgMYwsJVmV7UG8fSYHPQGSXa AhPui5HvSUYmHHlLd36GFRKisIKS+Us1t9CqzRn0yoJgjyCBc1inI1H9lRaPqldaqHPg fpL/VvDklDDaAvYqdDIZ6NA2FHMjP+7Jcm0ytha+EsPd5memcqDVvsieWLgzOCLSv8o9 dN3dj5xz4cCmvrBPfShszUXtVomJgEwhpdo8bMFv9iZMIIvVcsU0qykJiiAzmLjxVF2m By8zL95nv/tqRPsh94+srkKaMDPmaWbLJoJj82AXWUs1dkTqfhAyZJwM1GuczvFjJGZG oMkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/BZj/qoQjjZ336X1A3Hi5aurAFkd0vAMUh1yTzDpCJE=; b=E6NeBcRO1TcI1qyN4ZSAhDHMGEifQOeP/yflSGxCVxfE/No9sbODUUomJyRRTZbBuH Y8mJWyXbPFGmI+bCz638GuoG8Lg/QDViRrdp6ETC8APxn8MGDAO8bFjKTedsEPy/VMkq vupiHC/luHGMZW3/M1p11zVTKyLwIoimZUQc3gC8XKtI4rxIicY+UMkIWyoNkx0w0QH/ 9JPm9pbmcjamMd81KTpdoFcNppRBsOpylDiWkZsfS8qtKTziqQ7rVLdTeQnT1za1jgYK rGiV4MoKgnSQkffNR5Q1XUeX2uqil/NjM7tSDefqvTc3f7q5qNSQZ387gsxTqz3NyAfD NIzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g12-20020a170902fe0c00b00161a06c1dc4si1396221plj.48.2022.05.17.21.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:19:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0A3431E3ED; Tue, 17 May 2022 20:46:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241275AbiEQH15 (ORCPT + 99 others); Tue, 17 May 2022 03:27:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240906AbiEQH13 (ORCPT ); Tue, 17 May 2022 03:27:29 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC3743EF4; Tue, 17 May 2022 00:27:28 -0700 (PDT) Received: from kwepemi100018.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L2SL90wTHzGpxl; Tue, 17 May 2022 15:24:33 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by kwepemi100018.china.huawei.com (7.221.188.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 17 May 2022 15:27:26 +0800 Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 17 May 2022 15:27:25 +0800 From: Tong Tiangen To: Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Palmer Dabbelt , Albert Ou , Arnd Bergmann CC: , , , , Tong Tiangen , , Guohanjun , Xie XiuQi Subject: [PATCH -next 2/2] arm64/mm: fix page table check compile error for CONFIG_PGTABLE_LEVELS=2 Date: Tue, 17 May 2022 07:45:48 +0000 Message-ID: <20220517074548.2227779-3-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517074548.2227779-1-tongtiangen@huawei.com> References: <20220517074548.2227779-1-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_PGTABLE_LEVELS=2 and CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y, then we trigger a compile error: error: implicit declaration of function 'pte_user_accessible_page' Move the definition of page table check helper out of branch CONFIG_PGTABLE_LEVELS > 2 Fixes: daf214c14dbe ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK") Signed-off-by: Tong Tiangen --- arch/arm64/include/asm/pgtable.h | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 4e61cde27f9f..979601528f1e 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -667,22 +667,6 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) #define pud_valid(pud) pte_valid(pud_pte(pud)) #define pud_user(pud) pte_user(pud_pte(pud)) -#ifdef CONFIG_PAGE_TABLE_CHECK -static inline bool pte_user_accessible_page(pte_t pte) -{ - return pte_present(pte) && (pte_user(pte) || pte_user_exec(pte)); -} - -static inline bool pmd_user_accessible_page(pmd_t pmd) -{ - return pmd_present(pmd) && (pmd_user(pmd) || pmd_user_exec(pmd)); -} - -static inline bool pud_user_accessible_page(pud_t pud) -{ - return pud_present(pud) && pud_user(pud); -} -#endif static inline void set_pud(pud_t *pudp, pud_t pud) { @@ -855,6 +839,23 @@ static inline int pgd_devmap(pgd_t pgd) } #endif +#ifdef CONFIG_PAGE_TABLE_CHECK +static inline bool pte_user_accessible_page(pte_t pte) +{ + return pte_present(pte) && (pte_user(pte) || pte_user_exec(pte)); +} + +static inline bool pmd_user_accessible_page(pmd_t pmd) +{ + return pmd_present(pmd) && (pmd_user(pmd) || pmd_user_exec(pmd)); +} + +static inline bool pud_user_accessible_page(pud_t pud) +{ + return pud_present(pud) && pud_user(pud); +} +#endif + /* * Atomic pte/pmd modifications. */ -- 2.25.1