Skip to contentSkip to conversation

<asm/sections.h> related cleanups

PATCH Applied Geert Uytterhoeven 15 participants 74 messages Nov 12, 2013 – Jul 10, 2014

Subsystems (19)
Device tree bindings x86 PowerPC MIPS +15 more subsystems
lore
Share & tools
lore
#0 lore raw

cover <asm/sections.h> related cleanups

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 -- [email protected]

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

#1 lore raw

PATCH 1/17 alpha: Use Kbuild logic to include <asm-generic/sections.h>

---
 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
arch/alpha/include/asm/Kbuild +1 -1
index f01fb505ad52..cd33bcfc49d8 100644
@@ -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
arch/alpha/include/asm/sections.h deleted +0 -7
deleted file mode 100644
index 43b40edd6e44..000000000000
@@ -1,7 +0,0 @@
-#ifndef _ALPHA_SECTIONS_H
-#define _ALPHA_SECTIONS_H
-
-/* nothing to see, move along */
-#include <asm-generic/sections.h>
-
-#endif
Signature · 1 line
1.7.9.5
Acked-by on v1 1/17
#2 lore raw

Re: [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h>

Quoted 8 lines · Geert Uytterhoeven
---
 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

r~

#3 lore raw

PATCH 2/17 cris: Use Kbuild logic to include <asm-generic/sections.h>

In reply to Geert Uytterhoeven
---
 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
arch/cris/include/asm/Kbuild +1 -0
index b06caf649a95..44e7d0dbcf32 100644
@@ -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
arch/cris/include/asm/sections.h deleted +0 -7
deleted file mode 100644
index 2c998ce8967b..000000000000
@@ -1,7 +0,0 @@
-#ifndef _CRIS_SECTIONS_H
-#define _CRIS_SECTIONS_H
-
-/* nothing to see, move along */
-#include <asm-generic/sections.h>
-
-#endif
Signature · 1 line
1.7.9.5
Acked-by on v1 2/17
#4 lore raw

Re: [PATCH 02/17] cris: Use Kbuild logic to include <asm-generic/sections.h>

Quoted 2 lines · Geert Uytterhoeven
Quoted 34 lines
---
 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
arch/cris/include/asm/Kbuild +1 -0
index b06caf649a95..44e7d0dbcf32 100644
@@ -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
arch/cris/include/asm/sections.h deleted +0 -7
deleted file mode 100644
index 2c998ce8967b..000000000000
@@ -1,7 +0,0 @@
-#ifndef _CRIS_SECTIONS_H
-#define _CRIS_SECTIONS_H
-
-/* nothing to see, move along */
-#include <asm-generic/sections.h>
-
-#endif
Signature · 1 line
1.7.9.5

/^JN - Jesper Nilsson

Signature · 1 line
               Jesper Nilsson -- [email protected]
#5 lore raw

PATCH 3/17 m32r: Use Kbuild logic to include <asm-generic/sections.h>

In reply to Geert Uytterhoeven
---
 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
arch/m32r/include/asm/Kbuild +1 -0
index 2b58c5f0bc38..e03862db9b75 100644
@@ -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
arch/m32r/include/asm/sections.h deleted +0 -7
deleted file mode 100644
index 5e5d21c4908a..000000000000
@@ -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 */
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 4/17 mn10300: Use Kbuild logic to include <asm-generic/sections.h>

In reply to Geert Uytterhoeven
---
 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
arch/mn10300/include/asm/Kbuild +1 -0
index 74742dc6a3da..cd33bcfc49d8 100644
@@ -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
arch/mn10300/include/asm/sections.h deleted +0 -1
deleted file mode 100644
index 2b8c5160388f..000000000000
@@ -1 +0,0 @@
-#include <asm-generic/sections.h>
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 5/17 score: Use Kbuild logic to include <asm-generic/sections.h>

In reply to Geert Uytterhoeven
---
 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
arch/score/include/asm/Kbuild +1 -0
index f3414ade77a3..32cd967c19a4 100644
@@ -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
arch/score/include/asm/sections.h deleted +0 -6
deleted file mode 100644
index 9441d23af005..000000000000
@@ -1,6 +0,0 @@
-#ifndef _ASM_SCORE_SECTIONS_H
-#define _ASM_SCORE_SECTIONS_H
-
-#include <asm-generic/sections.h>
-
-#endif /* _ASM_SCORE_SECTIONS_H */
Signature · 1 line
1.7.9.5
Acked-by on v1 5/17
#9 lore raw

Re: [PATCH 05/17] score: Use Kbuild logic to include <asm-generic/sections.h>

於 2013/11/13 上午 03:42, Geert Uytterhoeven 提到:

Quoted 33 lines
---
 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
arch/score/include/asm/Kbuild +1 -0
index f3414ade77a3..32cd967c19a4 100644
@@ -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
arch/score/include/asm/sections.h deleted +0 -6
deleted file mode 100644
index 9441d23af005..000000000000
@@ -1,6 +0,0 @@
-#ifndef _ASM_SCORE_SECTIONS_H
-#define _ASM_SCORE_SECTIONS_H
-
-#include <asm-generic/sections.h>
-
-#endif /* _ASM_SCORE_SECTIONS_H */
#10 lore raw

PATCH 6/17 frv: Remove unused declarations of __start___ex_table and __stop___ex_table

In reply to Geert Uytterhoeven
---
 arch/frv/mm/extable.c |    2 --
 1 file changed, 2 deletions(-)
arch/frv/mm/extable.c +0 -2
index 6aea124f574d..2fb9b3ab57b9 100644
@@ -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;
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 7/17 ia64: Remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[]

In reply to Geert Uytterhoeven

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

---
 arch/ia64/include/asm/sections.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/include/asm/sections.h +1 -1
index 1a873b36a4a1..2ab2003698ef 100644
@@ -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
Signature · 1 line
1.7.9.5
#13 lore raw

PATCH 8/17 microblaze: Remove _fdt_start casts

In reply to Geert Uytterhoeven

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

Cc Michal Simek <[email protected]>
Cc microblaze-uclinux-rVRm/[email protected]
---
 arch/microblaze/kernel/setup.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/microblaze/kernel/setup.c +2 -3
index 8de8ebc309f1..603e22fec6d5 100644
@@ -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",
Signature · 6 lines
1.7.9.5

_______________________________________________
microblaze-linux mailing list
microblaze-linux-FR6EJeJVuqfA6Z3fQjNZrN9u6TNh0Fb7@public.gmane.org
https://lists.eait.uq.edu.au/mailman/listinfo/microblaze-linux
maintainer Applied
#14 lore raw

Re: [PATCH 08/17] microblaze: Remove _fdt_start casts

Quoted 24 lines · Geert Uytterhoeven

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

---
 arch/microblaze/kernel/setup.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/microblaze/kernel/setup.c +1 -1
index 8de8ebc309f1..603e22fec6d5 100644
@@ -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);

