mm/CMA: fix boot regression due to physical address of high_memory
[cascardo/linux.git] / mm / cma.c
index fde706e..8e9ec13 100644 (file)
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -215,9 +215,21 @@ int __init cma_declare_contiguous(phys_addr_t base,
                        bool fixed, struct cma **res_cma)
 {
        phys_addr_t memblock_end = memblock_end_of_DRAM();
-       phys_addr_t highmem_start = __pa(high_memory);
+       phys_addr_t highmem_start;
        int ret = 0;
 
+#ifdef CONFIG_X86
+       /*
+        * high_memory isn't direct mapped memory so retrieving its physical
+        * address isn't appropriate.  But it would be useful to check the
+        * physical address of the highmem boundary so it's justfiable to get
+        * the physical address from it.  On x86 there is a validation check for
+        * this case, so the following workaround is needed to avoid it.
+        */
+       highmem_start = __pa_nodebug(high_memory);
+#else
+       highmem_start = __pa(high_memory);
+#endif
        pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n",
                __func__, &size, &base, &limit, &alignment);