nios2: use generic early_init_dt_add_memory_arch
authorMike Rapoport <rppt@linux.vnet.ibm.com>
Fri, 26 Oct 2018 22:04:51 +0000 (15:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Oct 2018 23:25:20 +0000 (16:25 -0700)
All we have to do is to enable memblock, the generic FDT code will take
care of the rest.

Link: http://lkml.kernel.org/r/1533326330-31677-4-git-send-email-rppt@linux.vnet.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rob Herring <robh@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/nios2/Kconfig
arch/nios2/kernel/prom.c
arch/nios2/kernel/setup.c

index 03965692fbfe2d22b20e947d1ce1e36428d2f41a..fd29f438ea702fe555696c8fc8ea88a94e478269 100644 (file)
@@ -23,6 +23,7 @@ config NIOS2
        select SPARSE_IRQ
        select USB_ARCH_HAS_HCD if USB_SUPPORT
        select CPU_NO_EFFICIENT_FFS
        select SPARSE_IRQ
        select USB_ARCH_HAS_HCD if USB_SUPPORT
        select CPU_NO_EFFICIENT_FFS
+       select HAVE_MEMBLOCK
 
 config GENERIC_CSUM
        def_bool y
 
 config GENERIC_CSUM
        def_bool y
index 8d7446a4b475f87a5292cfda2557115b0061413c..ba96a498ef136e1f96e7550ed338f849869e4589 100644 (file)
 
 #include <asm/sections.h>
 
 
 #include <asm/sections.h>
 
-void __init early_init_dt_add_memory_arch(u64 base, u64 size)
-{
-       u64 kernel_start = (u64)virt_to_phys(_text);
-
-       if (!memory_size &&
-           (kernel_start >= base) && (kernel_start < (base + size)))
-               memory_size = size;
-
-}
-
 int __init early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
                                             bool nomap)
 {
 int __init early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
                                             bool nomap)
 {
index 926a02b17b31f36df84655176aa5757f3b13a4a9..0946840ac3cdd042c464d6a63797e1ab6593309c 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/sched/task.h>
 #include <linux/console.h>
 #include <linux/bootmem.h>
 #include <linux/sched/task.h>
 #include <linux/console.h>
 #include <linux/bootmem.h>
+#include <linux/memblock.h>
 #include <linux/initrd.h>
 #include <linux/of_fdt.h>
 #include <linux/screen_info.h>
 #include <linux/initrd.h>
 #include <linux/of_fdt.h>
 #include <linux/screen_info.h>
@@ -147,6 +148,7 @@ void __init setup_arch(char **cmdline_p)
 
        console_verbose();
 
 
        console_verbose();
 
+       memory_size = memblock_phys_mem_size();
        memory_start = PAGE_ALIGN((unsigned long)__pa(_end));
        memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size;
 
        memory_start = PAGE_ALIGN((unsigned long)__pa(_end));
        memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size;