arch/microblaze/kernel/setup.c void __init machine_early_init(const char *cmdline, unsigned int ram, · line 158

Quoted 9 lines
arch/microblaze/kernel/setup.c +1 -2
@@ -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

Signature · 5 lines
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
#15 lore raw

PATCH 9/17 microblaze: Remove duplicate declarations of _stext[] and _etext[]

In reply to Geert Uytterhoeven

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

Cc Michal Simek <[email protected]>
Cc microblaze-uclinux-rVRm/[email protected]
---
 arch/microblaze/include/asm/sections.h |    1 -
 1 file changed, 1 deletion(-)
arch/microblaze/include/asm/sections.h +0 -1
index c07ed5d2a820..1b281d3ea734 100644
@@ -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[];
 
Signature · 6 lines
1.7.9.5

_______________________________________________
microblaze-linux mailing list
microblaze-linux-FR6EJeJVuqfA6Z3fQjNZrN9u6TNh0Fb7@public.gmane.org
https://lists.eait.uq.edu.au/mailman/listinfo/microblaze-linux
#16 lore raw

PATCH 10/17 tile: Remove tile-specific _sinitdata and _einitdata

In reply to Geert Uytterhoeven

Use standard __init_begin and __init_end instead.

---
 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(-)
arch/tile/include/asm/sections.h +0 -3
index 5d5d3b739a6b..86a746243dc8 100644
@@ -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[];
 
arch/tile/kernel/vmlinux.lds.S +0 -2
index f1819423ffc9..0e059a0101ea 100644
@@ -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 */
arch/tile/mm/init.c +9 -9
index 0fa1acfac79a..c4e0b6ddb48c 100644
@@ -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();
 }
Signature · 1 line
1.7.9.5
Acked-by on v1 10/17
#17 lore raw

Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata

Quoted 4 lines · Geert Uytterhoeven

Use standard __init_begin and __init_end instead.

[...]

Quoted 30 lines
arch/tile/mm/init.c +4 -4
@@ -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

[...]

arch/tile/mm/init.c void free_initmem(void) · line 990

Quoted 9 lines
arch/tile/mm/init.c +1 -1
@@ -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:

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

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
author Acked-by Chris Metcalf
#18 lore raw

Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata

Hi Chris,

Quoted 37 lines · Chris Metcalf
Quoted 4 lines · Geert Uytterhoeven

Use standard __init_begin and __init_end instead.

[...]

Quoted 30 lines
(quoted diff) +4 -4
@@ -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

[...]

Quoted 11 lines

Review void free_initmem(void) · line 990

Quoted 9 lines
(quoted diff) +1 -1
@@ -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!

Quoted 5 lines

With those changes removed:

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 <[email protected]>
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.

---
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(-)
arch/tile/include/asm/sections.h +0 -3
index 5d5d3b739a6b..86a746243dc8 100644
@@ -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[];
 
arch/tile/kernel/vmlinux.lds.S +0 -2
index f1819423ffc9..0e059a0101ea 100644
@@ -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 */
arch/tile/mm/init.c +5 -5
index 0fa1acfac79a..489a5a00cfaa 100644
@@ -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
Signature · 12 lines
1.7.9.5

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#19 lore raw

Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata

Quoted 11 lines · Geert Uytterhoeven

Feel free to take v2 below. Thanks!

From d761d4d63945ff0a6eab5a9058c132f870c92aff Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
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.

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

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#20 lore raw

Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata

Hi Chris,

Quoted 8 lines · Chris Metcalf
Quoted 7 lines · Geert Uytterhoeven

Feel free to take v2 below. Thanks!

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

Quoted 6 lines
Quoted 4 lines

Use standard __init_begin and __init_end instead.

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 -- [email protected]

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

#21 lore raw

Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata

Quoted 11 lines · Geert Uytterhoeven

Hi Chris,

Quoted 8 lines · Chris Metcalf
Quoted 7 lines · Geert Uytterhoeven

Feel free to take v2 below. Thanks!

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

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Use standard __init_begin and __init_end instead.

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!

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#22 lore raw

Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata

Hi Chris,

Quoted 23 lines · Chris Metcalf
Quoted 13 lines · Geert Uytterhoeven
Quoted 11 lines · Chris Metcalf
Quoted 10 lines · Geert Uytterhoeven

Feel free to take v2 below. Thanks!

From d761d4d63945ff0a6eab5a9058c132f870c92aff Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
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.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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?

Quoted 6 lines

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!

Quoted 1 line

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 -- [email protected]

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

#23 lore raw

PATCH 11/17 kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h>

In reply to Geert Uytterhoeven

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.

---
 include/linux/moduleparam.h |    2 ++
 init/main.c                 |    2 --
 kernel/params.c             |    7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)
include/linux/moduleparam.h +2 -0
index c3eb102a9cc8..77ccfca0c4ba 100644
@@ -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;
init/main.c +0 -2
index 15ed159b681b..f2c4901f90d1 100644
@@ -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);
kernel/params.c +3 -4
index c00d5b502aa4..54e05ffb7d24 100644
@@ -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];
 
Signature · 1 line
1.7.9.5
Acked-by on v1 11/17
#24 lore raw

Re: [PATCH 11/17] kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h>

Quoted 7 lines · Geert Uytterhoeven

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.

Thanks!
Rusty.

Quoted 80 lines
---
 include/linux/moduleparam.h |    2 ++
 init/main.c                 |    2 --
 kernel/params.c             |    7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)
include/linux/moduleparam.h +2 -0
index c3eb102a9cc8..77ccfca0c4ba 100644
@@ -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;
init/main.c +0 -2
index 15ed159b681b..f2c4901f90d1 100644
@@ -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);
kernel/params.c +3 -4
index c00d5b502aa4..54e05ffb7d24 100644
@@ -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];
 
Signature · 1 line
1.7.9.5
#25 lore raw

PATCH 12/17 nosave: Consolidate __nosave_{begin,end} in <asm/sections.h>

In reply to Geert Uytterhoeven

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>.

Cc Ralf Baechle <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
Cc Martin Schwidefsky <[email protected]>
Cc Paul Mundt <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Guan Xuetao <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 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
arch/mips/include/asm/suspend.h deleted +0 -7
deleted file mode 100644
index 3adac3b53d19..000000000000
@@ -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 */
arch/mips/power/cpu.c +1 -1
index 521e5963df05..2129e67723ff 100644
@@ -7,7 +7,7 @@
  * Author: Hu Hongbing <[email protected]>
  *	   Wu Zhangjin <[email protected]>
  */
-#include <asm/suspend.h>
+#include <asm/sections.h>
 #include <asm/fpu.h>
 #include <asm/dsp.h>
 
arch/powerpc/kernel/suspend.c +1 -3
index 0167d53da30c..a531154cc0f3 100644
@@ -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
arch/s390/kernel/suspend.c +1 -5
index a7a7537ce1e7..1c4c5accd220 100644
@@ -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
arch/sh/include/asm/sections.h +0 -1
index 1b6199740e98..7a99e6af6372 100644
@@ -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[];
arch/sparc/power/hibernate.c +1 -3
index 42b0b8ce699a..17bd2e167e07 100644
@@ -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;
 
 /*
arch/unicore32/include/mach/pm.h +0 -3
index 4dcd34ae194c..77b522694e74 100644
@@ -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
arch/unicore32/kernel/hibernate.c +1 -0
index d75ef8b6cb56..9969ec374abb 100644
@@ -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"
arch/x86/power/hibernate_32.c +1 -3
index 7d28c885d238..291226b952a9 100644
@@ -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;
 
arch/x86/power/hibernate_64.c +1 -3
index 304fca20d96e..2276238fde6f 100644
@@ -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);
 
include/asm-generic/sections.h +4 -0
index f1a24b5c3b90..b58fd667f87b 100644
@@ -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
Signature · 1 line
1.7.9.5
#26 lore raw

PATCH 13/17 openrisc: Refactor or32_early_setup()

In reply to Geert Uytterhoeven

- 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.

---
 arch/openrisc/kernel/setup.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
arch/openrisc/kernel/setup.c +7 -7
index d0e7693c67a3..4fc7ccc0a2cf 100644
@@ -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)
Signature · 1 line
1.7.9.5
maintainer
#27 lore raw

Re: [PATCH 13/17] openrisc: Refactor or32_early_setup()

Quoted 8 lines · Geert Uytterhoeven

- 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.

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

/Jonas

#28 lore raw

PATCH 14/17 dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>

In reply to Geert Uytterhoeven

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.

Cc Vineet Gupta <[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Jonas Bonn <[email protected]>
CC Chris Zankel <[email protected]>
Cc Rob Herring <[email protected]>
---
 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(-)
arch/arc/include/asm/sections.h +0 -1
index 764f1e3ba752..09db952e14bd 100644
@@ -12,6 +12,5 @@
 #include <asm-generic/sections.h>
 
 extern char __arc_dccm_base[];
-extern char __dtb_start[];
 
 #endif
arch/arc/kernel/setup.c +1 -1
index 643eae4436e0..ef705d0f50f5 100644
@@ -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");
 
arch/metag/kernel/setup.c +1 -5
index 129c7cdda1ce..919c782f5479 100644
@@ -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
arch/mips/include/asm/mips-boards/generic.h +0 -4
index 48616816bcbc..c904c24550f6 100644
@@ -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
arch/mips/lantiq/prom.h +0 -2
index 8e07b5f28ef1..bfd2d58c1d69 100644
@@ -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
arch/mips/netlogic/xlp/dt.c +2 -2
index 8316d5454b17..87250f378386 100644
@@ -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;
 		}
 	}
arch/mips/ralink/of.c +0 -2
index eccc5526155e..615603bd8063 100644
@@ -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;
arch/openrisc/kernel/setup.c +1 -1
index 4fc7ccc0a2cf..c9b880d64bb8 100644
@@ -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);
arch/openrisc/kernel/vmlinux.h +0 -2
index 70b9ce41835c..bbcdf21b0b35 100644
@@ -5,6 +5,4 @@
 extern char __initrd_start, __initrd_end;
 #endif
 
-extern u32 __dtb_start[];
-
 #endif
arch/xtensa/kernel/setup.c +1 -2
index 6e2b6638122d..d96cf8f3fe70 100644
@@ -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;
include/linux/of_fdt.h +3 -0
index 0beaee9dac1f..aabc49f3e403 100644
@@ -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;
Signature · 1 line
1.7.9.5
Acked-by on v1 14/17
#29 lore raw

Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>

Quoted 18 lines · Geert Uytterhoeven

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.

Cc Vineet Gupta <[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Jonas Bonn <[email protected]>
CC Chris Zankel <[email protected]>
Cc Rob Herring <[email protected]>
Quoted 13 lines
---
 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(-)

Thx,
-Vineet

#30 lore raw

Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>

In reply to Geert Uytterhoeven
Quoted 18 lines · Geert Uytterhoeven

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.

Cc Vineet Gupta <vgupta-HKixBCOQz3hWk0Htik3J/[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <ralf-6z/[email protected]>
Cc Jonas Bonn <[email protected]>
CC Chris Zankel <[email protected]>
Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Quoted 13 lines
---
 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:

drivers/of/fdt.c +0 -0
index 5c47910..723f854d 100644
@@ -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;
}
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#31 lore raw

Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>

Quoted 34 lines · Rob Herring
Quoted 18 lines · Geert Uytterhoeven

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.

Cc Vineet Gupta <[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Jonas Bonn <[email protected]>
CC Chris Zankel <[email protected]>
Cc Rob Herring <[email protected]>
Quoted 13 lines
---
 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(-)
Quoted 5 lines

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.

Quoted 1 line

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.

Quoted 14 lines

Something like this is what I have in mind:

drivers/of/fdt.c +0 -3
index 5c47910..723f854d 100644
@@ -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;
-

drivers/of/fdt.c void * __init __weak · line 881

Quoted 10 lines
drivers/of/fdt.c +5 -1
        /* 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.

drivers/of/fdt.c void * __init __weak · line 882

Quoted 1 line
drivers/of/fdt.c +1 -0
+           (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?

Quoted 3 lines
drivers/of/fdt.c +0 -0
                initial_boot_params = NULL;
                return false;
        }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#32 lore raw

Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>

Quoted 65 lines · Geert Uytterhoeven
Quoted 34 lines · Rob Herring
Quoted 18 lines · Geert Uytterhoeven

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.

Cc Vineet Gupta <[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc Jonas Bonn <[email protected]>
CC Chris Zankel <[email protected]>
Cc Rob Herring <[email protected]>
Quoted 13 lines
---
 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(-)
Quoted 5 lines

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.

Quoted 1 line

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.

Quoted 17 lines

Something like this is what I have in mind:

drivers/of/fdt.c +0 -3
index 5c47910..723f854d 100644
@@ -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;
 
Quoted 9 lines

drivers/of/fdt.c void * __init __weak · line 881

Quoted 7 lines
drivers/of/fdt.c +5 -1
+       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?

Quoted 6 lines

drivers/of/fdt.c void * __init __weak · line 882

Quoted 2 lines
drivers/of/fdt.c +1 -0
+           (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

Quoted 16 lines
Quoted 4 lines
drivers/of/fdt.c +0 -0
                initial_boot_params = NULL;
                return false;
        }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#33 lore raw

Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>

Quoted 11 lines · Rob Herring
Quoted 9 lines

Review

Quoted 7 lines
(quoted diff) +5 -1
+       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.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

+ (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 -- [email protected]

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

#34 lore raw

PATCH 1/9 dt: Handle passed/built-in DT selection in early_init_dt_scan()

In reply to Rob Herring

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.

---
 drivers/of/fdt.c       |   24 +++++++++++++++++-------
 include/linux/of_fdt.h |    1 +
 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/of/fdt.c +17 -7
index 2fa024b97c43..a797cd43bc8b 100644
@@ -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);
 
include/linux/of_fdt.h +1 -0
index aabc49f3e403..6c4a60454854 100644
@@ -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)
 
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#35 lore raw

PATCH 2/9 arc: Use NULL as the default DTB

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

---
 arch/arc/kernel/setup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/kernel/setup.c +1 -1
index ef705d0f50f5..481e11240e12 100644
@@ -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");
 
Signature · 1 line
1.7.9.5
#37 lore raw

PATCH 3/9 c6x: Remove duplicate DT selection logic

In reply to Geert Uytterhoeven

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

---
 arch/c6x/kernel/setup.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
arch/c6x/kernel/setup.c +1 -9
index 414353027ba9..ad7c5d73bb3c 100644
@@ -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();
 }
Signature · 1 line
1.7.9.5
#38 lore raw

PATCH 4/9 metag: Remove duplicate DT selection logic

In reply to Geert Uytterhoeven

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.

---
Untested due to lack of cross-compiler.

 arch/metag/kernel/setup.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
arch/metag/kernel/setup.c +12 -10
index 919c782f5479..e3ebfc5f5d77 100644
@@ -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;
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by on v1 4/9
#39 lore raw

Re: [PATCH 4/9] metag: Remove duplicate DT selection logic

Quoted 7 lines · Geert Uytterhoeven

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.

Looks good and seems to work fine.

Thanks
James

--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#40 lore raw

PATCH 5/9 microblaze: Use NULL as the default DTB

In reply to Geert Uytterhoeven

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

Cc Michal Simek <[email protected]>
Cc microblaze-uclinux-rVRm/[email protected]

---
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(-)
arch/microblaze/kernel/setup.c +1 -5
index a4534f584be0..a9a9f8baa94a 100644
@@ -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",
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#41 lore raw

PATCH 6/9 mips: Remove unused dt_setup_arch()

In reply to Geert Uytterhoeven
---
 arch/mips/include/asm/prom.h |    7 -------
 1 file changed, 7 deletions(-)
arch/mips/include/asm/prom.h +0 -7
index ccd2b75f152c..7e2ee8301c06 100644
@@ -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 */
Signature · 1 line
1.7.9.5
#42 lore raw

