From patchwork Thu Feb 15 10:31:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 201342 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp302863dyb; Thu, 15 Feb 2024 02:35:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmhGcrO5U4KEvXzJDhD+jc6sAeZNplccnKPYh2TS1oeQ6n1wjzj6b/zaoKB8WhsXy58DdAboPDE4bFLg+mbXyAvP1Xbg== X-Google-Smtp-Source: AGHT+IFAZNKoqLmuDSBUGfMar5VS6hl6MU35cESnsh/ZAb8TvzGdVm7PaRkFhNFf+weK02djBe8W X-Received: by 2002:a0c:da84:0:b0:68c:82a3:a440 with SMTP id z4-20020a0cda84000000b0068c82a3a440mr1372321qvj.35.1707993312472; Thu, 15 Feb 2024 02:35:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707993312; cv=pass; d=google.com; s=arc-20160816; b=bYvsqw36NJL68oEwD/UTWfcslkYUuP1NDUFDzxPOdwTCR+2tUokUFVJTZL+qJuiVkd y7VjP3Kep183Bw8nC2xxNQIYbh/VGW7WYZC15oLUC/1DolSiFNsrib7FCEIvfZTU2SFW FvjQfEXww996+kC6MljkKVPW8DcFAysc0ZYNO5D8m4Nci3UnRDDTJNC378wbCW9EEIFT wTFiGnb6LPZat5YEWnmC8eSM8xFDTi6RkqBSuzHLyptLG0O5OvyFzdl5Cbw7GgizwLe8 b90VwCif7EriMnmUvm2EHZZd+9IWs84Tqv3CypnVwRnMWdE7raWjN90IKsFHeeEmKE/Z KS8w== 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=rWO7ZiASv+iNEWh1oRqCx438LeAl19u3CVwsECquxEQ=; fh=Heagowc1O8zVDXTyU76nJjOwDjz9r3Gi+0zmhF4ZELQ=; b=g8lLm7Jo2fLHh5dhGLtkfdY4d5S5nOhqopQXyq6lUoQS/nZBwERafGwf9+H3iY2k0I RAPL8mIUdbqrW8tYGgEuD+12n9jqoePHQWJNAy3De3Z3NuM0K+1Vag34FSsVyvd+2aiu 8JZdOBh8dQLMe/JriEO5aelgIzZHWK44Asv8RdUkTaRqtF9eCVGOiRbakD2/kEvTisFr lT11rhm9ts0tRTLGp8OzZ+OqV3NVhzr67aP0HI3jsNGFI36If+fG5sVYD3vmF2M/FFln BZbbPDCDX6T9yMMdI/qiOZLNI8CL2soBIVGeSJzrUdTD0pGgI+gDVhWpFoHKySzGMfZ2 4SeQ==; 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-66639-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66639-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c12-20020a056214224c00b0068caf864c2esi1141507qvc.312.2024.02.15.02.35.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 02:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66639-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-66639-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66639-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7E84E1C21998 for ; Thu, 15 Feb 2024 10:35:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C8F212C54B; Thu, 15 Feb 2024 10:32:37 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B11012BF37 for ; Thu, 15 Feb 2024 10:32:34 +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=1707993155; cv=none; b=YM1ZppHyi9dyiWholRuAW24bXfy0xLxZlHkq4BtbZT+f6xsoAgnqy8jORKsQHoDdJRQj0SHjW1ie2+aUIKOcwSscznPquQ5zUPP34WmTJwzNObIRo7Wa6/28k2EwZYbUoS0j/ZJla0XTxAFSV9o6/7YUsDrwcL0BV2dprajZDEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707993155; c=relaxed/simple; bh=jaRLqPxfoaS5xa20g0zrcIskSnUTkXjKILoHiMbUoFA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l8KTc1yIIsnxmOG0yWX3ARHSAbhIH9ZJ1QnmFpPo6qOx9ijQSNp1XhJInXKWYMoUGSBZL94PN7AzEHz9pJOdjMiyPdt+3R2Y/Vja0j8tZ1746nljiVr7W7hIBFSc+gGzaywM8+/ghIcN9FezvqV38OpYgkANLtdtl/fz7wTfSJo= 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 7862D150C; Thu, 15 Feb 2024 02:33:14 -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 6F72D3F7B4; Thu, 15 Feb 2024 02:32:30 -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 04/18] arm64/mm: Convert pte_next_pfn() to pte_advance_pfn() Date: Thu, 15 Feb 2024 10:31:51 +0000 Message-Id: <20240215103205.2607016-5-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790960795469819647 X-GMAIL-MSGID: 1790960795469819647 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 Acked-by: David Hildenbrand Acked-by: Mark Rutland Acked-by: Catalin Marinas --- arch/arm64/include/asm/pgtable.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 52d0b0a763f1..b6d3e9e0a946 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -351,10 +351,10 @@ static inline pgprot_t pte_pgprot(pte_t pte) return __pgprot(pte_val(pfn_pte(pfn, __pgprot(0))) ^ pte_val(pte)); } -#define pte_next_pfn pte_next_pfn -static inline pte_t pte_next_pfn(pte_t pte) +#define pte_advance_pfn pte_advance_pfn +static inline pte_t pte_advance_pfn(pte_t pte, unsigned long nr) { - return pfn_pte(pte_pfn(pte) + 1, pte_pgprot(pte)); + return pfn_pte(pte_pfn(pte) + nr, pte_pgprot(pte)); } static inline void set_ptes(struct mm_struct *mm, @@ -370,7 +370,7 @@ static inline void set_ptes(struct mm_struct *mm, if (--nr == 0) break; ptep++; - pte = pte_next_pfn(pte); + pte = pte_advance_pfn(pte, 1); } } #define set_ptes set_ptes