ioremap_page_range() cannot provide us memory with the the non-secure
section flag set unfortunately at present ioremap+MT_DEVICE_NS will
fallback to this function and spuriously return a virtual pointer to
what is effectively MT_DEVICE memory.

This patch makes the fallback to ioremap_page_range() ineffective; to
allocate MT_DEVICE_NS memory we must rely instead on the platform startup
code providing a suitable static mapping.

Signed-off-by: Daniel Thompson <[email protected]>
---
 arch/arm/mm/ioremap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index d1e5ad7..1cb12f8 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -319,6 +319,10 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
                err = remap_area_sections(addr, pfn, size, type);
        } else
 #endif
+       if (type->prot_sect & PMD_SECT_NS)
+               /* required section flag is not achievable; give up */
+               return NULL;
+       else
                err = ioremap_page_range(addr, addr + size, paddr,
                                         __pgprot(type->prot_pte));
 
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to