Skip to contentSkip to conversation

riscv: mm: Drop redundant _sdata and _edata declaration

PATCH Superseded Kefeng Wang 2 participants 4 messages May 10, 2021 – May 12, 2021 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: mm: Drop redundant _sdata and _edata declaration

The _sdata/_edata is already in sections.h, drop redundant declaration, also move _xiprom/_exiprom close to the caller.

---
 arch/riscv/mm/init.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
arch/riscv/mm/init.c +1 -7
index 136d0342b147..4d08e1f7a362 100644
@@ -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)))
Signature · 7 lines
2.26.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
reviewer
#1 lore raw

Hi Kefeng,

Quoted 27 lines · Kefeng Wang

The _sdata/_edata is already in sections.h, drop redundant declaration, also move _xiprom/_exiprom close to the caller.

---
  arch/riscv/mm/init.c | 8 +-------
  1 file changed, 1 insertion(+), 7 deletions(-)
arch/riscv/mm/init.c +0 -7
index 136d0342b147..4d08e1f7a362 100644
@@ -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;
 

arch/riscv/mm/init.c uintptr_t load_pa, load_sz; · line 457

Quoted 4 lines
arch/riscv/mm/init.c +1 -0
@@ -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

arch/riscv/mm/init.c uintptr_t load_pa, load_sz; · line 460

Quoted 4 lines
arch/riscv/mm/init.c +0 -0
  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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#2 lore raw
Quoted 26 lines · Alex Ghiti

Hi Kefeng,

Quoted 23 lines · Kefeng Wang

The _sdata/_edata is already in sections.h, drop redundant declaration, also move _xiprom/_exiprom close to the caller.

---
  arch/riscv/mm/init.c | 8 +-------

  1 file changed, 1 insertion(+), 7 deletions(-)
arch/riscv/mm/init.c +0 -7
index 136d0342b147..4d08e1f7a362 100644
@@ -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
Quoted 8 lines

arch/riscv/mm/init.c uintptr_t load_pa, load_sz; · line 456

Quoted 5 lines
arch/riscv/mm/init.c +1 -0
   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.

Quoted 11 lines

Thanks,

Alex

arch/riscv/mm/init.c uintptr_t load_pa, load_sz;

Quoted 4 lines
arch/riscv/mm/init.c +0 -0
   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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

reviewer
#3 lore raw

Hi Kefeng,

Quoted 37 lines · Kefeng Wang
Quoted 26 lines · Alex Ghiti

Hi Kefeng,

Quoted 23 lines · Kefeng Wang

The _sdata/_edata is already in sections.h, drop redundant declaration, also move _xiprom/_exiprom close to the caller.

---
  arch/riscv/mm/init.c | 8 +-------

  1 file changed, 1 insertion(+), 7 deletions(-)
arch/riscv/mm/init.c +0 -7
index 136d0342b147..4d08e1f7a362 100644
@@ -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
Quoted 8 lines

arch/riscv/mm/init.c uintptr_t load_pa, load_sz; · line 456

Quoted 5 lines
arch/riscv/mm/init.c +1 -0
   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?

Quoted 2 lines

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

Quoted 9 lines
Quoted 9 lines

Thanks,

Alex

Quoted 4 lines
arch/riscv/mm/init.c +0 -0
   uintptr_t xiprom, xiprom_sz;
   #define xiprom_sz      (*((uintptr_t *)XIP_FIXUP(&xiprom_sz)))
   #define xiprom         (*((uintptr_t *)XIP_FIXUP(&xiprom)))
 
Quoted 7 lines
Quoted 2 lines

.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv