Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[sfrench/cifs-2.6.git] / arch / arm64 / mm / init.c
index cbba537ba3d25ff02804601b0a7e25ce47d90b77..7205a9085b4de23edf68ae194b20c54ceacc029e 100644 (file)
@@ -63,24 +63,6 @@ EXPORT_SYMBOL(memstart_addr);
 
 phys_addr_t arm64_dma_phys_limit __ro_after_init;
 
-#ifdef CONFIG_BLK_DEV_INITRD
-static int __init early_initrd(char *p)
-{
-       unsigned long start, size;
-       char *endp;
-
-       start = memparse(p, &endp);
-       if (*endp == ',') {
-               size = memparse(endp + 1, NULL);
-
-               initrd_start = start;
-               initrd_end = start + size;
-       }
-       return 0;
-}
-early_param("initrd", early_initrd);
-#endif
-
 #ifdef CONFIG_KEXEC_CORE
 /*
  * reserve_crashkernel() - reserves memory for crash kernel
@@ -417,14 +399,14 @@ void __init arm64_memblock_init(void)
                memblock_add(__pa_symbol(_text), (u64)(_end - _text));
        }
 
-       if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) {
+       if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_initrd_size) {
                /*
                 * Add back the memory we just removed if it results in the
                 * initrd to become inaccessible via the linear mapping.
                 * Otherwise, this is a no-op
                 */
-               u64 base = initrd_start & PAGE_MASK;
-               u64 size = PAGE_ALIGN(initrd_end) - base;
+               u64 base = phys_initrd_start & PAGE_MASK;
+               u64 size = PAGE_ALIGN(phys_initrd_size);
 
                /*
                 * We can only add back the initrd memory if we don't end up
@@ -457,7 +439,7 @@ void __init arm64_memblock_init(void)
                 * memory spans, randomize the linear region as well.
                 */
                if (memstart_offset_seed > 0 && range >= ARM64_MEMSTART_ALIGN) {
-                       range = range / ARM64_MEMSTART_ALIGN + 1;
+                       range /= ARM64_MEMSTART_ALIGN;
                        memstart_addr -= ARM64_MEMSTART_ALIGN *
                                         ((range * memstart_offset_seed) >> 16);
                }
@@ -468,15 +450,11 @@ void __init arm64_memblock_init(void)
         * pagetables with memblock.
         */
        memblock_reserve(__pa_symbol(_text), _end - _text);
-#ifdef CONFIG_BLK_DEV_INITRD
-       if (initrd_start) {
-               memblock_reserve(initrd_start, initrd_end - initrd_start);
-
+       if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_initrd_size) {
                /* the generic initrd code expects virtual addresses */
-               initrd_start = __phys_to_virt(initrd_start);
-               initrd_end = __phys_to_virt(initrd_end);
+               initrd_start = __phys_to_virt(phys_initrd_start);
+               initrd_end = initrd_start + phys_initrd_size;
        }
-#endif
 
        early_init_fdt_scan_reserved_mem();