mm/cma: Cleanup highmem check
[sfrench/cifs-2.6.git] / mm / cma.c
index c960459eda7e640ea55be1d4ed80c6a9125a8877..94b3460cd608aa26163ef84f99123d74c4a2d657 100644 (file)
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -235,18 +235,13 @@ int __init cma_declare_contiguous(phys_addr_t base,
        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 justifiable 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.
+        * We can't use __pa(high_memory) directly, since high_memory
+        * isn't a valid direct map VA, and DEBUG_VIRTUAL will (validly)
+        * complain. Find the boundary by adding one to the last valid
+        * address.
         */
-       highmem_start = __pa_nodebug(high_memory);
-#else
-       highmem_start = __pa(high_memory);
-#endif
+       highmem_start = __pa(high_memory - 1) + 1;
        pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n",
                __func__, &size, &base, &limit, &alignment);