PATCH 7/9 mips: Use NULL as the default DTB

In reply to Geert Uytterhoeven

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.

---
 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(-)
arch/mips/lantiq/prom.c +1 -1
index 19686c5bc5ed..582f6e4a5f6d 100644
@@ -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)
arch/mips/mti-sead3/sead3-setup.c +1 -1
index 928ba84c8a78..3afec4507ea5 100644
@@ -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)
arch/mips/netlogic/xlp/dt.c +3 -5
index 87250f378386..e52281b9214d 100644
@@ -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);
arch/mips/ralink/of.c +1 -1
index 615603bd8063..d72a5bc1efc2 100644
@@ -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,
Signature · 1 line
1.7.9.5
#43 lore raw

PATCH 8/9 openrisc: Remove duplicate DT selection logic

In reply to Geert Uytterhoeven

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

---
 arch/openrisc/kernel/setup.c |    6 ------
 1 file changed, 6 deletions(-)
arch/openrisc/kernel/setup.c +0 -6
index 3ca640cd42be..4ec6b07f02b3 100644
@@ -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);
 }
 
Signature · 1 line
1.7.9.5
#44 lore raw

PATCH 9/9 xtensa: Use NULL as the default DTB

In reply to Geert Uytterhoeven

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.

---
 arch/xtensa/kernel/setup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/kernel/setup.c +1 -1
index d96cf8f3fe70..dd440deb137d 100644
@@ -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;
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/9
#45 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

In reply to Geert Uytterhoeven
Quoted 5 lines · 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.

Thanks
James

Reviewed-by on v1 1/9
#46 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

In reply to Geert Uytterhoeven
Quoted 6 lines · 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.

---

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

Rob

Quoted 63 lines
 drivers/of/fdt.c       |   24 +++++++++++++++++-------
 include/linux/of_fdt.h |    1 +
 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/of/fdt.c +17 -7
index 2fa024b97c43..a797cd43bc8b 100644
@@ -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);
 
include/linux/of_fdt.h +1 -1
index aabc49f3e403..6c4a60454854 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#47 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

In reply to Geert Uytterhoeven
Quoted 31 lines · 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.

