Merge tag 'm68k-for-v4.20-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 20 Dec 2018 15:35:16 +0000 (07:35 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 20 Dec 2018 15:35:16 +0000 (07:35 -0800)
Pull m68k fix from Geert Uytterhoeven:
 "Fix memblock-related crashes"

* tag 'm68k-for-v4.20-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
  m68k: Fix memblock-related crashes

1  2 
arch/m68k/kernel/setup_mm.c
arch/m68k/mm/motorola.c

@@@ -20,6 -20,7 +20,6 @@@
  #include <linux/errno.h>
  #include <linux/string.h>
  #include <linux/init.h>
 -#include <linux/bootmem.h>
  #include <linux/memblock.h>
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
@@@ -164,8 -165,6 +164,6 @@@ static void __init m68k_parse_bootinfo(
                                        be32_to_cpu(m->addr);
                                m68k_memory[m68k_num_memory].size =
                                        be32_to_cpu(m->size);
-                               memblock_add(m68k_memory[m68k_num_memory].addr,
-                                            m68k_memory[m68k_num_memory].size);
                                m68k_num_memory++;
                        } else
                                pr_warn("%s: too many memory chunks\n",
diff --combined arch/m68k/mm/motorola.c
@@@ -18,6 -18,7 +18,6 @@@
  #include <linux/string.h>
  #include <linux/types.h>
  #include <linux/init.h>
 -#include <linux/bootmem.h>
  #include <linux/memblock.h>
  #include <linux/gfp.h>
  
@@@ -54,7 -55,7 +54,7 @@@ static pte_t * __init kernel_page_table
  {
        pte_t *ptablep;
  
 -      ptablep = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE);
 +      ptablep = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
  
        clear_page(ptablep);
        __flush_page_to_ram(ptablep);
@@@ -94,8 -95,7 +94,8 @@@ static pmd_t * __init kernel_ptr_table(
  
        last_pgtable += PTRS_PER_PMD;
        if (((unsigned long)last_pgtable & ~PAGE_MASK) == 0) {
 -              last_pgtable = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
 +              last_pgtable = (pmd_t *)memblock_alloc_low(PAGE_SIZE,
 +                                                         PAGE_SIZE);
  
                clear_page(last_pgtable);
                __flush_page_to_ram(last_pgtable);
@@@ -228,6 -228,7 +228,7 @@@ void __init paging_init(void
  
        min_addr = m68k_memory[0].addr;
        max_addr = min_addr + m68k_memory[0].size;
+       memblock_add(m68k_memory[0].addr, m68k_memory[0].size);
        for (i = 1; i < m68k_num_memory;) {
                if (m68k_memory[i].addr < min_addr) {
                        printk("Ignoring memory chunk at 0x%lx:0x%lx before the first chunk\n",
                                (m68k_num_memory - i) * sizeof(struct m68k_mem_info));
                        continue;
                }
+               memblock_add(m68k_memory[i].addr, m68k_memory[i].size);
                addr = m68k_memory[i].addr + m68k_memory[i].size;
                if (addr > max_addr)
                        max_addr = addr;
         * initialize the bad page table and bad page to point
         * to a couple of allocated pages
         */
 -      empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
 +      empty_zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
  
        /*
         * Set up SFC/DFC registers