From patchwork Thu Feb 15 10:31:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13557855 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 3D786C48BEB for ; Thu, 15 Feb 2024 10:32:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA1628D001A; Thu, 15 Feb 2024 05:32:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C78638D0001; Thu, 15 Feb 2024 05:32:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3F148D001A; Thu, 15 Feb 2024 05:32:39 -0500 (EST) 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 AA3108D0001 for ; Thu, 15 Feb 2024 05:32:39 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 55C20120F15 for ; Thu, 15 Feb 2024 10:32:39 +0000 (UTC) X-FDA: 81793674438.26.357CAB3 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf25.hostedemail.com (Postfix) with ESMTP id D4053A0008 for ; Thu, 15 Feb 2024 10:32:37 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707993157; a=rsa-sha256; cv=none; b=wwHWeRoqmdHv3wza23bDKT5tu037WmPGRZ+dX/Bj3LSxPO9j2TZZqgVnQ5Nh7mxupHCHi6 GLvi1TmZAPCrCKUCPbE1r5QJygWbt951XigdwdX/mLXCW/0p87UFYh7ooXHmeFV5aPMiVk AWHBZ0j+yxBSqVesELTtaeKEEl5eaBo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707993157; 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=Vt7HWCdphupCFZjtUl00kIkT38SYH1HEWXlJCnuRk3c=; b=HHljABbpVCxwRXg8OphLsG+/fso5gesWiv5GiDqgvXblGAyA5CSzqrmEP+TAmcMmdBaCMk qrOwyPDwZnR4XgxjXLB8MLEqsm5XeSpxks6WF/oWis8rLECMrCXaP66ajeyRU+r0VJxRUL Zu9GuQhJ3YSFGtBb9yu9z+r8BthnzUs= 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 DDA7C1515; Thu, 15 Feb 2024 02:33:17 -0800 (PST) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D34703F7B4; Thu, 15 Feb 2024 02:32:33 -0800 (PST) From: Ryan Roberts To: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 05/18] x86/mm: Convert pte_next_pfn() to pte_advance_pfn() Date: Thu, 15 Feb 2024 10:31:52 +0000 Message-Id: <20240215103205.2607016-6-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240215103205.2607016-1-ryan.roberts@arm.com> References: <20240215103205.2607016-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D4053A0008 X-Stat-Signature: oibzr1tmybx7aihazsueyxbqyqriy53w X-HE-Tag: 1707993157-678113 X-HE-Meta: U2FsdGVkX1/Bl2elvuxz0w4yH+jy/spUa2o4gbiiTIugbBevSIHQX7gdZ+wGcnnxWwAOkYJH75rRlHJbK1JgKijIsshD4ICDewv5jjrQgHsHpI17NFnUUo71eCqNv3Uw/kyRkkTOG4gyt0iW0IYFhU92GZoxytHMWcaonEqEUPHuO/28pwCy+TV9nPOJ70SbcDYf3mMdgS3BWo1xzTGUFvN0LPFaHpqsdY0hpeUGzDHbgogMxZlvxVl+DcrLxsT1qg6V6Qs3aiQhW712kP1KDhsBoPvLSCCZFoTdhZGrg9O2xuqEcIndZfVLBdOzDQ2i5e3BN607FKkfRFb/J/ybwpduTo+rvpiVwVGiYc0EjOGMZaa2CoZZ8Fi6o/Dj+MaEdtHPD552Jc5V09MuK9wPyt4CPDIuxcrCjhiOefwyM3VMEihCtoLmvbTPa06oY4M4753WDUcLJbF37nA/+LtN+aG4HvzmxShBMCBeXPZRsY/SfGkY2LlufpHTYgembtnsUOv/uDuNkcYB6c1teSgNifOmhbvbcBIAEpOmHZ6h0FXOYASHQOolz16oRw8r5m0bwMMvcGWyOlM41hsY2/spL7VcNZdP7BX60ci3RPg5MqwZYj8VEFLzHaN4tXswNLZGombZtbGz/xud/Fx1Bbs//LBqJHsNIA7MkmzHDBU6FQpAQeCp9EWA0nzyMjkKh0aDKOQpEDdT2MLmGQB0ldxnUJ+MmJAHB9wh6wbNVYFFLVSVN88nfxTjYeOlb039P0CBHFvNIHMCdznE0WahJd+BJnsz+U8cS76kLFa52MIszEUSkchH7DAgmgXqV8FF7VzxbhcZpOl3PnSQGiMfGSJNDL1vMgkTkZBCz26P2GT0Ra+8RDFKOskUieiAturMdky/MMKR+iq5biAKo4AwitOZn413NbG4muEhihDl0vDAwbEVg56lWCovGGhZyVYTVoFWga477ph6SXCrV2jKV1y VpQ== 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: Core-mm needs to be able to advance the pfn by an arbitrary amount, so override the new pte_advance_pfn() API to do so. Signed-off-by: Ryan Roberts Reviewed-by: David Hildenbrand --- arch/x86/include/asm/pgtable.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index b50b2ef63672..69ed0ea0641b 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -955,13 +955,13 @@ static inline int pte_same(pte_t a, pte_t b) return a.pte == b.pte; } -static inline pte_t pte_next_pfn(pte_t pte) +static inline pte_t pte_advance_pfn(pte_t pte, unsigned long nr) { if (__pte_needs_invert(pte_val(pte))) - return __pte(pte_val(pte) - (1UL << PFN_PTE_SHIFT)); - return __pte(pte_val(pte) + (1UL << PFN_PTE_SHIFT)); + return __pte(pte_val(pte) - (nr << PFN_PTE_SHIFT)); + return __pte(pte_val(pte) + (nr << PFN_PTE_SHIFT)); } -#define pte_next_pfn pte_next_pfn +#define pte_advance_pfn pte_advance_pfn static inline int pte_present(pte_t a) {