linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/17] <asm/sections.h> related cleanups
@ 2013-11-12 19:42 Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h> Geert Uytterhoeven
                   ` (21 more replies)
  0 siblings, 22 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch, linux-kernel

	Hi all,

This started as a small cleanup in the OpenRISC code, but then I got
pulled into the pool of all section-related symbols, many of which are
different or duplicated.

    [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h>
    [PATCH 02/17] cris: Use Kbuild logic to include <asm-generic/sections.h>
    [PATCH 03/17] m32r: Use Kbuild logic to include <asm-generic/sections.h>
    [PATCH 04/17] mn10300: Use Kbuild logic to include <asm-generic/sections.h>
    [PATCH 05/17] score: Use Kbuild logic to include <asm-generic/sections.h>
    [PATCH 06/17] frv: Remove unused declarations of __start___ex_table
    [PATCH 07/17] ia64: Remove duplicate declarations of  __per_cpu_start[]
    [PATCH 08/17] microblaze: Remove _fdt_start casts
    [PATCH 09/17] microblaze: Remove duplicate declarations of _stext[]
    [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
    [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in
    [PATCH 12/17] nosave: Consolidate __nosave_{begin,end} in
    [PATCH 13/17] openrisc: Refactor or32_early_setup()
    [PATCH 14/17] dt: Consolidate __dtb_start declarations in
    [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
    [PATCH RFC 16/17] c6x: Convert from _fdt_start to __dtb_start
    [PATCH 17/17] um: Remove unused declarations from <as-layout.h>

Most of this has been compile-tested. Notable exceptions are the changes
to arc, c6x, and score code, due to lack of cross-compilers.

Patches 15 and 16 are RFCs, as these make non-trivial changes, and I
couldn't test them.

Thanks for applying/comments/...!

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 21:23   ` Richard Henderson
  2013-11-12 19:42 ` [PATCH 02/17] cris: " Geert Uytterhoeven
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Richard Henderson,
	linux-alpha

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: linux-alpha@vger.kernel.org
---
 arch/alpha/include/asm/Kbuild     |    2 +-
 arch/alpha/include/asm/sections.h |    7 -------
 2 files changed, 1 insertion(+), 8 deletions(-)
 delete mode 100644 arch/alpha/include/asm/sections.h

diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index f01fb505ad52..cd33bcfc49d8 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -1,6 +1,6 @@
 
 generic-y += clkdev.h
-
 generic-y += exec.h
+generic-y += sections.h
 generic-y += trace_clock.h
 generic-y += preempt.h
diff --git a/arch/alpha/include/asm/sections.h b/arch/alpha/include/asm/sections.h
deleted file mode 100644
index 43b40edd6e44..000000000000
--- a/arch/alpha/include/asm/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _ALPHA_SECTIONS_H
-#define _ALPHA_SECTIONS_H
-
-/* nothing to see, move along */
-#include <asm-generic/sections.h>
-
-#endif
-- 
1.7.9.5


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

* [PATCH 02/17] cris: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h> Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-15 16:52   ` Jesper Nilsson
  2013-11-12 19:42 ` [PATCH 03/17] m32r: " Geert Uytterhoeven
                   ` (19 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Mikael Starvik,
	Jesper Nilsson, linux-cris-kernel

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: linux-cris-kernel@axis.com
---
 arch/cris/include/asm/Kbuild     |    1 +
 arch/cris/include/asm/sections.h |    7 -------
 2 files changed, 1 insertion(+), 7 deletions(-)
 delete mode 100644 arch/cris/include/asm/sections.h

diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index b06caf649a95..44e7d0dbcf32 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += exec.h
 generic-y += kvm_para.h
 generic-y += linkage.h
 generic-y += module.h
+generic-y += sections.h
 generic-y += trace_clock.h
 generic-y += vga.h
 generic-y += xor.h
diff --git a/arch/cris/include/asm/sections.h b/arch/cris/include/asm/sections.h
deleted file mode 100644
index 2c998ce8967b..000000000000
--- a/arch/cris/include/asm/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _CRIS_SECTIONS_H
-#define _CRIS_SECTIONS_H
-
-/* nothing to see, move along */
-#include <asm-generic/sections.h>
-
-#endif
-- 
1.7.9.5


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

* [PATCH 03/17] m32r: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h> Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 02/17] cris: " Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 04/17] mn10300: " Geert Uytterhoeven
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Hirokazu Takata,
	linux-m32r

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: linux-m32r@ml.linux-m32r.org
---
 arch/m32r/include/asm/Kbuild     |    1 +
 arch/m32r/include/asm/sections.h |    7 -------
 2 files changed, 1 insertion(+), 7 deletions(-)
 delete mode 100644 arch/m32r/include/asm/sections.h

diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index 2b58c5f0bc38..e03862db9b75 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -2,5 +2,6 @@
 generic-y += clkdev.h
 generic-y += exec.h
 generic-y += module.h
+generic-y += sections.h
 generic-y += trace_clock.h
 generic-y += preempt.h
diff --git a/arch/m32r/include/asm/sections.h b/arch/m32r/include/asm/sections.h
deleted file mode 100644
index 5e5d21c4908a..000000000000
--- a/arch/m32r/include/asm/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _M32R_SECTIONS_H
-#define _M32R_SECTIONS_H
-
-/* nothing to see, move along */
-#include <asm-generic/sections.h>
-
-#endif	/* _M32R_SECTIONS_H */
-- 
1.7.9.5


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

* [PATCH 04/17] mn10300: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 03/17] m32r: " Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 05/17] score: " Geert Uytterhoeven
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, David Howells,
	linux-am33-list

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Howells <dhowells@redhat.com>
Cc: linux-am33-list@redhat.com
---
 arch/mn10300/include/asm/Kbuild     |    1 +
 arch/mn10300/include/asm/sections.h |    1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 100644 arch/mn10300/include/asm/sections.h

diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index 74742dc6a3da..cd33bcfc49d8 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -1,5 +1,6 @@
 
 generic-y += clkdev.h
 generic-y += exec.h
+generic-y += sections.h
 generic-y += trace_clock.h
 generic-y += preempt.h
diff --git a/arch/mn10300/include/asm/sections.h b/arch/mn10300/include/asm/sections.h
deleted file mode 100644
index 2b8c5160388f..000000000000
--- a/arch/mn10300/include/asm/sections.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/sections.h>
-- 
1.7.9.5


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

* [PATCH 05/17] score: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 04/17] mn10300: " Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-15 18:05   ` Lennox Wu
  2013-11-12 19:42 ` [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table Geert Uytterhoeven
                   ` (16 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Chen Liqin, Lennox Wu

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Chen Liqin <liqin.linux@gmail.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
---
 arch/score/include/asm/Kbuild     |    1 +
 arch/score/include/asm/sections.h |    6 ------
 2 files changed, 1 insertion(+), 6 deletions(-)
 delete mode 100644 arch/score/include/asm/sections.h

diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index f3414ade77a3..32cd967c19a4 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -2,6 +2,7 @@
 header-y +=
 
 generic-y += clkdev.h
+generic-y += sections.h
 generic-y += trace_clock.h
 generic-y += xor.h
 generic-y += preempt.h
diff --git a/arch/score/include/asm/sections.h b/arch/score/include/asm/sections.h
deleted file mode 100644
index 9441d23af005..000000000000
--- a/arch/score/include/asm/sections.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_SCORE_SECTIONS_H
-#define _ASM_SCORE_SECTIONS_H
-
-#include <asm-generic/sections.h>
-
-#endif /* _ASM_SCORE_SECTIONS_H */
-- 
1.7.9.5


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

* [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 05/17] score: " Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 07/17] ia64: Remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[] Geert Uytterhoeven
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch, linux-kernel, Geert Uytterhoeven, David Howells

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Howells <dhowells@redhat.com>
---
 arch/frv/mm/extable.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/frv/mm/extable.c b/arch/frv/mm/extable.c
index 6aea124f574d..2fb9b3ab57b9 100644
--- a/arch/frv/mm/extable.c
+++ b/arch/frv/mm/extable.c
@@ -6,8 +6,6 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 
-extern const struct exception_table_entry __attribute__((aligned(8))) __start___ex_table[];
-extern const struct exception_table_entry __attribute__((aligned(8))) __stop___ex_table[];
 extern const void __memset_end, __memset_user_error_lr, __memset_user_error_handler;
 extern const void __memcpy_end, __memcpy_user_error_lr, __memcpy_user_error_handler;
 extern spinlock_t modlist_lock;
-- 
1.7.9.5


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

* [PATCH 07/17] ia64: Remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[]
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 08/17] microblaze: Remove _fdt_start casts Geert Uytterhoeven
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Tony Luck, linux-ia64

They're already provided by <asm/sections.h>.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org
---
 arch/ia64/include/asm/sections.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h
index 1a873b36a4a1..2ab2003698ef 100644
--- a/arch/ia64/include/asm/sections.h
+++ b/arch/ia64/include/asm/sections.h
@@ -10,7 +10,7 @@
 #include <linux/uaccess.h>
 #include <asm-generic/sections.h>
 
-extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[];
+extern char __phys_per_cpu_start[];
 #ifdef	CONFIG_SMP
 extern char __cpu0_per_cpu[];
 #endif
-- 
1.7.9.5


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

* [PATCH 08/17] microblaze: Remove _fdt_start casts
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 07/17] ia64: Remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[] Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-13 10:08   ` Michal Simek
  2013-11-12 19:42 ` [PATCH 09/17] microblaze: Remove duplicate declarations of _stext[] and _etext[] Geert Uytterhoeven
                   ` (13 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Michal Simek,
	microblaze-uclinux

_fdt_start is an array, i.e. a pointer.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
---
 arch/microblaze/kernel/setup.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 8de8ebc309f1..603e22fec6d5 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -136,7 +136,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
 	lockdep_init();
 
 /* initialize device tree for usage in early_printk */
-	early_init_devtree((void *)_fdt_start);
+	early_init_devtree(_fdt_start);
 
 #ifdef CONFIG_EARLY_PRINTK
 	setup_early_printk(NULL);
@@ -152,8 +152,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
 	if (fdt)
 		pr_info("FDT at 0x%08x\n", fdt);
 	else
-		pr_info("Compiled-in FDT at 0x%08x\n",
-					(unsigned int)_fdt_start);
+		pr_info("Compiled-in FDT at %p\n", _fdt_start);
 
 #ifdef CONFIG_MTD_UCLINUX
 	pr_info("Found romfs @ 0x%08x (0x%08x)\n",
-- 
1.7.9.5


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

* [PATCH 09/17] microblaze: Remove duplicate declarations of _stext[] and _etext[]
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (7 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 08/17] microblaze: Remove _fdt_start casts Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata Geert Uytterhoeven
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Michal Simek,
	microblaze-uclinux

They're already provided by <asm/sections.h>.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
---
 arch/microblaze/include/asm/sections.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/microblaze/include/asm/sections.h b/arch/microblaze/include/asm/sections.h
index c07ed5d2a820..1b281d3ea734 100644
--- a/arch/microblaze/include/asm/sections.h
+++ b/arch/microblaze/include/asm/sections.h
@@ -16,7 +16,6 @@
 # ifndef __ASSEMBLY__
 extern char _ssbss[], _esbss[];
 extern unsigned long __ivt_start[], __ivt_end[];
-extern char _etext[], _stext[];
 
 extern u32 _fdt_start[], _fdt_end[];
 
-- 
1.7.9.5


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

* [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (8 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 09/17] microblaze: Remove duplicate declarations of _stext[] and _etext[] Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-14  0:09   ` Chris Metcalf
  2013-11-12 19:42 ` [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h> Geert Uytterhoeven
                   ` (11 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Chris Metcalf

Use standard __init_begin and __init_end instead.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Chris Metcalf <cmetcalf@tilera.com>
---
 arch/tile/include/asm/sections.h |    3 ---
 arch/tile/kernel/vmlinux.lds.S   |    2 --
 arch/tile/mm/init.c              |   18 +++++++++---------
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/arch/tile/include/asm/sections.h b/arch/tile/include/asm/sections.h
index 5d5d3b739a6b..86a746243dc8 100644
--- a/arch/tile/include/asm/sections.h
+++ b/arch/tile/include/asm/sections.h
@@ -19,9 +19,6 @@
 
 #include <asm-generic/sections.h>
 
-/* Text and data are at different areas in the kernel VA space. */
-extern char _sinitdata[], _einitdata[];
-
 /* Write-once data is writable only till the end of initialization. */
 extern char __w1data_begin[], __w1data_end[];
 
diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S
index f1819423ffc9..0e059a0101ea 100644
--- a/arch/tile/kernel/vmlinux.lds.S
+++ b/arch/tile/kernel/vmlinux.lds.S
@@ -66,11 +66,9 @@ SECTIONS
 
   . = ALIGN(PAGE_SIZE);
   __init_begin = .;
-  VMLINUX_SYMBOL(_sinitdata) = .;
   INIT_DATA_SECTION(16) :data =0
   PERCPU_SECTION(L2_CACHE_BYTES)
   . = ALIGN(PAGE_SIZE);
-  VMLINUX_SYMBOL(_einitdata) = .;
   __init_end = .;
 
   _sdata = .;                   /* Start of data section */
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 0fa1acfac79a..c4e0b6ddb48c 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -254,7 +254,7 @@ static pgprot_t __init init_pgprot(ulong address)
 	 * Everything else that isn't data or bss is heap, so mark it
 	 * with the initial heap home (hash-for-home, or this cpu).  This
 	 * includes any addresses after the loaded image and any address before
-	 * _einitdata, since we already captured the case of text before
+	 * __init_end, since we already captured the case of text before
 	 * _sinittext, and __pa(einittext) is approximately __pa(sinitdata).
 	 *
 	 * All the LOWMEM pages that we mark this way will get their
@@ -263,7 +263,7 @@ static pgprot_t __init init_pgprot(ulong address)
 	 * homes, but with a zero free_time we don't have to actually
 	 * do a flush action the first time we use them, either.
 	 */
-	if (address >= (ulong) _end || address < (ulong) _einitdata)
+	if (address >= (ulong) _end || address < (ulong) __init_end)
 		return construct_pgprot(PAGE_KERNEL, initial_heap_home());
 
 	/* Use hash-for-home if requested for data/bss. */
@@ -534,7 +534,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
 
 		BUG_ON(address != (unsigned long)_text);
 		pte = NULL;
-		for (; address < (unsigned long)_einittext;
+		for (; address < (unsigned long)__init_end;
 		     pfn++, address += PAGE_SIZE) {
 			pte_ofs = pte_index(address);
 			if (pte_ofs == 0) {
@@ -572,7 +572,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
 		else
 			pteval = hv_pte_set_mode(pteval,
 						 HV_PTE_MODE_CACHE_NO_L3);
-		for (; address < (unsigned long)_einittext;
+		for (; address < (unsigned long)__init_end;
 		     pfn += PFN_DOWN(HPAGE_SIZE), address += HPAGE_SIZE)
 			*(pte_t *)(pmd++) = pfn_pte(pfn, pteval);
 	}
@@ -632,9 +632,9 @@ int devmem_is_allowed(unsigned long pagenr)
 {
 	return pagenr < kaddr_to_pfn(_end) &&
 		!(pagenr >= kaddr_to_pfn(&init_thread_union) ||
-		  pagenr < kaddr_to_pfn(_einitdata)) &&
+		  pagenr < kaddr_to_pfn(__init_end)) &&
 		!(pagenr >= kaddr_to_pfn(_sinittext) ||
-		  pagenr <= kaddr_to_pfn(_einittext-1));
+		  pagenr <= kaddr_to_pfn(__init_end-1));
 }
 
 #ifdef CONFIG_HIGHMEM
@@ -975,8 +975,8 @@ void free_initmem(void)
 
 	/* Free the data pages that we won't use again after init. */
 	free_init_pages("unused kernel data",
-			(unsigned long)_sinitdata,
-			(unsigned long)_einitdata);
+			(unsigned long)__init_begin,
+			(unsigned long)__init_end);
 
 	/*
 	 * Free the pages mapped from 0xc0000000 that correspond to code
@@ -984,7 +984,7 @@ void free_initmem(void)
 	 */
 	free_init_pages("unused kernel text",
 			(unsigned long)_sinittext - text_delta,
-			(unsigned long)_einittext - text_delta);
+			(unsigned long)__init_end - text_delta);
 	/* Do a global TLB flush so everyone sees the changes. */
 	flush_tlb_all();
 }
-- 
1.7.9.5


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

