Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: remove custom definition of mk_pte()

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.

Link: https://lkml.kernel.org/r/20250402181709.2386022-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: <x86@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
669eec68 a03079e4

+8 -20
-1
arch/um/include/asm/pgtable-2level.h
··· 37 37 #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) 38 38 39 39 #define pte_pfn(x) phys_to_pfn(pte_val(x)) 40 - #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) 41 40 #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) 42 41 43 42 #endif
-9
arch/um/include/asm/pgtable-4level.h
··· 102 102 return phys_to_pfn(pte_val(pte)); 103 103 } 104 104 105 - static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) 106 - { 107 - pte_t pte; 108 - phys_t phys = pfn_to_phys(page_nr); 109 - 110 - pte_set_val(pte, phys, pgprot); 111 - return pte; 112 - } 113 - 114 105 static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot) 115 106 { 116 107 return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot));
+8 -10
arch/um/include/asm/pgtable.h
··· 260 260 return !((pte_val(pte_a) ^ pte_val(pte_b)) & ~_PAGE_NEEDSYNC); 261 261 } 262 262 263 - /* 264 - * Conversion functions: convert a page and protection to a page entry, 265 - * and a page entry and page directory to the page they refer to. 266 - */ 267 - 268 263 #define __virt_to_page(virt) phys_to_page(__pa(virt)) 269 264 #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) 270 265 271 - #define mk_pte(page, pgprot) \ 272 - ({ pte_t pte; \ 273 - \ 274 - pte_set_val(pte, page_to_phys(page), (pgprot)); \ 275 - pte;}) 266 + static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) 267 + { 268 + pte_t pte; 269 + 270 + pte_set_val(pte, pfn_to_phys(pfn), pgprot); 271 + 272 + return pte; 273 + } 276 274 277 275 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 278 276 {