From patchwork Wed Apr 2 18:16:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 14036356 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 EACE2C36017 for ; Wed, 2 Apr 2025 18:17:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FE9F28000A; Wed, 2 Apr 2025 14:17:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2AF0B280006; Wed, 2 Apr 2025 14:17:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 152E528000A; Wed, 2 Apr 2025 14:17:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E3B80280006 for ; Wed, 2 Apr 2025 14:17:23 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B729312065D for ; Wed, 2 Apr 2025 18:17:23 +0000 (UTC) X-FDA: 83289911166.11.33A10B4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 2657F80012 for ; Wed, 2 Apr 2025 18:17:21 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DiiWRSGF; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743617842; 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:dkim-signature; bh=irsUPCJDDf9sWPbOR5tfnHLkyAVI2ujQHmur4Rc6/5I=; b=kZuMmgARg8W/gXYO/q4hCRsEyhJOdZk7iXjm5do3hbbsHNbamN7Gq6mhlRZHohS8pvivkv ij311jQAH1JdZLgyikL4a8d9aN6dSHLr0tctAknFryqUUTN5kv35+y/6+JioaWJXtbLkkT /Oj5n6ZX8uAeiE6967/9UoYg1+rTdRc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743617842; a=rsa-sha256; cv=none; b=a3IS1+Io8LJChA5qJ0HKma9CUNHLAX2ibAvdi7JgeasM/L5NRKThYudTbnv1WgmeUsqIvj jQyxfjZ2hy3EFBowV8y6JmNcpY1NNyrwHdpxDZAeZdBkkDhGCs89Iij3mRWu4Yy+R85Ujh 9zV9KPpMubDFWzijAxZWTTZRnWTdVDQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DiiWRSGF; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=irsUPCJDDf9sWPbOR5tfnHLkyAVI2ujQHmur4Rc6/5I=; b=DiiWRSGFkDv/1wb2fMATmgO0vc GPHSBhKGsY40maSdYr53ANtoYmy+Q9JbmLRz6xIplGek+MQ/LURoGK9tpG7tAXsWIh/VZUClVjnxE NS7WQlrkUv/c70EHHrj7ePkHPMs0QLCT29rmZwcJ2wCsen3CVmvie+eTBlaENziQMmwAOZSi+eZHT ZytgqdauVNdVUj3q9U+y8YtSFQQ+ZbvJNGFRZDYi7A5VdTI4CUzMje6BlLAO6g2fQMV1Hngn5X5My YG+ApHc+jeaNZXFOb2sCIKDGvmzY0sScCa5PVNe5JVe9qPQX6WNLDxAk+yIpKdrwjvEecqx0fHKij Uf3znXEg==; Received: from willy by casper.infradead.org with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1u02eF-0000000A0ic-1hFm; Wed, 02 Apr 2025 18:17:11 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-arch@vger.kernel.org Subject: [PATCH v2 05/11] um: Remove custom definition of mk_pte() Date: Wed, 2 Apr 2025 19:16:59 +0100 Message-ID: <20250402181709.2386022-6-willy@infradead.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250402181709.2386022-1-willy@infradead.org> References: <20250402181709.2386022-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2657F80012 X-Stat-Signature: fxqpkcgypyg5bes85oz3cx5kxsu7zs87 X-Rspam-User: X-HE-Tag: 1743617841-168660 X-HE-Meta: U2FsdGVkX1/9DWhTvAtlUtUpIiWoEH4TYJ6aRlPv8oGah5sXSat6LM3ZUxl2OPbzlmphmlkiL7UlXLz6EpqNFwQt5JLnDp6mjHCKYvOzshKF9Rx0626WtKMeXjGevdYYvNFqCA5xV0j5m/o+jSyh2Enz4ekNQhcLpUHmwlBfxcQ9jNSTonkiaag0JEw1x80RzGjouD73rJDFx8bgFybJwXfmZbMR9TF5RyEEajRZjEGw2PDaYMEqAHKr/tJEG8f84lbP4k6kH6kLTcep05ww4ooM0Px8G5Ys/b9BIB90jsDl/svr8vYBapDOHNxOBp8LtpQuhd2mgGmyp6s9HTIA7F/55OpacIiDkTq3CMgl33ZqvbCw4pzVRFr4s0AgAAc2RfVOusTVWH6BKEUTTSp9NrMvzYAqtjGCUU24vKfq7wUPYm5+j6X5ALtt6AVzbg7DUV3y5S6tkbg+nrMrEV7VkbGq8fsOXSootLQmzNfgBk/DxShskd1urT2YOtRixx4+FwpBHOafm3dZc3cnnzpf06UZGqT+Ahla2nQNW+k8ukYKev3QJdWI2YYMbsLtJnVDFFnn93TYtec06ntPmBfqP7LY6H9qQgu2xx+5Udueb3muHxyzUeBKQVfpLUcI4b6OLEfjoesVJHgx/y9zpuof8+JYjPzgExJYaJOWNfmBQKeAN8fA0M64g1NBSsUmUt6sy1CKdazzUBA7J4i4Cju2GuUM4+dCip7UH445ZJz3TG628k3ovF3haA78ui8GB4csabJSD3cZyN3+1drQmVAFMbVLJZkks1BRsWkRQmtrj/bSIOdI8dNqVVclRkS4lYSCHzMmZP4nsJZK2d2dDGBRdDDJwEPH6obgMwoW11I6roQxNudXu9B6bXRafFifiJ+9V4T8nQf8JuCd1M9LUwD6khJd4rxdEIJO8OX0rs9Jxs4gcYGJpF7dnvMbBUTJaAXIDPq9vXQ/92Y= 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: Move the pfn_pte() definitions from the 2level and 4level files to the generic pgtable.h and delete the custom definition of mk_pte() so that we use the central definition. Signed-off-by: Matthew Wilcox (Oracle) --- arch/um/include/asm/pgtable-2level.h | 1 - arch/um/include/asm/pgtable-4level.h | 9 --------- arch/um/include/asm/pgtable.h | 18 ++++++++---------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/arch/um/include/asm/pgtable-2level.h b/arch/um/include/asm/pgtable-2level.h index ab0c8dd86564..14ec16f92ce4 100644 --- a/arch/um/include/asm/pgtable-2level.h +++ b/arch/um/include/asm/pgtable-2level.h @@ -37,7 +37,6 @@ static inline void pgd_mkuptodate(pgd_t pgd) { } #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) #define pte_pfn(x) phys_to_pfn(pte_val(x)) -#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) #endif diff --git a/arch/um/include/asm/pgtable-4level.h b/arch/um/include/asm/pgtable-4level.h index 0d279caee93c..7a271b7b83d2 100644 --- a/arch/um/include/asm/pgtable-4level.h +++ b/arch/um/include/asm/pgtable-4level.h @@ -102,15 +102,6 @@ static inline unsigned long pte_pfn(pte_t pte) return phys_to_pfn(pte_val(pte)); } -static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) -{ - pte_t pte; - phys_t phys = pfn_to_phys(page_nr); - - pte_set_val(pte, phys, pgprot); - return pte; -} - static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) { return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)); diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h index 5601ca98e8a6..ca2a519d53ab 100644 --- a/arch/um/include/asm/pgtable.h +++ b/arch/um/include/asm/pgtable.h @@ -260,19 +260,17 @@ static inline int pte_same(pte_t pte_a, pte_t pte_b) return !((pte_val(pte_a) ^ pte_val(pte_b)) & ~_PAGE_NEEDSYNC); } -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ - #define __virt_to_page(virt) phys_to_page(__pa(virt)) #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) -#define mk_pte(page, pgprot) \ - ({ pte_t pte; \ - \ - pte_set_val(pte, page_to_phys(page), (pgprot)); \ - pte;}) +static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) +{ + pte_t pte; + + pte_set_val(pte, pfn_to_phys(pfn), pgprot); + + return pte; +} static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) {