<asm/sections.h> related cleanups
Subsystems (19)
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
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
@@ -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
@@ -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
Re: [PATCH 01/17] alpha: Use Kbuild logic to include <asm-generic/sections.h>
Quoted 8 lines · Geert Uytterhoeven
Signed-off-by Geert Uytterhoeven <[email protected]>Cc Richard Henderson <[email protected]>--- 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~
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
@@ -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
@@ -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
Re: [PATCH 02/17] cris: Use Kbuild logic to include <asm-generic/sections.h>
Quoted 2 lines · Geert Uytterhoeven
Signed-off-by Geert Uytterhoeven <[email protected]>Cc Mikael Starvik <[email protected]>
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.harch/cris/include/asm/Kbuild +1
-0@@ -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.harch/cris/include/asm/sections.h deleted +0
-7@@ -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]
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
@@ -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
@@ -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
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
@@ -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
@@ -1 +0,0 @@ -#include <asm-generic/sections.h>
Signature · 1 line
1.7.9.5
Re: [PATCH 04/17] mn10300: Use Kbuild logic to include <asm-generic/sections.h>
Quoted 3 lines · Geert Uytterhoeven
Signed-off-by Geert Uytterhoeven <[email protected]>Cc David Howells <[email protected]>
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
@@ -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
@@ -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
Re: [PATCH 05/17] score: Use Kbuild logic to include <asm-generic/sections.h>
於 2013/11/13 上午 03:42, Geert Uytterhoeven 提到:
Quoted 33 lines
Signed-off-by Geert Uytterhoeven <[email protected]>Cc Chen Liqin <[email protected]>Cc Lennox Wu <[email protected]>--- 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.harch/score/include/asm/Kbuild +1
-0@@ -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.harch/score/include/asm/sections.h deleted +0
-6@@ -1,6 +0,0 @@ -#ifndef _ASM_SCORE_SECTIONS_H -#define _ASM_SCORE_SECTIONS_H - -#include <asm-generic/sections.h> - -#endif /* _ASM_SCORE_SECTIONS_H */
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
@@ -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
Re: [PATCH 06/17] frv: Remove unused declarations of __start___ex_table and __stop___ex_table
Quoted 2 lines · Geert Uytterhoeven
Signed-off-by Geert Uytterhoeven <[email protected]>Cc David Howells <[email protected]>
PATCH 7/17 ia64: Remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[]
In reply to Geert UytterhoevenThey'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
@@ -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
PATCH 8/17 microblaze: Remove _fdt_start casts
In reply to 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 +2 -3
@@ -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
Re: [PATCH 08/17] microblaze: Remove _fdt_start casts
Quoted 24 lines · Geert Uytterhoeven
_fdt_startis an array, i.e. a pointer.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Michal Simek <[email protected]>--- arch/microblaze/kernel/setup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)arch/microblaze/kernel/setup.c +1
-1@@ -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
PATCH 9/17 microblaze: Remove duplicate declarations of _stext[] and _etext[]
In reply to Geert UytterhoevenThey're already provided by <asm/sections.h>.
--- arch/microblaze/include/asm/sections.h | 1 - 1 file changed, 1 deletion(-)
arch/microblaze/include/asm/sections.h +0 -1
@@ -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
PATCH 10/17 tile: Remove tile-specific _sinitdata and _einitdata
In reply to Geert UytterhoevenUse 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
@@ -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
@@ -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
@@ -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
Re: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
Quoted 4 lines · Geert Uytterhoeven
Use standard
__init_beginand__init_endinstead.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Chris Metcalf <[email protected]>
[...]
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
Geert Uytterhoeven
Acked-by Chris MetcalfRe: [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_beginand__init_endinstead.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Chris Metcalf <[email protected]>[...]
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:
Acked-by Chris Metcalf <[email protected]>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
@@ -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
@@ -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
@@ -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 TorvaldsRe: [PATCH 10/17] tile: Remove tile-specific _sinitdata and _einitdata
Quoted 11 lines · Geert Uytterhoeven
Feel free to take v2 below. Thanks!
From
d761d4d63945ff0a6eab5a9058c132f870c92affMon 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_sinitdataand_einitdataUse standard
__init_beginand__init_endinstead.Signed-off-by Geert Uytterhoeven <[email protected]>Acked-by Chris Metcalf <[email protected]>
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
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
d761d4d63945ff0a6eab5a9058c132f870c92affMon 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_sinitdataand_einitdata
Quoted 6 lines
Quoted 4 lines
Use standard
__init_beginand__init_endinstead.Signed-off-by Geert Uytterhoeven <[email protected]>Acked-by Chris Metcalf <[email protected]>Taken into the tile tree; thanks! (I did fix one extra place where it mentioned
_sinitdatain 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
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
d761d4d63945ff0a6eab5a9058c132f870c92affMon 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_sinitdataand_einitdata
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Use standard
__init_beginand__init_endinstead.Signed-off-by Geert Uytterhoeven <[email protected]>Acked-by Chris Metcalf <[email protected]>Taken into the tile tree; thanks! (I did fix one extra place where it mentioned
_sinitdatain 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
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
d761d4d63945ff0a6eab5a9058c132f870c92affMon 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_sinitdataand_einitdataUse standard
__init_beginand__init_endinstead.Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Geert Uytterhoeven <[email protected]>Acked-by Chris Metcalf <[email protected]>Taken into the tile tree; thanks! (I did fix one extra place where it mentioned
_sinitdatain 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
PATCH 11/17 kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h>
In reply to Geert UytterhoevenConsolidate 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
@@ -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
@@ -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
@@ -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
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___paramin <linux/moduleparam.h>. This requires making a few structkernel_parampointers inkernel/params.cconst.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Rusty Russell <[email protected]>
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@@ -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@@ -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@@ -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
PATCH 12/17 nosave: Consolidate __nosave_{begin,end} in <asm/sections.h>
In reply to Geert UytterhoevenThe 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>.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
Jonas Bonn
maintainerRe: [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.
- Usepr_info(),
- Extract common part.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Jonas Bonn <[email protected]>
Thanks, I'll take this one directly into the OpenRISC tree.
/Jonas
PATCH 14/17 dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
In reply to Geert UytterhoevenThe 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -5,6 +5,4 @@extern char __initrd_start, __initrd_end;#endif -extern u32 __dtb_start[]; -#endif
arch/xtensa/kernel/setup.c +1 -2
@@ -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
@@ -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
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_startwas an array before.Signed-off-by Geert Uytterhoeven <[email protected]>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
Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
In reply to Geert UytterhoevenQuoted 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_startwas an array before.Signed-off-by Geert Uytterhoeven <[email protected]>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
@@ -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
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_startwas an array before.Signed-off-by Geert Uytterhoeven <[email protected]>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_scanis 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@@ -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
-0initial_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
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_startwas an array before.Signed-off-by Geert Uytterhoeven <[email protected]>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_scanis 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@@ -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_paramscannot 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. TheOF_DT_HEADERcheck 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
-0initial_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
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_paramscannot 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. TheOF_DT_HEADERcheck 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
PATCH 1/9 dt: Handle passed/built-in DT selection in early_init_dt_scan()
In reply to Rob HerringLet 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
@@ -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
@@ -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
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
@@ -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
Re: [PATCH 2/9] arc: Use NULL as the default DTB
Quoted 4 lines · Geert Uytterhoeven
early_init_dt_scan()now takes care of falling back to the built-in DTB.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Vineet Gupta <[email protected]>
Thx,
-Vineet
PATCH 3/9 c6x: Remove duplicate DT selection logic
In reply to Geert Uytterhoevenearly_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
@@ -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
PATCH 4/9 metag: Remove duplicate DT selection logic
In reply to Geert Uytterhoevenearly_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
@@ -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
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 whetheroriginal_cmd_lineis a DTB or a command line, to keep command line append working.Signed-off-by Geert Uytterhoeven <[email protected]>Cc James Hogan <[email protected]>
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
PATCH 5/9 microblaze: Use NULL as the default DTB
In reply to Geert Uytterhoevenearly_init_dt_scan() now takes care of falling back to the built-in DTB, and printing what it did.
---
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
@@ -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
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
@@ -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
PATCH 7/9 mips: Use NULL as the default DTB
In reply to Geert Uytterhoevenearly_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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 8/9 openrisc: Remove duplicate DT selection logic
In reply to Geert Uytterhoevenearly_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
@@ -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
PATCH 9/9 xtensa: Use NULL as the default DTB
In reply to Geert Uytterhoevenearly_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
@@ -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
Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
In reply to Geert UytterhoevenQuoted 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.Suggested-by Rob Herring <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>
Thanks
James
Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
In reply to Geert UytterhoevenQuoted 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.Suggested-by Rob Herring <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>---
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@@ -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@@ -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
Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
In reply to Geert UytterhoevenQuoted 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.Suggested-by Rob Herring <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/of/fdt.c | 24 +++++++++++++++++------- include/linux/of_fdt.h | 1 + 2 files changed, 18 insertions(+), 7 deletions(-)drivers/of/fdt.c +3
-7@@ -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.
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.Suggested-by Rob Herring <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/of/fdt.c | 24 +++++++++++++++++------- include/linux/of_fdt.h | 1 + 2 files changed, 18 insertions(+), 7 deletions(-)drivers/of/fdt.c +3
-7@@ -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_startis 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.
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.Suggested-by Rob Herring <[email protected]>Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/of/fdt.c | 24 +++++++++++++++++------- include/linux/of_fdt.h | 1 + 2 files changed, 18 insertions(+), 7 deletions(-)drivers/of/fdt.c +3
-7@@ -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_startis 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.
Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
In reply to Grant LikelyQuoted 20 lines · Grant Likely
Quoted 20 lines
bool
__initearly_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_startis 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
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
__initearly_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_startis 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_startin 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.
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_startin several places. If this is broken, it's already broken.Yes, but it is called on platforms that already make that assumption that
__dtb_startmust be copied and therefore callunflatten_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
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_startin several places. If this is broken, it's already broken.Yes, but it is called on platforms that already make that assumption that
__dtb_startmust be copied and therefore callunflatten_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
Re: [PATCH 1/9] dt: Handle passed/built-in DT selection in early_init_dt_scan()
In reply to Geert UytterhoevenQuoted 30 lines · Geert Uytterhoeven
Quoted 20 lines · Grant Likely
Quoted 20 lines
bool
__initearly_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_startis 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_startin 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
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
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
Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
In reply to Geert UytterhoevenQuoted 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_startwas an array before.
Quoted 8 lines
Signed-off-by Geert Uytterhoeven <[email protected]>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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -5,6 +5,4 @@extern char __initrd_start, __initrd_end;#endif -extern u32 __dtb_start[]; -#endif arch/xtensa/kernel/setup.c +1
-2@@ -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
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
RFC PATCH 15/17 microblaze: Convert from _fdt_start to __dtb_start
In reply to Geert UytterhoevenKill 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.
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Michal Simek
maintainerRe: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
Quoted 9 lines · Geert Uytterhoeven
Kill the microblaze-specific
__fdt_blobsection, and start using .dtb.init.rodata from <asm-generic/sections.h> for built-in DTBs, like most other DT enabled architectures.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Michal Simek <[email protected]>Cc Rob Herring <[email protected]>
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.libinstead of
arch/microblaze/boot/dts/linked_dtb.Sarch/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
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
-0UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)arch/microblaze/boot/dts/linked_dtb.S +1
-1@@ -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@@ -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
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
Michal Simek
maintainerRe: [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_blobsection, and start using .dtb.init.rodata from <asm-generic/sections.h> for built-in DTBs, like most other DT enabled architectures.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Michal Simek <[email protected]>Cc Rob Herring <[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.
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
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.Scode 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
Michal Simek
maintainerRe: [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.Scode 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
#defineARCH_DTB_PADDING
#endifand 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_PADDINGin 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
Re: [PATCH RFC 15/17] microblaze: Convert from _fdt_start to __dtb_start
In reply to Michal SimekQuoted 25 lines · Michal Simek
Quoted 12 lines · Michal Simek
Quoted 11 lines · Geert Uytterhoeven
Kill the microblaze-specific
__fdt_blobsection, and start using .dtb.init.rodata from <asm-generic/sections.h> for built-in DTBs, like most other DT enabled architectures.Signed-off-by Geert Uytterhoeven <[email protected]> Cc: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.Scode 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
Michal Simek
maintainerRe: [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_blobsection, and start using .dtb.init.rodata from <asm-generic/sections.h> for built-in DTBs, like most other DT enabled architectures.Signed-off-by Geert Uytterhoeven <[email protected]> Cc: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.Scode 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
RFC PATCH 16/17 c6x: Convert from _fdt_start to __dtb_start
In reply to Geert UytterhoevenKill 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
@@ -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
@@ -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
@@ -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
@@ -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
Re: [PATCH RFC 16/17] c6x: Convert from _fdt_start to __dtb_start
Quoted 11 lines · Geert Uytterhoeven
Kill the c6x-specific
__fdt_blobsection, and start using .dtb.init.rodata
from <asm-generic/sections.h> for built-in DTBs, like most other DT enabled
architectures.Signed-off-by Geert Uytterhoeven <[email protected]>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
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
@@ -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
@@ -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
Re: [PATCH 17/17] um: Remove unused declarations from <as-layout.h>
Am 12.11.2013 20:42, schrieb Geert Uytterhoeven:
Quoted 5 lines
_endis used, but it's already provided by <asm/sections.h>, so use that.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Richard Weinberger <[email protected]>
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@@ -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@@ -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>
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
_endis used, but it's already provided by <asm/sections.h>, so use that.Signed-off-by Geert Uytterhoeven <[email protected]>Cc Richard Weinberger <[email protected]>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
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
PATCH 1/2 openrisc: Use the declarations provided by <asm/sections.h>
In reply to Geert UytterhoevenOpenrisc'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
@@ -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
@@ -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
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
@@ -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
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)