Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp686093rdb; Fri, 2 Feb 2024 00:11:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEY0X5S3eH/UE5r1VNdPll2A5x2O347fDtS6+L/hqZuvy/One5tms+pqvsjhrEgouWmR+Ho X-Received: by 2002:a05:6830:43:b0:6e1:73b8:d6a9 with SMTP id d3-20020a056830004300b006e173b8d6a9mr1229769otp.33.1706861499072; Fri, 02 Feb 2024 00:11:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706861499; cv=pass; d=google.com; s=arc-20160816; b=1HgCJ7spuX42a1/K9nH4FxztJKvAL8tj+XuiXN076tQoj34NgzPUD/+cJvj90G7zaZ YmboHuLfoU3tckh14SvOxnUsjyHvbW22i6ZI8GGwpfjNKqQuBri+joVT+P+nfuTKVdMQ rsML6kGmR9KIQ6B09yBCMzPMDy4WjBsPRzJHQuZXI+xZ99K3m6VKWvCey/7GTfgvxR3q 3ak2CAeHVAc0SynBttrNtkXCzo5wxtraWornG9xy4TeVpZfrX62iOo1evf6DWQXb4veB Czh/4WmPOH1gbzf3NNsSMpI4CBg4EdrJehvEbAkImIQYP2YuuqO3SRV4KbZSBIN784mc 8c7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=MiB2yK22g/POYHUygPxWvSb+30lGFDNWNkV8pOKxEt0=; fh=a/DEjwgxm4IUqqaNNoiQtiObRdp1PMzey5NtLuruMio=; b=M7hIwQOGsye1n6KuyyMPQkGUBSVa4U21UwRNXgpOBd/z+BSPTX7Alwis72XQm3Sb20 C9AnNco1xO1DxwDMZPvzLwoRdOlMaSZfd3VMc/uvTDx2p6aOY17nesMEpbDXJ8yk1mK/ P5cD8ewKl+8UDFwHMj/VFMSTCF2dcGYWz/uVf+LcdbygvEZlPUk+QWUWXa4LJIYv6wse TQagn231aGIzN8ihXdIuCHRprHlI7j1C+RpNonfsOIkrRvrgf0Oo4g7hKh/nnmWbMDxX khVigWBctjs37951MqhEjDzpPEC8d2Y9NUOhE70Guk0puBHjjoZcZAi+DlngM3/sG0i5 do5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49415-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=1; AJvYcCXd9IZR8ov9QeuCrI4Cmky8kyT1fdyFL0WpDnR7tOM4JXMbJeYV7tFrtgoBijElryjAr8k+DCxPQoTvwTaAtfVpS0OuxrSCrVz6krNGiA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k19-20020a63ff13000000b005d8b6a66b33si1164729pgi.459.2024.02.02.00.11.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 00:11:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49415-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-49415-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 876F728F31D for ; Fri, 2 Feb 2024 08:09:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B715D18EAD; Fri, 2 Feb 2024 08:08:30 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6361218E1A for ; Fri, 2 Feb 2024 08:08:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706861310; cv=none; b=c881Vo5p4UE9Iq9fK7pUNnw8KNTcH0bDe9Gj4ftMmrXnZl2tu7byklPwDROvPiSGGwKn2kW+bnT3WTZz3CuGZ8Oxx2gk/1q9MMCdKLpeKL3mdG5xJEQWZPTtSnFMxG5xclvrPC+wfXFy+ZowC7g+Ojf5Mb0Xp5UvjU19awlBzvY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706861310; c=relaxed/simple; bh=ilkctyHCFTKph7SguchDk3Oqzwpxdv9pwaYrbYycKgQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=khWin5suZO0qkx6sPjk7iohPp7VxrDncpmKVhK1kOxJgFlB0jy2kLoS16BkZulkAbJlBcPT91N9MLKHC2jWeqKVPY6/gxQewynHclxgUJ0THYiKVE02Y/qtckUuOVORWbkJTvCdyKgsLyi6X/0eORCULwphVzmeF5hVeIsBw4VI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 -- 2.25.1