Message ID | 20210510115808.96615-1-wangkefeng.wang@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | riscv: mm: Drop redundant _sdata and _edata declaration | expand |
Hi Kefeng, On 10/05/2021 13:58, Kefeng Wang wrote: > The _sdata/_edata is already in sections.h, drop redundant > declaration, also move _xiprom/_exiprom close to the caller. > > Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> > --- > arch/riscv/mm/init.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 136d0342b147..4d08e1f7a362 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -176,13 +176,6 @@ static void __init setup_bootmem(void) > memblock_allow_resize(); > } > > -#ifdef CONFIG_XIP_KERNEL > - > -extern char _xiprom[], _exiprom[]; > -extern char _sdata[], _edata[]; > - > -#endif /* CONFIG_XIP_KERNEL */ > - > #ifdef CONFIG_MMU > static struct pt_alloc_ops _pt_ops __ro_after_init; > > @@ -461,6 +454,7 @@ uintptr_t load_pa, load_sz; > #endif > > #ifdef CONFIG_XIP_KERNEL > +extern char _xiprom[], _exiprom[]; This place is guarded by #ifdef CONFIG_MMU and Vitaly has plans to make XIP kernels work on !MMU configurations, so that may not be the best place to move this declaration? Thanks, Alex > uintptr_t xiprom, xiprom_sz; > #define xiprom_sz (*((uintptr_t *)XIP_FIXUP(&xiprom_sz))) > #define xiprom (*((uintptr_t *)XIP_FIXUP(&xiprom))) >
On 2021/5/10 20:34, Alex Ghiti wrote: > Hi Kefeng, > > On 10/05/2021 13:58, Kefeng Wang wrote: >> The _sdata/_edata is already in sections.h, drop redundant >> declaration, also move _xiprom/_exiprom close to the caller. >> >> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> >> --- >> arch/riscv/mm/init.c | 8 +------- >> 1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c >> index 136d0342b147..4d08e1f7a362 100644 >> --- a/arch/riscv/mm/init.c >> +++ b/arch/riscv/mm/init.c >> @@ -176,13 +176,6 @@ static void __init setup_bootmem(void) >> memblock_allow_resize(); >> } >> -#ifdef CONFIG_XIP_KERNEL >> - >> -extern char _xiprom[], _exiprom[]; >> -extern char _sdata[], _edata[]; >> - >> -#endif /* CONFIG_XIP_KERNEL */ >> - >> #ifdef CONFIG_MMU >> static struct pt_alloc_ops _pt_ops __ro_after_init; >> @@ -461,6 +454,7 @@ uintptr_t load_pa, load_sz; >> #endif >> #ifdef CONFIG_XIP_KERNEL >> +extern char _xiprom[], _exiprom[]; > > > This place is guarded by #ifdef CONFIG_MMU and Vitaly has plans to make > XIP kernels work on !MMU configurations, so that may not be the best > place to move this declaration? OK, is it better to move the top of the init.c, close to kernel_virt_addr, or don't change them. > > Thanks, > > Alex > >> uintptr_t xiprom, xiprom_sz; >> #define xiprom_sz (*((uintptr_t *)XIP_FIXUP(&xiprom_sz))) >> #define xiprom (*((uintptr_t *)XIP_FIXUP(&xiprom))) >> > . >
Hi Kefeng, On 10/05/2021 16:03, Kefeng Wang wrote: > > > On 2021/5/10 20:34, Alex Ghiti wrote: >> Hi Kefeng, >> >> On 10/05/2021 13:58, Kefeng Wang wrote: >>> The _sdata/_edata is already in sections.h, drop redundant >>> declaration, also move _xiprom/_exiprom close to the caller. >>> >>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> >>> --- >>> arch/riscv/mm/init.c | 8 +------- >>> 1 file changed, 1 insertion(+), 7 deletions(-) >>> >>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c >>> index 136d0342b147..4d08e1f7a362 100644 >>> --- a/arch/riscv/mm/init.c >>> +++ b/arch/riscv/mm/init.c >>> @@ -176,13 +176,6 @@ static void __init setup_bootmem(void) >>> memblock_allow_resize(); >>> } >>> -#ifdef CONFIG_XIP_KERNEL >>> - >>> -extern char _xiprom[], _exiprom[]; >>> -extern char _sdata[], _edata[]; >>> - >>> -#endif /* CONFIG_XIP_KERNEL */ >>> - >>> #ifdef CONFIG_MMU >>> static struct pt_alloc_ops _pt_ops __ro_after_init; >>> @@ -461,6 +454,7 @@ uintptr_t load_pa, load_sz; >>> #endif >>> #ifdef CONFIG_XIP_KERNEL >>> +extern char _xiprom[], _exiprom[]; >> >> >> This place is guarded by #ifdef CONFIG_MMU and Vitaly has plans to >> make XIP kernels work on !MMU configurations, so that may not be the >> best place to move this declaration? > OK, is it better to move the top of the init.c, close to > kernel_virt_addr, or don't change them. > I like when all declarations are at the beginning of the file, but that's subjective so you can put this wherever you like as long as it is outside #ifdef CONFIG_MMU :) Thanks, Alex >> >> Thanks, >> >> Alex >> >>> uintptr_t xiprom, xiprom_sz; >>> #define xiprom_sz (*((uintptr_t *)XIP_FIXUP(&xiprom_sz))) >>> #define xiprom (*((uintptr_t *)XIP_FIXUP(&xiprom))) >>> >> . >> > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 136d0342b147..4d08e1f7a362 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -176,13 +176,6 @@ static void __init setup_bootmem(void) memblock_allow_resize(); } -#ifdef CONFIG_XIP_KERNEL - -extern char _xiprom[], _exiprom[]; -extern char _sdata[], _edata[]; - -#endif /* CONFIG_XIP_KERNEL */ - #ifdef CONFIG_MMU static struct pt_alloc_ops _pt_ops __ro_after_init; @@ -461,6 +454,7 @@ uintptr_t load_pa, load_sz; #endif #ifdef CONFIG_XIP_KERNEL +extern char _xiprom[], _exiprom[]; uintptr_t xiprom, xiprom_sz; #define xiprom_sz (*((uintptr_t *)XIP_FIXUP(&xiprom_sz))) #define xiprom (*((uintptr_t *)XIP_FIXUP(&xiprom)))
The _sdata/_edata is already in sections.h, drop redundant declaration, also move _xiprom/_exiprom close to the caller. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- arch/riscv/mm/init.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)