From patchwork Thu Oct 3 15:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13821163 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 44003CF34B0 for ; Thu, 3 Oct 2024 15:29:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BAAE86B0476; Thu, 3 Oct 2024 11:29:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B32F96B0478; Thu, 3 Oct 2024 11:29:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 986866B0477; Thu, 3 Oct 2024 11:29:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 77B9A6B0400 for ; Thu, 3 Oct 2024 11:29:26 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2C646C1700 for ; Thu, 3 Oct 2024 15:29:26 +0000 (UTC) X-FDA: 82632675132.10.98A4E57 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf24.hostedemail.com (Postfix) with ESMTP id 7F608180010 for ; Thu, 3 Oct 2024 15:29:24 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf24.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727969269; a=rsa-sha256; cv=none; b=riFQc+5w1jPxVjWmeIOqoMjfcRF7XVPtaHvY/y5QwHUKzzaicVf6sOtw4wff3Rlk58Jtvk ycFKhYBz9L9OqlDHOpNqfZl9eC4HRHaUSqoO8ecMrVpltuZ4+DRsmAnBNRD1PDRsaYY3hN a9dryguhlIs1VlY8lJr9vg6VpehdqH4= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf24.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727969269; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dOaH9Tm+8hlINETgYKYKnAhOS1xwlxi07qA8yD5Vww8=; b=on52818BTEkG6iUwL52z23WFH2i1jRXjz2qOdhf7vZfnwZGEbb7ZKWKrhBqPLE8QLixuT4 I+N1hAB7y0CfTRIoVa70xOCoZ4TKeD/fGWhlsY8O/KInkSB690QdWJaICH94KDEPxlCLiP p6onPFxcCZA16Bi1Wf6jkqRzRB/gsJM= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 245E014BF; Thu, 3 Oct 2024 08:29:53 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AF29F3F640; Thu, 3 Oct 2024 08:29:20 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v3 1/2] drm: Fix fault format Date: Thu, 3 Oct 2024 16:29:09 +0100 Message-Id: <20241003152910.3287259-2-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241003152910.3287259-1-vincenzo.frascino@arm.com> References: <20241003152910.3287259-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7F608180010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: hfefm5cu8x5ssunpkun3wizz7sbub5sz X-HE-Tag: 1727969364-474317 X-HE-Meta: U2FsdGVkX1/f3bd70WtfcgYyvQ1hUrW1BlhUSHsmjAOFmzj9bfYBdP1GdGRsNQKrjuePfVqbbxyaTTD47IMPqAtPqOdS4mQg8xi5Nj1WfDF7zYclQku9k9GNvY1jZMpcgi7S2Lo6kNF8abd/Dy7x9EWBg8dNV6Doj5TzJdV2k7Jt9lEp28ovks2j0WLUBI4dPV+5s0ae54/VP9sWJT1czDrhFxgm27QbbPgzFk7KlzXzY4FsYnWSK3nz/7N5n1OxJJV0MRBB/W18a+NJ6sITei/Aae3ao961IEZe6Ua67B3ePiFdKfMq8WTDerdWLt0VSc8SQcFgGfwps8oZJS8bZYOOuoEW5wYajPRaRrBuncjBAGPCgPVAz6TrX7AYOUlVplyvFLWbp1H9aiHuZQwjPf5k74kTbT4P8vPo1b71yOHSeLDO4sXBiHTOkkZItCsS8BtKlyrTugNU8WWwM1lmUXpLPwd98woGlhMUP5DO5oX/OjL07JH73nXAm/2VGf6YLlr44GM85nz3GhmwQGJPhhIzsInpJT/UNj+LelzFzldRPiIq32RAh0wvvHARJ8ZMTEFU59Kx+lHu9DX5pUj3oLkqUgjo/mEbPrtsQngPp8UtzHMPsvSC0nuPnVwVLpjKZAlJpJ/mPrEZ6ie2ZkFkujYl2w4A9v0YS4AJln//KFMRNS7SSjCmxCMnykNvgpDVCqKNKIJ593lVzBesfLeQWwLB+J7Kbbo82q/bTnRK+h6r9JXfWELUT4x3E2zzq3bd6POH0u1oqsg0MWdB5iUsmReFOsLpRz5jzERv5/WtA2HjNJNmG1XOnK8c0pUyvA2Zxpj6tf1X4krUGGAIjlrB2IPHHn74qUrpgoKewrDTMZ1SJMs8O6zxVT7yX5TadAKB+s/M8hbu8AQOncOMY24ylylocoQJ7+wT9nLEiWOVRCMtB+e1GWEjTpzH3z5yKVccIl5STDrorG6CldwHkrr AsJtN5lO TuxZnfyBCKd9EzTBXTiHtyuQdAhRv4W8B2DnyqkkpzE1P5V16ZmNi1ufSVPcMlbQpMCKFXEBLIL7MZHYXXFA1NDuiIk88roMZR4aJJHvsPuoqz3q7mwvl4aMchOi+hW29aPbjQ5xqWJ5ui2lnVxjDlweMsfHrUQB/qZaCeKwREF5zydLyR1QFrcZTW15TbMcngz8WTpHsnp4ey3leqh562cHJ7wiUS565aCnYnE8GcA3Xv0z0Zxl+/7i+TNy+G63j6KbDzpejyx3a4A3E3218tSYv4xJMyPb4UT8c2brpraiXU3EZlSG6/3Pv22xQtOSTcHYRboGSIqn/dP0= 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: Fault is of type u32 and PAGE_MASK is type agnostic, hence the correct format for address should be %x not %lx otherwise: drivers/gpu/drm/i915/gt/intel_gt_print.h:29:36: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘u32’ {aka ‘unsigned int’} [-Werror=format=] 29 | drm_dbg(&(_gt)->i915->drm, "GT%u: " _fmt, (_gt)->info.id, | ^~~~~~~~ include/drm/drm_print.h:424:39: note: in definition of macro ‘drm_dev_dbg’ 424 | __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__) | ^~~ include/drm/drm_print.h:524:33: note: in expansion of macro ‘drm_dbg_driver’ 524 | #define drm_dbg(drm, fmt, ...) drm_dbg_driver(drm, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~~~ linux/drivers/gpu/drm/i915/gt/intel_gt_print.h:29:9: note: in expansion of macro ‘drm_dbg’ 29 | drm_dbg(&(_gt)->i915->drm, "GT%u: " _fmt, (_gt)->info.id, | ^~~~~~~ drivers/gpu/drm/i915/gt/intel_gt.c:310:25: note: in expansion of macro ‘gt_dbg’ 310 | gt_dbg(gt, "Unexpected fault\n" | ^~~~~~ Fix address format. Cc: Arnd Bergmann Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Suggested-by: Christophe Leroy Signed-off-by: Vincenzo Frascino --- drivers/gpu/drm/i915/gt/intel_gt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c index a6c69a706fd7..352ef5e1c615 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt.c +++ b/drivers/gpu/drm/i915/gt/intel_gt.c @@ -308,7 +308,7 @@ static void gen6_check_faults(struct intel_gt *gt) fault = GEN6_RING_FAULT_REG_READ(engine); if (fault & RING_FAULT_VALID) { gt_dbg(gt, "Unexpected fault\n" - "\tAddr: 0x%08lx\n" + "\tAddr: 0x%08x\n" "\tAddress space: %s\n" "\tSource ID: %d\n" "\tType: %d\n", From patchwork Thu Oct 3 15:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincenzo Frascino X-Patchwork-Id: 13821164 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 D649FCF34B0 for ; Thu, 3 Oct 2024 15:29:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 652096B0477; Thu, 3 Oct 2024 11:29:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 602136B0478; Thu, 3 Oct 2024 11:29:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A2C36B0479; Thu, 3 Oct 2024 11:29:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 28B676B0477 for ; Thu, 3 Oct 2024 11:29:30 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9B7E11C758A for ; Thu, 3 Oct 2024 15:29:29 +0000 (UTC) X-FDA: 82632675258.19.8C4B355 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf05.hostedemail.com (Postfix) with ESMTP id C97C3100010 for ; Thu, 3 Oct 2024 15:29:27 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf05.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727969345; a=rsa-sha256; cv=none; b=GXw99jIAL5yDTCeqxN3UDm4vAVkxMAq/rxSKnqHeaZR+ZlufAgzDytF9D6HwY/m4EO/MIl Vk1UFMeD+O07g2MFoM3PMqDrQAZ9D2raDw6Ch70S1CMqDHseXt2iezd+ST32L90vZDkB7D ho9OxPazZ/LmfbKAZYWUoEanjzNvYi0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf05.hostedemail.com: domain of vincenzo.frascino@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=vincenzo.frascino@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727969345; 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=MQjUkTvk5L93yTMeMi1uN/6ddsYvDh/+Zb84DrPYg6s=; b=QW231WZUW5siWLsGF9xEbv7s+PlwTIlgDloauE2IMOxZLHF2ddypXFH12k3g3TENcEzNQh kyPh87B+Q9YOmedIQeezkb5g4YUMdVNzKJAi+VqPLc3gdGzd6VDaK4BI5jlJ1LhN6lJQsY /yD7UwTPBcLztiWG4wR++AgOnxz2p9k= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 72F3F497; Thu, 3 Oct 2024 08:29:56 -0700 (PDT) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD6053F640; Thu, 3 Oct 2024 08:29:23 -0700 (PDT) From: Vincenzo Frascino To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Vincenzo Frascino , Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH v3 2/2] vdso: Introduce vdso/page.h Date: Thu, 3 Oct 2024 16:29:10 +0100 Message-Id: <20241003152910.3287259-3-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241003152910.3287259-1-vincenzo.frascino@arm.com> References: <20241003152910.3287259-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: qxbz3bog1wm6bjju71rioh1b3g6qgkni X-Rspamd-Queue-Id: C97C3100010 X-Rspamd-Server: rspam02 X-HE-Tag: 1727969367-480447 X-HE-Meta: U2FsdGVkX19XpRnCCSnMYv6iP3eWoW9plDOek3I2pO2q0pf5H0px9xQSphHEmwT9L+xRX/OqcyX4INteCrdpHMO8Fn5Sc0xVfEuZVFSZ6x/p7UiqIUxBUVrV63NOc7mSnyoNT36O10Wc1Dg1HMTMhVjPU5s6JmlYsDzF2KrZg/35ceTLms9NMP+lOM99TiKdtW5GEKBCvH5HNA2YksGhmVNROp2fZNpaCFA7j/XLPkLlUWWoICT4O8/zt5Q9+GtVioWDdGB2nSEx8aye1myCKhkimANCKvG2JcUGWDJr7z0YqV9ibcT2F5YVIO9rrEO1fXob6TnPWfdhLR3i3PUSujIpiEPfxWOtpSp9HP26hxIzv+U5RS91YoCknAN+jXHQa1X2bGvCLLnRZD28AQj6eVZx6UEhGWB97f/77PKCe9t11g3GMu+Y293QEtX49J33re/h1bJ5uGf8bDFpbf9MLDgirB0X0gZotzBko982XVaS1KEwZV35j6uuIlIWlhswVd/6aZ7l91a+WgERTe1vH4xwR3VHjTt1y1/kJK5yu/s2IBGQh+1oEem/lyuVMNVjD6m0sF5xlG8HdWBprsdIvrQOC0K07mAlO/DKpuhEApd2aZejel76UU4hCEBvAWVcXTZOQp8bQUgGfGTNwuLkUZimrMJq89Genf3dwPyqsqHrQAvgbwByG183Bt5rImxaFof+VQ7zRE/fpczKASODyPT0FlNqmKBKYJwjAzZWqlHVdEv6gMYJYvoMoZNuQwESywWYJX+VeT+fCH+ZHkuCIUO2jV69ifGswc9Ievu5nnKjZ4llZ7CXfUA8fm2+GzZgoHJj8YSW+nCCs656T7sW8jI+Nqd1pxcb+3e+2XkNWjNoLHOk4OVGaQmpzjhWe7gEJrkynMc6VN8M2WvoAqjSCj9lDvlIU39e3XHubHwC3X56ovMvXjVedLGXPFXNENDyHGCbRRqGyMWmpu9SkLv uRAyBvcK S4x9ijdSXzjB/jx4CEE8kCNUQkVfPycfmEr7L2nQZXcqYXjRENmogWxD/5mCwYbojrf+43uzYpg3I99HpQDEmLqT6FjtJ5aXoAQoBCR3f0YjZlk85qz2AK1Itjns4XsuFtR/oDc7CH8bWgd7dXo9JYfM5mt4icm+fkILbaybbNExKlY8DZe9BjaDcbexTtTI3s4tz5jCWEnAaOOQWuL5wufdBTlr8Mu2cOEK9uE2GzZRzVGE= 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: The VDSO implementation includes headers from outside of the vdso/ namespace. Introduce vdso/page.h to make sure that the generic library uses only the allowed namespace. Note: on a 32-bit architecture UL is an unsigned 32 bit long. Hence when it supports 64-bit phys_addr_t we might end up in situation in which the top 32 bit are cleared. To prevent this issue this patch provides separate macros for PAGE_MASK. Cc: Arnd Bergmann Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Jason A. Donenfeld Signed-off-by: Vincenzo Frascino Acked-by: Geert Uytterhoeven # m68k Reviewed-by: Arnd Bergmann --- arch/alpha/include/asm/page.h | 6 +----- arch/arc/include/uapi/asm/page.h | 7 +++---- arch/arm/include/asm/page.h | 5 +---- arch/arm64/include/asm/page-def.h | 5 +---- arch/csky/include/asm/page.h | 8 ++------ arch/hexagon/include/asm/page.h | 4 +--- arch/loongarch/include/asm/page.h | 7 +------ arch/m68k/include/asm/page.h | 6 ++---- arch/microblaze/include/asm/page.h | 5 +---- arch/mips/include/asm/page.h | 7 +------ arch/nios2/include/asm/page.h | 7 +------ arch/openrisc/include/asm/page.h | 11 +---------- arch/parisc/include/asm/page.h | 4 +--- arch/powerpc/include/asm/page.h | 10 +--------- arch/riscv/include/asm/page.h | 4 +--- arch/s390/include/asm/page.h | 4 +--- arch/sh/include/asm/page.h | 6 ++---- arch/sparc/include/asm/page_32.h | 4 +--- arch/sparc/include/asm/page_64.h | 4 +--- arch/um/include/asm/page.h | 5 +---- arch/x86/include/asm/page_types.h | 5 +---- arch/xtensa/include/asm/page.h | 8 +------- include/vdso/page.h | 23 +++++++++++++++++++++++ 23 files changed, 50 insertions(+), 105 deletions(-) create mode 100644 include/vdso/page.h diff --git a/arch/alpha/include/asm/page.h b/arch/alpha/include/asm/page.h index 70419e6be1a3..261af54fd601 100644 --- a/arch/alpha/include/asm/page.h +++ b/arch/alpha/include/asm/page.h @@ -4,11 +4,7 @@ #include #include - -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/arc/include/uapi/asm/page.h b/arch/arc/include/uapi/asm/page.h index 7fd9e741b527..4606a326af5c 100644 --- a/arch/arc/include/uapi/asm/page.h +++ b/arch/arc/include/uapi/asm/page.h @@ -14,7 +14,7 @@ /* PAGE_SHIFT determines the page size */ #ifdef __KERNEL__ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT +#include #else /* * Default 8k @@ -24,11 +24,10 @@ * not available */ #define PAGE_SHIFT 13 +#define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */ +#define PAGE_MASK (~(PAGE_SIZE-1)) #endif -#define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */ #define PAGE_OFFSET _AC(0x80000000, UL) /* Kernel starts at 2G onwrds */ -#define PAGE_MASK (~(PAGE_SIZE-1)) - #endif /* _UAPI__ASM_ARC_PAGE_H */ diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index 62af9f7f9e96..ef11b721230e 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h @@ -7,10 +7,7 @@ #ifndef _ASMARM_PAGE_H #define _ASMARM_PAGE_H -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/arm64/include/asm/page-def.h b/arch/arm64/include/asm/page-def.h index 792e9fe881dc..d402e08442ee 100644 --- a/arch/arm64/include/asm/page-def.h +++ b/arch/arm64/include/asm/page-def.h @@ -10,9 +10,6 @@ #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #endif /* __ASM_PAGE_DEF_H */ diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h index 0ca6c408c07f..f8beae295afb 100644 --- a/arch/csky/include/asm/page.h +++ b/arch/csky/include/asm/page.h @@ -7,12 +7,8 @@ #include #include -/* - * PAGE_SHIFT determines the page size: 4KB - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include + #define THREAD_SIZE (PAGE_SIZE * 2) #define THREAD_MASK (~(THREAD_SIZE - 1)) #define THREAD_SHIFT (PAGE_SHIFT + 1) diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h index 8a6af57274c2..b01f8df69dd4 100644 --- a/arch/hexagon/include/asm/page.h +++ b/arch/hexagon/include/asm/page.h @@ -45,9 +45,7 @@ #define HVM_HUGEPAGE_SIZE 0x5 #endif -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) +#include #ifdef __KERNEL__ #ifndef __ASSEMBLY__ diff --git a/arch/loongarch/include/asm/page.h b/arch/loongarch/include/asm/page.h index e85df33f11c7..83f3533e31a4 100644 --- a/arch/loongarch/include/asm/page.h +++ b/arch/loongarch/include/asm/page.h @@ -8,12 +8,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include #define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) #define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT) diff --git a/arch/m68k/include/asm/page.h b/arch/m68k/include/asm/page.h index 8cfb84b49975..b173ba27d36f 100644 --- a/arch/m68k/include/asm/page.h +++ b/arch/m68k/include/asm/page.h @@ -6,10 +6,8 @@ #include #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include + #define PAGE_OFFSET (PAGE_OFFSET_RAW) #ifndef __ASSEMBLY__ diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index 8810f4f1c3b0..d1ec3806edab 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h @@ -19,10 +19,7 @@ #ifdef __KERNEL__ -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR)) diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 4609cb0326cf..bc3e3484c1bf 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h @@ -14,12 +14,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) +#include /* * This is used for calculating the real page sizes diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h index 0722f88e63cc..2897ec1b74f6 100644 --- a/arch/nios2/include/asm/page.h +++ b/arch/nios2/include/asm/page.h @@ -18,12 +18,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include /* * PAGE_OFFSET -- the first address of the first page of memory. diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h index 1d5913f67c31..124a2db4b160 100644 --- a/arch/openrisc/include/asm/page.h +++ b/arch/openrisc/include/asm/page.h @@ -15,16 +15,7 @@ #ifndef __ASM_OPENRISC_PAGE_H #define __ASM_OPENRISC_PAGE_H - -/* PAGE_SHIFT determines the page size */ - -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#ifdef __ASSEMBLY__ -#define PAGE_SIZE (1 << PAGE_SHIFT) -#else -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#endif -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define PAGE_OFFSET 0xc0000000 #define KERNELBASE PAGE_OFFSET diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h index 4bea2e95798f..6c4836fb5407 100644 --- a/arch/parisc/include/asm/page.h +++ b/arch/parisc/include/asm/page.h @@ -4,9 +4,7 @@ #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 83d0a4fc5f75..af9a2628d1df 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -21,8 +21,7 @@ * page size. When using 64K pages however, whether we are really supporting * 64K pages in HW or not is irrelevant to those definitions. */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) +#include #ifndef __ASSEMBLY__ #ifndef CONFIG_HUGETLB_PAGE @@ -41,13 +40,6 @@ extern unsigned int hpage_shift; #define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1) #endif -/* - * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we - * assign PAGE_MASK to a larger type it gets extended the way we want - * (i.e. with 1s in the high bits) - */ -#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) - /* * KERNELBASE is the virtual address of the start of the kernel, it's often * the same as PAGE_OFFSET, but _might not be_. diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index 32d308a3355f..9875399827c7 100644 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h @@ -12,9 +12,7 @@ #include #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#include #define HPAGE_SHIFT PMD_SHIFT #define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT) diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h index 73e1e03317b4..c949fe7736b9 100644 --- a/arch/s390/include/asm/page.h +++ b/arch/s390/include/asm/page.h @@ -11,9 +11,7 @@ #include #include -#define _PAGE_SHIFT CONFIG_PAGE_SHIFT -#define _PAGE_SIZE (_AC(1, UL) << _PAGE_SHIFT) -#define _PAGE_MASK (~(_PAGE_SIZE - 1)) +#include /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT _PAGE_SHIFT diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h index f780b467e75d..fc39b8171bfb 100644 --- a/arch/sh/include/asm/page.h +++ b/arch/sh/include/asm/page.h @@ -8,10 +8,8 @@ #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include + #define PTE_MASK PAGE_MASK #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K) diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h index 9977c77374cd..9954254ea569 100644 --- a/arch/sparc/include/asm/page_32.h +++ b/arch/sparc/include/asm/page_32.h @@ -11,9 +11,7 @@ #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h index e9bd24821c93..2a68ff5b6eab 100644 --- a/arch/sparc/include/asm/page_64.h +++ b/arch/sparc/include/asm/page_64.h @@ -4,9 +4,7 @@ #include -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include /* Flushing for D-cache alias handling is only needed if * the page size is smaller than 16K. diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h index 9ef9a8aedfa6..834313ecd3d6 100644 --- a/arch/um/include/asm/page.h +++ b/arch/um/include/asm/page.h @@ -9,10 +9,7 @@ #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifndef __ASSEMBLY__ diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 52f1b4ff0cc1..974688973cf6 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h @@ -6,10 +6,7 @@ #include #include -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h index 4db56ef052d2..595c1037b738 100644 --- a/arch/xtensa/include/asm/page.h +++ b/arch/xtensa/include/asm/page.h @@ -18,13 +18,7 @@ #include #include -/* - * PAGE_SHIFT determines the page size - */ - -#define PAGE_SHIFT CONFIG_PAGE_SHIFT -#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) +#include #ifdef CONFIG_MMU #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR diff --git a/include/vdso/page.h b/include/vdso/page.h new file mode 100644 index 000000000000..36693093665b --- /dev/null +++ b/include/vdso/page.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __VDSO_PAGE_H +#define __VDSO_PAGE_H + +#include + +/* + * PAGE_SHIFT determines the page size. + * + * Note: This definition is required because PAGE_SHIFT is used + * in several places throuout the codebase. + */ +#define PAGE_SHIFT CONFIG_PAGE_SHIFT + +#define PAGE_SIZE (_AC(1,UL) << CONFIG_PAGE_SHIFT) + +#if defined(CONFIG_PHYS_ADDR_T_64BIT) +#define PAGE_MASK (~((1 << CONFIG_PAGE_SHIFT) - 1)) +#else +#define PAGE_MASK (~(PAGE_SIZE-1)) +#endif + +#endif /* __VDSO_PAGE_H */