ARM: keystone2: move update of the phys-to-virt constants into generic code
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-keystone / keystone.c
index 3d58a8f4dc7e326c7d5b8b0d97d232705595855b..baa0fbc9803a4f23b92596108944a3959c03bb76 100644 (file)
@@ -68,11 +68,9 @@ static phys_addr_t keystone_virt_to_idmap(unsigned long x)
        return (phys_addr_t)(x) - CONFIG_PAGE_OFFSET + KEYSTONE_LOW_PHYS_START;
 }
 
-static void __init keystone_init_meminfo(void)
+static long long __init keystone_init_meminfo(void)
 {
-       bool lpae = IS_ENABLED(CONFIG_ARM_LPAE);
-       bool pvpatch = IS_ENABLED(CONFIG_ARM_PATCH_PHYS_VIRT);
-       phys_addr_t offset = PHYS_OFFSET - KEYSTONE_LOW_PHYS_START;
+       long long offset;
        phys_addr_t mem_start, mem_end;
 
        mem_start = memblock_start_of_DRAM();
@@ -81,29 +79,24 @@ static void __init keystone_init_meminfo(void)
        /* nothing to do if we are running out of the <32-bit space */
        if (mem_start >= KEYSTONE_LOW_PHYS_START &&
            mem_end   <= KEYSTONE_LOW_PHYS_END)
-               return;
-
-       if (!lpae || !pvpatch) {
-               pr_crit("Enable %s%s%s to run outside 32-bit space\n",
-                     !lpae ? __stringify(CONFIG_ARM_LPAE) : "",
-                     (!lpae && !pvpatch) ? " and " : "",
-                     !pvpatch ? __stringify(CONFIG_ARM_PATCH_PHYS_VIRT) : "");
-       }
+               return 0;
 
        if (mem_start < KEYSTONE_HIGH_PHYS_START ||
            mem_end   > KEYSTONE_HIGH_PHYS_END) {
                pr_crit("Invalid address space for memory (%08llx-%08llx)\n",
-                     (u64)mem_start, (u64)mem_end);
+                       (u64)mem_start, (u64)mem_end);
+               return 0;
        }
 
-       offset += KEYSTONE_HIGH_PHYS_START;
-       __pv_phys_pfn_offset = PFN_DOWN(offset);
-       __pv_offset = (offset - PAGE_OFFSET);
+       offset = KEYSTONE_HIGH_PHYS_START - KEYSTONE_LOW_PHYS_START;
 
        /* Populate the arch idmap hook */
        arch_virt_to_idmap = keystone_virt_to_idmap;
 
-       pr_info("Switching to high address space at 0x%llx\n", (u64)offset);
+       pr_info("Switching to high address space at 0x%llx\n",
+               (u64)PHYS_OFFSET + (u64)offset);
+
+       return offset;
 }
 
 static const char *const keystone_match[] __initconst = {