---
 drivers/of/fdt.c       |   24 +++++++++++++++++-------
 include/linux/of_fdt.h |    1 +
 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/of/fdt.c +3 -7
index 2fa024b97c43..a797cd43bc8b 100644
@@ -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) {

drivers/of/fdt.c void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align) · line 886

Quoted 10 lines
drivers/of/fdt.c +10 -0
+		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.

#48 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

Quoted 53 lines · Grant Likely
Quoted 31 lines · 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.

---
 drivers/of/fdt.c       |   24 +++++++++++++++++-------
 include/linux/of_fdt.h |    1 +
 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/of/fdt.c +3 -7
index 2fa024b97c43..a797cd43bc8b 100644
@@ -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) {

drivers/of/fdt.c void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align) · line 886

Quoted 10 lines
drivers/of/fdt.c +10 -0
+             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.

Quoted 8 lines

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.

#49 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

Quoted 60 lines · Grant Likely
Quoted 58 lines · Grant Likely
Quoted 31 lines · 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.

---
 drivers/of/fdt.c       |   24 +++++++++++++++++-------
 include/linux/of_fdt.h |    1 +
 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/of/fdt.c +3 -7
index 2fa024b97c43..a797cd43bc8b 100644
@@ -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) {

drivers/of/fdt.c void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align) · line 886

Quoted 10 lines
drivers/of/fdt.c +10 -0
+             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.

Quoted 6 lines
Quoted 3 lines

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.

#50 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

In reply to Grant Likely
Quoted 20 lines · Grant Likely
Quoted 20 lines

bool __init early_init_dt_scan(void *params)
{

drivers/of/fdt.c +8 -7
-     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 */
Quoted 8 lines

drivers/of/fdt.c void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align) · line 886

Quoted 5 lines
drivers/of/fdt.c +5 -0
+     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.

Quoted 2 lines

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().

Quoted 10 lines

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 -- [email protected]

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

#51 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

Quoted 30 lines · Geert Uytterhoeven
Quoted 20 lines · Grant Likely
Quoted 20 lines

bool __init early_init_dt_scan(void *params)
{

drivers/of/fdt.c +8 -7
-     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 */
Quoted 8 lines

drivers/of/fdt.c void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align) · line 886

Quoted 5 lines
drivers/of/fdt.c +5 -0
+     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

Quoted 3 lines

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!

Quoted 5 lines
Quoted 2 lines

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.

Quoted 6 lines
Quoted 6 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

#52 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

Quoted 9 lines · Grant Likely
Quoted 3 lines

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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

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.

Quoted 5 lines
Quoted 2 lines

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 -- [email protected]

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

#53 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

Quoted 41 lines · Geert Uytterhoeven
Quoted 9 lines · Grant Likely
Quoted 3 lines

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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

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.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

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.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#54 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

In reply to Geert Uytterhoeven
Quoted 30 lines · Geert Uytterhoeven
Quoted 20 lines · Grant Likely
Quoted 20 lines

bool __init early_init_dt_scan(void *params)
{

drivers/of/fdt.c +8 -7
-     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 */
Quoted 8 lines

drivers/of/fdt.c void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align) · line 886

Quoted 5 lines
drivers/of/fdt.c +5 -0
+     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

Quoted 3 lines

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.

Quoted 6 lines
Quoted 2 lines

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.

Quoted 6 lines
Quoted 6 lines

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.

Quoted 7 lines
Quoted 4 lines

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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#55 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

Quoted 3 lines · Rob Herring

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 -- [email protected]

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

#56 lore raw

Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()

Quoted 8 lines · Geert Uytterhoeven
Quoted 3 lines · Rob Herring

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.

Quoted 9 lines

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

Acked-by on v1 14/17
#57 lore raw

Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>

In reply to Geert Uytterhoeven
Quoted 10 lines · Geert Uytterhoeven

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.

Quoted 8 lines
Cc Vineet Gupta <vgupta-HKixBCOQz3hWk0Htik3J/[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <ralf-6z/[email protected]>
Cc Jonas Bonn <[email protected]>
CC Chris Zankel <[email protected]>
Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>

Thanks
James

Quoted 167 lines
---
 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(-)
arch/arc/include/asm/sections.h +0 -1
index 764f1e3ba752..09db952e14bd 100644
@@ -12,6 +12,5 @@
 #include <asm-generic/sections.h>
 
 extern char __arc_dccm_base[];
-extern char __dtb_start[];
 
 #endif
arch/arc/kernel/setup.c +1 -1
index 643eae4436e0..ef705d0f50f5 100644
@@ -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");
 
arch/metag/kernel/setup.c +1 -5
index 129c7cdda1ce..919c782f5479 100644
@@ -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
arch/mips/include/asm/mips-boards/generic.h +0 -4
index 48616816bcbc..c904c24550f6 100644
@@ -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
arch/mips/lantiq/prom.h +0 -2
index 8e07b5f28ef1..bfd2d58c1d69 100644
@@ -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
arch/mips/netlogic/xlp/dt.c +2 -2
index 8316d5454b17..87250f378386 100644
@@ -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;
 		}
 	}
