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

Merge tag 'fixes-2021-07-09' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock

Pull memblock fix from Mike Rapoport:
"This is a fix for the rework of ARM's pfn_valid() implementation
merged during this merge window.

Don't abuse pfn_valid() to check if pfn is in RAM

The semantics of pfn_valid() is to check presence of the memory map
for a PFN and not whether a PFN is in RAM. The memory map may be
present for a hole in the physical memory and if such hole corresponds
to an MMIO range, __arm_ioremap_pfn_caller() will produce a WARN() and
fail.

Use memblock_is_map_memory() instead of pfn_valid() to check if a PFN
is in RAM or not"

* tag 'fixes-2021-07-09' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
arm: ioremap: don't abuse pfn_valid() to check if pfn is in RAM

+3 -1
+3 -1
arch/arm/mm/ioremap.c
··· 27 27 #include <linux/vmalloc.h> 28 28 #include <linux/io.h> 29 29 #include <linux/sizes.h> 30 + #include <linux/memblock.h> 30 31 31 32 #include <asm/cp15.h> 32 33 #include <asm/cputype.h> ··· 285 284 * Don't allow RAM to be mapped with mismatched attributes - this 286 285 * causes problems with ARMv6+ 287 286 */ 288 - if (WARN_ON(pfn_valid(pfn) && mtype != MT_MEMORY_RW)) 287 + if (WARN_ON(memblock_is_map_memory(PFN_PHYS(pfn)) && 288 + mtype != MT_MEMORY_RW)) 289 289 return NULL; 290 290 291 291 area = get_vm_area_caller(size, VM_IOREMAP, caller);