From patchwork Fri Feb 2 08:07:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13542338 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 D9362C47258 for ; Fri, 2 Feb 2024 08:08:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6857E6B007B; Fri, 2 Feb 2024 03:08:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6360E6B007D; Fri, 2 Feb 2024 03:08:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FD946B007E; Fri, 2 Feb 2024 03:08:32 -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 3FBF06B007B for ; Fri, 2 Feb 2024 03:08:32 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0D37A140F2E for ; Fri, 2 Feb 2024 08:08:32 +0000 (UTC) X-FDA: 81746136864.23.F77F58F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf27.hostedemail.com (Postfix) with ESMTP id 6B28440018 for ; Fri, 2 Feb 2024 08:08:30 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706861310; 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=MiB2yK22g/POYHUygPxWvSb+30lGFDNWNkV8pOKxEt0=; b=oZFT4ry1EIw5HziiYHpzbJyKPcu6VapJvtNoTbmNpQjYF1teFwGMMr68x669/9Yiya7osl a78uAeYyn4qoydZSiXFf8BQFoEEGpKIcV1xy2j0LVuGhDUNjvjlK/mnG/DXMALT2flbBgt FarEs3w7ShLbTkhf5K7ucb78OcGuc7w= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706861310; a=rsa-sha256; cv=none; b=GfmrQISOGyRbanvgx6oiBmYhDzCF2KAMdcrmQnbDOg70gfMPr6GentB+KVNayQO3hIbj4B 5MX9jEgoh37Vyje0yB0k0Q5j3jRn5OjVJTGLUz3/R/Lctg71j4KMFxiNFeh6K/rbKz/ldQ ZLRxByW80FNalUUpnjQX9/v2XCKI4XE= 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 2865B169E; Fri, 2 Feb 2024 00:09:10 -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 3C7A53F5A1; Fri, 2 Feb 2024 00:08:24 -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 , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , 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 v5 03/25] mm: Make pte_next_pfn() a wrapper around pte_advance_pfn() Date: Fri, 2 Feb 2024 08:07:34 +0000 Message-Id: <20240202080756.1453939-4-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240202080756.1453939-1-ryan.roberts@arm.com> References: <20240202080756.1453939-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6B28440018 X-Stat-Signature: fyyi5xds3s4s7icq4exr6jc4cym9c4mm X-Rspam-User: X-HE-Tag: 1706861310-751723 X-HE-Meta: U2FsdGVkX1+M21m1eh+lyBLrLhywq7V8deJQBebESPGh8pNEB8f4+q4Qs1liOIdMRyx3NMF3SNtq3dYIyNfttqgLQ1lAWTo33Xejb8hQGrYkAXf7eGRKeJKTtc0M7JkfoHPMnCI28TOVuoexvgqZowIhdvBKeDc+Yk1u7l6T83OQZUxCROSwK65Ovtr7VyrQ7JlM3hohBzRdgHhtPkzedyzZNSQ+nyav43F57AZvvVIVa2aJLm3jaFUrMuK+b7SCiQ5hbAELu+I0u7NgeIy9sqSut+7Qi8fbOMxYbwhxAAJNhKw8vfTZ8lcJx/dFzVaQpxSRHKUKqKVbEsgiauLki9axI9TxgzhjhtyHdy0QTdElQT0+yeSBfVrFavHcyK7oe/gX6/YWDpejvQ3a55dTsuitzpmNxDVd0KYTop9d0cKCwarhk8AwvkPUFU22whu1e7GKJefCTuUcRT2N8kuDaOf5JKUUAIf0BsnrIiT+/zMJYaRKZkTrxNxsN7ROSi4F0sYtiMzPICIAIviyVBONZyhGBQluwYi6rb/hr1StEagGODSK3nmWArpxGRq+Qg3clV4HEmM+t28fkZ1nJs/KBNOe8yqbEjoIrkqRtYJwc2PngWwV4IzvVMdZFDUhsq1OJCGSinvcw5L6eK5igY1VxIpuTmP9HRjkVw5KQn5Qrgb73Gh8o0YqTDeJ2qw7T56OJrFJIzwGj8BYK/1W9Hd7HvK+QOf8KtOE1Nc8Cm9er3hPxDmCyrO16i+cOoI8dDnSl8Uvq7yOtfTuIfbtdLAHu38qPZalr4b/iiO4ToEINiV1lLe5vrB1Uu896MrBZEQ+SO4ZrKjxZsmc7fz+X/Fyy2JnFuKpBlijzBgf0jTf+sqnHgqgNXewsYOfaaIsj17F1GhUkCldixtIZXVP6BYL6c90czprtFQh+s64r3k/dMs/7i2WyydI4Vv4u95gobh4oD+ffe5kw13kLDJa1PG wf6IyQtg zuVv9+4QBL9D01cuhuvJpHNbXzQm6b/4Xj2nQNkdxfYzEvI2qw4L/qCvEFLHrDFSeCSPLnA/6sm2Jboa/ZY5fCMCFVxry/PcaGFLi6iPzg6bISIyJ+DbgRYxgyIg+NIVp1twu++ckyFxRKE3zQOdvqzFa1+U4xOwgF7OQnhuliY+McrkQGW9msMwPvhKpW52RoV3uW0Nd6pmhvRMn2Gvsyt2nPgSG5I7egmFW77HLIqryQ0FXJWBkaOMw/OX1FnWydKrU/8TOM50aryDn0eyrDoiBXQ== 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 goal is to be able to advance a PTE by an arbitrary number of PFNs. So introduce a new API that takes a nr param. We are going to remove pte_next_pfn() and replace it with pte_advance_pfn(). As a first step, implement pte_next_pfn() as a wrapper around pte_advance_pfn() so that we can incrementally switch the architectures over. Once all arches are moved over, we will change all the core-mm callers to call pte_advance_pfn() directly and remove the wrapper. Signed-off-by: Ryan Roberts --- include/linux/pgtable.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 5e7eaf8f2b97..815d92dcb96b 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -214,9 +214,15 @@ static inline int pmd_dirty(pmd_t pmd) #ifndef pte_next_pfn +#ifndef pte_advance_pfn +static inline pte_t pte_advance_pfn(pte_t pte, unsigned long nr) +{ + return __pte(pte_val(pte) + (nr << PFN_PTE_SHIFT)); +} +#endif static inline pte_t pte_next_pfn(pte_t pte) { - return __pte(pte_val(pte) + (1UL << PFN_PTE_SHIFT)); + return pte_advance_pfn(pte, 1); } #endif