Hi Greg, let me add a few remarks.
From: Joachim Dietrich <jo.dietrich@xxxxxx> There are no separate supervisor and user stack pointers on older Coldfire CPUs such as the mcf5329. We, therefore, must enable the use of software copies which is done by selecting CONFIG_COLDFIRE_SW_A7, else the first user process has a wrong stack pointer. Signed-off-by: Joachim Dietrich <jo.dietrich@xxxxxx> Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> --- I (Geert) am not that super familiar with the CONFIG_COLDFIRE_SW_A7 handling. According to Section 3.2.3 ("Supervisor/User Stack Pointers (A7 and OTHER_A7)") of MCF5329RM.pdf[1], mcf5329 does have separate stack pointers, but they're not USP and SSP, like on classic m68k and newer Coldfire parts.
Yes, I know he's right. So my description is probably not correct. But I'm a little bit confused about the stack pointer handling of the v3 coldfire, because in the reference manual of the mcf5329 stands: "To support dual stack pointers, the following two supervisor instructions are included in the ColdFire instruction set architecture to load/store the USP: move.l Ay,USP;move to USP move.l USP,Ax;move from USP" And that's what the CONFIG_COLDFIRE_SW_A7 code does in entry.h. Furthermore, in earlier versions of uclinux, e.g kernel 2.6.26, this was the default handling for the mcf5329.
Hence mcf5329 differs from e.g. mcf5206[2], which has a single unified stack pointer, which is what CONFIG_COLDFIRE_SW_A7 is designed for. I don't know if this applies to all mcf532x variants. It's quite possible CONFIG_COLDFIRE_SW_A7 is the correct solution for mcf5329, or perhaps it needs some special handling for A7 vs. OTHER_A7?
Perhaps there's a better or more correct handling for the stack pointers, but without CONFIG_COLDFIRE_SW_A7 my kernel (4.19.15) fails at rdusp() and wdusp() in processor.h and my first user process has a wrong sp.
Thanks! [1] https://www.nxp.com/docs/en/reference-manual/MCF5329RM.pdf [2] https://www.nxp.com/docs/en/data-sheet/MCF5206UM.pdf --- arch/m68k/Kconfig.cpu | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu index 60ac1cd8b96fb868..e41e74cd1125b8de 100644 --- a/arch/m68k/Kconfig.cpu +++ b/arch/m68k/Kconfig.cpu @@ -239,6 +239,7 @@ config M532x depends on !MMU select M53xx select HAVE_CACHE_CB + select COLDFIRE_SW_A7 help Freescale (Motorola) ColdFire 532x processor support.
Thanks! /joachim