* [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (9 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-14  4:01   ` Rusty Russell
  2013-11-12 19:42 ` [PATCH 12/17] nosave: Consolidate __nosave_{begin,end} in <asm/sections.h> Geert Uytterhoeven
                   ` (10 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Rusty Russell

Consolidate the various external const and non-const declarations of
__start___param[] and __stop___param in <linux/moduleparam.h>.
This requires making a few struct kernel_param pointers in kernel/params.c
const.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
 include/linux/moduleparam.h |    2 ++
 init/main.c                 |    2 --
 kernel/params.c             |    7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index c3eb102a9cc8..77ccfca0c4ba 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -68,6 +68,8 @@ struct kernel_param {
 	};
 };
 
+extern const struct kernel_param __start___param[], __stop___param[];
+
 /* Special one for strings we want to copy into */
 struct kparam_string {
 	unsigned int maxlen;
diff --git a/init/main.c b/init/main.c
index 15ed159b681b..f2c4901f90d1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -469,7 +469,6 @@ static void __init mm_init(void)
 asmlinkage void __init start_kernel(void)
 {
 	char * command_line;
-	extern const struct kernel_param __start___param[], __stop___param[];
 
 	/*
 	 * Need to run as early as possible, to initialize the
@@ -737,7 +736,6 @@ static char *initcall_level_names[] __initdata = {
 
 static void __init do_initcall_level(int level)
 {
-	extern const struct kernel_param __start___param[], __stop___param[];
 	initcall_t *fn;
 
 	strcpy(static_command_line, saved_command_line);
diff --git a/kernel/params.c b/kernel/params.c
index c00d5b502aa4..54e05ffb7d24 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -19,6 +19,7 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -506,8 +507,6 @@ EXPORT_SYMBOL(param_ops_string);
 #define to_module_attr(n) container_of(n, struct module_attribute, attr)
 #define to_module_kobject(n) container_of(n, struct module_kobject, kobj)
 
-extern struct kernel_param __start___param[], __stop___param[];
-
 struct param_attribute
 {
 	struct module_attribute mattr;
@@ -766,7 +765,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name)
 }
 
 static void __init kernel_add_sysfs_param(const char *name,
-					  struct kernel_param *kparam,
+					  const struct kernel_param *kparam,
 					  unsigned int name_skip)
 {
 	struct module_kobject *mk;
@@ -801,7 +800,7 @@ static void __init kernel_add_sysfs_param(const char *name,
  */
 static void __init param_sysfs_builtin(void)
 {
-	struct kernel_param *kp;
+	const struct kernel_param *kp;
 	unsigned int name_len;
 	char modname[MODULE_NAME_LEN];
 
-- 
1.7.9.5


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

* [PATCH 12/17] nosave: Consolidate __nosave_{begin,end} in <asm/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (10 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h> Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 19:42 ` [PATCH 13/17] openrisc: Refactor or32_early_setup() Geert Uytterhoeven
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Ralf Baechle,
	Benjamin Herrenschmidt, Martin Schwidefsky, Paul Mundt,
	David S. Miller, Guan Xuetao, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin

The different architectures used their own (and different) declarations:

    extern __visible const void __nosave_begin, __nosave_end;
    extern const void __nosave_begin, __nosave_end;
    extern long __nosave_begin, __nosave_end;

Consolidate them using the first variant in <asm/sections.h>.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
 arch/mips/include/asm/suspend.h   |    7 -------
 arch/mips/power/cpu.c             |    2 +-
 arch/powerpc/kernel/suspend.c     |    4 +---
 arch/s390/kernel/suspend.c        |    6 +-----
 arch/sh/include/asm/sections.h    |    1 -
 arch/sparc/power/hibernate.c      |    4 +---
 arch/unicore32/include/mach/pm.h  |    3 ---
 arch/unicore32/kernel/hibernate.c |    1 +
 arch/x86/power/hibernate_32.c     |    4 +---
 arch/x86/power/hibernate_64.c     |    4 +---
 include/asm-generic/sections.h    |    4 ++++
 11 files changed, 11 insertions(+), 29 deletions(-)
 delete mode 100644 arch/mips/include/asm/suspend.h

diff --git a/arch/mips/include/asm/suspend.h b/arch/mips/include/asm/suspend.h
deleted file mode 100644
index 3adac3b53d19..000000000000
--- a/arch/mips/include/asm/suspend.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __ASM_SUSPEND_H
-#define __ASM_SUSPEND_H
-
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
-#endif /* __ASM_SUSPEND_H */
diff --git a/arch/mips/power/cpu.c b/arch/mips/power/cpu.c
index 521e5963df05..2129e67723ff 100644
--- a/arch/mips/power/cpu.c
+++ b/arch/mips/power/cpu.c
@@ -7,7 +7,7 @@
  * Author: Hu Hongbing <huhb@lemote.com>
  *	   Wu Zhangjin <wuzhangjin@gmail.com>
  */
-#include <asm/suspend.h>
+#include <asm/sections.h>
 #include <asm/fpu.h>
 #include <asm/dsp.h>
 
diff --git a/arch/powerpc/kernel/suspend.c b/arch/powerpc/kernel/suspend.c
index 0167d53da30c..a531154cc0f3 100644
--- a/arch/powerpc/kernel/suspend.c
+++ b/arch/powerpc/kernel/suspend.c
@@ -9,9 +9,7 @@
 
 #include <linux/mm.h>
 #include <asm/page.h>
-
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
+#include <asm/sections.h>
 
 /*
  *	pfn_is_nosave - check if given pfn is in the 'nosave' section
diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index a7a7537ce1e7..1c4c5accd220 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -13,14 +13,10 @@
 #include <asm/ipl.h>
 #include <asm/cio.h>
 #include <asm/pci.h>
+#include <asm/sections.h>
 #include "entry.h"
 
 /*
- * References to section boundaries
- */
-extern const void __nosave_begin, __nosave_end;
-
-/*
  * The restore of the saved pages in an hibernation image will set
  * the change and referenced bits in the storage key for each page.
  * Overindication of the referenced bits after an hibernation cycle
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h
index 1b6199740e98..7a99e6af6372 100644
--- a/arch/sh/include/asm/sections.h
+++ b/arch/sh/include/asm/sections.h
@@ -3,7 +3,6 @@
 
 #include <asm-generic/sections.h>
 
-extern long __nosave_begin, __nosave_end;
 extern long __machvec_start, __machvec_end;
 extern char __uncached_start, __uncached_end;
 extern char __start_eh_frame[], __stop_eh_frame[];
diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c
index 42b0b8ce699a..17bd2e167e07 100644
--- a/arch/sparc/power/hibernate.c
+++ b/arch/sparc/power/hibernate.c
@@ -9,11 +9,9 @@
 #include <asm/hibernate.h>
 #include <asm/visasm.h>
 #include <asm/page.h>
+#include <asm/sections.h>
 #include <asm/tlb.h>
 
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
 struct saved_context saved_context;
 
 /*
diff --git a/arch/unicore32/include/mach/pm.h b/arch/unicore32/include/mach/pm.h
index 4dcd34ae194c..77b522694e74 100644
--- a/arch/unicore32/include/mach/pm.h
+++ b/arch/unicore32/include/mach/pm.h
@@ -36,8 +36,5 @@ extern int puv3_pm_enter(suspend_state_t state);
 /* Defined in hibernate_asm.S */
 extern int restore_image(pgd_t *resume_pg_dir, struct pbe *restore_pblist);
 
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
 extern struct pbe *restore_pblist;
 #endif
diff --git a/arch/unicore32/kernel/hibernate.c b/arch/unicore32/kernel/hibernate.c
index d75ef8b6cb56..9969ec374abb 100644
--- a/arch/unicore32/kernel/hibernate.c
+++ b/arch/unicore32/kernel/hibernate.c
@@ -18,6 +18,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
+#include <asm/sections.h>
 #include <asm/suspend.h>
 
 #include "mach/pm.h"
diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
index 7d28c885d238..291226b952a9 100644
--- a/arch/x86/power/hibernate_32.c
+++ b/arch/x86/power/hibernate_32.c
@@ -13,13 +13,11 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/mmzone.h>
+#include <asm/sections.h>
 
 /* Defined in hibernate_asm_32.S */
 extern int restore_image(void);
 
-/* References to section boundaries */
-extern const void __nosave_begin, __nosave_end;
-
 /* Pointer to the temporary resume page tables */
 pgd_t *resume_pg_dir;
 
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index 304fca20d96e..2276238fde6f 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -17,11 +17,9 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/mtrr.h>
+#include <asm/sections.h>
 #include <asm/suspend.h>
 
-/* References to section boundaries */
-extern __visible const void __nosave_begin, __nosave_end;
-
 /* Defined in hibernate_asm_64.S */
 extern asmlinkage int restore_image(void);
 
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index f1a24b5c3b90..b58fd667f87b 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -3,6 +3,8 @@
 
 /* References to section boundaries */
 
+#include <linux/compiler.h>
+
 /*
  * Usage guidelines:
  * _text, _data: architecture specific, don't use them in arch-independent code
@@ -37,6 +39,8 @@ extern char __start_rodata[], __end_rodata[];
 /* Start and end of .ctors section - used for constructor calls. */
 extern char __ctors_start[], __ctors_end[];
 
+extern __visible const void __nosave_begin, __nosave_end;
+
 /* function descriptor handling (if any).  Override
  * in asm/sections.h */
 #ifndef dereference_function_descriptor
-- 
1.7.9.5


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

* [PATCH 13/17] openrisc: Refactor or32_early_setup()
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (11 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 12/17] nosave: Consolidate __nosave_{begin,end} in <asm/sections.h> Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-15  9:59   ` Jonas Bonn
  2013-11-12 19:42 ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> Geert Uytterhoeven
                   ` (8 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Jonas Bonn, linux

  - Change fdt pointer (passed from head.S) from unsigned int to void *,
    which allows to kill a cast, and makes it compatible with __dtb_start.
  - Use pr_info(),
  - Extract common part.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux@lists.openrisc.net
---
 arch/openrisc/kernel/setup.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index d0e7693c67a3..4fc7ccc0a2cf 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -208,15 +208,15 @@ void __init setup_cpuinfo(void)
  * Falls back on built-in device tree in case null pointer is passed.
  */
 
-void __init or32_early_setup(unsigned int fdt)
+void __init or32_early_setup(void *fdt)
 {
-	if (fdt) {
-		early_init_devtree((void*) fdt);
-		printk(KERN_INFO "FDT at 0x%08x\n", fdt);
-	} else {
-		early_init_devtree(__dtb_start);
-		printk(KERN_INFO "Compiled-in FDT at %p\n", __dtb_start);
+	if (fdt)
+		pr_info("FDT at %p\n", fdt);
+	else {
+		fdt = __dtb_start;
+		pr_info("Compiled-in FDT at %p\n", fdt);
 	}
+	early_init_devtree(fdt);
 }
 
 static int __init openrisc_device_probe(void)
-- 
1.7.9.5


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

* [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (12 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 13/17] openrisc: Refactor or32_early_setup() Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-13  5:41   ` Vineet Gupta
                     ` (2 more replies)
  2013-11-12 19:42 ` [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start Geert Uytterhoeven
                   ` (7 subsequent siblings)
  21 siblings, 3 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Vineet Gupta,
	James Hogan, Ralf Baechle, Jonas Bonn, Chris Zankel, Rob Herring,
	devicetree

The different architectures used their own (and different) declarations:

    extern struct boot_param_header __dtb_start;
    extern u32 __dtb_start[];
    extern char __dtb_start[];

Consolidate them using the first variant in <linux/of_fdt.h>.
This requires adding a few "address of" operators on architectures where
__dtb_start was an array before.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
CC: Chris Zankel <chris@zankel.net>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: devicetree@vger.kernel.org
---
 arch/arc/include/asm/sections.h             |    1 -
 arch/arc/kernel/setup.c                     |    2 +-
 arch/metag/kernel/setup.c                   |    6 +-----
 arch/mips/include/asm/mips-boards/generic.h |    4 ----
 arch/mips/lantiq/prom.h                     |    2 --
 arch/mips/netlogic/xlp/dt.c                 |    4 ++--
 arch/mips/ralink/of.c                       |    2 --
 arch/openrisc/kernel/setup.c                |    2 +-
 arch/openrisc/kernel/vmlinux.h              |    2 --
 arch/xtensa/kernel/setup.c                  |    3 +--
 include/linux/of_fdt.h                      |    3 +++
 11 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/arch/arc/include/asm/sections.h b/arch/arc/include/asm/sections.h
index 764f1e3ba752..09db952e14bd 100644
--- a/arch/arc/include/asm/sections.h
+++ b/arch/arc/include/asm/sections.h
@@ -12,6 +12,5 @@
 #include <asm-generic/sections.h>
 
 extern char __arc_dccm_base[];
-extern char __dtb_start[];
 
 #endif
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 643eae4436e0..ef705d0f50f5 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -314,7 +314,7 @@ void setup_processor(void)
 void __init setup_arch(char **cmdline_p)
 {
 	/* This also populates @boot_command_line from /bootargs */
-	machine_desc = setup_machine_fdt(__dtb_start);
+	machine_desc = setup_machine_fdt(&__dtb_start);
 	if (!machine_desc)
 		panic("Embedded DT invalid\n");
 
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 129c7cdda1ce..919c782f5479 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -105,10 +105,6 @@
 
 extern char _heap_start[];
 
-#ifdef CONFIG_METAG_BUILTIN_DTB
-extern u32 __dtb_start[];
-#endif
-
 #ifdef CONFIG_DA_CONSOLE
 /* Our early channel based console driver */
 extern struct console dash_console;
@@ -251,7 +247,7 @@ void __init setup_arch(char **cmdline_p)
 	if (!machine_desc) {
 #ifdef CONFIG_METAG_BUILTIN_DTB
 		/* try the embedded device tree */
-		machine_desc = setup_machine_fdt(__dtb_start);
+		machine_desc = setup_machine_fdt(&__dtb_start);
 		if (!machine_desc)
 			panic("Invalid embedded device tree.");
 #else
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
index 48616816bcbc..c904c24550f6 100644
--- a/arch/mips/include/asm/mips-boards/generic.h
+++ b/arch/mips/include/asm/mips-boards/generic.h
@@ -67,10 +67,6 @@
 
 extern int mips_revision_sconid;
 
-#ifdef CONFIG_OF
-extern struct boot_param_header __dtb_start;
-#endif
-
 #ifdef CONFIG_PCI
 extern void mips_pcibios_init(void);
 #else
diff --git a/arch/mips/lantiq/prom.h b/arch/mips/lantiq/prom.h
index 8e07b5f28ef1..bfd2d58c1d69 100644
--- a/arch/mips/lantiq/prom.h
+++ b/arch/mips/lantiq/prom.h
@@ -26,6 +26,4 @@ struct ltq_soc_info {
 extern void ltq_soc_detect(struct ltq_soc_info *i);
 extern void ltq_soc_init(void);
 
-extern struct boot_param_header __dtb_start;
-
 #endif
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 8316d5454b17..87250f378386 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -42,7 +42,7 @@
 #include <asm/prom.h>
 
 extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
-	__dtb_xlp_fvp_begin[], __dtb_start[];
+	__dtb_xlp_fvp_begin[];
 static void *xlp_fdt_blob;
 
 void __init *xlp_dt_init(void *fdtp)
@@ -66,7 +66,7 @@ void __init *xlp_dt_init(void *fdtp)
 #endif
 		default:
 			/* Pick a built-in if any, and hope for the best */
-			fdtp = __dtb_start;
+			fdtp = &__dtb_start;
 			break;
 		}
 	}
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index eccc5526155e..615603bd8063 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -28,8 +28,6 @@
 __iomem void *rt_sysc_membase;
 __iomem void *rt_memc_membase;
 
-extern struct boot_param_header __dtb_start;
-
 __iomem void *plat_of_remap_node(const char *node)
 {
 	struct resource res;
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index 4fc7ccc0a2cf..c9b880d64bb8 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -213,7 +213,7 @@ void __init or32_early_setup(void *fdt)
 	if (fdt)
 		pr_info("FDT at %p\n", fdt);
 	else {
-		fdt = __dtb_start;
+		fdt = &__dtb_start;
 		pr_info("Compiled-in FDT at %p\n", fdt);
 	}
 	early_init_devtree(fdt);
diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
index 70b9ce41835c..bbcdf21b0b35 100644
--- a/arch/openrisc/kernel/vmlinux.h
+++ b/arch/openrisc/kernel/vmlinux.h
@@ -5,6 +5,4 @@
 extern char __initrd_start, __initrd_end;
 #endif
 
-extern u32 __dtb_start[];
-
 #endif
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 6e2b6638122d..d96cf8f3fe70 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -68,8 +68,7 @@ extern int initrd_below_start_ok;
 #endif
 
 #ifdef CONFIG_OF
-extern u32 __dtb_start[];
-void *dtb_start = __dtb_start;
+void *dtb_start = &__dtb_start;
 #endif
 
 unsigned char aux_device_present;
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 0beaee9dac1f..aabc49f3e403 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -57,6 +57,9 @@ struct boot_param_header {
 	__be32	dt_struct_size;		/* size of the DT structure block */
 };
 
+/* For kernels with a built-in device tree */
+extern struct boot_param_header __dtb_start;
+
 #if defined(CONFIG_OF_FLATTREE)
 
 struct device_node;
-- 
1.7.9.5


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

* [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (13 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-13 10:19   ` Michal Simek
  2013-11-12 19:42 ` [PATCH RFC 16/17] c6x: " Geert Uytterhoeven
                   ` (6 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Michal Simek,
	Rob Herring, microblaze-uclinux, devicetree

Kill the microblaze-specific __fdt_blob section, and start using
.dtb.init.rodata from <asm-generic/sections.h> for built-in DTBs, like
most other DT enabled architectures.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: devicetree@vger.kernel.org
---
Untested, but the resulting vmlinux after "make simpleImage.system" looks
sane.

QUESTION: The padding of the DTB is gone, is this OK?

TODO: Start using the DTB logic in scripts/Makefile.lib instead of
      arch/microblaze/boot/dts/linked_dtb.S

 arch/microblaze/boot/Makefile          |    2 +-
 arch/microblaze/boot/dts/linked_dtb.S  |    2 +-
 arch/microblaze/include/asm/sections.h |    4 +---
 arch/microblaze/kernel/head.S          |    2 +-
 arch/microblaze/kernel/setup.c         |    4 ++--
 arch/microblaze/kernel/vmlinux.lds.S   |    8 --------
 6 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
index 8e211cc28dac..e4a99a22dab8 100644
--- a/arch/microblaze/boot/Makefile
+++ b/arch/microblaze/boot/Makefile
@@ -23,7 +23,7 @@ quiet_cmd_cp = CP      $< $@$2
 
 quiet_cmd_strip = STRIP   $@
 	cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
-				-K _fdt_start vmlinux -o $@
+				-K __dtb_start vmlinux -o $@
 
 UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)
 
diff --git a/arch/microblaze/boot/dts/linked_dtb.S b/arch/microblaze/boot/dts/linked_dtb.S
index 23345af3721f..bfc53b5795aa 100644
--- a/arch/microblaze/boot/dts/linked_dtb.S
+++ b/arch/microblaze/boot/dts/linked_dtb.S
@@ -1,2 +1,2 @@
-.section __fdt_blob,"a"
+.section .dtb.init.rodata,"a"
 .incbin "arch/microblaze/boot/dts/system.dtb"
diff --git a/arch/microblaze/include/asm/sections.h b/arch/microblaze/include/asm/sections.h
index 1b281d3ea734..fb8ab0ba03fc 100644
--- a/arch/microblaze/include/asm/sections.h
+++ b/arch/microblaze/include/asm/sections.h
@@ -16,8 +16,6 @@
 # ifndef __ASSEMBLY__
 extern char _ssbss[], _esbss[];
 extern unsigned long __ivt_start[], __ivt_end[];
-
-extern u32 _fdt_start[], _fdt_end[];
-
 # endif /* !__ASSEMBLY__ */
+
 #endif /* _ASM_MICROBLAZE_SECTIONS_H */
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index 817b7eec95b6..6108889f0025 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -94,7 +94,7 @@ big_endian:
 	bnei	r11, no_fdt_arg			/* No - get out of here */
 _prepare_copy_fdt:
 	or	r11, r0, r0 /* incremment */
-	ori	r4, r0, TOPHYS(_fdt_start)
+	ori	r4, r0, TOPHYS(__dtb_start)
 	ori	r3, r0, (0x8000 - 4)
 _copy_fdt:
 	lw	r12, r7, r11 /* r12 = r7 + r11 */
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 603e22fec6d5..a4534f584be0 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -136,7 +136,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
 	lockdep_init();
 
 /* initialize device tree for usage in early_printk */
-	early_init_devtree(_fdt_start);
+	early_init_devtree(&__dtb_start);
 
 #ifdef CONFIG_EARLY_PRINTK
 	setup_early_printk(NULL);
@@ -152,7 +152,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
 	if (fdt)
 		pr_info("FDT at 0x%08x\n", fdt);
 	else
-		pr_info("Compiled-in FDT at %p\n", _fdt_start);
+		pr_info("Compiled-in FDT at %p\n", &__dtb_start);
 
 #ifdef CONFIG_MTD_UCLINUX
 	pr_info("Found romfs @ 0x%08x (0x%08x)\n",
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
index 936d01a689d7..2659e70984a3 100644
--- a/arch/microblaze/kernel/vmlinux.lds.S
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -40,14 +40,6 @@ SECTIONS {
 		_etext = . ;
 	}
 
-	. = ALIGN (4) ;
-	__fdt_blob : AT(ADDR(__fdt_blob) - LOAD_OFFSET) {
-		_fdt_start = . ;		/* place for fdt blob */
-		*(__fdt_blob) ;			/* Any link-placed DTB */
-	        . = _fdt_start + 0x8000;	/* Pad up to 32kbyte */
-		_fdt_end = . ;
-	}
-
 	. = ALIGN(16);
 	RODATA
 	EXCEPTION_TABLE(16)
-- 
1.7.9.5


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

* [PATCH RFC 16/17] c6x: Convert from _fdt_start to __dtb_start
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (14 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 23:38   ` Mark Salter
  2013-11-12 19:42 ` [PATCH 17/17] um: Remove unused declarations from <as-layout.h> Geert Uytterhoeven
                   ` (5 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Aurelien Jacquiot,
	Rob Herring, linux-c6x-dev, devicetree

Kill the c6x-specific __fdt_blob section, and start using .dtb.init.rodata
from <asm-generic/sections.h> for built-in DTBs, like most other DT enabled
architectures.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: linux-c6x-dev@linux-c6x.org
Cc: devicetree@vger.kernel.org
---
Untested due to lack of cross-compiler, but the changes are similar to
microblaze.

QUESTION: The padding of the DTB is gone, is this OK?

TODO: Start using the DTB logic in scripts/Makefile.lib instead of
      arch/c6x/boot/dts/linked_dtb.S

 arch/c6x/boot/dts/linked_dtb.S  |    2 +-
 arch/c6x/include/asm/sections.h |    1 -
 arch/c6x/kernel/setup.c         |    2 +-
 arch/c6x/kernel/vmlinux.lds.S   |    9 ---------
 4 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/c6x/boot/dts/linked_dtb.S b/arch/c6x/boot/dts/linked_dtb.S
index cf347f1d16ce..a3447423abda 100644
--- a/arch/c6x/boot/dts/linked_dtb.S
+++ b/arch/c6x/boot/dts/linked_dtb.S
@@ -1,2 +1,2 @@
-.section __fdt_blob,"a"
+.section .dtb.init.rodata,"a"
 .incbin "arch/c6x/boot/dts/builtin.dtb"
diff --git a/arch/c6x/include/asm/sections.h b/arch/c6x/include/asm/sections.h
index f703989d837a..b0eeca16824f 100644
--- a/arch/c6x/include/asm/sections.h
+++ b/arch/c6x/include/asm/sections.h
@@ -7,6 +7,5 @@ extern char _vectors_start[];
 extern char _vectors_end[];
 
 extern char _data_lma[];
-extern char _fdt_start[], _fdt_end[];
 
 #endif /* _ASM_C6X_SECTIONS_H */
diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
index 731db4b9014d..414353027ba9 100644
--- a/arch/c6x/kernel/setup.c
+++ b/arch/c6x/kernel/setup.c
@@ -266,7 +266,7 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)
 notrace void __init machine_init(unsigned long dt_ptr)
 {
 	struct boot_param_header *dtb = __va(dt_ptr);
-	struct boot_param_header *fdt = (struct boot_param_header *)_fdt_start;
+	struct boot_param_header *fdt = &__dtb_start;
 
 	/* interrupts must be masked */
 	set_creg(IER, 2);
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index 5a6e141d1641..fea7f7a90f0f 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -88,15 +88,6 @@ SECTIONS
 	}
 
 	. = ALIGN (8) ;
-	__fdt_blob : AT(ADDR(__fdt_blob) - LOAD_OFFSET)
-	{
-		_fdt_start = . ;	/* place for fdt blob */
-		*(__fdt_blob) ;		/* Any link-placed DTB */
-		BYTE(0);		/* section always has contents */
-	        . = _fdt_start + 0x4000;	/* Pad up to 16kbyte */
-		_fdt_end = . ;
-	}
-
 	_etext = .;
 
 	/*
-- 
1.7.9.5


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

* [PATCH 17/17] um: Remove unused declarations from <as-layout.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (15 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH RFC 16/17] c6x: " Geert Uytterhoeven
@ 2013-11-12 19:42 ` Geert Uytterhoeven
  2013-11-12 19:51   ` Richard Weinberger
  2013-11-12 19:54 ` [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (4 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven, Richard Weinberger,
	user-mode-linux-devel

_end is used, but it's already provided by <asm/sections.h>, so use that.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: user-mode-linux-devel@lists.sourceforge.net
---
 arch/um/include/shared/as-layout.h |    3 ---
 arch/um/kernel/um_arch.c           |    1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h
index 694c792bab4e..41c8c774ec10 100644
--- a/arch/um/include/shared/as-layout.h
+++ b/arch/um/include/shared/as-layout.h
@@ -44,7 +44,6 @@ struct cpu_task {
 
 extern struct cpu_task cpu_tasks[];
 
-extern unsigned long low_physmem;
 extern unsigned long high_physmem;
 extern unsigned long uml_physmem;
 extern unsigned long uml_reserved;
@@ -52,8 +51,6 @@ extern unsigned long end_vm;
 extern unsigned long start_vm;
 extern unsigned long long highmem;
 
-extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end;
-extern unsigned long _unprotected_end;
 extern unsigned long brk_start;
 
 extern unsigned long host_task_size;
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 9fce866b0416..c44139833212 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -17,6 +17,7 @@
 #include <asm/byteorder.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
+#include <asm/sections.h>
 #include <asm/setup.h>
 #include <as-layout.h>
 #include <arch.h>
-- 
1.7.9.5


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

* Re: [PATCH 17/17] um: Remove unused declarations from <as-layout.h>
  2013-11-12 19:42 ` [PATCH 17/17] um: Remove unused declarations from <as-layout.h> Geert Uytterhoeven
@ 2013-11-12 19:51   ` Richard Weinberger
  2013-11-12 19:52     ` Geert Uytterhoeven
  0 siblings, 1 reply; 74+ messages in thread
From: Richard Weinberger @ 2013-11-12 19:51 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrew Morton
  Cc: linux-arch, linux-kernel, user-mode-linux-devel

Am 12.11.2013 20:42, schrieb Geert Uytterhoeven:
> _end is used, but it's already provided by <asm/sections.h>, so use that.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: user-mode-linux-devel@lists.sourceforge.net

Geert, do you want me to pickup this patch or takes Andrew the whole series?

Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard

> ---
>  arch/um/include/shared/as-layout.h |    3 ---
>  arch/um/kernel/um_arch.c           |    1 +
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h
> index 694c792bab4e..41c8c774ec10 100644
> --- a/arch/um/include/shared/as-layout.h
> +++ b/arch/um/include/shared/as-layout.h
> @@ -44,7 +44,6 @@ struct cpu_task {
>  
>  extern struct cpu_task cpu_tasks[];
>  
> -extern unsigned long low_physmem;
>  extern unsigned long high_physmem;
>  extern unsigned long uml_physmem;
>  extern unsigned long uml_reserved;
> @@ -52,8 +51,6 @@ extern unsigned long end_vm;
>  extern unsigned long start_vm;
>  extern unsigned long long highmem;
>  
> -extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end;
> -extern unsigned long _unprotected_end;
>  extern unsigned long brk_start;
>  
>  extern unsigned long host_task_size;
> diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
> index 9fce866b0416..c44139833212 100644
> --- a/arch/um/kernel/um_arch.c
> +++ b/arch/um/kernel/um_arch.c
> @@ -17,6 +17,7 @@
>  #include <asm/byteorder.h>
>  #include <asm/pgtable.h>
>  #include <asm/processor.h>
> +#include <asm/sections.h>
>  #include <asm/setup.h>
>  #include <as-layout.h>
>  #include <arch.h>
> 


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

* Re: [PATCH 17/17] um: Remove unused declarations from <as-layout.h>
  2013-11-12 19:51   ` Richard Weinberger
@ 2013-11-12 19:52     ` Geert Uytterhoeven
  0 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:52 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: Andrew Morton, Linux-Arch, linux-kernel, uml-devel

Hi Richard,

On Tue, Nov 12, 2013 at 8:51 PM, Richard Weinberger <richard@nod.at> wrote:
> Am 12.11.2013 20:42, schrieb Geert Uytterhoeven:
>> _end is used, but it's already provided by <asm/sections.h>, so use that.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Cc: Richard Weinberger <richard@nod.at>
>> Cc: user-mode-linux-devel@lists.sourceforge.net
>
> Geert, do you want me to pickup this patch or takes Andrew the whole series?
>
> Acked-by: Richard Weinberger <richard@nod.at>

Feel free to pick it up. Less work for (overworked?) Andrew.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 00/17] <asm/sections.h> related cleanups
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (16 preceding siblings ...)
  2013-11-12 19:42 ` [PATCH 17/17] um: Remove unused declarations from <as-layout.h> Geert Uytterhoeven
@ 2013-11-12 19:54 ` Geert Uytterhoeven
  2013-11-12 19:56 ` [PATCH 1/2] openrisc: Use the declarations provided by <asm/sections.h> Geert Uytterhoeven
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:54 UTC (permalink / raw)
  To: Andrew Morton, Jonas Bonn; +Cc: Linux-Arch, linux-kernel, linux

On Tue, Nov 12, 2013 at 8:42 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> This started as a small cleanup in the OpenRISC code, but then I got
> pulled into the pool of all section-related symbols, many of which are
> different or duplicated.

Bummer, I forgot the two OpenRISC commits that started it all
(too high up in my commit chain). Will send...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH 1/2] openrisc: Use the declarations provided by <asm/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (17 preceding siblings ...)
  2013-11-12 19:54 ` [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
@ 2013-11-12 19:56 ` Geert Uytterhoeven
  2013-11-12 19:56   ` [PATCH 2/2] openrisc: Remove unused declaration of __initramfs_start Geert Uytterhoeven
  2013-11-13  5:25 ` [PATCH 00/17] <asm/sections.h> related cleanups Vineet Gupta
                   ` (2 subsequent siblings)
  21 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:56 UTC (permalink / raw)
  To: Andrew Morton, Jonas Bonn
  Cc: linux, linux-arch, linux-kernel, Geert Uytterhoeven

Openrisc's private vmlinux.h duplicates a few definitions that are already
provided by asm-generic/sections.h. The former is used by setup.c only,
while the latter is already used everywhere else.

Convert setup.c to use the generic version:
  - Include <asm/sections.h>,
  - Remove the (slightly different) extern declarations,
  - Remove the no longer needed address-of ('&') operators.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/openrisc/kernel/setup.c   |   11 ++++++-----
 arch/openrisc/kernel/vmlinux.h |    1 -
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index ecc1c8850a11..c9b880d64bb8 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -40,6 +40,7 @@
 #include <linux/device.h>
 #include <linux/of_platform.h>
 
+#include <asm/sections.h>
 #include <asm/segment.h>
 #include <asm/pgtable.h>
 #include <asm/types.h>
@@ -75,7 +76,7 @@ static unsigned long __init setup_memory(void)
 
 	ram_start_pfn = PFN_UP(memory_start);
 	/* free_ram_start_pfn is first page after kernel */
-	free_ram_start_pfn = PFN_UP(__pa(&_end));
+	free_ram_start_pfn = PFN_UP(__pa(_end));
 	ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM());
 
 	max_pfn = ram_end_pfn;
@@ -288,10 +289,10 @@ void __init setup_arch(char **cmdline_p)
 	setup_cpuinfo();
 
 	/* process 1's initial memory region is the kernel code/data */
-	init_mm.start_code = (unsigned long)&_stext;
-	init_mm.end_code = (unsigned long)&_etext;
-	init_mm.end_data = (unsigned long)&_edata;
-	init_mm.brk = (unsigned long)&_end;
+	init_mm.start_code = (unsigned long)_stext;
+	init_mm.end_code = (unsigned long)_etext;
+	init_mm.end_data = (unsigned long)_edata;
+	init_mm.brk = (unsigned long)_end;
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	initrd_start = (unsigned long)&__initrd_start;
diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
index 653728abcc7c..6c0b24772f85 100644
--- a/arch/openrisc/kernel/vmlinux.h
+++ b/arch/openrisc/kernel/vmlinux.h
@@ -1,7 +1,6 @@
 #ifndef __OPENRISC_VMLINUX_H_
 #define __OPENRISC_VMLINUX_H_
 
-extern char _stext, _etext, _edata, _end;
 #ifdef CONFIG_BLK_DEV_INITRD
 extern char __initrd_start, __initrd_end;
 extern char __initramfs_start;
-- 
1.7.9.5


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

* [PATCH 2/2] openrisc: Remove unused declaration of __initramfs_start
  2013-11-12 19:56 ` [PATCH 1/2] openrisc: Use the declarations provided by <asm/sections.h> Geert Uytterhoeven
@ 2013-11-12 19:56   ` Geert Uytterhoeven
  0 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-12 19:56 UTC (permalink / raw)
  To: Andrew Morton, Jonas Bonn
  Cc: linux, linux-arch, linux-kernel, Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/openrisc/kernel/vmlinux.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
index 6c0b24772f85..bbcdf21b0b35 100644
--- a/arch/openrisc/kernel/vmlinux.h
+++ b/arch/openrisc/kernel/vmlinux.h
@@ -3,7 +3,6 @@
 
 #ifdef CONFIG_BLK_DEV_INITRD
 extern char __initrd_start, __initrd_end;
-extern char __initramfs_start;
 #endif
 
 #endif
-- 
1.7.9.5


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

* Re: [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 ` [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h> Geert Uytterhoeven
@ 2013-11-12 21:23   ` Richard Henderson
  0 siblings, 0 replies; 74+ messages in thread
From: Richard Henderson @ 2013-11-12 21:23 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrew Morton; +Cc: linux-arch, linux-kernel, linux-alpha

On 11/13/2013 05:42 AM, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: linux-alpha@vger.kernel.org
> ---
>  arch/alpha/include/asm/Kbuild     |    2 +-
>  arch/alpha/include/asm/sections.h |    7 -------
>  2 files changed, 1 insertion(+), 8 deletions(-)
>  delete mode 100644 arch/alpha/include/asm/sections.h

Acked-by: Richard Henderson <rth@twiddle.net>


r~

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

* Re: [PATCH RFC 16/17] c6x: Convert from _fdt_start to __dtb_start
  2013-11-12 19:42 ` [PATCH RFC 16/17] c6x: " Geert Uytterhoeven
@ 2013-11-12 23:38   ` Mark Salter
  0 siblings, 0 replies; 74+ messages in thread
From: Mark Salter @ 2013-11-12 23:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Aurelien Jacquiot,
	Rob Herring, linux-c6x-dev, devicetree

On Tue, 2013-11-12 at 20:42 +0100, Geert Uytterhoeven wrote:
> Kill the c6x-specific __fdt_blob section, and start
> using .dtb.init.rodata
> from <asm-generic/sections.h> for built-in DTBs, like most other DT
> enabled
> architectures.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: linux-c6x-dev@linux-c6x.org
> Cc: devicetree@vger.kernel.org
> ---
> Untested due to lack of cross-compiler, but the changes are similar to
> microblaze.
> 
> QUESTION: The padding of the DTB is gone, is this OK?

Yes, that's fine.

Acked-by: Mark Salter <msalter@redhat.com>



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

* Re: [PATCH 00/17] <asm/sections.h> related cleanups
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (18 preceding siblings ...)
  2013-11-12 19:56 ` [PATCH 1/2] openrisc: Use the declarations provided by <asm/sections.h> Geert Uytterhoeven
@ 2013-11-13  5:25 ` Vineet Gupta
  2013-11-20 18:55 ` [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table David Howells
  2013-11-20 18:56 ` [PATCH 04/17] mn10300: Use Kbuild logic to include <asm-generic/sections.h> David Howells
  21 siblings, 0 replies; 74+ messages in thread
From: Vineet Gupta @ 2013-11-13  5:25 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrew Morton; +Cc: linux-arch, linux-kernel

On 11/13/2013 01:12 AM, Geert Uytterhoeven wrote:
> Most of this has been compile-tested. Notable exceptions are the changes
> to arc, c6x, and score code, due to lack of cross-compilers.

Mainline buildroot will enable you to build a cross compiler for ARC. It is not
relocatable (pending issue in Buildroot itself) but should suffice your needs.

Then a defconfig kernel build will be good enough (allmodconfig tends to select a
uncommon configuration - e.g. Big endian, -Os and since the default tools are not
multilib'ed, it will fail to link.

To avoid fiailure all*config builds I probably need to invert a few config items
on ARC (CONFIG_CPU_BIG_ENDIAN => CONFIG_CPU_LITTLE_ENDIAN)

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

* Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
  2013-11-12 19:42 ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> Geert Uytterhoeven
@ 2013-11-13  5:41   ` Vineet Gupta
  2013-11-13 15:51   ` Rob Herring
  2013-11-19 13:24   ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> James Hogan
  2 siblings, 0 replies; 74+ messages in thread
From: Vineet Gupta @ 2013-11-13  5:41 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrew Morton
  Cc: linux-arch, linux-kernel, James Hogan, Ralf Baechle, Jonas Bonn,
	Chris Zankel, Rob Herring, devicetree

On 11/13/2013 01:12 AM, Geert Uytterhoeven wrote:
> The different architectures used their own (and different) declarations:
> 
>     extern struct boot_param_header __dtb_start;
>     extern u32 __dtb_start[];
>     extern char __dtb_start[];
> 
> Consolidate them using the first variant in <linux/of_fdt.h>.
> This requires adding a few "address of" operators on architectures where
> __dtb_start was an array before.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Jonas Bonn <jonas@southpole.se>
> CC: Chris Zankel <chris@zankel.net>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree@vger.kernel.org
> ---
>  arch/arc/include/asm/sections.h             |    1 -
>  arch/arc/kernel/setup.c                     |    2 +-
>  arch/metag/kernel/setup.c                   |    6 +-----
>  arch/mips/include/asm/mips-boards/generic.h |    4 ----
>  arch/mips/lantiq/prom.h                     |    2 --
>  arch/mips/netlogic/xlp/dt.c                 |    4 ++--
>  arch/mips/ralink/of.c                       |    2 --
>  arch/openrisc/kernel/setup.c                |    2 +-
>  arch/openrisc/kernel/vmlinux.h              |    2 --
>  arch/xtensa/kernel/setup.c                  |    3 +--
>  include/linux/of_fdt.h                      |    3 +++
>  11 files changed, 9 insertions(+), 22 deletions(-)


Acked-by: Vineet Gupta <vgupta@synopsys.com>

Thx,
-Vineet

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

* Re: [PATCH 08/17] microblaze: Remove _fdt_start casts
  2013-11-12 19:42 ` [PATCH 08/17] microblaze: Remove _fdt_start casts Geert Uytterhoeven
@ 2013-11-13 10:08   ` Michal Simek
  0 siblings, 0 replies; 74+ messages in thread
From: Michal Simek @ 2013-11-13 10:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, microblaze-uclinux

[-- Attachment #1: Type: text/plain, Size: 1600 bytes --]

On 11/12/2013 08:42 PM, Geert Uytterhoeven wrote:
> _fdt_start is an array, i.e. a pointer.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: microblaze-uclinux@itee.uq.edu.au
> ---
>  arch/microblaze/kernel/setup.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
> index 8de8ebc309f1..603e22fec6d5 100644
> --- a/arch/microblaze/kernel/setup.c
> +++ b/arch/microblaze/kernel/setup.c
> @@ -136,7 +136,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
>  	lockdep_init();
>  
>  /* initialize device tree for usage in early_printk */
> -	early_init_devtree((void *)_fdt_start);
> +	early_init_devtree(_fdt_start);
>  
>  #ifdef CONFIG_EARLY_PRINTK
>  	setup_early_printk(NULL);
> @@ -152,8 +152,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
>  	if (fdt)
>  		pr_info("FDT at 0x%08x\n", fdt);
>  	else
> -		pr_info("Compiled-in FDT at 0x%08x\n",
> -					(unsigned int)_fdt_start);
> +		pr_info("Compiled-in FDT at %p\n", _fdt_start);
>  
>  #ifdef CONFIG_MTD_UCLINUX
>  	pr_info("Found romfs @ 0x%08x (0x%08x)\n",
> 

Applied.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
  2013-11-12 19:42 ` [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start Geert Uytterhoeven
@ 2013-11-13 10:19   ` Michal Simek
  2013-11-13 13:40     ` Michal Simek
  0 siblings, 1 reply; 74+ messages in thread
From: Michal Simek @ 2013-11-13 10:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Rob Herring,
	microblaze-uclinux, devicetree

[-- Attachment #1: Type: text/plain, Size: 3702 bytes --]

On 11/12/2013 08:42 PM, Geert Uytterhoeven wrote:
> Kill the microblaze-specific __fdt_blob section, and start using
> .dtb.init.rodata from <asm-generic/sections.h> for built-in DTBs, like
> most other DT enabled architectures.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: microblaze-uclinux@itee.uq.edu.au
> Cc: devicetree@vger.kernel.org
> ---
> Untested, but the resulting vmlinux after "make simpleImage.system" looks
> sane.
> 
> QUESTION: The padding of the DTB is gone, is this OK?

Removing this kernel padding should be fine. I can't remember
why it was there from the beginning.

> 
> TODO: Start using the DTB logic in scripts/Makefile.lib instead of
>       arch/microblaze/boot/dts/linked_dtb.S
> 
>  arch/microblaze/boot/Makefile          |    2 +-
>  arch/microblaze/boot/dts/linked_dtb.S  |    2 +-
>  arch/microblaze/include/asm/sections.h |    4 +---
>  arch/microblaze/kernel/head.S          |    2 +-
>  arch/microblaze/kernel/setup.c         |    4 ++--
>  arch/microblaze/kernel/vmlinux.lds.S   |    8 --------
>  6 files changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
> index 8e211cc28dac..e4a99a22dab8 100644
> --- a/arch/microblaze/boot/Makefile
> +++ b/arch/microblaze/boot/Makefile
> @@ -23,7 +23,7 @@ quiet_cmd_cp = CP      $< $@$2
>  
>  quiet_cmd_strip = STRIP   $@
>  	cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
> -				-K _fdt_start vmlinux -o $@
> +				-K __dtb_start vmlinux -o $@

I have started to discuss this change internally because our tools related
on this _fdt_start name.

>  
>  UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)
>  
> diff --git a/arch/microblaze/boot/dts/linked_dtb.S b/arch/microblaze/boot/dts/linked_dtb.S
> index 23345af3721f..bfc53b5795aa 100644
> --- a/arch/microblaze/boot/dts/linked_dtb.S
> +++ b/arch/microblaze/boot/dts/linked_dtb.S
> @@ -1,2 +1,2 @@
> -.section __fdt_blob,"a"
> +.section .dtb.init.rodata,"a"
>  .incbin "arch/microblaze/boot/dts/system.dtb"
> diff --git a/arch/microblaze/include/asm/sections.h b/arch/microblaze/include/asm/sections.h
> index 1b281d3ea734..fb8ab0ba03fc 100644
> --- a/arch/microblaze/include/asm/sections.h
> +++ b/arch/microblaze/include/asm/sections.h
> @@ -16,8 +16,6 @@
>  # ifndef __ASSEMBLY__
>  extern char _ssbss[], _esbss[];
>  extern unsigned long __ivt_start[], __ivt_end[];
> -
> -extern u32 _fdt_start[], _fdt_end[];
> -
>  # endif /* !__ASSEMBLY__ */
> +
>  #endif /* _ASM_MICROBLAZE_SECTIONS_H */
> diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
> index 817b7eec95b6..6108889f0025 100644
> --- a/arch/microblaze/kernel/head.S
> +++ b/arch/microblaze/kernel/head.S
> @@ -94,7 +94,7 @@ big_endian:
>  	bnei	r11, no_fdt_arg			/* No - get out of here */
>  _prepare_copy_fdt:
>  	or	r11, r0, r0 /* incremment */
> -	ori	r4, r0, TOPHYS(_fdt_start)
> +	ori	r4, r0, TOPHYS(__dtb_start)
>  	ori	r3, r0, (0x8000 - 4)

If others is fine this 0x8000 is that hardcoded pad dtb size in lds file
and needs to be changed too.

Let me discuss this with others but if changing symbol name is fine
then we can fix just this problem and your patch is fine.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
  2013-11-13 10:19   ` Michal Simek
@ 2013-11-13 13:40     ` Michal Simek
  2013-11-13 14:02       ` Geert Uytterhoeven
  2013-11-13 16:14       ` Rob Herring
  0 siblings, 2 replies; 74+ messages in thread
From: Michal Simek @ 2013-11-13 13:40 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Rob Herring,
	microblaze-uclinux, devicetree

[-- Attachment #1: Type: text/plain, Size: 1749 bytes --]

On 11/13/2013 11:19 AM, Michal Simek wrote:
> On 11/12/2013 08:42 PM, Geert Uytterhoeven wrote:
>> Kill the microblaze-specific __fdt_blob section, and start using
>> .dtb.init.rodata from <asm-generic/sections.h> for built-in DTBs, like
>> most other DT enabled architectures.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Cc: Michal Simek <monstr@monstr.eu>
>> Cc: Rob Herring <rob.herring@calxeda.com>
>> Cc: microblaze-uclinux@itee.uq.edu.au
>> Cc: devicetree@vger.kernel.org
>> ---
>> Untested, but the resulting vmlinux after "make simpleImage.system" looks
>> sane.
>>
>> QUESTION: The padding of the DTB is gone, is this OK?
> 
> Removing this kernel padding should be fine. I can't remember
> why it was there from the beginning.

I know why is this here. The reason is process how dtb is passed
to the kernel via command line. head.S code just copy that dtb to
the same location where compiled-in dts is expected and kernel
doesn't need to care about position of dtb because this copy is
done without MMU. And the full kernel is covered by 2 tlbs and
we don't need to use another TLB for dtb mapping.

It means pad matters a lot. Because u-boot ITS format doesn't use
simpleImage target but the kernel need to have a space for copying
dtb to this kernel location.

Let me think about if there is an easy way to handle dtbs
which are passed from bootloader.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
  2013-11-13 13:40     ` Michal Simek
@ 2013-11-13 14:02       ` Geert Uytterhoeven
  2013-11-13 14:21         ` Michal Simek
  2013-11-13 16:14       ` Rob Herring
  1 sibling, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-13 14:02 UTC (permalink / raw)
  To: Michal Simek
  Cc: Andrew Morton, Linux-Arch, linux-kernel, Rob Herring,
	microblaze-uclinux, devicetree

On Wed, Nov 13, 2013 at 2:40 PM, Michal Simek <monstr@monstr.eu> wrote:
>>> QUESTION: The padding of the DTB is gone, is this OK?
>>
>> Removing this kernel padding should be fine. I can't remember
>> why it was there from the beginning.
>
> I know why is this here. The reason is process how dtb is passed
> to the kernel via command line. head.S code just copy that dtb to
> the same location where compiled-in dts is expected and kernel
> doesn't need to care about position of dtb because this copy is
> done without MMU. And the full kernel is covered by 2 tlbs and
> we don't need to use another TLB for dtb mapping.
>
> It means pad matters a lot. Because u-boot ITS format doesn't use
> simpleImage target but the kernel need to have a space for copying
> dtb to this kernel location.
>
> Let me think about if there is an easy way to handle dtbs
> which are passed from bootloader.

You can add to asm-generic/sections.h:

#ifndef ARCH_DTB_PADDING
#define ARCH_DTB_PADDING
#endif

and change KERNEL_DTB() to:

#define KERNEL_DTB()                                                    \
       STRUCT_ALIGN();                                                 \
       VMLINUX_SYMBOL(__dtb_start) = .;                                \
       *(.dtb.init.rodata)                                             \
       ARCH_DTB_PADDING                                \
       VMLINUX_SYMBOL(__dtb_end) = .;

Then microblaze can predefine ARCH_DTB_PADDING in its
<asm/sections.h>.

Still, it will crash badly if the external DTB is larger than
ARCH_DTB_PADDING.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
  2013-11-13 14:02       ` Geert Uytterhoeven
@ 2013-11-13 14:21         ` Michal Simek
  0 siblings, 0 replies; 74+ messages in thread
From: Michal Simek @ 2013-11-13 14:21 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, Linux-Arch, linux-kernel, Rob Herring,
	microblaze-uclinux, devicetree

[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]

On 11/13/2013 03:02 PM, Geert Uytterhoeven wrote:
> On Wed, Nov 13, 2013 at 2:40 PM, Michal Simek <monstr@monstr.eu> wrote:
>>>> QUESTION: The padding of the DTB is gone, is this OK?
>>>
>>> Removing this kernel padding should be fine. I can't remember
>>> why it was there from the beginning.
>>
>> I know why is this here. The reason is process how dtb is passed
>> to the kernel via command line. head.S code just copy that dtb to
>> the same location where compiled-in dts is expected and kernel
>> doesn't need to care about position of dtb because this copy is
>> done without MMU. And the full kernel is covered by 2 tlbs and
>> we don't need to use another TLB for dtb mapping.
>>
>> It means pad matters a lot. Because u-boot ITS format doesn't use
>> simpleImage target but the kernel need to have a space for copying
>> dtb to this kernel location.
>>
>> Let me think about if there is an easy way to handle dtbs
>> which are passed from bootloader.
> 
> You can add to asm-generic/sections.h:
> 
> #ifndef ARCH_DTB_PADDING
> #define ARCH_DTB_PADDING
> #endif
> 
> and change KERNEL_DTB() to:
> 
> #define KERNEL_DTB()                                                    \
>        STRUCT_ALIGN();                                                 \
>        VMLINUX_SYMBOL(__dtb_start) = .;                                \
>        *(.dtb.init.rodata)                                             \
>        ARCH_DTB_PADDING                                \
>        VMLINUX_SYMBOL(__dtb_end) = .;
> 
> Then microblaze can predefine ARCH_DTB_PADDING in its
> <asm/sections.h>.
> 
> Still, it will crash badly if the external DTB is larger than
> ARCH_DTB_PADDING.

yes but the question is if our bootflow is correct or not.
Because the problem is still with ARCH_DTB_PADDING value.
In past we have extended this padding from 16k to 32k.

We are setting up one tlb for early console and we can just do the same
for dtb and fix kernel for this cases. Then we don't need to waste
of memory for allocating space for dtb.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
  2013-11-12 19:42 ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> Geert Uytterhoeven
  2013-11-13  5:41   ` Vineet Gupta
@ 2013-11-13 15:51   ` Rob Herring
       [not found]     ` < 1384859554-27268-1-git-send-email-geert@linux-m68k.org>
                       ` (2 more replies)
  2013-11-19 13:24   ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> James Hogan
  2 siblings, 3 replies; 74+ messages in thread
From: Rob Herring @ 2013-11-13 15:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Vineet Gupta,
	James Hogan, Ralf Baechle, Jonas Bonn, Chris Zankel, Rob Herring,
	devicetree

On Tue, Nov 12, 2013 at 1:42 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> The different architectures used their own (and different) declarations:
>
>     extern struct boot_param_header __dtb_start;
>     extern u32 __dtb_start[];
>     extern char __dtb_start[];
>
> Consolidate them using the first variant in <linux/of_fdt.h>.
> This requires adding a few "address of" operators on architectures where
> __dtb_start was an array before.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Jonas Bonn <jonas@southpole.se>
> CC: Chris Zankel <chris@zankel.net>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree@vger.kernel.org
> ---
>  arch/arc/include/asm/sections.h             |    1 -
>  arch/arc/kernel/setup.c                     |    2 +-
>  arch/metag/kernel/setup.c                   |    6 +-----
>  arch/mips/include/asm/mips-boards/generic.h |    4 ----
>  arch/mips/lantiq/prom.h                     |    2 --
>  arch/mips/netlogic/xlp/dt.c                 |    4 ++--
>  arch/mips/ralink/of.c                       |    2 --
>  arch/openrisc/kernel/setup.c                |    2 +-
>  arch/openrisc/kernel/vmlinux.h              |    2 --
>  arch/xtensa/kernel/setup.c                  |    3 +--
>  include/linux/of_fdt.h                      |    3 +++
>  11 files changed, 9 insertions(+), 22 deletions(-)

This is great, but I would like to see this taken one step further and
move the selection logic into the core code. We can try to use the
built-in dtb if early_init_dt_scan is passed a NULL or invalid dtb. This
should work for most arches I think and still allows an arch to do a
different selection algorithm if desired.

Are the DT related patches dependent on the rest of the series?

Something like this is what I have in mind:

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 5c47910..723f854d 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -869,14 +869,16 @@ void * __init __weak
early_init_dt_alloc_memory_arch(u64 size, u64 align)

 bool __init early_init_dt_scan(void *params)
 {
-	if (!params)
-		return false;
-
 	/* Setup flat device-tree pointer */
 	initial_boot_params = params;

+	if (!initial_boot_params ||
+	    (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER))
+		initial_boot_params = &__dtb_start;
+
 	/* check device tree validity */
-	if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
+	if (!initial_boot_params ||
+	    (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER)) {
 		initial_boot_params = NULL;
 		return false;
 	}

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

* Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
  2013-11-13 13:40     ` Michal Simek
  2013-11-13 14:02       ` Geert Uytterhoeven
@ 2013-11-13 16:14       ` Rob Herring
  2013-11-14 16:29         ` Michal Simek
  1 sibling, 1 reply; 74+ messages in thread
From: Rob Herring @ 2013-11-13 16:14 UTC (permalink / raw)
  To: monstr, Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Rob Herring,
	microblaze-uclinux, devicetree

On 11/13/2013 07:40 AM, Michal Simek wrote:
> On 11/13/2013 11:19 AM, Michal Simek wrote:
>> On 11/12/2013 08:42 PM, Geert Uytterhoeven wrote:
>>> Kill the microblaze-specific __fdt_blob section, and start
>>> using .dtb.init.rodata from <asm-generic/sections.h> for
>>> built-in DTBs, like most other DT enabled architectures.
>>> 
>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc:
>>> Michal Simek <monstr@monstr.eu> Cc: Rob Herring
>>> <rob.herring@calxeda.com> Cc:
>>> microblaze-uclinux@itee.uq.edu.au Cc:
>>> devicetree@vger.kernel.org --- Untested, but the resulting
>>> vmlinux after "make simpleImage.system" looks sane.
>>> 
>>> QUESTION: The padding of the DTB is gone, is this OK?
>> 
>> Removing this kernel padding should be fine. I can't remember why
>> it was there from the beginning.
> 
> I know why is this here. The reason is process how dtb is passed to
> the kernel via command line. head.S code just copy that dtb to the
> same location where compiled-in dts is expected and kernel doesn't
> need to care about position of dtb because this copy is done
> without MMU. And the full kernel is covered by 2 tlbs and we don't
> need to use another TLB for dtb mapping.
> 
> It means pad matters a lot. Because u-boot ITS format doesn't use 
> simpleImage target but the kernel need to have a space for copying 
> dtb to this kernel location.
> 
> Let me think about if there is an easy way to handle dtbs which are
> passed from bootloader.

Isn't the built-in dtb in a RO init section? Seems like a bad idea to
write to it. Also, it will be a double copy because a built-in dtb has
to be copied out of init section.

Rob

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

* Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
  2013-11-13 15:51   ` Rob Herring
       [not found]     ` < 1384859554-27268-1-git-send-email-geert@linux-m68k.org>
@ 2013-11-13 17:20     ` Geert Uytterhoeven
  2013-11-13 17:34       ` Rob Herring
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
  2 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-13 17:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Morton, linux-arch, linux-kernel, Vineet Gupta,
	James Hogan, Ralf Baechle, Jonas Bonn, Chris Zankel, Rob Herring,
	devicetree

On Wed, Nov 13, 2013 at 4:51 PM, Rob Herring <robherring2@gmail.com> wrote:
> On Tue, Nov 12, 2013 at 1:42 PM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
>> The different architectures used their own (and different) declarations:
>>
>>     extern struct boot_param_header __dtb_start;
>>     extern u32 __dtb_start[];
>>     extern char __dtb_start[];
>>
>> Consolidate them using the first variant in <linux/of_fdt.h>.
>> This requires adding a few "address of" operators on architectures where
>> __dtb_start was an array before.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Cc: Vineet Gupta <vgupta@synopsys.com>
>> Cc: James Hogan <james.hogan@imgtec.com>
>> Cc: Ralf Baechle <ralf@linux-mips.org>
>> Cc: Jonas Bonn <jonas@southpole.se>
>> CC: Chris Zankel <chris@zankel.net>
>> Cc: Rob Herring <rob.herring@calxeda.com>
>> Cc: devicetree@vger.kernel.org
>> ---
>>  arch/arc/include/asm/sections.h             |    1 -
>>  arch/arc/kernel/setup.c                     |    2 +-
>>  arch/metag/kernel/setup.c                   |    6 +-----
>>  arch/mips/include/asm/mips-boards/generic.h |    4 ----
>>  arch/mips/lantiq/prom.h                     |    2 --
>>  arch/mips/netlogic/xlp/dt.c                 |    4 ++--
>>  arch/mips/ralink/of.c                       |    2 --
>>  arch/openrisc/kernel/setup.c                |    2 +-
>>  arch/openrisc/kernel/vmlinux.h              |    2 --
>>  arch/xtensa/kernel/setup.c                  |    3 +--
>>  include/linux/of_fdt.h                      |    3 +++
>>  11 files changed, 9 insertions(+), 22 deletions(-)
>
> This is great, but I would like to see this taken one step further and
> move the selection logic into the core code. We can try to use the
> built-in dtb if early_init_dt_scan is passed a NULL or invalid dtb. This
> should work for most arches I think and still allows an arch to do a
> different selection algorithm if desired.

Yes, that makes sense.

> Are the DT related patches dependent on the rest of the series?

Not really. There may be small rejects if you apply it out-of-order,
but nothing serious.

> Something like this is what I have in mind:
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 5c47910..723f854d 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -869,14 +869,16 @@ void * __init __weak
> early_init_dt_alloc_memory_arch(u64 size, u64 align)
>
>  bool __init early_init_dt_scan(void *params)
>  {
> -       if (!params)
> -               return false;
> -
>         /* Setup flat device-tree pointer */
>         initial_boot_params = params;
>
> +       if (!initial_boot_params ||
> +           (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER))
> +               initial_boot_params = &__dtb_start;
> +
>         /* check device tree validity */
> -       if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
> +       if (!initial_boot_params ||

initial_boot_params cannot be NULL here, so no need to check.

> +           (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER)) {

However, if __dtb_end == __dtb_start, you may be reading random
data here from the next section. The OF_DT_HEADER check should cover
this, but better safe than sorry?

>                 initial_boot_params = NULL;
>                 return false;
>         }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
  2013-11-13 17:20     ` Geert Uytterhoeven
@ 2013-11-13 17:34       ` Rob Herring
  2013-11-13 18:40         ` Geert Uytterhoeven
  0 siblings, 1 reply; 74+ messages in thread
From: Rob Herring @ 2013-11-13 17:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Vineet Gupta,
	James Hogan, Ralf Baechle, Jonas Bonn, Chris Zankel, Rob Herring,
	devicetree

On 11/13/2013 11:20 AM, Geert Uytterhoeven wrote:
> On Wed, Nov 13, 2013 at 4:51 PM, Rob Herring <robherring2@gmail.com> wrote:
>> On Tue, Nov 12, 2013 at 1:42 PM, Geert Uytterhoeven
>> <geert@linux-m68k.org> wrote:
>>> The different architectures used their own (and different) declarations:
>>>
>>>     extern struct boot_param_header __dtb_start;
>>>     extern u32 __dtb_start[];
>>>     extern char __dtb_start[];
>>>
>>> Consolidate them using the first variant in <linux/of_fdt.h>.
>>> This requires adding a few "address of" operators on architectures where
>>> __dtb_start was an array before.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>> Cc: Vineet Gupta <vgupta@synopsys.com>
>>> Cc: James Hogan <james.hogan@imgtec.com>
>>> Cc: Ralf Baechle <ralf@linux-mips.org>
>>> Cc: Jonas Bonn <jonas@southpole.se>
>>> CC: Chris Zankel <chris@zankel.net>
>>> Cc: Rob Herring <rob.herring@calxeda.com>
>>> Cc: devicetree@vger.kernel.org
>>> ---
>>>  arch/arc/include/asm/sections.h             |    1 -
>>>  arch/arc/kernel/setup.c                     |    2 +-
>>>  arch/metag/kernel/setup.c                   |    6 +-----
>>>  arch/mips/include/asm/mips-boards/generic.h |    4 ----
>>>  arch/mips/lantiq/prom.h                     |    2 --
>>>  arch/mips/netlogic/xlp/dt.c                 |    4 ++--
>>>  arch/mips/ralink/of.c                       |    2 --
>>>  arch/openrisc/kernel/setup.c                |    2 +-
>>>  arch/openrisc/kernel/vmlinux.h              |    2 --
>>>  arch/xtensa/kernel/setup.c                  |    3 +--
>>>  include/linux/of_fdt.h                      |    3 +++
>>>  11 files changed, 9 insertions(+), 22 deletions(-)
>>
>> This is great, but I would like to see this taken one step further and
>> move the selection logic into the core code. We can try to use the
>> built-in dtb if early_init_dt_scan is passed a NULL or invalid dtb. This
>> should work for most arches I think and still allows an arch to do a
>> different selection algorithm if desired.
> 
> Yes, that makes sense.
> 
>> Are the DT related patches dependent on the rest of the series?
> 
> Not really. There may be small rejects if you apply it out-of-order,
> but nothing serious.
> 
>> Something like this is what I have in mind:
>>
>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> index 5c47910..723f854d 100644
>> --- a/drivers/of/fdt.c
>> +++ b/drivers/of/fdt.c
>> @@ -869,14 +869,16 @@ void * __init __weak
>> early_init_dt_alloc_memory_arch(u64 size, u64 align)
>>
>>  bool __init early_init_dt_scan(void *params)
>>  {
>> -       if (!params)
>> -               return false;
>> -
>>         /* Setup flat device-tree pointer */
>>         initial_boot_params = params;
>>
>> +       if (!initial_boot_params ||
>> +           (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER))
>> +               initial_boot_params = &__dtb_start;
>> +
>>         /* check device tree validity */
>> -       if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
>> +       if (!initial_boot_params ||
> 
> initial_boot_params cannot be NULL here, so no need to check.

What about the case of no built-in dtb like on arm?

> 
>> +           (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER)) {
> 
> However, if __dtb_end == __dtb_start, you may be reading random
> data here from the next section. The OF_DT_HEADER check should cover
> this, but better safe than sorry?

Then we should also check that (__dtb_end != __dtb_start).

Rob

> 
>>                 initial_boot_params = NULL;
>>                 return false;
>>         }
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 


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

* Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
  2013-11-13 17:34       ` Rob Herring
@ 2013-11-13 18:40         ` Geert Uytterhoeven
  0 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-13 18:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Morton, linux-arch, linux-kernel, Vineet Gupta,
	James Hogan, Ralf Baechle, Jonas Bonn, Chris Zankel, Rob Herring,
	devicetree

On Wed, Nov 13, 2013 at 6:34 PM, Rob Herring <robherring2@gmail.com> wrote:
>>> +       if (!initial_boot_params ||
>>> +           (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER))
>>> +               initial_boot_params = &__dtb_start;
>>> +
>>>         /* check device tree validity */
>>> -       if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
>>> +       if (!initial_boot_params ||
>>
>> initial_boot_params cannot be NULL here, so no need to check.
>
> What about the case of no built-in dtb like on arm?

Even then the symbol exists, as all architectures put INIT_DATA or
INIT_DATA_SECTION in their vmlinux.lds.S.
But the section will be empty, cfr. the case __dtb_end == __dtb_start below.

>>
>>> +           (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER)) {
>>
>> However, if __dtb_end == __dtb_start, you may be reading random
>> data here from the next section. The OF_DT_HEADER check should cover
>> this, but better safe than sorry?
>
> Then we should also check that (__dtb_end != __dtb_start).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
  2013-11-12 19:42 ` [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata Geert Uytterhoeven
@ 2013-11-14  0:09   ` Chris Metcalf
  2013-11-14  8:31     ` Geert Uytterhoeven
  0 siblings, 1 reply; 74+ messages in thread
From: Chris Metcalf @ 2013-11-14  0:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrew Morton; +Cc: linux-arch, linux-kernel

On 11/12/2013 2:42 PM, Geert Uytterhoeven wrote:
> Use standard __init_begin and __init_end instead.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Chris Metcalf <cmetcalf@tilera.com>
[...]
> @@ -534,7 +534,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
>  
>  		BUG_ON(address != (unsigned long)_text);
>  		pte = NULL;
> -		for (; address < (unsigned long)_einittext;
> +		for (; address < (unsigned long)__init_end;
>  		     pfn++, address += PAGE_SIZE) {
>  			pte_ofs = pte_index(address);
>  			if (pte_ofs == 0) {
> @@ -572,7 +572,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
>  		else
>  			pteval = hv_pte_set_mode(pteval,
>  						 HV_PTE_MODE_CACHE_NO_L3);
> -		for (; address < (unsigned long)_einittext;
> +		for (; address < (unsigned long)__init_end;
>  		     pfn += PFN_DOWN(HPAGE_SIZE), address += HPAGE_SIZE)
>  			*(pte_t *)(pmd++) = pfn_pte(pfn, pteval);
>  	}
> @@ -632,9 +632,9 @@ int devmem_is_allowed(unsigned long pagenr)
>  {
>  	return pagenr < kaddr_to_pfn(_end) &&
>  		!(pagenr >= kaddr_to_pfn(&init_thread_union) ||
> -		  pagenr < kaddr_to_pfn(_einitdata)) &&
> +		  pagenr < kaddr_to_pfn(__init_end)) &&
>  		!(pagenr >= kaddr_to_pfn(_sinittext) ||
> -		  pagenr <= kaddr_to_pfn(_einittext-1));
> +		  pagenr <= kaddr_to_pfn(__init_end-1));
>  }
>  
>  #ifdef CONFIG_HIGHMEM
[...]
> @@ -984,7 +984,7 @@ void free_initmem(void)
>  	 */
>  	free_init_pages("unused kernel text",
>  			(unsigned long)_sinittext - text_delta,
> -			(unsigned long)_einittext - text_delta);
> +			(unsigned long)__init_end - text_delta);
>  	/* Do a global TLB flush so everyone sees the changes. */
>  	flush_tlb_all();
>  }

These changes are touching _einittext, and they shouldn't.  Only bomb _einitdata (and _sinitdata).

With those changes removed:

Acked-by: Chris Metcalf <cmetcalf@tilera.com>

or let me know if you'd rather I staged your v2 change into the tile tree.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


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

* Re: [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h>
  2013-11-12 19:42 ` [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h> Geert Uytterhoeven
@ 2013-11-14  4:01   ` Rusty Russell
  0 siblings, 0 replies; 74+ messages in thread
From: Rusty Russell @ 2013-11-14  4:01 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrew Morton
  Cc: linux-arch, linux-kernel, Geert Uytterhoeven

Geert Uytterhoeven <geert@linux-m68k.org> writes:
> Consolidate the various external const and non-const declarations of
> __start___param[] and __stop___param in <linux/moduleparam.h>.
> This requires making a few struct kernel_param pointers in kernel/params.c
> const.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Rusty Russell <rusty@rustcorp.com.au>

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Thanks!
Rusty.

> ---
>  include/linux/moduleparam.h |    2 ++
>  init/main.c                 |    2 --
>  kernel/params.c             |    7 +++----
>  3 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
> index c3eb102a9cc8..77ccfca0c4ba 100644
> --- a/include/linux/moduleparam.h
> +++ b/include/linux/moduleparam.h
> @@ -68,6 +68,8 @@ struct kernel_param {
>  	};
>  };
>  
> +extern const struct kernel_param __start___param[], __stop___param[];
> +
>  /* Special one for strings we want to copy into */
>  struct kparam_string {
>  	unsigned int maxlen;
> diff --git a/init/main.c b/init/main.c
> index 15ed159b681b..f2c4901f90d1 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -469,7 +469,6 @@ static void __init mm_init(void)
>  asmlinkage void __init start_kernel(void)
>  {
>  	char * command_line;
> -	extern const struct kernel_param __start___param[], __stop___param[];
>  
>  	/*
>  	 * Need to run as early as possible, to initialize the
> @@ -737,7 +736,6 @@ static char *initcall_level_names[] __initdata = {
>  
>  static void __init do_initcall_level(int level)
>  {
> -	extern const struct kernel_param __start___param[], __stop___param[];
>  	initcall_t *fn;
>  
>  	strcpy(static_command_line, saved_command_line);
> diff --git a/kernel/params.c b/kernel/params.c
> index c00d5b502aa4..54e05ffb7d24 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -19,6 +19,7 @@
>  #include <linux/string.h>
>  #include <linux/errno.h>
>  #include <linux/module.h>
> +#include <linux/moduleparam.h>
>  #include <linux/device.h>
>  #include <linux/err.h>
>  #include <linux/slab.h>
> @@ -506,8 +507,6 @@ EXPORT_SYMBOL(param_ops_string);
>  #define to_module_attr(n) container_of(n, struct module_attribute, attr)
>  #define to_module_kobject(n) container_of(n, struct module_kobject, kobj)
>  
> -extern struct kernel_param __start___param[], __stop___param[];
> -
>  struct param_attribute
>  {
>  	struct module_attribute mattr;
> @@ -766,7 +765,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name)
>  }
>  
>  static void __init kernel_add_sysfs_param(const char *name,
> -					  struct kernel_param *kparam,
> +					  const struct kernel_param *kparam,
>  					  unsigned int name_skip)
>  {
>  	struct module_kobject *mk;
> @@ -801,7 +800,7 @@ static void __init kernel_add_sysfs_param(const char *name,
>   */
>  static void __init param_sysfs_builtin(void)
>  {
> -	struct kernel_param *kp;
> +	const struct kernel_param *kp;
>  	unsigned int name_len;
>  	char modname[MODULE_NAME_LEN];
>  
> -- 
> 1.7.9.5

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

* Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
  2013-11-14  0:09   ` Chris Metcalf
@ 2013-11-14  8:31     ` Geert Uytterhoeven
  2013-11-14 14:55       ` Chris Metcalf
  0 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-14  8:31 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: Andrew Morton, linux-arch, linux-kernel

	Hi Chris,

On Wed, 13 Nov 2013, Chris Metcalf wrote:
> On 11/12/2013 2:42 PM, Geert Uytterhoeven wrote:
> > Use standard __init_begin and __init_end instead.
> >
> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: Chris Metcalf <cmetcalf@tilera.com>
> [...]
> > @@ -534,7 +534,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
> >  
> >  		BUG_ON(address != (unsigned long)_text);
> >  		pte = NULL;
> > -		for (; address < (unsigned long)_einittext;
> > +		for (; address < (unsigned long)__init_end;
> >  		     pfn++, address += PAGE_SIZE) {
> >  			pte_ofs = pte_index(address);
> >  			if (pte_ofs == 0) {
> > @@ -572,7 +572,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
> >  		else
> >  			pteval = hv_pte_set_mode(pteval,
> >  						 HV_PTE_MODE_CACHE_NO_L3);
> > -		for (; address < (unsigned long)_einittext;
> > +		for (; address < (unsigned long)__init_end;
> >  		     pfn += PFN_DOWN(HPAGE_SIZE), address += HPAGE_SIZE)
> >  			*(pte_t *)(pmd++) = pfn_pte(pfn, pteval);
> >  	}
> > @@ -632,9 +632,9 @@ int devmem_is_allowed(unsigned long pagenr)
> >  {
> >  	return pagenr < kaddr_to_pfn(_end) &&
> >  		!(pagenr >= kaddr_to_pfn(&init_thread_union) ||
> > -		  pagenr < kaddr_to_pfn(_einitdata)) &&
> > +		  pagenr < kaddr_to_pfn(__init_end)) &&
> >  		!(pagenr >= kaddr_to_pfn(_sinittext) ||
> > -		  pagenr <= kaddr_to_pfn(_einittext-1));
> > +		  pagenr <= kaddr_to_pfn(__init_end-1));
> >  }
> >  
> >  #ifdef CONFIG_HIGHMEM
> [...]
> > @@ -984,7 +984,7 @@ void free_initmem(void)
> >  	 */
> >  	free_init_pages("unused kernel text",
> >  			(unsigned long)_sinittext - text_delta,
> > -			(unsigned long)_einittext - text_delta);
> > +			(unsigned long)__init_end - text_delta);
> >  	/* Do a global TLB flush so everyone sees the changes. */
> >  	flush_tlb_all();
> >  }
> 
> These changes are touching _einittext, and they shouldn't.  Only bomb _einitdata (and _sinitdata).

Woops, that's a serious brain fart. Sorry about that, and thanks for
noticing!

> With those changes removed:
> 
> Acked-by: Chris Metcalf <cmetcalf@tilera.com>
> 
> or let me know if you'd rather I staged your v2 change into the tile tree.

Feel free to take v2 below. Thanks!

>From d761d4d63945ff0a6eab5a9058c132f870c92aff Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Fri, 8 Nov 2013 21:33:29 +0100
Subject: [PATCH -v2] tile: Remove tile-specific _sinitdata and _einitdata

Use standard __init_begin and __init_end instead.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
---
v2: Remove bogus _einittext changes.

 arch/tile/include/asm/sections.h |    3 ---
 arch/tile/kernel/vmlinux.lds.S   |    2 --
 arch/tile/mm/init.c              |   10 +++++-----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/arch/tile/include/asm/sections.h b/arch/tile/include/asm/sections.h
index 5d5d3b739a6b..86a746243dc8 100644
--- a/arch/tile/include/asm/sections.h
+++ b/arch/tile/include/asm/sections.h
@@ -19,9 +19,6 @@
 
 #include <asm-generic/sections.h>
 
-/* Text and data are at different areas in the kernel VA space. */
-extern char _sinitdata[], _einitdata[];
-
 /* Write-once data is writable only till the end of initialization. */
 extern char __w1data_begin[], __w1data_end[];
 
diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S
index f1819423ffc9..0e059a0101ea 100644
--- a/arch/tile/kernel/vmlinux.lds.S
+++ b/arch/tile/kernel/vmlinux.lds.S
@@ -66,11 +66,9 @@ SECTIONS
 
   . = ALIGN(PAGE_SIZE);
   __init_begin = .;
-  VMLINUX_SYMBOL(_sinitdata) = .;
   INIT_DATA_SECTION(16) :data =0
   PERCPU_SECTION(L2_CACHE_BYTES)
   . = ALIGN(PAGE_SIZE);
-  VMLINUX_SYMBOL(_einitdata) = .;
   __init_end = .;
 
   _sdata = .;                   /* Start of data section */
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 0fa1acfac79a..489a5a00cfaa 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -254,7 +254,7 @@ static pgprot_t __init init_pgprot(ulong address)
 	 * Everything else that isn't data or bss is heap, so mark it
 	 * with the initial heap home (hash-for-home, or this cpu).  This
 	 * includes any addresses after the loaded image and any address before
-	 * _einitdata, since we already captured the case of text before
+	 * __init_end, since we already captured the case of text before
 	 * _sinittext, and __pa(einittext) is approximately __pa(sinitdata).
 	 *
 	 * All the LOWMEM pages that we mark this way will get their
@@ -263,7 +263,7 @@ static pgprot_t __init init_pgprot(ulong address)
 	 * homes, but with a zero free_time we don't have to actually
 	 * do a flush action the first time we use them, either.
 	 */
-	if (address >= (ulong) _end || address < (ulong) _einitdata)
+	if (address >= (ulong) _end || address < (ulong) __init_end)
 		return construct_pgprot(PAGE_KERNEL, initial_heap_home());
 
 	/* Use hash-for-home if requested for data/bss. */
@@ -632,7 +632,7 @@ int devmem_is_allowed(unsigned long pagenr)
 {
 	return pagenr < kaddr_to_pfn(_end) &&
 		!(pagenr >= kaddr_to_pfn(&init_thread_union) ||
-		  pagenr < kaddr_to_pfn(_einitdata)) &&
+		  pagenr < kaddr_to_pfn(__init_end)) &&
 		!(pagenr >= kaddr_to_pfn(_sinittext) ||
 		  pagenr <= kaddr_to_pfn(_einittext-1));
 }
@@ -975,8 +975,8 @@ void free_initmem(void)
 
 	/* Free the data pages that we won't use again after init. */
 	free_init_pages("unused kernel data",
-			(unsigned long)_sinitdata,
-			(unsigned long)_einitdata);
+			(unsigned long)__init_begin,
+			(unsigned long)__init_end);
 
 	/*
 	 * Free the pages mapped from 0xc0000000 that correspond to code
-- 
1.7.9.5

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
  2013-11-14  8:31     ` Geert Uytterhoeven
@ 2013-11-14 14:55       ` Chris Metcalf
  2014-07-09 18:33         ` Geert Uytterhoeven
  0 siblings, 1 reply; 74+ messages in thread
From: Chris Metcalf @ 2013-11-14 14:55 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Andrew Morton, linux-arch, linux-kernel

On 11/14/2013 3:31 AM, Geert Uytterhoeven wrote:
> Feel free to take v2 below. Thanks!
>
> From d761d4d63945ff0a6eab5a9058c132f870c92aff Mon Sep 17 00:00:00 2001
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Date: Fri, 8 Nov 2013 21:33:29 +0100
> Subject: [PATCH -v2] tile: Remove tile-specific _sinitdata and _einitdata
>
> Use standard __init_begin and __init_end instead.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Chris Metcalf <cmetcalf@tilera.com>

Taken into the tile tree; thanks!  (I did fix one extra place where it mentioned _sinitdata in a comment.)

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


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

* Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
  2013-11-13 16:14       ` Rob Herring
@ 2013-11-14 16:29         ` Michal Simek
  0 siblings, 0 replies; 74+ messages in thread
From: Michal Simek @ 2013-11-14 16:29 UTC (permalink / raw)
  To: Rob Herring
  Cc: Geert Uytterhoeven, Andrew Morton, linux-arch, linux-kernel,
	Rob Herring, microblaze-uclinux, devicetree,
	Benjamin Herrenschmidt

[-- Attachment #1: Type: text/plain, Size: 2681 bytes --]

On 11/13/2013 05:14 PM, Rob Herring wrote:
> On 11/13/2013 07:40 AM, Michal Simek wrote:
>> On 11/13/2013 11:19 AM, Michal Simek wrote:
>>> On 11/12/2013 08:42 PM, Geert Uytterhoeven wrote:
>>>> Kill the microblaze-specific __fdt_blob section, and start
>>>> using .dtb.init.rodata from <asm-generic/sections.h> for
>>>> built-in DTBs, like most other DT enabled architectures.
>>>>
>>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc:
>>>> Michal Simek <monstr@monstr.eu> Cc: Rob Herring
>>>> <rob.herring@calxeda.com> Cc:
>>>> microblaze-uclinux@itee.uq.edu.au Cc:
>>>> devicetree@vger.kernel.org --- Untested, but the resulting
>>>> vmlinux after "make simpleImage.system" looks sane.
>>>>
>>>> QUESTION: The padding of the DTB is gone, is this OK?
>>>
>>> Removing this kernel padding should be fine. I can't remember why
>>> it was there from the beginning.
>>
>> I know why is this here. The reason is process how dtb is passed to
>> the kernel via command line. head.S code just copy that dtb to the
>> same location where compiled-in dts is expected and kernel doesn't
>> need to care about position of dtb because this copy is done
>> without MMU. And the full kernel is covered by 2 tlbs and we don't
>> need to use another TLB for dtb mapping.
>>
>> It means pad matters a lot. Because u-boot ITS format doesn't use 
>> simpleImage target but the kernel need to have a space for copying 
>> dtb to this kernel location.
>>
>> Let me think about if there is an easy way to handle dtbs which are
>> passed from bootloader.
> 
> Isn't the built-in dtb in a RO init section? Seems like a bad idea to
> write to it. Also, it will be a double copy because a built-in dtb has
> to be copied out of init section.

Microblaze has it currently out of RO section.
This patch is adding it there.

I have looked at powerpc flow which is probably the closest to our version.

head.S
Saving dtb pointer to r31 then initial_mmu which setups 16MB tlb for kernel
then some exception and calling machine_init()->early_init_devtree()
->move_device_tree() where also change initial_boot_params location
for unflatten_device_tree() in setup_arch().

Ben: I didn't find any TLB entry for DTB itself.
Does it mean that I missed it or that powerpc can access in machine_init()
the whole memory space?

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: [PATCH 13/17] openrisc: Refactor or32_early_setup()
  2013-11-12 19:42 ` [PATCH 13/17] openrisc: Refactor or32_early_setup() Geert Uytterhoeven
@ 2013-11-15  9:59   ` Jonas Bonn
  0 siblings, 0 replies; 74+ messages in thread
From: Jonas Bonn @ 2013-11-15  9:59 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Andrew Morton, linux-arch, linux-kernel, linux

On 11/12/2013 08:42 PM, Geert Uytterhoeven wrote:
>    - Change fdt pointer (passed from head.S) from unsigned int to void *,
>      which allows to kill a cast, and makes it compatible with __dtb_start.
>    - Use pr_info(),
>    - Extract common part.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: linux@lists.openrisc.net

Thanks, I'll take this one directly into the OpenRISC tree.

/Jonas

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

* Re: [PATCH 02/17] cris: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 ` [PATCH 02/17] cris: " Geert Uytterhoeven
@ 2013-11-15 16:52   ` Jesper Nilsson
  0 siblings, 0 replies; 74+ messages in thread
From: Jesper Nilsson @ 2013-11-15 16:52 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Mikael Starvik,
	Jesper Nilsson, linux-cris-kernel

On Tue, Nov 12, 2013 at 08:42:12PM +0100, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Mikael Starvik <starvik@axis.com>

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

> Cc: linux-cris-kernel@axis.com
> ---
>  arch/cris/include/asm/Kbuild     |    1 +
>  arch/cris/include/asm/sections.h |    7 -------
>  2 files changed, 1 insertion(+), 7 deletions(-)
>  delete mode 100644 arch/cris/include/asm/sections.h
> 
> diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
> index b06caf649a95..44e7d0dbcf32 100644
> --- a/arch/cris/include/asm/Kbuild
> +++ b/arch/cris/include/asm/Kbuild
> @@ -8,6 +8,7 @@ generic-y += exec.h
>  generic-y += kvm_para.h
>  generic-y += linkage.h
>  generic-y += module.h
> +generic-y += sections.h
>  generic-y += trace_clock.h
>  generic-y += vga.h
>  generic-y += xor.h
> diff --git a/arch/cris/include/asm/sections.h b/arch/cris/include/asm/sections.h
> deleted file mode 100644
> index 2c998ce8967b..000000000000
> --- a/arch/cris/include/asm/sections.h
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -#ifndef _CRIS_SECTIONS_H
> -#define _CRIS_SECTIONS_H
> -
> -/* nothing to see, move along */
> -#include <asm-generic/sections.h>
> -
> -#endif
> -- 
> 1.7.9.5

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

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

* Re: [PATCH 05/17] score: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 ` [PATCH 05/17] score: " Geert Uytterhoeven
@ 2013-11-15 18:05   ` Lennox Wu
  0 siblings, 0 replies; 74+ messages in thread
From: Lennox Wu @ 2013-11-15 18:05 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrew Morton; +Cc: linux-arch, linux-kernel, Chen Liqin

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]


  Acked-by: Lennox Wu <lennox.wu@gmail.com>

於 2013/11/13 上午 03:42, Geert Uytterhoeven 提到:
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Chen Liqin <liqin.linux@gmail.com>
> Cc: Lennox Wu <lennox.wu@gmail.com>
> ---
>  arch/score/include/asm/Kbuild     |    1 +
>  arch/score/include/asm/sections.h |    6 ------
>  2 files changed, 1 insertion(+), 6 deletions(-)
>  delete mode 100644 arch/score/include/asm/sections.h
>
> diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
> index f3414ade77a3..32cd967c19a4 100644
> --- a/arch/score/include/asm/Kbuild
> +++ b/arch/score/include/asm/Kbuild
> @@ -2,6 +2,7 @@
>  header-y +=
>  
>  generic-y += clkdev.h
> +generic-y += sections.h
>  generic-y += trace_clock.h
>  generic-y += xor.h
>  generic-y += preempt.h
> diff --git a/arch/score/include/asm/sections.h b/arch/score/include/asm/sections.h
> deleted file mode 100644
> index 9441d23af005..000000000000
> --- a/arch/score/include/asm/sections.h
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -#ifndef _ASM_SCORE_SECTIONS_H
> -#define _ASM_SCORE_SECTIONS_H
> -
> -#include <asm-generic/sections.h>
> -
> -#endif /* _ASM_SCORE_SECTIONS_H */



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 544 bytes --]

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

* [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-13 15:51   ` Rob Herring
       [not found]     ` < 1384859554-27268-1-git-send-email-geert@linux-m68k.org>
  2013-11-13 17:20     ` Geert Uytterhoeven
@ 2013-11-19 11:12     ` Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 2/9] arc: Use NULL as the default DTB Geert Uytterhoeven
                         ` (10 more replies)
  2 siblings, 11 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven

Let early_init_dt_scan() fall-back to the built-in DT if no DT was passed,
or if it's invalid, so architectures don't have to duplicate this logic.

Suggested-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/of/fdt.c       |   24 +++++++++++++++++-------
 include/linux/of_fdt.h |    1 +
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 2fa024b97c43..a797cd43bc8b 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -868,18 +868,28 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
 
 bool __init early_init_dt_scan(void *params)
 {
-	if (!params)
-		return false;
-
 	/* Setup flat device-tree pointer */
 	initial_boot_params = params;
 
-	/* check device tree validity */
-	if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
-		initial_boot_params = NULL;
-		return false;
+	/* check passed device tree validity */
+	if (initial_boot_params &&
+	    be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
+		pr_info("FDT at %p\n", initial_boot_params);
+		goto found;
+	}
+
+	/* check built-in device tree validity */
+	initial_boot_params = &__dtb_start;
+	if (__dtb_end != (void *)&__dtb_start &&
+	    be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
+		pr_info("Compiled-in FDT at %p\n", initial_boot_params);
+		goto found;
 	}
 
+	initial_boot_params = NULL;
+	return false;
+
+found:
 	/* Retrieve various information from the /chosen node */
 	of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
 
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index aabc49f3e403..6c4a60454854 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -59,6 +59,7 @@ struct boot_param_header {
 
 /* For kernels with a built-in device tree */
 extern struct boot_param_header __dtb_start;
+extern char __dtb_end[];
 
 #if defined(CONFIG_OF_FLATTREE)
 
-- 
1.7.9.5


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

* [PATCH 2/9] arc: Use NULL as the default DTB
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-20  4:58         ` Vineet Gupta
  2013-11-19 11:12       ` [PATCH 3/9] c6x: Remove duplicate DT selection logic Geert Uytterhoeven
                         ` (9 subsequent siblings)
  10 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven, Vineet Gupta

early_init_dt_scan() now takes care of falling back to the built-in DTB.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
---
 arch/arc/kernel/setup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index ef705d0f50f5..481e11240e12 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -314,7 +314,7 @@ void setup_processor(void)
 void __init setup_arch(char **cmdline_p)
 {
 	/* This also populates @boot_command_line from /bootargs */
-	machine_desc = setup_machine_fdt(&__dtb_start);
+	machine_desc = setup_machine_fdt(NULL);
 	if (!machine_desc)
 		panic("Embedded DT invalid\n");
 
-- 
1.7.9.5


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

* [PATCH 3/9] c6x: Remove duplicate DT selection logic
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 2/9] arc: Use NULL as the default DTB Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 4/9] metag: " Geert Uytterhoeven
                         ` (8 subsequent siblings)
  10 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven,
	Mark Salter, Aurelien Jacquiot, linux-c6x-dev

early_init_dt_scan() now takes care of falling back to the built-in DTB.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: linux-c6x-dev@linux-c6x.org
---
 arch/c6x/kernel/setup.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
index 414353027ba9..ad7c5d73bb3c 100644
--- a/arch/c6x/kernel/setup.c
+++ b/arch/c6x/kernel/setup.c
@@ -266,7 +266,6 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)
 notrace void __init machine_init(unsigned long dt_ptr)
 {
 	struct boot_param_header *dtb = __va(dt_ptr);
-	struct boot_param_header *fdt = &__dtb_start;
 
 	/* interrupts must be masked */
 	set_creg(IER, 2);
@@ -279,15 +278,8 @@ notrace void __init machine_init(unsigned long dt_ptr)
 
 	lockdep_init();
 
-	/*
-	 * dtb is passed in from bootloader.
-	 * fdt is linked in blob.
-	 */
-	if (dtb && dtb != fdt)
-		fdt = dtb;
-
 	/* Do some early initialization based on the flat device tree */
-	early_init_dt_scan(fdt);
+	early_init_dt_scan(dtb);
 
 	parse_early_param();
 }
-- 
1.7.9.5


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

* [PATCH 4/9] metag: Remove duplicate DT selection logic
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 2/9] arc: Use NULL as the default DTB Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 3/9] c6x: Remove duplicate DT selection logic Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-19 13:14         ` James Hogan
  2013-11-19 11:12       ` [PATCH 5/9] microblaze: Use NULL as the default DTB Geert Uytterhoeven
                         ` (7 subsequent siblings)
  10 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven,
	James Hogan, linux-metag

early_init_dt_scan() now takes care of falling back to the built-in DTB.
Note that we now have to check ourselves whether original_cmd_line is
a DTB or a command line, to keep command line append working.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
---
Untested due to lack of cross-compiler.

 arch/metag/kernel/setup.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 919c782f5479..e3ebfc5f5d77 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -221,6 +221,7 @@ static struct notifier_block metag_panic_block = {
 
 void __init setup_arch(char **cmdline_p)
 {
+	void *dt = NULL;
 	unsigned long start_pfn;
 	unsigned long text_start = (unsigned long)(&_stext);
 	unsigned long cpu = smp_processor_id();
@@ -242,26 +243,27 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	/* try interpreting the argument as a device tree */
-	machine_desc = setup_machine_fdt(original_cmd_line);
-	/* if it doesn't look like a device tree it must be a command line */
+	if (original_cmd_line &&
+	    be32_to_cpup((__be32 *)original_cmd_line) == OF_DT_HEADER) {
+		dt = original_cmd_line;
+		original_cmd_line = NULL;
+	}
+
+	machine_desc = setup_machine_fdt(dt);
 	if (!machine_desc) {
-#ifdef CONFIG_METAG_BUILTIN_DTB
-		/* try the embedded device tree */
-		machine_desc = setup_machine_fdt(&__dtb_start);
-		if (!machine_desc)
-			panic("Invalid embedded device tree.");
-#else
 		/* use the default machine description */
 		machine_desc = default_machine_desc();
-#endif
+	}
+
 #ifndef CONFIG_CMDLINE_FORCE
+	if (original_cmd_line) {
 		/* append the bootloader cmdline to any builtin fdt cmdline */
 		if (boot_command_line[0] && original_cmd_line[0])
 			strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
 		strlcat(boot_command_line, original_cmd_line,
 			COMMAND_LINE_SIZE);
-#endif
 	}
+#endif
 	setup_meta_clocks(machine_desc->clocks);
 
 	*cmdline_p = boot_command_line;
-- 
1.7.9.5


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

* [PATCH 5/9] microblaze: Use NULL as the default DTB
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (2 preceding siblings ...)
  2013-11-19 11:12       ` [PATCH 4/9] metag: " Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 6/9] mips: Remove unused dt_setup_arch() Geert Uytterhoeven
                         ` (6 subsequent siblings)
  10 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven,
	Michal Simek, microblaze-uclinux

early_init_dt_scan() now takes care of falling back to the built-in DTB,
and printing what it did.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
---
Note: I did not remove the now-unused fdt parameter from
      machine_early_init(), as this would require quite some changes
      to head.S. BTW, cmdline is also unused.

 arch/microblaze/kernel/setup.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index a4534f584be0..a9a9f8baa94a 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -136,7 +136,7 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
 	lockdep_init();
 
 /* initialize device tree for usage in early_printk */
-	early_init_devtree(&__dtb_start);
+	early_init_devtree(NULL);
 
 #ifdef CONFIG_EARLY_PRINTK
 	setup_early_printk(NULL);
@@ -149,10 +149,6 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
 							tlb1, kernel_tlb); */
 
 	pr_info("Ramdisk addr 0x%08x, ", ram);
-	if (fdt)
-		pr_info("FDT at 0x%08x\n", fdt);
-	else
-		pr_info("Compiled-in FDT at %p\n", &__dtb_start);
 
 #ifdef CONFIG_MTD_UCLINUX
 	pr_info("Found romfs @ 0x%08x (0x%08x)\n",
-- 
1.7.9.5


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

* [PATCH 6/9] mips: Remove unused dt_setup_arch()
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (3 preceding siblings ...)
  2013-11-19 11:12       ` [PATCH 5/9] microblaze: Use NULL as the default DTB Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 7/9] mips: Use NULL as the default DTB Geert Uytterhoeven
                         ` (5 subsequent siblings)
  10 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven,
	Ralf Baechle, John Crispin, linux-mips

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: John Crispin <blogic@openwrt.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/include/asm/prom.h |    7 -------
 1 file changed, 7 deletions(-)

diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
index ccd2b75f152c..7e2ee8301c06 100644
--- a/arch/mips/include/asm/prom.h
+++ b/arch/mips/include/asm/prom.h
@@ -23,13 +23,6 @@ struct boot_param_header;
 
 extern void __dt_setup_arch(struct boot_param_header *bph);
 
-#define dt_setup_arch(sym)						\
-({									\
-	extern struct boot_param_header __dtb_##sym##_begin;		\
-									\
-	__dt_setup_arch(&__dtb_##sym##_begin);				\
-})
-
 #else /* CONFIG_OF */
 static inline void device_tree_init(void) { }
 #endif /* CONFIG_OF */
-- 
1.7.9.5


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

* [PATCH 7/9] mips: Use NULL as the default DTB
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (4 preceding siblings ...)
  2013-11-19 11:12       ` [PATCH 6/9] mips: Remove unused dt_setup_arch() Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 8/9] openrisc: Remove duplicate DT selection logic Geert Uytterhoeven
                         ` (4 subsequent siblings)
  10 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven,
	Ralf Baechle, linux-mips

early_init_dt_scan() now takes care of falling back to the built-in DTB.

On Netlogic XLP, use initial_boot_params in device_tree_init(), like
the other MIPS sub-platforms do, as xlp_fdt_blob will now be NULL when
using the default built-in DTB.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/lantiq/prom.c           |    2 +-
 arch/mips/mti-sead3/sead3-setup.c |    2 +-
 arch/mips/netlogic/xlp/dt.c       |    8 +++-----
 arch/mips/ralink/of.c             |    2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 19686c5bc5ed..582f6e4a5f6d 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -71,7 +71,7 @@ void __init plat_mem_setup(void)
 	 * Load the builtin devicetree. This causes the chosen node to be
 	 * parsed resulting in our memory appearing
 	 */
-	__dt_setup_arch(&__dtb_start);
+	__dt_setup_arch(NULL);
 }
 
 void __init device_tree_init(void)
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index 928ba84c8a78..3afec4507ea5 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -25,7 +25,7 @@ void __init plat_mem_setup(void)
 	 * Load the builtin devicetree. This causes the chosen node to be
 	 * parsed resulting in our memory appearing
 	 */
-	__dt_setup_arch(&__dtb_start);
+	__dt_setup_arch(NULL);
 }
 
 void __init device_tree_init(void)
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 87250f378386..e52281b9214d 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -66,7 +66,6 @@ void __init *xlp_dt_init(void *fdtp)
 #endif
 		default:
 			/* Pick a built-in if any, and hope for the best */
-			fdtp = &__dtb_start;
 			break;
 		}
 	}
@@ -83,13 +82,12 @@ void __init xlp_early_init_devtree(void)
 void __init device_tree_init(void)
 {
 	unsigned long base, size;
-	struct boot_param_header *fdtp = xlp_fdt_blob;
 
-	if (!fdtp)
+	if (!initial_boot_params)
 		return;
 
-	base = virt_to_phys(fdtp);
-	size = be32_to_cpu(fdtp->totalsize);
+	base = virt_to_phys(initial_boot_params);
+	size = be32_to_cpu(initial_boot_params->totalsize);
 
 	/* Before we do anything, lets reserve the dt blob */
 	reserve_bootmem(base, size, BOOTMEM_DEFAULT);
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 615603bd8063..d72a5bc1efc2 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -84,7 +84,7 @@ void __init plat_mem_setup(void)
 	 * Load the builtin devicetree. This causes the chosen node to be
 	 * parsed resulting in our memory appearing
 	 */
-	__dt_setup_arch(&__dtb_start);
+	__dt_setup_arch(NULL);
 
 	if (soc_info.mem_size)
 		add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
-- 
1.7.9.5


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

* [PATCH 8/9] openrisc: Remove duplicate DT selection logic
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (5 preceding siblings ...)
  2013-11-19 11:12       ` [PATCH 7/9] mips: Use NULL as the default DTB Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-19 11:12       ` [PATCH 9/9] xtensa: Use NULL as the default DTB Geert Uytterhoeven
                         ` (3 subsequent siblings)
  10 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven,
	Jonas Bonn, linux

early_init_dt_scan() now takes care of falling back to the built-in DTB,
and printing what it did.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux@lists.openrisc.net
---
 arch/openrisc/kernel/setup.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index 3ca640cd42be..4ec6b07f02b3 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -212,12 +212,6 @@ void __init setup_cpuinfo(void)
 
 void __init or32_early_setup(void *fdt)
 {
-	if (fdt)
-		pr_info("FDT at %p\n", fdt);
-	else {
-		fdt = &__dtb_start;
-		pr_info("Compiled-in FDT at %p\n", fdt);
-	}
 	early_init_devtree(fdt);
 }
 
-- 
1.7.9.5


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

* [PATCH 9/9] xtensa: Use NULL as the default DTB
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (6 preceding siblings ...)
  2013-11-19 11:12       ` [PATCH 8/9] openrisc: Remove duplicate DT selection logic Geert Uytterhoeven
@ 2013-11-19 11:12       ` Geert Uytterhoeven
  2013-11-19 13:27       ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() James Hogan
                         ` (2 subsequent siblings)
  10 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven,
	Chris Zankel, Max Filippov, linux-xtensa

early_init_dt_scan() now takes care of falling back to the built-in DTB.
Also make dtb_start static while we're at it.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
---
 arch/xtensa/kernel/setup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index d96cf8f3fe70..dd440deb137d 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -68,7 +68,7 @@ extern int initrd_below_start_ok;
 #endif
 
 #ifdef CONFIG_OF
-void *dtb_start = &__dtb_start;
+static void *dtb_start;
 #endif
 
 unsigned char aux_device_present;
-- 
1.7.9.5


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

* Re: [PATCH 4/9] metag: Remove duplicate DT selection logic
  2013-11-19 11:12       ` [PATCH 4/9] metag: " Geert Uytterhoeven
@ 2013-11-19 13:14         ` James Hogan
  0 siblings, 0 replies; 74+ messages in thread
From: James Hogan @ 2013-11-19 13:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, devicetree, linux-arch, linux-kernel, linux-metag

On 19/11/13 11:12, Geert Uytterhoeven wrote:
> early_init_dt_scan() now takes care of falling back to the built-in DTB.
> Note that we now have to check ourselves whether original_cmd_line is
> a DTB or a command line, to keep command line append working.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: linux-metag@vger.kernel.org

Looks good and seems to work fine.
Acked-by: James Hogan <james.hogan@imgtec.com>

Thanks
James


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

* Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
  2013-11-12 19:42 ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> Geert Uytterhoeven
  2013-11-13  5:41   ` Vineet Gupta
  2013-11-13 15:51   ` Rob Herring
@ 2013-11-19 13:24   ` James Hogan
  2 siblings, 0 replies; 74+ messages in thread
From: James Hogan @ 2013-11-19 13:24 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Andrew Morton, linux-arch, linux-kernel, Vineet Gupta,
	Ralf Baechle, Jonas Bonn, Chris Zankel, Rob Herring, devicetree,
	linux-metag

On 12/11/13 19:42, Geert Uytterhoeven wrote:
> The different architectures used their own (and different) declarations:
> 
>     extern struct boot_param_header __dtb_start;
>     extern u32 __dtb_start[];
>     extern char __dtb_start[];
> 
> Consolidate them using the first variant in <linux/of_fdt.h>.
> This requires adding a few "address of" operators on architectures where
> __dtb_start was an array before.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Jonas Bonn <jonas@southpole.se>
> CC: Chris Zankel <chris@zankel.net>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree@vger.kernel.org

Acked-by: James Hogan <james.hogan@imgtec.com>

Thanks
James

> ---
>  arch/arc/include/asm/sections.h             |    1 -
>  arch/arc/kernel/setup.c                     |    2 +-
>  arch/metag/kernel/setup.c                   |    6 +-----
>  arch/mips/include/asm/mips-boards/generic.h |    4 ----
>  arch/mips/lantiq/prom.h                     |    2 --
>  arch/mips/netlogic/xlp/dt.c                 |    4 ++--
>  arch/mips/ralink/of.c                       |    2 --
>  arch/openrisc/kernel/setup.c                |    2 +-
>  arch/openrisc/kernel/vmlinux.h              |    2 --
>  arch/xtensa/kernel/setup.c                  |    3 +--
>  include/linux/of_fdt.h                      |    3 +++
>  11 files changed, 9 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/arc/include/asm/sections.h b/arch/arc/include/asm/sections.h
> index 764f1e3ba752..09db952e14bd 100644
> --- a/arch/arc/include/asm/sections.h
> +++ b/arch/arc/include/asm/sections.h
> @@ -12,6 +12,5 @@
>  #include <asm-generic/sections.h>
>  
>  extern char __arc_dccm_base[];
> -extern char __dtb_start[];
>  
>  #endif
> diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
> index 643eae4436e0..ef705d0f50f5 100644
> --- a/arch/arc/kernel/setup.c
> +++ b/arch/arc/kernel/setup.c
> @@ -314,7 +314,7 @@ void setup_processor(void)
>  void __init setup_arch(char **cmdline_p)
>  {
>  	/* This also populates @boot_command_line from /bootargs */
> -	machine_desc = setup_machine_fdt(__dtb_start);
> +	machine_desc = setup_machine_fdt(&__dtb_start);
>  	if (!machine_desc)
>  		panic("Embedded DT invalid\n");
>  
> diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
> index 129c7cdda1ce..919c782f5479 100644
> --- a/arch/metag/kernel/setup.c
> +++ b/arch/metag/kernel/setup.c
> @@ -105,10 +105,6 @@
>  
>  extern char _heap_start[];
>  
> -#ifdef CONFIG_METAG_BUILTIN_DTB
> -extern u32 __dtb_start[];
> -#endif
> -
>  #ifdef CONFIG_DA_CONSOLE
>  /* Our early channel based console driver */
>  extern struct console dash_console;
> @@ -251,7 +247,7 @@ void __init setup_arch(char **cmdline_p)
>  	if (!machine_desc) {
>  #ifdef CONFIG_METAG_BUILTIN_DTB
>  		/* try the embedded device tree */
> -		machine_desc = setup_machine_fdt(__dtb_start);
> +		machine_desc = setup_machine_fdt(&__dtb_start);
>  		if (!machine_desc)
>  			panic("Invalid embedded device tree.");
>  #else
> diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
> index 48616816bcbc..c904c24550f6 100644
> --- a/arch/mips/include/asm/mips-boards/generic.h
> +++ b/arch/mips/include/asm/mips-boards/generic.h
> @@ -67,10 +67,6 @@
>  
>  extern int mips_revision_sconid;
>  
> -#ifdef CONFIG_OF
> -extern struct boot_param_header __dtb_start;
> -#endif
> -
>  #ifdef CONFIG_PCI
>  extern void mips_pcibios_init(void);
>  #else
> diff --git a/arch/mips/lantiq/prom.h b/arch/mips/lantiq/prom.h
> index 8e07b5f28ef1..bfd2d58c1d69 100644
> --- a/arch/mips/lantiq/prom.h
> +++ b/arch/mips/lantiq/prom.h
> @@ -26,6 +26,4 @@ struct ltq_soc_info {
>  extern void ltq_soc_detect(struct ltq_soc_info *i);
>  extern void ltq_soc_init(void);
>  
> -extern struct boot_param_header __dtb_start;
> -
>  #endif
> diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
> index 8316d5454b17..87250f378386 100644
> --- a/arch/mips/netlogic/xlp/dt.c
> +++ b/arch/mips/netlogic/xlp/dt.c
> @@ -42,7 +42,7 @@
>  #include <asm/prom.h>
>  
>  extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
> -	__dtb_xlp_fvp_begin[], __dtb_start[];
> +	__dtb_xlp_fvp_begin[];
>  static void *xlp_fdt_blob;
>  
>  void __init *xlp_dt_init(void *fdtp)
> @@ -66,7 +66,7 @@ void __init *xlp_dt_init(void *fdtp)
>  #endif
>  		default:
>  			/* Pick a built-in if any, and hope for the best */
> -			fdtp = __dtb_start;
> +			fdtp = &__dtb_start;
>  			break;
>  		}
>  	}
> diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
> index eccc5526155e..615603bd8063 100644
> --- a/arch/mips/ralink/of.c
> +++ b/arch/mips/ralink/of.c
> @@ -28,8 +28,6 @@
>  __iomem void *rt_sysc_membase;
>  __iomem void *rt_memc_membase;
>  
> -extern struct boot_param_header __dtb_start;
> -
>  __iomem void *plat_of_remap_node(const char *node)
>  {
>  	struct resource res;
> diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
> index 4fc7ccc0a2cf..c9b880d64bb8 100644
> --- a/arch/openrisc/kernel/setup.c
> +++ b/arch/openrisc/kernel/setup.c
> @@ -213,7 +213,7 @@ void __init or32_early_setup(void *fdt)
>  	if (fdt)
>  		pr_info("FDT at %p\n", fdt);
>  	else {
> -		fdt = __dtb_start;
> +		fdt = &__dtb_start;
>  		pr_info("Compiled-in FDT at %p\n", fdt);
>  	}
>  	early_init_devtree(fdt);
> diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
> index 70b9ce41835c..bbcdf21b0b35 100644
> --- a/arch/openrisc/kernel/vmlinux.h
> +++ b/arch/openrisc/kernel/vmlinux.h
> @@ -5,6 +5,4 @@
>  extern char __initrd_start, __initrd_end;
>  #endif
>  
> -extern u32 __dtb_start[];
> -
>  #endif
> diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
> index 6e2b6638122d..d96cf8f3fe70 100644
> --- a/arch/xtensa/kernel/setup.c
> +++ b/arch/xtensa/kernel/setup.c
> @@ -68,8 +68,7 @@ extern int initrd_below_start_ok;
>  #endif
>  
>  #ifdef CONFIG_OF
> -extern u32 __dtb_start[];
> -void *dtb_start = __dtb_start;
> +void *dtb_start = &__dtb_start;
>  #endif
>  
>  unsigned char aux_device_present;
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 0beaee9dac1f..aabc49f3e403 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -57,6 +57,9 @@ struct boot_param_header {
>  	__be32	dt_struct_size;		/* size of the DT structure block */
>  };
>  
> +/* For kernels with a built-in device tree */
> +extern struct boot_param_header __dtb_start;
> +
>  #if defined(CONFIG_OF_FLATTREE)
>  
>  struct device_node;
> 


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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (7 preceding siblings ...)
  2013-11-19 11:12       ` [PATCH 9/9] xtensa: Use NULL as the default DTB Geert Uytterhoeven
@ 2013-11-19 13:27       ` James Hogan
  2013-11-20 20:50       ` Rob Herring
  2013-11-21 12:21       ` Grant Likely
  10 siblings, 0 replies; 74+ messages in thread
From: James Hogan @ 2013-11-19 13:27 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Rob Herring, devicetree, linux-arch, linux-kernel

On 19/11/13 11:12, Geert Uytterhoeven wrote:
> Let early_init_dt_scan() fall-back to the built-in DT if no DT was passed,
> or if it's invalid, so architectures don't have to duplicate this logic.
> 
> Suggested-by: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Reviewed-by: James Hogan <james.hogan@imgtec.com>

Thanks
James


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

* Re: [PATCH 2/9] arc: Use NULL as the default DTB
  2013-11-19 11:12       ` [PATCH 2/9] arc: Use NULL as the default DTB Geert Uytterhoeven
@ 2013-11-20  4:58         ` Vineet Gupta
  0 siblings, 0 replies; 74+ messages in thread
From: Vineet Gupta @ 2013-11-20  4:58 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Herring; +Cc: devicetree, linux-arch, linux-kernel

On 11/19/2013 04:42 PM, Geert Uytterhoeven wrote:
> early_init_dt_scan() now takes care of falling back to the built-in DTB.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>

Acked-by: Vineet Gupta <vgupta@synopsys.com>

Thx,
-Vineet

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

* Re: [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (19 preceding siblings ...)
  2013-11-13  5:25 ` [PATCH 00/17] <asm/sections.h> related cleanups Vineet Gupta
@ 2013-11-20 18:55 ` David Howells
  2013-11-20 18:56 ` [PATCH 04/17] mn10300: Use Kbuild logic to include <asm-generic/sections.h> David Howells
  21 siblings, 0 replies; 74+ messages in thread
From: David Howells @ 2013-11-20 18:55 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: dhowells, Andrew Morton, linux-arch, linux-kernel

Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: David Howells <dhowells@redhat.com>

Acked-by: David Howells <dhowells@redhat.com>

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

* Re: [PATCH 04/17] mn10300: Use Kbuild logic to include <asm-generic/sections.h>
  2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
                   ` (20 preceding siblings ...)
  2013-11-20 18:55 ` [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table David Howells
@ 2013-11-20 18:56 ` David Howells
  21 siblings, 0 replies; 74+ messages in thread
From: David Howells @ 2013-11-20 18:56 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: dhowells, Andrew Morton, linux-arch, linux-kernel, linux-am33-list

Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: David Howells <dhowells@redhat.com>
> Cc: linux-am33-list@redhat.com

Acked-by: David Howells <dhowells@redhat.com>

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (8 preceding siblings ...)
  2013-11-19 13:27       ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() James Hogan
@ 2013-11-20 20:50       ` Rob Herring
  2013-11-21 12:21       ` Grant Likely
  10 siblings, 0 replies; 74+ messages in thread
From: Rob Herring @ 2013-11-20 20:50 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Rob Herring, devicetree, linux-arch, linux-kernel

On Tue, Nov 19, 2013 at 5:12 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Let early_init_dt_scan() fall-back to the built-in DT if no DT was passed,
> or if it's invalid, so architectures don't have to duplicate this logic.
>
> Suggested-by: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---

Looks good to me. I can take this series if you want to send me a pull
request. In any case, for the series:

Reviewed-by: Rob Herring <rob.herring@calxeda.com>

Rob

>  drivers/of/fdt.c       |   24 +++++++++++++++++-------
>  include/linux/of_fdt.h |    1 +
>  2 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 2fa024b97c43..a797cd43bc8b 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -868,18 +868,28 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
>
>  bool __init early_init_dt_scan(void *params)
>  {
> -       if (!params)
> -               return false;
> -
>         /* Setup flat device-tree pointer */
>         initial_boot_params = params;
>
> -       /* check device tree validity */
> -       if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
> -               initial_boot_params = NULL;
> -               return false;
> +       /* check passed device tree validity */
> +       if (initial_boot_params &&
> +           be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
> +               pr_info("FDT at %p\n", initial_boot_params);
> +               goto found;
> +       }
> +
> +       /* check built-in device tree validity */
> +       initial_boot_params = &__dtb_start;
> +       if (__dtb_end != (void *)&__dtb_start &&
> +           be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
> +               pr_info("Compiled-in FDT at %p\n", initial_boot_params);
> +               goto found;
>         }
>
> +       initial_boot_params = NULL;
> +       return false;
> +
> +found:
>         /* Retrieve various information from the /chosen node */
>         of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
>
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index aabc49f3e403..6c4a60454854 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -59,6 +59,7 @@ struct boot_param_header {
>
>  /* For kernels with a built-in device tree */
>  extern struct boot_param_header __dtb_start;
> +extern char __dtb_end[];
>
>  #if defined(CONFIG_OF_FLATTREE)
>
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
                         ` (9 preceding siblings ...)
  2013-11-20 20:50       ` Rob Herring
@ 2013-11-21 12:21       ` Grant Likely
  2013-11-21 12:23         ` Grant Likely
  2013-11-21 13:42         ` Geert Uytterhoeven
  10 siblings, 2 replies; 74+ messages in thread
From: Grant Likely @ 2013-11-21 12:21 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Herring
  Cc: devicetree, linux-arch, linux-kernel, Geert Uytterhoeven

On Tue, 19 Nov 2013 12:12:26 +0100, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Let early_init_dt_scan() fall-back to the built-in DT if no DT was passed,
> or if it's invalid, so architectures don't have to duplicate this logic.
> 
> Suggested-by: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  drivers/of/fdt.c       |   24 +++++++++++++++++-------
>  include/linux/of_fdt.h |    1 +
>  2 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 2fa024b97c43..a797cd43bc8b 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -868,18 +868,28 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
>  
>  bool __init early_init_dt_scan(void *params)
>  {
> -	if (!params)
> -		return false;
> -
>  	/* Setup flat device-tree pointer */
>  	initial_boot_params = params;
>  
> -	/* check device tree validity */
> -	if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
> -		initial_boot_params = NULL;
> -		return false;
> +	/* check passed device tree validity */
> +	if (initial_boot_params &&
> +	    be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
> +		pr_info("FDT at %p\n", initial_boot_params);
> +		goto found;
> +	}
> +
> +	/* check built-in device tree validity */
> +	initial_boot_params = &__dtb_start;
> +	if (__dtb_end != (void *)&__dtb_start &&
> +	    be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
> +		pr_info("Compiled-in FDT at %p\n", initial_boot_params);
> +		goto found;

__dtb_start is in an init section which is discarded after initcalls.
For this to work, the dtb needs to be copied into a region of allocated
memory. The dtb section can also potentially contain multiple .dtb
blobs. In the use case that you care about you are probably only
thinking about one, but it is entirely possible for device drivers to
have a dtb linked in which may break this if it gets linked in a
different order. The specific example I'm thinking about is I want to
have the DT selftest code load an overlay to get testcase data from a
dtb blob.

The other concern I have here is that I don't really want this to be the
default on a lot of platforms. ARM and PowerPC for instance should only
get the default dtb from the boot wrapper. It needs to be configurable
in some way.

Instead of using __dtb_start, it would probably solve both of the above
problems if the build-in DTB has a specific label identifying it as the
default DT.

g.


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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 12:21       ` Grant Likely
@ 2013-11-21 12:23         ` Grant Likely
  2013-11-21 12:33           ` Grant Likely
  2013-11-21 13:42         ` Geert Uytterhoeven
  1 sibling, 1 reply; 74+ messages in thread
From: Grant Likely @ 2013-11-21 12:23 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Herring
  Cc: devicetree, linux-arch, Linux Kernel Mailing List

On Thu, Nov 21, 2013 at 12:21 PM, Grant Likely
<grant.likely@secretlab.ca> wrote:
> On Tue, 19 Nov 2013 12:12:26 +0100, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> Let early_init_dt_scan() fall-back to the built-in DT if no DT was passed,
>> or if it's invalid, so architectures don't have to duplicate this logic.
>>
>> Suggested-by: Rob Herring <rob.herring@calxeda.com>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> ---
>>  drivers/of/fdt.c       |   24 +++++++++++++++++-------
>>  include/linux/of_fdt.h |    1 +
>>  2 files changed, 18 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> index 2fa024b97c43..a797cd43bc8b 100644
>> --- a/drivers/of/fdt.c
>> +++ b/drivers/of/fdt.c
>> @@ -868,18 +868,28 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
>>
>>  bool __init early_init_dt_scan(void *params)
>>  {
>> -     if (!params)
>> -             return false;
>> -
>>       /* Setup flat device-tree pointer */
>>       initial_boot_params = params;
>>
>> -     /* check device tree validity */
>> -     if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
>> -             initial_boot_params = NULL;
>> -             return false;
>> +     /* check passed device tree validity */
>> +     if (initial_boot_params &&
>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>> +             pr_info("FDT at %p\n", initial_boot_params);
>> +             goto found;
>> +     }
>> +
>> +     /* check built-in device tree validity */
>> +     initial_boot_params = &__dtb_start;
>> +     if (__dtb_end != (void *)&__dtb_start &&
>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>> +             pr_info("Compiled-in FDT at %p\n", initial_boot_params);
>> +             goto found;
>
> __dtb_start is in an init section which is discarded after initcalls.
> For this to work, the dtb needs to be copied into a region of allocated
> memory. The dtb section can also potentially contain multiple .dtb
> blobs. In the use case that you care about you are probably only
> thinking about one, but it is entirely possible for device drivers to
> have a dtb linked in which may break this if it gets linked in a
> different order. The specific example I'm thinking about is I want to
> have the DT selftest code load an overlay to get testcase data from a
> dtb blob.
>
> The other concern I have here is that I don't really want this to be the
> default on a lot of platforms. ARM and PowerPC for instance should only
> get the default dtb from the boot wrapper. It needs to be configurable
> in some way.
>
> Instead of using __dtb_start, it would probably solve both of the above
> problems if the build-in DTB has a specific label identifying it as the
> default DT.

Er, not quite. It still doesn't solve the init section discard
problem. That still needs solving.

g.

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 12:23         ` Grant Likely
@ 2013-11-21 12:33           ` Grant Likely
  0 siblings, 0 replies; 74+ messages in thread
From: Grant Likely @ 2013-11-21 12:33 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Herring
  Cc: devicetree, linux-arch, Linux Kernel Mailing List

On Thu, Nov 21, 2013 at 12:23 PM, Grant Likely
<grant.likely@secretlab.ca> wrote:
> On Thu, Nov 21, 2013 at 12:21 PM, Grant Likely
> <grant.likely@secretlab.ca> wrote:
>> On Tue, 19 Nov 2013 12:12:26 +0100, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>> Let early_init_dt_scan() fall-back to the built-in DT if no DT was passed,
>>> or if it's invalid, so architectures don't have to duplicate this logic.
>>>
>>> Suggested-by: Rob Herring <rob.herring@calxeda.com>
>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>> ---
>>>  drivers/of/fdt.c       |   24 +++++++++++++++++-------
>>>  include/linux/of_fdt.h |    1 +
>>>  2 files changed, 18 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>>> index 2fa024b97c43..a797cd43bc8b 100644
>>> --- a/drivers/of/fdt.c
>>> +++ b/drivers/of/fdt.c
>>> @@ -868,18 +868,28 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
>>>
>>>  bool __init early_init_dt_scan(void *params)
>>>  {
>>> -     if (!params)
>>> -             return false;
>>> -
>>>       /* Setup flat device-tree pointer */
>>>       initial_boot_params = params;
>>>
>>> -     /* check device tree validity */
>>> -     if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
>>> -             initial_boot_params = NULL;
>>> -             return false;
>>> +     /* check passed device tree validity */
>>> +     if (initial_boot_params &&
>>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>>> +             pr_info("FDT at %p\n", initial_boot_params);
>>> +             goto found;
>>> +     }
>>> +
>>> +     /* check built-in device tree validity */
>>> +     initial_boot_params = &__dtb_start;
>>> +     if (__dtb_end != (void *)&__dtb_start &&
>>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>>> +             pr_info("Compiled-in FDT at %p\n", initial_boot_params);
>>> +             goto found;
>>
>> __dtb_start is in an init section which is discarded after initcalls.
>> For this to work, the dtb needs to be copied into a region of allocated
>> memory. The dtb section can also potentially contain multiple .dtb
>> blobs. In the use case that you care about you are probably only
>> thinking about one, but it is entirely possible for device drivers to
>> have a dtb linked in which may break this if it gets linked in a
>> different order. The specific example I'm thinking about is I want to
>> have the DT selftest code load an overlay to get testcase data from a
>> dtb blob.
>>
>> The other concern I have here is that I don't really want this to be the
>> default on a lot of platforms. ARM and PowerPC for instance should only
>> get the default dtb from the boot wrapper. It needs to be configurable
>> in some way.
>>
>> Instead of using __dtb_start, it would probably solve both of the above
>> problems if the build-in DTB has a specific label identifying it as the
>> default DT.
>
> Er, not quite. It still doesn't solve the init section discard
> problem. That still needs solving.

Okay, I've got one more comment on this. I know that some
architectures use unflatten_and_copy_devicetree() to sort out the dtb
copy problem. My point here is that for this to become generic code
then early_init_dt_scan() needs to grow the ability to differentiate
between a DT that needs to be copied (built in) vs. a DT that is
already in safe memory. The contents of
unflatten_and_copy_devicetree() could even be rolled into
unflatten_devicetree() if there is a common way to indicate whether or
not the DT needs to be copied that early_init_dt_scan() can
manipulate. ie. a global flag.

g.

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 12:21       ` Grant Likely
  2013-11-21 12:23         ` Grant Likely
@ 2013-11-21 13:42         ` Geert Uytterhoeven
  2013-11-21 15:53           ` Grant Likely
  2013-11-21 17:38           ` Rob Herring
  1 sibling, 2 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-21 13:42 UTC (permalink / raw)
  To: Grant Likely; +Cc: Rob Herring, devicetree, Linux-Arch, linux-kernel

On Thu, Nov 21, 2013 at 1:21 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>>  bool __init early_init_dt_scan(void *params)
>>  {
>> -     if (!params)
>> -             return false;
>> -
>>       /* Setup flat device-tree pointer */
>>       initial_boot_params = params;
>>
>> -     /* check device tree validity */
>> -     if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
>> -             initial_boot_params = NULL;
>> -             return false;
>> +     /* check passed device tree validity */
>> +     if (initial_boot_params &&
>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>> +             pr_info("FDT at %p\n", initial_boot_params);
>> +             goto found;
>> +     }
>> +
>> +     /* check built-in device tree validity */
>> +     initial_boot_params = &__dtb_start;
>> +     if (__dtb_end != (void *)&__dtb_start &&
>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>> +             pr_info("Compiled-in FDT at %p\n", initial_boot_params);
>> +             goto found;
>
> __dtb_start is in an init section which is discarded after initcalls.
> For this to work, the dtb needs to be copied into a region of allocated

My changes don't change the current behavior much: currently
early_init_dt_scan() is already called with &__dtb_start in several places.
If this is broken, it's already broken.

> memory. The dtb section can also potentially contain multiple .dtb
> blobs. In the use case that you care about you are probably only

Multiple dtb blobs are currently handled in platform-specific code, which
passes the right dtb to early_init_dt_scan().

> thinking about one, but it is entirely possible for device drivers to
> have a dtb linked in which may break this if it gets linked in a
> different order. The specific example I'm thinking about is I want to
> have the DT selftest code load an overlay to get testcase data from a
> dtb blob.
>
> The other concern I have here is that I don't really want this to be the
> default on a lot of platforms. ARM and PowerPC for instance should only
> get the default dtb from the boot wrapper. It needs to be configurable
> in some way.

On ARM and PowerPC, the section is empty, hence &__dbt_start ==
&__dtb_end.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 13:42         ` Geert Uytterhoeven
@ 2013-11-21 15:53           ` Grant Likely
  2013-11-21 17:49             ` Geert Uytterhoeven
  2013-11-21 17:38           ` Rob Herring
  1 sibling, 1 reply; 74+ messages in thread
From: Grant Likely @ 2013-11-21 15:53 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Rob Herring, devicetree, Linux-Arch, linux-kernel

On Thu, 21 Nov 2013 14:42:27 +0100, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Nov 21, 2013 at 1:21 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> >>  bool __init early_init_dt_scan(void *params)
> >>  {
> >> -     if (!params)
> >> -             return false;
> >> -
> >>       /* Setup flat device-tree pointer */
> >>       initial_boot_params = params;
> >>
> >> -     /* check device tree validity */
> >> -     if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
> >> -             initial_boot_params = NULL;
> >> -             return false;
> >> +     /* check passed device tree validity */
> >> +     if (initial_boot_params &&
> >> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
> >> +             pr_info("FDT at %p\n", initial_boot_params);
> >> +             goto found;
> >> +     }
> >> +
> >> +     /* check built-in device tree validity */
> >> +     initial_boot_params = &__dtb_start;
> >> +     if (__dtb_end != (void *)&__dtb_start &&
> >> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
> >> +             pr_info("Compiled-in FDT at %p\n", initial_boot_params);
> >> +             goto found;
> >
> > __dtb_start is in an init section which is discarded after initcalls.
> > For this to work, the dtb needs to be copied into a region of allocated
> 
> My changes don't change the current behavior much: currently
> early_init_dt_scan() is already called with &__dtb_start in several places.
> If this is broken, it's already broken.

Yes, but it is called on platforms that already make that assumption
that __dtb_start must be copied and therefore call
unflatten_and_copy_devicetree(). This change makes *all* platforms do
that. That breaks arm, arm64, c6x, microblaze, some mips platforms, and
powerpc!

> > memory. The dtb section can also potentially contain multiple .dtb
> > blobs. In the use case that you care about you are probably only
> 
> Multiple dtb blobs are currently handled in platform-specific code, which
> passes the right dtb to early_init_dt_scan().

The problem is that it makes the default dt completely random because
the generic code still deferrences __dtb_start.

> > thinking about one, but it is entirely possible for device drivers to
> > have a dtb linked in which may break this if it gets linked in a
> > different order. The specific example I'm thinking about is I want to
> > have the DT selftest code load an overlay to get testcase data from a
> > dtb blob.
> >
> > The other concern I have here is that I don't really want this to be the
> > default on a lot of platforms. ARM and PowerPC for instance should only
> > get the default dtb from the boot wrapper. It needs to be configurable
> > in some way.
> 
> On ARM and PowerPC, the section is empty, hence &__dbt_start ==
> &__dtb_end.

There is no guarantee that that will always be so. The patch makes some
poor assumtions, but they shouldn't be difficult to fix.

g.


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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 13:42         ` Geert Uytterhoeven
  2013-11-21 15:53           ` Grant Likely
@ 2013-11-21 17:38           ` Rob Herring
  2013-11-21 17:42             ` Geert Uytterhoeven
  1 sibling, 1 reply; 74+ messages in thread
From: Rob Herring @ 2013-11-21 17:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Grant Likely, Rob Herring, devicetree, Linux-Arch, linux-kernel

On Thu, Nov 21, 2013 at 7:42 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Thu, Nov 21, 2013 at 1:21 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>>>  bool __init early_init_dt_scan(void *params)
>>>  {
>>> -     if (!params)
>>> -             return false;
>>> -
>>>       /* Setup flat device-tree pointer */
>>>       initial_boot_params = params;
>>>
>>> -     /* check device tree validity */
>>> -     if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
>>> -             initial_boot_params = NULL;
>>> -             return false;
>>> +     /* check passed device tree validity */
>>> +     if (initial_boot_params &&
>>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>>> +             pr_info("FDT at %p\n", initial_boot_params);
>>> +             goto found;
>>> +     }
>>> +
>>> +     /* check built-in device tree validity */
>>> +     initial_boot_params = &__dtb_start;
>>> +     if (__dtb_end != (void *)&__dtb_start &&
>>> +         be32_to_cpu(initial_boot_params->magic) == OF_DT_HEADER) {
>>> +             pr_info("Compiled-in FDT at %p\n", initial_boot_params);
>>> +             goto found;
>>
>> __dtb_start is in an init section which is discarded after initcalls.
>> For this to work, the dtb needs to be copied into a region of allocated
>
> My changes don't change the current behavior much: currently
> early_init_dt_scan() is already called with &__dtb_start in several places.
> If this is broken, it's already broken.

Agreed. The early scan is already done in the init section.

>> memory. The dtb section can also potentially contain multiple .dtb
>> blobs. In the use case that you care about you are probably only
>
> Multiple dtb blobs are currently handled in platform-specific code, which
> passes the right dtb to early_init_dt_scan().
>

Agreed. Arches can still do however complicated dtb search they want.
This handles the common, default case.

>> thinking about one, but it is entirely possible for device drivers to
>> have a dtb linked in which may break this if it gets linked in a
>> different order. The specific example I'm thinking about is I want to
>> have the DT selftest code load an overlay to get testcase data from a
>> dtb blob.
>>
>> The other concern I have here is that I don't really want this to be the
>> default on a lot of platforms. ARM and PowerPC for instance should only
>> get the default dtb from the boot wrapper. It needs to be configurable
>> in some way.
>
> On ARM and PowerPC, the section is empty, hence &__dbt_start ==
> &__dtb_end.

The build rules for built-in dtbs are architecture specific already,
so I don't see a need to make this code configurable at this point.

I really don't like saying one arch can have built-in dtb and another
one can't. Either we allow it or we don't. If this is a bad feature,
then why did we let multiple arches implement it.

Rob

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 17:38           ` Rob Herring
@ 2013-11-21 17:42             ` Geert Uytterhoeven
  2013-11-27 15:35               ` Grant Likely
  0 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-21 17:42 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, Rob Herring, devicetree, Linux-Arch, linux-kernel

On Thu, Nov 21, 2013 at 6:38 PM, Rob Herring <robherring2@gmail.com> wrote:
> I really don't like saying one arch can have built-in dtb and another
> one can't. Either we allow it or we don't. If this is a bad feature,
> then why did we let multiple arches implement it.

... and did we put it in asm-generic, so now _every_ arch has __dtb_start.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 15:53           ` Grant Likely
@ 2013-11-21 17:49             ` Geert Uytterhoeven
  2013-11-27 15:32               ` Grant Likely
  0 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2013-11-21 17:49 UTC (permalink / raw)
  To: Grant Likely; +Cc: Rob Herring, devicetree, Linux-Arch, linux-kernel

On Thu, Nov 21, 2013 at 4:53 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>> My changes don't change the current behavior much: currently
>> early_init_dt_scan() is already called with &__dtb_start in several places.
>> If this is broken, it's already broken.
>
> Yes, but it is called on platforms that already make that assumption
> that __dtb_start must be copied and therefore call
> unflatten_and_copy_devicetree(). This change makes *all* platforms do
> that. That breaks arm, arm64, c6x, microblaze, some mips platforms, and
> powerpc!

arm, arm64, and powerpc don't have builtin DTBs, hence no change.
microblaze and c6x already did "early_init_devtree(&__dtb_start)" before.

That leaves mips, which has DT handling in too many variants, which I
didn't all verify.

>> > memory. The dtb section can also potentially contain multiple .dtb
>> > blobs. In the use case that you care about you are probably only
>>
>> Multiple dtb blobs are currently handled in platform-specific code, which
>> passes the right dtb to early_init_dt_scan().
>
> The problem is that it makes the default dt completely random because
> the generic code still deferrences __dtb_start.

Only if no DT was passed by the bootloader. And only if there really
is something at __dtb_start. Before it would fail if no DTB was passed
by the bootloader.

>> > thinking about one, but it is entirely possible for device drivers to
>> > have a dtb linked in which may break this if it gets linked in a
>> > different order. The specific example I'm thinking about is I want to
>> > have the DT selftest code load an overlay to get testcase data from a
>> > dtb blob.
>> >
>> > The other concern I have here is that I don't really want this to be the
>> > default on a lot of platforms. ARM and PowerPC for instance should only
>> > get the default dtb from the boot wrapper. It needs to be configurable
>> > in some way.
>>
>> On ARM and PowerPC, the section is empty, hence &__dbt_start ==
>> &__dtb_end.
>
> There is no guarantee that that will always be so. The patch makes some
> poor assumtions, but they shouldn't be difficult to fix.

OK, how to proceed?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 17:49             ` Geert Uytterhoeven
@ 2013-11-27 15:32               ` Grant Likely
  0 siblings, 0 replies; 74+ messages in thread
From: Grant Likely @ 2013-11-27 15:32 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Rob Herring, devicetree, Linux-Arch, linux-kernel

On Thu, 21 Nov 2013 18:49:08 +0100, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Nov 21, 2013 at 4:53 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> >> My changes don't change the current behavior much: currently
> >> early_init_dt_scan() is already called with &__dtb_start in several places.
> >> If this is broken, it's already broken.
> >
> > Yes, but it is called on platforms that already make that assumption
> > that __dtb_start must be copied and therefore call
> > unflatten_and_copy_devicetree(). This change makes *all* platforms do
> > that. That breaks arm, arm64, c6x, microblaze, some mips platforms, and
> > powerpc!
> 
> arm, arm64, and powerpc don't have builtin DTBs, hence no change.
> microblaze and c6x already did "early_init_devtree(&__dtb_start)" before.
> 
> That leaves mips, which has DT handling in too many variants, which I
> didn't all verify.
> 
> >> > memory. The dtb section can also potentially contain multiple .dtb
> >> > blobs. In the use case that you care about you are probably only
> >>
> >> Multiple dtb blobs are currently handled in platform-specific code, which
> >> passes the right dtb to early_init_dt_scan().
> >
> > The problem is that it makes the default dt completely random because
> > the generic code still deferrences __dtb_start.
> 
> Only if no DT was passed by the bootloader. And only if there really
> is something at __dtb_start. Before it would fail if no DTB was passed
> by the bootloader.
> 
> >> > thinking about one, but it is entirely possible for device drivers to
> >> > have a dtb linked in which may break this if it gets linked in a
> >> > different order. The specific example I'm thinking about is I want to
> >> > have the DT selftest code load an overlay to get testcase data from a
> >> > dtb blob.
> >> >
> >> > The other concern I have here is that I don't really want this to be the
> >> > default on a lot of platforms. ARM and PowerPC for instance should only
> >> > get the default dtb from the boot wrapper. It needs to be configurable
> >> > in some way.
> >>
> >> On ARM and PowerPC, the section is empty, hence &__dbt_start ==
> >> &__dtb_end.
> >
> > There is no guarantee that that will always be so. The patch makes some
> > poor assumtions, but they shouldn't be difficult to fix.
> 
> OK, how to proceed?

Add a global flag, bool __init of_dtb_needs_copy, and make it default to
false. On platforms that need it, change it to true. Make
unflatten_device_tree() check the flag and copy the tree if necessary.
Make early_init_dt_scan() set the flag if it choses to use a default
built-in tree. Then get rid of unflatten_and_copy_devicetree() because
it has become redundant.

Finally, make an explicit backup __dtb pointer.  Don't assume that
__dtb_start == __dtb_end is the correct test. We never want to have that
behavour on arm/powerpc/microblaze, but that doesn't mean there won't be
compiled in dtbs for other reasons. Create a __dtb_default symbol
require platforms to do something specific (ie. select a config symbol)
to set it to __dtb_start. It's not perfect, but at least it acknowledges
the problem and can be refined later.

g.

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

* Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
  2013-11-21 17:42             ` Geert Uytterhoeven
@ 2013-11-27 15:35               ` Grant Likely
  0 siblings, 0 replies; 74+ messages in thread
From: Grant Likely @ 2013-11-27 15:35 UTC (permalink / raw)
  To: Geert Uytterhoeven, Rob Herring
  Cc: Rob Herring, devicetree, Linux-Arch, linux-kernel

On Thu, 21 Nov 2013 18:42:58 +0100, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Nov 21, 2013 at 6:38 PM, Rob Herring <robherring2@gmail.com> wrote:
> > I really don't like saying one arch can have built-in dtb and another
> > one can't. Either we allow it or we don't. If this is a bad feature,
> > then why did we let multiple arches implement it.
> 
> ... and did we put it in asm-generic, so now _every_ arch has __dtb_start.
> 
> Gr{oetje,eeting}s,

Some platforms need it because they either don't have bootloader
support, they couldn't change the boot interface, or they don't have a
bootwrapper they can put it in. I'd rather have it in common code than a
different implementation on each architecture.

For the copy flag, it would be fine to put an "if (IS_CONFIGURED())"
test around the copy block so that it never happens on some
architectures.

g.

> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds


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

* Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
  2013-11-14 14:55       ` Chris Metcalf
@ 2014-07-09 18:33         ` Geert Uytterhoeven
  2014-07-10 19:49           ` Chris Metcalf
  0 siblings, 1 reply; 74+ messages in thread
From: Geert Uytterhoeven @ 2014-07-09 18:33 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: Andrew Morton, Linux-Arch, linux-kernel

Hi Chris,

On Thu, Nov 14, 2013 at 3:55 PM, Chris Metcalf <cmetcalf@tilera.com> wrote:
> On 11/14/2013 3:31 AM, Geert Uytterhoeven wrote:
>> Feel free to take v2 below. Thanks!
>>
>> From d761d4d63945ff0a6eab5a9058c132f870c92aff Mon Sep 17 00:00:00 2001
>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>> Date: Fri, 8 Nov 2013 21:33:29 +0100
>> Subject: [PATCH -v2] tile: Remove tile-specific _sinitdata and _einitdata
>>
>> Use standard __init_begin and __init_end instead.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Acked-by: Chris Metcalf <cmetcalf@tilera.com>
>
> Taken into the tile tree; thanks!  (I did fix one extra place where it mentioned _sinitdata in a comment.)

I'm going through old patches, and it seems this is still not upstream?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
  2014-07-09 18:33         ` Geert Uytterhoeven
@ 2014-07-10 19:49           ` Chris Metcalf
  2014-07-10 20:14             ` Geert Uytterhoeven
  0 siblings, 1 reply; 74+ messages in thread
From: Chris Metcalf @ 2014-07-10 19:49 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Andrew Morton, Linux-Arch, linux-kernel

On 7/9/2014 2:33 PM, Geert Uytterhoeven wrote:
> Hi Chris,
>
> On Thu, Nov 14, 2013 at 3:55 PM, Chris Metcalf <cmetcalf@tilera.com> wrote:
>> On 11/14/2013 3:31 AM, Geert Uytterhoeven wrote:
>>> Feel free to take v2 below. Thanks!
>>>
>>>  From d761d4d63945ff0a6eab5a9058c132f870c92aff Mon Sep 17 00:00:00 2001
>>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>>> Date: Fri, 8 Nov 2013 21:33:29 +0100
>>> Subject: [PATCH -v2] tile: Remove tile-specific _sinitdata and _einitdata
>>>
>>> Use standard __init_begin and __init_end instead.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>> Acked-by: Chris Metcalf <cmetcalf@tilera.com>
>> Taken into the tile tree; thanks!  (I did fix one extra place where it mentioned _sinitdata in a comment.)
> I'm going through old patches, and it seems this is still not upstream?

Yes, and I'm not at all sure what happened.  There were a couple of mistakes
in the original post (einittext converted instead of einitdata), and maybe I
ended up dropping it entirely instead of taking v2.

In any case it's now in the tile tree and upstreamed to linux-tile so you
should see it in linux-next shortly.

Sorry!

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


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

* Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
  2014-07-10 19:49           ` Chris Metcalf
@ 2014-07-10 20:14             ` Geert Uytterhoeven
  0 siblings, 0 replies; 74+ messages in thread
From: Geert Uytterhoeven @ 2014-07-10 20:14 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: Andrew Morton, Linux-Arch, linux-kernel

Hi Chris,

On Thu, Jul 10, 2014 at 9:49 PM, Chris Metcalf <cmetcalf@tilera.com> wrote:
> On 7/9/2014 2:33 PM, Geert Uytterhoeven wrote:
>> On Thu, Nov 14, 2013 at 3:55 PM, Chris Metcalf <cmetcalf@tilera.com>
>> wrote:
>>> On 11/14/2013 3:31 AM, Geert Uytterhoeven wrote:
>>>> Feel free to take v2 below. Thanks!
>>>>
>>>>  From d761d4d63945ff0a6eab5a9058c132f870c92aff Mon Sep 17 00:00:00 2001
>>>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>>>> Date: Fri, 8 Nov 2013 21:33:29 +0100
>>>> Subject: [PATCH -v2] tile: Remove tile-specific _sinitdata and
>>>> _einitdata
>>>>
>>>> Use standard __init_begin and __init_end instead.
>>>>
>>>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>>> Acked-by: Chris Metcalf <cmetcalf@tilera.com>
>>>
>>> Taken into the tile tree; thanks!  (I did fix one extra place where it
>>> mentioned _sinitdata in a comment.)
>>
>> I'm going through old patches, and it seems this is still not upstream?
>
>
> Yes, and I'm not at all sure what happened.  There were a couple of mistakes
> in the original post (einittext converted instead of einitdata), and maybe I
> ended up dropping it entirely instead of taking v2.
>
> In any case it's now in the tile tree and upstreamed to linux-tile so you
> should see it in linux-next shortly.

Thanks!

> Sorry!

No problem. I was just going through old stuff that had accumulated in
my local tree.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2014-07-10 20:14 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-12 19:42 [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h> Geert Uytterhoeven
2013-11-12 21:23   ` Richard Henderson
2013-11-12 19:42 ` [PATCH 02/17] cris: " Geert Uytterhoeven
2013-11-15 16:52   ` Jesper Nilsson
2013-11-12 19:42 ` [PATCH 03/17] m32r: " Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 04/17] mn10300: " Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 05/17] score: " Geert Uytterhoeven
2013-11-15 18:05   ` Lennox Wu
2013-11-12 19:42 ` [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 07/17] ia64: Remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[] Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 08/17] microblaze: Remove _fdt_start casts Geert Uytterhoeven
2013-11-13 10:08   ` Michal Simek
2013-11-12 19:42 ` [PATCH 09/17] microblaze: Remove duplicate declarations of _stext[] and _etext[] Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata Geert Uytterhoeven
2013-11-14  0:09   ` Chris Metcalf
2013-11-14  8:31     ` Geert Uytterhoeven
2013-11-14 14:55       ` Chris Metcalf
2014-07-09 18:33         ` Geert Uytterhoeven
2014-07-10 19:49           ` Chris Metcalf
2014-07-10 20:14             ` Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h> Geert Uytterhoeven
2013-11-14  4:01   ` Rusty Russell
2013-11-12 19:42 ` [PATCH 12/17] nosave: Consolidate __nosave_{begin,end} in <asm/sections.h> Geert Uytterhoeven
2013-11-12 19:42 ` [PATCH 13/17] openrisc: Refactor or32_early_setup() Geert Uytterhoeven
2013-11-15  9:59   ` Jonas Bonn
2013-11-12 19:42 ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> Geert Uytterhoeven
2013-11-13  5:41   ` Vineet Gupta
2013-11-13 15:51   ` Rob Herring
     [not found]     ` < 1384859554-27268-1-git-send-email-geert@linux-m68k.org>
     [not found]       ` <20131121122148. 1B43DC40A2C@trevor.secretlab.ca>
     [not found]         ` < CAMuHMdXfsB_Ewz9sUPZaAjFaQGTGeqMiD8mJ0tCoH1uFLYGoxw@mail.gmail.com>
     [not found]           ` < CAL_JsqJVteJuaD0PRMHSR9cVcMJTSNj4wXtYiftG=-pYSR9vsQ@mail.gmail.com>
     [not found]           ` < 20131121155348.66751C406A3@trevor.secretlab.ca>
2013-11-13 17:20     ` Geert Uytterhoeven
2013-11-13 17:34       ` Rob Herring
2013-11-13 18:40         ` Geert Uytterhoeven
2013-11-19 11:12     ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() Geert Uytterhoeven
2013-11-19 11:12       ` [PATCH 2/9] arc: Use NULL as the default DTB Geert Uytterhoeven
2013-11-20  4:58         ` Vineet Gupta
2013-11-19 11:12       ` [PATCH 3/9] c6x: Remove duplicate DT selection logic Geert Uytterhoeven
2013-11-19 11:12       ` [PATCH 4/9] metag: " Geert Uytterhoeven
2013-11-19 13:14         ` James Hogan
2013-11-19 11:12       ` [PATCH 5/9] microblaze: Use NULL as the default DTB Geert Uytterhoeven
2013-11-19 11:12       ` [PATCH 6/9] mips: Remove unused dt_setup_arch() Geert Uytterhoeven
2013-11-19 11:12       ` [PATCH 7/9] mips: Use NULL as the default DTB Geert Uytterhoeven
2013-11-19 11:12       ` [PATCH 8/9] openrisc: Remove duplicate DT selection logic Geert Uytterhoeven
2013-11-19 11:12       ` [PATCH 9/9] xtensa: Use NULL as the default DTB Geert Uytterhoeven
2013-11-19 13:27       ` [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan() James Hogan
2013-11-20 20:50       ` Rob Herring
2013-11-21 12:21       ` Grant Likely
2013-11-21 12:23         ` Grant Likely
2013-11-21 12:33           ` Grant Likely
2013-11-21 13:42         ` Geert Uytterhoeven
2013-11-21 15:53           ` Grant Likely
2013-11-21 17:49             ` Geert Uytterhoeven
2013-11-27 15:32               ` Grant Likely
2013-11-21 17:38           ` Rob Herring
2013-11-21 17:42             ` Geert Uytterhoeven
2013-11-27 15:35               ` Grant Likely
2013-11-19 13:24   ` [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h> James Hogan
2013-11-12 19:42 ` [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start Geert Uytterhoeven
2013-11-13 10:19   ` Michal Simek
2013-11-13 13:40     ` Michal Simek
2013-11-13 14:02       ` Geert Uytterhoeven
2013-11-13 14:21         ` Michal Simek
2013-11-13 16:14       ` Rob Herring
2013-11-14 16:29         ` Michal Simek
2013-11-12 19:42 ` [PATCH RFC 16/17] c6x: " Geert Uytterhoeven
2013-11-12 23:38   ` Mark Salter
2013-11-12 19:42 ` [PATCH 17/17] um: Remove unused declarations from <as-layout.h> Geert Uytterhoeven
2013-11-12 19:51   ` Richard Weinberger
2013-11-12 19:52     ` Geert Uytterhoeven
2013-11-12 19:54 ` [PATCH 00/17] <asm/sections.h> related cleanups Geert Uytterhoeven
2013-11-12 19:56 ` [PATCH 1/2] openrisc: Use the declarations provided by <asm/sections.h> Geert Uytterhoeven
2013-11-12 19:56   ` [PATCH 2/2] openrisc: Remove unused declaration of __initramfs_start Geert Uytterhoeven
2013-11-13  5:25 ` [PATCH 00/17] <asm/sections.h> related cleanups Vineet Gupta
2013-11-20 18:55 ` [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table David Howells
2013-11-20 18:56 ` [PATCH 04/17] mn10300: Use Kbuild logic to include <asm-generic/sections.h> David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).