powerpc/prom_init: Make of_workarounds static
PATCH 1/12 powerpc/prom_init: Make of_workarounds static
It's not used anywhere else
--- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +1 -1
@@ -87,7 +87,7 @@#define OF_WORKAROUNDS 0#else #define OF_WORKAROUNDS of_workarounds -int of_workarounds; +static int of_workarounds __promdata;#endif #define OF_WA_CLAIM 1/* do phys/virt claim separately, then map */
Signature · 1 line
2.17.1
PATCH 2/12 powerpc/prom_init: Make "fake_elf" const
It is never modified
--- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +1 -1
@@ -922,7 +922,7 @@ struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = {/* Old method - ELF header with PT_NOTE sections only works on BE */ #ifdef __BIG_ENDIAN__ -static struct fake_elf { +static const struct fake_elf { Elf32_Ehdr elfhdr; Elf32_Phdr phdr[2]; struct chrpnote {
Signature · 1 line
2.17.1
PATCH 3/12 powerpc/prom_init: Make "default_colors" const
In reply to Benjamin HerrenschmidtIt's never modified either
--- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +1 -1
@@ -2202,7 +2202,7 @@ static void __init prom_check_displays(void)ihandle ih;int i; -static unsigned char default_colors[] = { +static const unsigned char default_colors[] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0xaa ,0x00 ,0xaa ,0x00 ,
Signature · 1 line
2.17.1
PATCH 4/12 powerpc/prom_init: Replace __initdata with __prombss when applicable
In reply to Benjamin HerrenschmidtThis replaces all occurrences of __initdata for uninitialized data with a new __prombss
Currently __promdata is defined to be __initdata but we'll eventually change that.
--- arch/powerpc/kernel/prom_init.c | 55 +++++++++++++++++---------------- 1 file changed, 29 insertions(+), 26 deletions(-)
arch/powerpc/kernel/prom_init.c +29 -26
@@ -48,6 +48,9 @@#include <linux/linux_logo.h> +/* All of prom_init bss lives here */ +#define __prombss __initdata +/* * Eventually bump that one up */
@@ -87,7 +90,7 @@#define OF_WORKAROUNDS 0#else #define OF_WORKAROUNDS of_workarounds -static int of_workarounds __promdata; +static int of_workarounds __prombss;#endif #define OF_WA_CLAIM 1/* do phys/virt claim separately, then map */
@@ -148,26 +151,26 @@ extern void copy_and_flush(unsigned long dest, unsigned long src, unsigned long size, unsigned long offset);/* prom structure */ -static struct prom_t __initdata prom; +static struct prom_t __prombss prom; -static unsigned long prom_entry__initdata ; +static unsigned long __prombss prom_entry;#define PROM_SCRATCH_SIZE 256 -static char __initdata of_stdout_device[256 ]; -static char __initdata prom_scratch[PROM_SCRATCH_SIZE ]; +static char __prombss of_stdout_device[256]; +static char __prombss prom_scratch[PROM_SCRATCH_SIZE]; -static unsigned long __initdata dt_header_start; -static unsigned long __initdata dt_struct_start, dt_struct_end; -static unsigned long __initdata dt_string_start, dt_string_end; +static unsigned long __prombss dt_header_start; +static unsigned long __prombss dt_struct_start, dt_struct_end; +static unsigned long __prombss dt_string_start, dt_string_end; -static unsigned long __initdata prom_initrd_start, prom_initrd_end; +static unsigned long __prombss prom_initrd_start, prom_initrd_end;#ifdef CONFIG_PPC64 -static int __initdata prom_iommu_force_on; -static int __initdata prom_iommu_off; -static unsigned long __initdata prom_tce_alloc_start; -static unsigned long __initdata prom_tce_alloc_end; +static int __prombss prom_iommu_force_on; +static int __prombss prom_iommu_off; +static unsigned long __prombss prom_tce_alloc_start; +static unsigned long __prombss prom_tce_alloc_end;#endif static bool prom_radix_disable__initdata = !IS_ENABLED (CONFIG_PPC_RADIX_MMU_DEFAULT );
@@ -190,22 +193,22 @@ struct platform_support {#define PLATFORM_GENERIC 0x0500#define PLATFORM_OPAL 0x0600 -static int __initdata of_platform; +static int __prombss of_platform; -static char __initdata prom_cmd_line[COMMAND_LINE_SIZE ]; +static char __prombss prom_cmd_line[COMMAND_LINE_SIZE]; -static unsigned long __initdata prom_memory_limit; +static unsigned long __prombss prom_memory_limit; -static unsigned long __initdata alloc_top; -static unsigned long __initdata alloc_top_high; -static unsigned long __initdata alloc_bottom; -static unsigned long __initdata rmo_top; -static unsigned long __initdata ram_top; +static unsigned long __prombss alloc_top; +static unsigned long __prombss alloc_top_high; +static unsigned long __prombss alloc_bottom; +static unsigned long __prombss rmo_top; +static unsigned long __prombss ram_top; -static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE ]; -static int __initdata mem_reserve_cnt; +static struct mem_map_entry __prombss mem_reserve_map[MEM_RESERVE_MAP_SIZE]; +static int __prombss mem_reserve_cnt; -static cell_t __initdata regbuf[1024 ]; +static cell_t __prombss regbuf[1024];static bool rtas_has_query_cpu_stopped;
@@ -1565,8 +1568,8 @@ static void __init prom_close_stdin(void)#ifdef CONFIG_PPC_POWERNV #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL -static u64 __initdata prom_opal_base; -static u64 __initdata prom_opal_entry; +static u64 __prombss prom_opal_base; +static u64 __prombss prom_opal_entry;#endif /*
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [04/12] powerpc/prom_init: Replace __initdata with __prombss when applicable
Quoted 7 lines · Benjamin Herrenschmidt
This replaces all occurrences of
__initdatafor uninitialized data with a new__prombssCurrently
__promdatais defined to be__initdatabut we'll eventually change that.Signed-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e63334e556d9286fc30bec10503608
cheers
PATCH 5/12 powerpc/prom_init: Remove support for OPAL v2
In reply to Benjamin HerrenschmidtWe removed support for running under any OPAL version earlier than v3 in 2015 (they never saw the light of day anyway), but we kept some leftovers of this support in prom_init.c, so let's take it out.
--- arch/powerpc/kernel/prom_init.c | 125 +++----------------------------- 1 file changed, 10 insertions(+), 115 deletions(-)
arch/powerpc/kernel/prom_init.c +10 -115
@@ -43,7 +43,6 @@#include <asm/btext.h> #include <asm/sections.h> #include <asm/machdep.h> -#include <asm/opal.h> #include <asm/asm-prototypes.h> #include <linux/linux_logo.h>
@@ -191,7 +190,6 @@ struct platform_support {#define PLATFORM_LPAR 0x0001#define PLATFORM_POWERMAC 0x0400#define PLATFORM_GENERIC 0x0500 -#define PLATFORM_OPAL 0x0600 static int __prombss of_platform;
@@ -684,7 +682,7 @@ static void __init early_cmdline_parse(void)prom_debug ("Radix disabled from cmdline\n" ); } -#if defined(CONFIG_PPC_PSERIES ) || defined(CONFIG_PPC_POWERNV ) +#ifdef CONFIG_PPC_PSERIES /* * The architecture vector has an array of PVR mask/value pairs, * followed by # option vectors - 1, followed by the option vectors.
@@ -1228,7 +1226,7 @@ static void __init prom_send_capabilities(void) }#endif /* __BIG_ENDIAN__ */ } -#endif /* #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */ +#endif /* CONFIG_PPC_PSERIES */ /* * Memory allocation strategy... our layout is normally:
@@ -1565,88 +1563,6 @@ static void __init prom_close_stdin(void) } } -#ifdef CONFIG_PPC_POWERNV - -#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL -static u64 __prombss prom_opal_base; -static u64 __prombss prom_opal_entry; -#endif - -/* -* Allocate room for and instantiate OPAL -*/ -static void __init prom_instantiate_opal (void ) -{ -phandle opal_node; -ihandle opal_inst; -u64 base, entry; -u64 size =0 , align =0x10000 ; -__be64 val64; -u32 rets[2 ]; - -prom_debug ("prom_instantiate_opal: start...\n" ); - - opal_node =call_prom ("finddevice" ,1 ,1 ,ADDR ("/ibm,opal" )); -prom_debug ("opal_node: %x\n" , opal_node); -if (!PHANDLE_VALID (opal_node)) -return ; - - val64 =0 ; -prom_getprop (opal_node,"opal-runtime-size" , &val64,sizeof (val64)); - size =be64_to_cpu (val64); -if (size ==0 ) -return ; - val64 =0 ; -prom_getprop (opal_node,"opal-runtime-alignment" , &val64,sizeof (val64)); - align =be64_to_cpu (val64); - - base =alloc_down (size, align,0 ); -if (base ==0 ) { -prom_printf ("OPAL allocation failed !\n" ); -return ; - } - - opal_inst =call_prom ("open" ,1 ,1 ,ADDR ("/ibm,opal" )); -if (!IHANDLE_VALID (opal_inst)) { -prom_printf ("opening opal package failed (%x)\n" , opal_inst); -return ; - } - -prom_printf ("instantiating opal at 0x%llx..." , base); - -if (call_prom_ret ("call-method" ,4 ,3 , rets, -ADDR ("load-opal-runtime" ), - opal_inst, - base >>32 , base &0xffffffff ) !=0 - || (rets[0 ] ==0 && rets[1 ] ==0 )) { -prom_printf (" failed\n" ); -return ; - } - entry = (((u64 )rets[0 ]) <<32 ) | rets[1 ]; - -prom_printf (" done\n" ); - -reserve_mem (base, size); - -prom_debug ("opal base = 0x%llx\n" , base); -prom_debug ("opal align = 0x%llx\n" , align); -prom_debug ("opal entry = 0x%llx\n" , entry); -prom_debug ("opal size = 0x%llx\n" , size); - -prom_setprop (opal_node,"/ibm,opal" ,"opal-base-address" , - &base,sizeof (base)); -prom_setprop (opal_node,"/ibm,opal" ,"opal-entry-address" , - &entry,sizeof (entry)); - -#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL - prom_opal_base = base; - prom_opal_entry = entry; -#endif -prom_debug ("prom_instantiate_opal: end...\n" ); -} - -#endif /* CONFIG_PPC_POWERNV */ -/* * Allocate room for and instantiate RTAS */
@@ -2153,10 +2069,6 @@ static int __init prom_find_machine_type(void) } }#ifdef CONFIG_PPC64 -/* Try to detect OPAL */ -if (PHANDLE_VALID (call_prom ("finddevice" ,1 ,1 ,ADDR ("/ibm,opal" )))) -return PLATFORM_OPAL ; -/* Try to figure out if it's an IBM pSeries or any other * PAPR compliant platform. We assume it is if : * - /device_type is "chrp" (please, do NOT use that for future
@@ -2485,7 +2397,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start, }/* Add a "linux,phandle" property if no "phandle" property already -* existed (can happen with OPAL) +* existed. */ if (!has_phandle) { soff =dt_find_string ("linux,phandle" );
@@ -3175,7 +3087,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,*/ early_cmdline_parse (); -#if defined(CONFIG_PPC_PSERIES ) || defined(CONFIG_PPC_POWERNV ) +#ifdef CONFIG_PPC_PSERIES /* * On pSeries, inform the firmware about our capabilities */
@@ -3219,15 +3131,9 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,* On non-powermacs, try to instantiate RTAS. PowerMacs don't * have a usable RTAS implementation. */ -if (of_platform !=PLATFORM_POWERMAC && - of_platform !=PLATFORM_OPAL ) +if (of_platform !=PLATFORM_POWERMAC )prom_instantiate_rtas (); -#ifdef CONFIG_PPC_POWERNV -if (of_platform ==PLATFORM_OPAL ) -prom_instantiate_opal (); -#endif /* CONFIG_PPC_POWERNV */ -#ifdef CONFIG_PPC64 /* instantiate sml */ prom_instantiate_sml ();
@@ -3240,8 +3146,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,* * (This must be done after instanciating RTAS) */ -if (of_platform !=PLATFORM_POWERMAC && - of_platform !=PLATFORM_OPAL ) +if (of_platform !=PLATFORM_POWERMAC )prom_hold_cpus ();/*
@@ -3285,11 +3190,9 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,/* * in case stdin is USB and still active on IBM machines... * Unfortunately quiesce crashes on some powermacs if we have -* closed stdin already (in particular the powerbook 101). It -* appears that the OPAL version of OFW doesn't like it either. +* closed stdin already (in particular the powerbook 101). */ -if (of_platform !=PLATFORM_POWERMAC && - of_platform !=PLATFORM_OPAL ) +if (of_platform !=PLATFORM_POWERMAC )prom_close_stdin ();/*
@@ -3307,10 +3210,8 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, hdr = dt_header_start;/* Don't print anything after quiesce under OPAL, it crashes OFW */ -if (of_platform !=PLATFORM_OPAL ) { -prom_printf ("Booting Linux via __start() @ 0x%lx ...\n" , kbase); -prom_debug ("->dt_header_start=0x%lx\n" , hdr); - } +prom_printf ("Booting Linux via __start() @ 0x%lx ...\n" , kbase); +prom_debug ("->dt_header_start=0x%lx\n" , hdr);#ifdef CONFIG_PPC32 reloc_got2 (-offset);
@@ -3318,13 +3219,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,unreloc_toc ();#endif -#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL -/* OPAL early debug gets the OPAL base & entry in r8 and r9 */ -__start (hdr, kbase,0 ,0 ,0 , - prom_opal_base, prom_opal_entry); -#else __start (hdr, kbase,0 ,0 ,0 ,0 ,0 ); -#endif return 0 ; }
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [05/12] powerpc/prom_init: Remove support for OPAL v2
Quoted 6 lines · Benjamin Herrenschmidt
We removed support for running under any OPAL version earlier than v3 in 2015 (they never saw the light of day anyway), but we kept some leftovers of this support in
prom_init.c, so let's take it out.Signed-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/11fdb309341ca1ba2e3d03fd1c9c0c
cheers
PATCH 6/12 powerpc/prom_init: Move prom_radix_disable to __prombss
In reply to Benjamin HerrenschmidtInitialize it dynamically instead of statically
--- arch/powerpc/kernel/prom_init.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +6 -1
@@ -172,7 +172,9 @@ static unsigned long __prombss prom_tce_alloc_start;static unsigned long __prombss prom_tce_alloc_end;#endif -static bool prom_radix_disable__initdata = !IS_ENABLED (CONFIG_PPC_RADIX_MMU_DEFAULT ); +#ifdef CONFIG_PPC_PSERIES +static bool prom_radix_disable __prombss; +#endif struct platform_support {bool hash_mmu;
@@ -665,6 +667,8 @@ static void __init early_cmdline_parse(void)#endif } +#ifdef CONFIG_PPC_PSERIES + prom_radix_disable = !IS_ENABLED (CONFIG_PPC_RADIX_MMU_DEFAULT ); opt =strstr (prom_cmd_line,"disable_radix" );if (opt) { opt +=13 ;
@@ -680,6 +684,7 @@ static void __init early_cmdline_parse(void) }if (prom_radix_disable)prom_debug ("Radix disabled from cmdline\n" ); +#endif /* CONFIG_PPC_PSERIES */ }#ifdef CONFIG_PPC_PSERIES
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [06/12] powerpc/prom_init: Move prom_radix_disable to __prombss
Quoted 3 lines · Benjamin Herrenschmidt
Initialize it dynamically instead of statically
Signed-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/c886087caee759790db47f345f8382
cheers
PATCH 7/12 powerpc/prom_init: Move ibm_arch_vec to __prombss
In reply to Benjamin HerrenschmidtMake the existing initialized definition constant and copy it to a __prombss copy
--- arch/powerpc/kernel/prom_init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +7 -1
@@ -788,7 +788,7 @@ struct ibm_arch_vec {struct option_vector6 vec6; } __packed; -struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = { +static const struct ibm_arch_vec ibm_architecture_vec_template = { .pvrs = { { .mask =cpu_to_be32 (0xfffe0000 ),/* POWER5/POWER5+ */
@@ -926,6 +926,8 @@ struct ibm_arch_vec __cacheline_aligned ibm_architecture_vec = { }, }; +static struct ibm_arch_vec __prombss ibm_architecture_vec ____cacheline_aligned; +/* Old method - ELF header with PT_NOTE sections only works on BE */ #ifdef __BIG_ENDIAN__ static const struct fake_elf {
@@ -1135,6 +1137,10 @@ static void __init prom_check_platform_support(void) };int prop_len =prom_getproplen (prom.chosen,"ibm,arch-vec-5-platform-support" ); + +/* First copy the architecture vec template */ + ibm_architecture_vec = ibm_architecture_vec_template; +if (prop_len >1 ) {int i;u8 vec[prop_len];
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [07/12] powerpc/prom_init: Move ibm_arch_vec to __prombss
Quoted 4 lines · Benjamin Herrenschmidt
Make the existing initialized definition constant and copy it to a
__prombsscopySigned-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a614f52e75bd69b513707b4adc6721
cheers
PATCH 8/12 powerpc/prom_init: Move const structures to __initconst
In reply to Benjamin HerrenschmidtAs they are no longer used past the end of prom_init
--- arch/powerpc/kernel/prom_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/prom_init.c +3 -3
@@ -788,7 +788,7 @@ struct ibm_arch_vec {struct option_vector6 vec6; } __packed; -static const struct ibm_arch_vec ibm_architecture_vec_template = { +static const struct ibm_arch_vec ibm_architecture_vec_template__initconst = { .pvrs = { { .mask =cpu_to_be32 (0xfffe0000 ),/* POWER5/POWER5+ */
@@ -963,7 +963,7 @@ static const struct fake_elf {u32 ignore_me; } rpadesc; } rpanote; -} fake_elf = { +} fake_elf __initconst = { .elfhdr = { .e_ident = { 0x7f, 'E', 'L', 'F', ELFCLASS32, ELFDATA2MSB, EV_CURRENT },
@@ -2128,7 +2128,7 @@ static void __init prom_check_displays(void)ihandle ih;int i; -static const unsigned char default_colors[] = { +static const unsigned char default_colors[]__initconst = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0xaa ,0x00 ,0xaa ,0x00 ,
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [08/12] powerpc/prom_init: Move const structures to __initconst
Quoted 3 lines · Benjamin Herrenschmidt
As they are no longer used past the end of
prom_initSigned-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/d00e34b92cd7d8f1c10c2f0a8c1036
cheers
PATCH 9/12 powerpc/prom_init: Move a few remaining statics to appropriate sections
In reply to Benjamin Herrenschmidt--- arch/powerpc/kernel/prom_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/kernel/prom_init.c +5 -5
@@ -173,7 +173,7 @@ static unsigned long __prombss prom_tce_alloc_end;#endif #ifdef CONFIG_PPC_PSERIES -static bool prom_radix_disable __prombss; +static bool __prombss prom_radix_disable;#endif struct platform_support {
@@ -210,7 +210,7 @@ static int __prombss mem_reserve_cnt; static cell_t __prombss regbuf[1024]; -static bool rtas_has_query_cpu_stopped; +static bool __prombss rtas_has_query_cpu_stopped;/*
@@ -525,8 +525,8 @@ static void add_string(char **str, const char *q)static char *tohex (unsigned int x) { -static char digits[] ="0123456789abcdef" ; -static char result[9 ]; +static const char digits[]__initconst ="0123456789abcdef" ; + static char result[9] __prombss;int i; result[8 ] =0 ;
@@ -2324,7 +2324,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,char *namep, *prev_name, *sstart, *p, *ep, *lp, *path;unsigned long soff;unsigned char *valp; -static char pname[MAX_PROPERTY_NAME ]; + static char pname[MAX_PROPERTY_NAME] __prombss;int l, room, has_phandle =0 ;dt_push_token (OF_DT_BEGIN_NODE , mem_start, mem_end);
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [09/12] powerpc/prom_init: Move a few remaining statics to appropriate sections
Quoted 1 line · Benjamin Herrenschmidt
Signed-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/8ca2d5151e7f5cbef42eda780eac56
cheers
PATCH 10/12 powerpc/prom_init: Move __prombss to it's own section and store it in .bss
In reply to Benjamin HerrenschmidtThis makes __prombss its own section, and for now store it in .bss.
This will give us the ability later to store it elsewhere and/or free it after boot (it's about 8KB).
--- arch/powerpc/kernel/prom_init.c | 2 +- arch/powerpc/kernel/vmlinux.lds.S | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +1 -1
@@ -48,7 +48,7 @@#include <linux/linux_logo.h> /* All of prom_init bss lives here */ -#define __prombss __initdata +#define __prombss __section(.bss.prominit)/* * Eventually bump that one up
arch/powerpc/kernel/vmlinux.lds.S +3 -0
@@ -4,6 +4,9 @@ #else #define PROVIDE32(x) PROVIDE(x) #endif + +#define BSS_FIRST_SECTIONS *(.bss.prominit) + #include <asm/page.h> #include <asm-generic/vmlinux.lds.h> #include <asm/cache.h>
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [10/12] powerpc/prom_init: Move __prombss to it's own section and store it in .bss
Quoted 7 lines · Benjamin Herrenschmidt
This makes
__prombssits own section, and for now store it in .bss.This will give us the ability later to store it elsewhere and/or free it after boot (it's about 8KB).
Signed-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/5f69e38885c3483a1838dd946aaf01
cheers
PATCH 11/12 powerpc: Check prom_init for disallowed sections
In reply to Benjamin Herrenschmidtprom_init.c must not modify the kernel image outside of the .bss.prominit section. Thus make sure that prom_init.o doesn't have anything in any of these:
.data
.bss
.init.data
--- arch/powerpc/kernel/prom_init_check.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/powerpc/kernel/prom_init_check.sh +16 -0
@@ -28,6 +28,18 @@ OBJ="$2" ERROR=0 +function check_section() +{ + file=$1 + section=$2 + size=$(objdump -h -j $section $file 2>/dev/null | awk "\$2 == \"$section\" {print \$3}") + size=${size:-0} + if [ $size -ne 0 ]; then + ERROR=1 + echo "Error: Section $section not empty in prom_init.c" >&2 + fi +} + for UNDEF in $($NM -u $OBJ | awk '{print $2}') do # On 64-bit nm gives us the function descriptors, which have
@@ -66,4 +78,8 @@ do fi done +check_section $OBJ .data +check_section $OBJ .bss +check_section $OBJ .init.data + exit $ERROR
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [11/12] powerpc: Check prom_init for disallowed sections
Quoted 9 lines · Benjamin Herrenschmidt
prom_init.cmust not modify the kernel image outside of the .bss.prominit section. Thus make sure that prom_init.o doesn't have anything in any of these:.data
.bss
.init.dataSigned-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/2c51d97ee88da897db8405f659d173
cheers
PATCH 12/12 powerpc/prom_init: Generate "phandle" instead of "linux, phandle"
In reply to Benjamin HerrenschmidtWhen creating the boot-time FDT from an actual Open Firmware live tree, let's generate "phandle" properties for the phandles instead of the old deprecated "linux,phandle".
--- arch/powerpc/kernel/prom_init.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
arch/powerpc/kernel/prom_init.c +5 -7
@@ -2407,14 +2407,12 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start, has_phandle =1 ; } -/* Add a "linux,phandle" property if no "phandle" property already -* existed. -*/ +/* Add a "phandle" property if none already exist */ if (!has_phandle) { - soff =dt_find_string ("linux,phandle" ); + soff =dt_find_string ("phandle" );if (soff ==0 )prom_printf ("WARNING: Can't find string index for" -" <linux-phandle> node %s\n" , path); +" <phandle> node %s\n" , path);else {dt_push_token (OF_DT_PROP , mem_start, mem_end);dt_push_token (4 , mem_start, mem_end);
@@ -2474,9 +2472,9 @@ static void __init flatten_device_tree(void) dt_string_start = mem_start; mem_start +=4 ;/* hole */ -/* Add "linux,phandle" in there, we'll need it */ +/* Add "phandle" in there, we'll need it */ namep =make_room (&mem_start, &mem_end,16 ,1 ); -strcpy (namep,"linux,phandle" ); +strcpy (namep,"phandle" ); mem_start = (unsigned long )namep +strlen (namep) +1 ;/* Build string array */
Signature · 1 line
2.17.1
Michael Ellerman
AppliedRe: [12/12] powerpc/prom_init: Generate "phandle" instead of "linux, phandle"
Quoted 5 lines · Benjamin Herrenschmidt
When creating the boot-time FDT from an actual Open Firmware live tree, let's generate "phandle" properties for the phandles instead of the old deprecated "linux,phandle".
Signed-off-by Benjamin Herrenschmidt <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/f1f208e54d08ccf00121c700a9bb1f
cheers