arm: ioremap: 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. -----BEGIN PGP SIGNATURE----- iQFHBAABCAAxFiEEeOVYVaWZL5900a/pOQOGJssO/ZEFAmDoctcTHHJwcHRAbGlu dXguaWJtLmNvbQAKCRA5A4Ymyw79kW1HCAC8lhm79EoktNw2+fumIfch15RjOGHC 8MfTSoPGJXLbwQXxBsTY8lGk8NRaLVRFDJ4OE8pMuwjCBbsgukg3oQUAbEt2n+zt DN4bCOV9vsunWs/w7S5xifFcNeeB3VqOjy2mFPaLpz3wj8fll+LtfghvHlXPyMSO xCO61F8AhsR4mUHeMmy5FRi0AG7fjYfaFrRYHqXQNAlnYqc3UgSSkfVViVEPeyOj TLefgjXkwCdrJ/84GRFkBqkXAz2vLNhic9BFt7YG2ZKbRDcAsQK5uqdmRR667edo Ca58NDOdsq3P2p+Qqum+JzWRc/F7/cGp+Twg+sA8sVvQ6Hr0TxmUNmsy =klV7 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
b6fd9e2594
|
@ -27,6 +27,7 @@
|
|||
#include <linux/vmalloc.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include <asm/cp15.h>
|
||||
#include <asm/cputype.h>
|
||||
|
@ -284,7 +285,8 @@ static void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
|
|||
* Don't allow RAM to be mapped with mismatched attributes - this
|
||||
* causes problems with ARMv6+
|
||||
*/
|
||||
if (WARN_ON(pfn_valid(pfn) && mtype != MT_MEMORY_RW))
|
||||
if (WARN_ON(memblock_is_map_memory(PFN_PHYS(pfn)) &&
|
||||
mtype != MT_MEMORY_RW))
|
||||
return NULL;
|
||||
|
||||
area = get_vm_area_caller(size, VM_IOREMAP, caller);
|
||||
|
|
Loading…
Reference in New Issue