All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: ralink: use memblock instead of rescanning the FDT
@ 2018-03-28  1:14 Rob Herring
  2018-05-02  2:38 ` Rob Herring
       [not found] ` <20180508233758.GE14903@jamesdev>
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring @ 2018-03-28  1:14 UTC (permalink / raw)
  To: James Hogan; +Cc: John Crispin, Ralf Baechle, linux-mips

There's no need to scan /memory nodes twice. The DT core code scans
nodes and adds memblocks already, so we can just use
memblock_phys_mem_size() to see if we have any memory already setup.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: John Crispin <john@phrozen.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/ralink/of.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 1ada8492733b..cf3b01b5c624 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -14,7 +14,7 @@
 #include <linux/sizes.h>
 #include <linux/of_fdt.h>
 #include <linux/kernel.h>
-#include <linux/bootmem.h>
+#include <linux/memblock.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
 
@@ -53,17 +53,6 @@ void __init device_tree_init(void)
 	unflatten_and_copy_device_tree();
 }
 
-static int memory_dtb;
-
-static int __init early_init_dt_find_memory(unsigned long node,
-				const char *uname, int depth, void *data)
-{
-	if (depth == 1 && !strcmp(uname, "memory@0"))
-		memory_dtb = 1;
-
-	return 0;
-}
-
 void __init plat_mem_setup(void)
 {
 	void *dtb = NULL;
@@ -82,10 +71,10 @@ void __init plat_mem_setup(void)
 
 	__dt_setup_arch(dtb);
 
-	of_scan_flat_dt(early_init_dt_find_memory, NULL);
-	if (memory_dtb)
-		of_scan_flat_dt(early_init_dt_scan_memory, NULL);
-	else if (soc_info.mem_size)
+	if (memblock_phys_mem_size())
+		return;
+
+	if (soc_info.mem_size)
 		add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
 				  BOOT_MEM_RAM);
 	else
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: ralink: use memblock instead of rescanning the FDT
  2018-03-28  1:14 [PATCH] MIPS: ralink: use memblock instead of rescanning the FDT Rob Herring
@ 2018-05-02  2:38 ` Rob Herring
       [not found] ` <20180508233758.GE14903@jamesdev>
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2018-05-02  2:38 UTC (permalink / raw)
  To: James Hogan; +Cc: John Crispin, Ralf Baechle, Linux-MIPS

On Tue, Mar 27, 2018 at 8:14 PM, Rob Herring <robh@kernel.org> wrote:
> There's no need to scan /memory nodes twice. The DT core code scans
> nodes and adds memblocks already, so we can just use
> memblock_phys_mem_size() to see if we have any memory already setup.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: John Crispin <john@phrozen.org>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: James Hogan <jhogan@kernel.org>
> Cc: linux-mips@linux-mips.org
> ---
>  arch/mips/ralink/of.c | 21 +++++----------------
>  1 file changed, 5 insertions(+), 16 deletions(-)

Ping. Can MIPS maintainers please pick this up.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: ralink: use memblock instead of rescanning the FDT
       [not found] ` <20180508233758.GE14903@jamesdev>
@ 2018-05-10 12:55   ` Rob Herring
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Herring @ 2018-05-10 12:55 UTC (permalink / raw)
  To: James Hogan; +Cc: John Crispin, Ralf Baechle, Linux-MIPS

On Tue, May 8, 2018 at 6:38 PM, James Hogan <jhogan@kernel.org> wrote:
> On Tue, Mar 27, 2018 at 08:14:35PM -0500, Rob Herring wrote:
>> There's no need to scan /memory nodes twice. The DT core code scans
>> nodes and adds memblocks already, so we can just use
>> memblock_phys_mem_size() to see if we have any memory already setup.
>
> Hmm, on MIPS, early_init_dt_add_memory_arch() calls add_memory_region(),
> which just modifies boot_mem_map. memblock isn't notified until after
> plat_mem_setup() returns, in bootmem_init().

Yes, you're right. I guess first boot_mem_map needs to be converted to memblock.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-14  6:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28  1:14 [PATCH] MIPS: ralink: use memblock instead of rescanning the FDT Rob Herring
2018-05-02  2:38 ` Rob Herring
     [not found] ` <20180508233758.GE14903@jamesdev>
2018-05-10 12:55   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.