Skip to contentSkip to conversation

MIPS: vpe-mt: drop physical_memsize

PATCH Applied Randy Dunlap 2 participants 2 messages Feb 19, 2023 – Feb 20, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MIPS: vpe-mt: drop physical_memsize

When neither LANTIQ nor MIPS_MALTA is set, 'physical_memsize' is not declared. This causes the build to fail with:

mips-linux-ld: arch/mips/kernel/vpe-mt.o: in function `vpe_run':
arch/mips/kernel/vpe-mt.c:(.text.vpe_run+0x280): undefined reference to `physical_memsize'

LANTIQ is not using 'physical_memsize' and MIPS_MALTA's use of it is self-contained in mti-malta/malta-dtshim.c.
Use of physical_memsize in vpe-mt.c appears to be unused, so eliminate this loader mode completely and require VPE programs to be compiled with DFLT_STACK_SIZE and DFLT_HEAP_SIZE defined.

Fixes 9050d50e2244 ("MIPS: lantiq: Set physical_memsize")
Fixes 1a2a6d7e8816 ("MIPS: APRP: Split VPE loader into separate files.")
Cc Dengcheng Zhu <[email protected]>
Cc John Crispin <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc "Steven J. Hill" <[email protected]>
Cc Qais Yousef <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Hauke Mehrtens <[email protected]>
Cc James Hogan <[email protected]>

---
v2 changes: instead of providing a default physical_memsize of 0, which
is not correct for MIPS_MALTA, just eliminate its use in vpe-mt.c.

 arch/mips/include/asm/vpe.h |    1 -
 arch/mips/kernel/vpe-mt.c   |    7 +++----
 arch/mips/lantiq/prom.c     |    6 ------
 3 files changed, 3 insertions(+), 11 deletions(-)
arch/mips/lantiq/prom.c +0 -6
diff -- a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
@@ -23,12 +23,6 @@ DEFINE_SPINLOCK(ebu_lock);
 EXPORT_SYMBOL_GPL(ebu_lock);
 
 /*
- * This is needed by the VPE loader code, just set it to 0 and assume
- * that the firmware hardcodes this value to something useful.
- */
-unsigned long physical_memsize = 0L;
-
-/*
  * this struct is filled by the soc specific detection code and holds
  * information about the specific soc type, revision and name
  */
arch/mips/include/asm/vpe.h +0 -1
diff -- a/arch/mips/include/asm/vpe.h b/arch/mips/include/asm/vpe.h
@@ -102,7 +102,6 @@ struct vpe_control {
 	struct list_head tc_list;       /* Thread contexts */
 };
 
-extern unsigned long physical_memsize;
 extern struct vpe_control vpecontrol;
 extern const struct file_operations vpe_fops;
 
arch/mips/kernel/vpe-mt.c +3 -4
diff -- a/arch/mips/kernel/vpe-mt.c b/arch/mips/kernel/vpe-mt.c
@@ -92,12 +92,11 @@ int vpe_run(struct vpe *v)
 	write_tc_c0_tchalt(read_tc_c0_tchalt() & ~TCHALT_H);
 
 	/*
-	 * The sde-kit passes 'memsize' to __start in $a3, so set something
-	 * here...  Or set $a3 to zero and define DFLT_STACK_SIZE and
-	 * DFLT_HEAP_SIZE when you compile your program
+	 * We don't pass the memsize here, so VPE programs need to be
+	 * compiled with DFLT_STACK_SIZE and DFLT_HEAP_SIZE defined.
 	 */
+	mttgpr(7, 0);
 	mttgpr(6, v->ntcs);
-	mttgpr(7, physical_memsize);
 
 	/* set up VPE1 */
 	/*
maintainer Applied
#1 lore raw
Quoted 27 lines · Randy Dunlap

When neither LANTIQ nor MIPS_MALTA is set, 'physical_memsize' is not declared. This causes the build to fail with:

mips-linux-ld: arch/mips/kernel/vpe-mt.o: in function `vpe_run':
arch/mips/kernel/vpe-mt.c:(.text.vpe_run+0x280): undefined reference to `physical_memsize'

LANTIQ is not using 'physical_memsize' and MIPS_MALTA's use of it is self-contained in mti-malta/malta-dtshim.c.
Use of physical_memsize in vpe-mt.c appears to be unused, so eliminate this loader mode completely and require VPE programs to be compiled with DFLT_STACK_SIZE and DFLT_HEAP_SIZE defined.

Fixes 9050d50e2244 ("MIPS: lantiq: Set physical_memsize")
Fixes 1a2a6d7e8816 ("MIPS: APRP: Split VPE loader into separate files.")
Cc Dengcheng Zhu <[email protected]>
Cc John Crispin <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc "Steven J. Hill" <[email protected]>
Cc Qais Yousef <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Hauke Mehrtens <[email protected]>
Cc James Hogan <[email protected]>
Quoted 8 lines

---
v2 changes: instead of providing a default physical_memsize of 0, which
is not correct for MIPS_MALTA, just eliminate its use in vpe-mt.c.

 arch/mips/include/asm/vpe.h |    1 -
 arch/mips/kernel/vpe-mt.c   |    7 +++----
 arch/mips/lantiq/prom.c     |    6 ------
 3 files changed, 3 insertions(+), 11 deletions(-)

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]