arch/mips/ralink/of.c +0 -2
index eccc5526155e..615603bd8063 100644
@@ -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;
arch/openrisc/kernel/setup.c +1 -1
index 4fc7ccc0a2cf..c9b880d64bb8 100644
@@ -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);
arch/openrisc/kernel/vmlinux.h +0 -2
index 70b9ce41835c..bbcdf21b0b35 100644
@@ -5,6 +5,4 @@
 extern char __initrd_start, __initrd_end;
 #endif
 
-extern u32 __dtb_start[];
-
 #endif
arch/xtensa/kernel/setup.c +1 -2
index 6e2b6638122d..d96cf8f3fe70 100644
@@ -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;
include/linux/of_fdt.h +0 -0
index 0beaee9dac1f..aabc49f3e403 100644

include/linux/of_fdt.h struct boot_param_header { · line 65

Quoted 9 lines
include/linux/of_fdt.h +3 -0
@@ -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;

--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#58 lore raw

RFC PATCH 15/17 microblaze: Convert from _fdt_start to __dtb_start

In reply to Geert Uytterhoeven

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.

Cc Michal Simek <[email protected]>
Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Cc microblaze-uclinux-rVRm/[email protected]

---
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(-)
arch/microblaze/boot/Makefile +1 -1
index 8e211cc28dac..e4a99a22dab8 100644
@@ -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)
 
arch/microblaze/boot/dts/linked_dtb.S +1 -1
index 23345af3721f..bfc53b5795aa 100644
@@ -1,2 +1,2 @@
-.section __fdt_blob,"a"
+.section .dtb.init.rodata,"a"
 .incbin "arch/microblaze/boot/dts/system.dtb"
arch/microblaze/include/asm/sections.h +1 -3
index 1b281d3ea734..fb8ab0ba03fc 100644
@@ -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 */
arch/microblaze/kernel/head.S +1 -1
index 817b7eec95b6..6108889f0025 100644
@@ -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 */
arch/microblaze/kernel/setup.c +2 -2
index 603e22fec6d5..a4534f584be0 100644
@@ -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",
arch/microblaze/kernel/vmlinux.lds.S +0 -8
index 936d01a689d7..2659e70984a3 100644
@@ -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)
Signature · 6 lines
1.7.9.5

_______________________________________________
microblaze-linux mailing list
microblaze-linux-FR6EJeJVuqfA6Z3fQjNZrN9u6TNh0Fb7@public.gmane.org
https://lists.eait.uq.edu.au/mailman/listinfo/microblaze-linux
maintainer
#59 lore raw

Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start

Quoted 9 lines · Geert Uytterhoeven

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.

Quoted 5 lines

---
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.

Quoted 17 lines

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(-)
arch/microblaze/boot/Makefile +0 -0
index 8e211cc28dac..e4a99a22dab8 100644

arch/microblaze/boot/Makefile quiet_cmd_cp = CP $< $@$2 · line 26

Quoted 5 lines
arch/microblaze/boot/Makefile +1 -1
@@ -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.

Quoted 30 lines
arch/microblaze/boot/Makefile +0 -0
 UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)
 
arch/microblaze/boot/dts/linked_dtb.S +1 -1
index 23345af3721f..bfc53b5795aa 100644
@@ -1,2 +1,2 @@
-.section __fdt_blob,"a"
+.section .dtb.init.rodata,"a"
 .incbin "arch/microblaze/boot/dts/system.dtb"
arch/microblaze/include/asm/sections.h +1 -3
index 1b281d3ea734..fb8ab0ba03fc 100644
@@ -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 */
arch/microblaze/kernel/head.S +0 -0
index 817b7eec95b6..6108889f0025 100644

arch/microblaze/kernel/head.S big_endian: · line 98

Quoted 6 lines
arch/microblaze/kernel/head.S +1 -1
@@ -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

Signature · 5 lines
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
maintainer
#60 lore raw

Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start

Quoted 14 lines · Michal Simek
Quoted 13 lines · Geert Uytterhoeven

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.

---
Untested, but the resulting vmlinux after "make simpleImage.system" looks sane.

Quoted 4 lines
Quoted 1 line

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

Signature · 5 lines
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
#61 lore raw

Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start

Quoted 12 lines · Michal Simek
Quoted 4 lines
Quoted 1 line

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.

Quoted 6 lines

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 -- [email protected]

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

maintainer
#62 lore raw

Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start

Quoted 35 lines · Geert Uytterhoeven
Quoted 12 lines · Michal Simek
Quoted 4 lines
Quoted 1 line

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.

Quoted 6 lines

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) = .;
Quoted 5 lines

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

Signature · 5 lines
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
#63 lore raw

Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start

In reply to Michal Simek
Quoted 25 lines · Michal Simek
Quoted 12 lines · Michal Simek
Quoted 11 lines · Geert Uytterhoeven

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.

Michal Simek <[email protected]> Cc: Rob Herring <[email protected]> Cc:
[email protected] Cc:
[email protected] --- Untested, but the resulting vmlinux after "make simpleImage.system" looks sane.

Quoted 4 lines
Quoted 1 line

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.

