Message ID | 20241204103042.1904639-7-arnd@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | x86: 32-bit cleanups | expand |
On Wed, Dec 4, 2024 at 12:31 PM Arnd Bergmann <arnd@kernel.org> wrote: > > From: Arnd Bergmann <arnd@arndb.de> > > Since kernels with and without CONFIG_X86_PAE are now limited > to the low 4GB of physical address space, there is no need to > use either swiotlb or 64-bit phys_addr_t any more, so stop > selecting these and fix up the build warnings from that. ... > mtrr_type_lookup(addr, addr + PMD_SIZE, &uniform); > if (!uniform) { > pr_warn_once("%s: Cannot satisfy [mem %#010llx-%#010llx] with a huge-page mapping due to MTRR override.\n", > - __func__, addr, addr + PMD_SIZE); > + __func__, (u64)addr, (u64)addr + PMD_SIZE); Instead of castings I would rather: 1) have addr and size (? does above have off-by-one error?) or end; 2) use struct resource / range with the respective %p[Rr][a] specifier or use %pa.
On Wed, Dec 4, 2024, at 19:41, Andy Shevchenko wrote: > On Wed, Dec 4, 2024 at 12:31 PM Arnd Bergmann <arnd@kernel.org> wrote: >> >> From: Arnd Bergmann <arnd@arndb.de> >> >> Since kernels with and without CONFIG_X86_PAE are now limited >> to the low 4GB of physical address space, there is no need to >> use either swiotlb or 64-bit phys_addr_t any more, so stop >> selecting these and fix up the build warnings from that. > > ... > >> mtrr_type_lookup(addr, addr + PMD_SIZE, &uniform); >> if (!uniform) { >> pr_warn_once("%s: Cannot satisfy [mem %#010llx-%#010llx] with a huge-page mapping due to MTRR override.\n", >> - __func__, addr, addr + PMD_SIZE); >> + __func__, (u64)addr, (u64)addr + PMD_SIZE); > > Instead of castings I would rather: > 1) have addr and size (? does above have off-by-one error?) or end; > 2) use struct resource / range with the respective %p[Rr][a] specifier > or use %pa. Changed as below now. I'm still not sure whether the mtrr_type_lookup end argument is meant to be inclusive or exclusive, so I've left that alone, but the printed range should be correct now. Thanks, Arnd @@ -740,11 +740,12 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot) int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot) { u8 uniform; + struct resource res = DEFINE_RES_MEM(addr, PMD_SIZE); mtrr_type_lookup(addr, addr + PMD_SIZE, &uniform); if (!uniform) { - pr_warn_once("%s: Cannot satisfy [mem %#010llx-%#010llx] with a huge-page mapping due to MTRR override.\n", - __func__, (u64)addr, (u64)addr + PMD_SIZE); + pr_warn_once("%s: Cannot satisfy %pR with a huge-page mapping due to MTRR override.\n", + __func__, &res); return 0; }
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index b373db8a8176..d0d055f6f56e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1456,8 +1456,6 @@ config HIGHMEM config X86_PAE bool "PAE (Physical Address Extension) Support" depends on X86_32 && X86_HAVE_PAE - select PHYS_ADDR_T_64BIT - select SWIOTLB help PAE is required for NX support, and furthermore enables larger swapspace support for non-overcommit purposes. It diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 5745a354a241..bdf63524e30a 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -769,7 +769,7 @@ int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot) mtrr_type_lookup(addr, addr + PMD_SIZE, &uniform); if (!uniform) { pr_warn_once("%s: Cannot satisfy [mem %#010llx-%#010llx] with a huge-page mapping due to MTRR override.\n", - __func__, addr, addr + PMD_SIZE); + __func__, (u64)addr, (u64)addr + PMD_SIZE); return 0; } diff --git a/include/linux/mm.h b/include/linux/mm.h index c39c4945946c..7725e9e46e90 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -99,7 +99,7 @@ extern int mmap_rnd_compat_bits __read_mostly; #ifndef DIRECT_MAP_PHYSMEM_END # ifdef MAX_PHYSMEM_BITS -# define DIRECT_MAP_PHYSMEM_END ((1ULL << MAX_PHYSMEM_BITS) - 1) +# define DIRECT_MAP_PHYSMEM_END (phys_addr_t)((1ULL << MAX_PHYSMEM_BITS) - 1) # else # define DIRECT_MAP_PHYSMEM_END (((phys_addr_t)-1)&~(1ULL<<63)) # endif