Quoted 6 lines

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

maintainer
#64 lore raw

Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start

Quoted 30 lines · Rob Herring
Quoted 29 lines · Michal Simek
Quoted 12 lines · Michal Simek
Quoted 11 lines · Geert Uytterhoeven

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.

Michal Simek <[email protected]> Cc: Rob Herring <[email protected]> Cc:
[email protected] Cc:
[email protected] --- Untested, but the resulting vmlinux after "make simpleImage.system" looks sane.

Quoted 4 lines
Quoted 1 line

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.

Quoted 6 lines
Quoted 2 lines

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

Signature · 5 lines
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
#65 lore raw

RFC PATCH 16/17 c6x: Convert from _fdt_start to __dtb_start

In reply to Geert Uytterhoeven

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.

---
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(-)
arch/c6x/boot/dts/linked_dtb.S +1 -1
index cf347f1d16ce..a3447423abda 100644
@@ -1,2 +1,2 @@
-.section __fdt_blob,"a"
+.section .dtb.init.rodata,"a"
 .incbin "arch/c6x/boot/dts/builtin.dtb"
arch/c6x/include/asm/sections.h +0 -1
index f703989d837a..b0eeca16824f 100644
@@ -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 */
arch/c6x/kernel/setup.c +1 -1
index 731db4b9014d..414353027ba9 100644
@@ -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);
arch/c6x/kernel/vmlinux.lds.S +0 -9
index 5a6e141d1641..fea7f7a90f0f 100644
@@ -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 = .;
 
 	/*
Signature · 1 line
1.7.9.5
Acked-by on v1 16/17
#66 lore raw

Re: [PATCH RFC 16/17] c6x: Convert from _fdt_start to __dtb_start

Quoted 11 lines · Geert Uytterhoeven

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.

Cc Aurelien Jacquiot <[email protected]>
Cc Rob Herring <rob.herring-bsGFqQB8/[email protected]>
Quoted 5 lines

---
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.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#67 lore raw

PATCH 17/17 um: Remove unused declarations from <as-layout.h>

In reply to Geert Uytterhoeven

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

---
 arch/um/include/shared/as-layout.h |    3 ---
 arch/um/kernel/um_arch.c           |    1 +
 2 files changed, 1 insertion(+), 3 deletions(-)
arch/um/include/shared/as-layout.h +0 -3
index 694c792bab4e..41c8c774ec10 100644
@@ -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;
arch/um/kernel/um_arch.c +1 -0
index 9fce866b0416..c44139833212 100644
@@ -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>
Signature · 1 line
1.7.9.5
maintainer Acked-by on v1 17/17
#68 lore raw

Re: [PATCH 17/17] um: Remove unused declarations from <as-layout.h>

Am 12.11.2013 20:42, schrieb Geert Uytterhoeven:

Quoted 5 lines

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

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

Thanks,
//richard

Quoted 39 lines
---
 arch/um/include/shared/as-layout.h |    3 ---
 arch/um/kernel/um_arch.c           |    1 +
 2 files changed, 1 insertion(+), 3 deletions(-)
arch/um/include/shared/as-layout.h +0 -3
index 694c792bab4e..41c8c774ec10 100644
@@ -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;
arch/um/kernel/um_arch.c +1 -0
index 9fce866b0416..c44139833212 100644
@@ -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>
#69 lore raw

Re: [PATCH 17/17] um: Remove unused declarations from <as-layout.h>

Hi Richard,

Quoted 10 lines · Richard Weinberger

Am 12.11.2013 20:42, schrieb Geert Uytterhoeven:

Quoted 5 lines

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

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

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 -- [email protected]

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

#70 lore raw
In reply to Geert Uytterhoeven
Quoted 3 lines · Geert Uytterhoeven

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 -- [email protected]

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

#71 lore raw

PATCH 1/2 openrisc: Use the declarations provided by <asm/sections.h>

In reply to 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.

---
 arch/openrisc/kernel/setup.c   |   11 ++++++-----
 arch/openrisc/kernel/vmlinux.h |    1 -
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/openrisc/kernel/setup.c +6 -5
index ecc1c8850a11..c9b880d64bb8 100644
@@ -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;
arch/openrisc/kernel/vmlinux.h +0 -1
index 653728abcc7c..6c0b24772f85 100644
@@ -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;
Signature · 1 line
1.7.9.5
#72 lore raw

PATCH 2/2 openrisc: Remove unused declaration of __initramfs_start

---
 arch/openrisc/kernel/vmlinux.h |    1 -
 1 file changed, 1 deletion(-)
arch/openrisc/kernel/vmlinux.h +0 -1
index 6c0b24772f85..bbcdf21b0b35 100644
@@ -3,7 +3,6 @@
 
 #ifdef CONFIG_BLK_DEV_INITRD
 extern char __initrd_start, __initrd_end;
-extern char __initramfs_start;
 #endif
 
 #endif
Signature · 1 line
1.7.9.5
#73 lore raw
In reply to Geert Uytterhoeven
Quoted 2 lines · Geert Uytterhoeven

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)