m5441x: mmu support patchset
Subsystems (2)
cover m5441x: mmu support patchset
Hi all,
Here is a patchset proposal for MMU support on Coldfire 5441x serie.
This patchset allows building the mcfmmu on chip without FPU, enable the elf binary support and report some code from m54xx to m5441x sources files.
Also, it contains a proposal for uImage generation.
Functional status is OK on kernel v3.14.
But on v4.2-rc1, we observe a map_err exit fail in do_page_fault(). After bisecting, we point out the regression appears after the vm_ops->map_pages() feature integration (introduced in 8c6e50b and later)
Your feedbacks are welcome on this.
Best Regards,
Yannick
Yannick GICQUEL (8):
m68k: coldfire: unlink FPU presence from MMU activation
m68k: fix build issue in setup_arch() when no FPU
m68k: add dummy dump_fpu() when FPU is not present
m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
m68k: m5441x: fix ACR0 base address when MBAR is not present
m68k: m5441x: set rambar to end of SRAM physical addr space
m68k: mmu: add u-boot command line support in setup_arch()
m68k: uImage generation support
arch/m68k/Kconfig | 2 +- arch/m68k/Kconfig.cpu | 4 +- arch/m68k/Makefile | 8 +++- arch/m68k/boot/Makefile | 45 ++++++++++++++++++++++ arch/m68k/coldfire/head.S | 9 +++++ arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++ arch/m68k/include/asm/m54xxacr.h | 13 ++++++- arch/m68k/kernel/process.c | 6 ++- arch/m68k/kernel/setup_mm.c | 82 +++++++++++++++++++++++++++++++++++++++- 9 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 arch/m68k/boot/Makefile
Signature · 1 line
1.9.1.286.g5172cb3
RFC 1/8 m68k: coldfire: unlink FPU presence from MMU activation
m5441x coldfire chips contains a MMU and no FPU. This patch allow building this chip with MMU activated.
--- arch/m68k/Kconfig | 2 +- arch/m68k/Kconfig.cpu | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
arch/m68k/Kconfig +1 -1
@@ -14,7 +14,7 @@ config M68K select GENERIC_IOMAP select GENERIC_STRNCPY_FROM_USER if MMU select GENERIC_STRNLEN_USER if MMU - select FPU if MMU + select FPU if MMU && !COLDFIRE select ARCH_WANT_IPC_PARSE_VERSION select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
arch/m68k/Kconfig.cpu +3 -1
@@ -257,6 +257,7 @@ config M54xx config M547x bool "MCF547x" select M54xx + select FPU select MMU_COLDFIRE if MMU select HAVE_CACHE_CB select HAVE_MBAR
@@ -265,6 +266,7 @@ config M547x config M548x bool "MCF548x" + select FPU select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB
@@ -274,7 +276,7 @@ config M548x config M5441x bool "MCF5441x" - depends on !MMU + select MMU_COLDFIRE if MMU select GENERIC_CLOCKEVENTS select HAVE_CACHE_CB help
Signature · 1 line
1.9.1.286.g5172cb3
Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
Hi Yannick,
I think this needs to be two separate patches. The FPU change is logically one.
The change to the MCF5441x config is another - and it really needs to be the last one in the series (so that all the actuall code support is in place first).
Regards
Greg
Quoted 52 lines · Yannick GICQUEL
m5441x coldfire chips contains a MMU and no FPU. This patch allow building this chip with MMU activated.
Signed-off-by Yannick GICQUEL <[email protected]>--- arch/m68k/Kconfig | 2 +- arch/m68k/Kconfig.cpu | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)arch/m68k/Kconfig +1
-1@@ -14,7 +14,7 @@ config M68K select GENERIC_IOMAP select GENERIC_STRNCPY_FROM_USER if MMU select GENERIC_STRNLEN_USER if MMU - select FPU if MMU + select FPU if MMU && !COLDFIRE select ARCH_WANT_IPC_PARSE_VERSION select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE select HAVE_FUTEX_CMPXCHG if MMU && FUTEXarch/m68k/Kconfig.cpu +3
-1@@ -257,6 +257,7 @@ config M54xx config M547x bool "MCF547x" select M54xx + select FPU select MMU_COLDFIRE if MMU select HAVE_CACHE_CB select HAVE_MBAR@@ -265,6 +266,7 @@ config M547x config M548x bool "MCF548x" + select FPU select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB@@ -274,7 +276,7 @@ config M548x config M5441x bool "MCF5441x" - depends on !MMU + select MMU_COLDFIRE if MMU select GENERIC_CLOCKEVENTS select HAVE_CACHE_CB help
Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
Hi Greg,
Ok with that.
Source code rework and feature activation are two different things. Keep it in mind for future...
Regards,
Yannick
Quoted 66 lines · Greg Ungerer
Hi Yannick,
I think this needs to be two separate patches. The FPU change is logically one.
The change to the MCF5441x config is another - and it really needs to be the last one in the series (so that all the actuall code support is in place first).Regards
GregQuoted 52 lines · Yannick GICQUEL
m5441x coldfire chips contains a MMU and no FPU. This patch allow building this chip with MMU activated.
Signed-off-by Yannick GICQUEL <[email protected]>--- arch/m68k/Kconfig | 2 +- arch/m68k/Kconfig.cpu | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)arch/m68k/Kconfig +1
-1@@ -14,7 +14,7 @@ config M68K select GENERIC_IOMAP select GENERIC_STRNCPY_FROM_USER if MMU select GENERIC_STRNLEN_USER if MMU - select FPU if MMU + select FPU if MMU && !COLDFIRE select ARCH_WANT_IPC_PARSE_VERSION select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE select HAVE_FUTEX_CMPXCHG if MMU && FUTEXarch/m68k/Kconfig.cpu +3
-1@@ -257,6 +257,7 @@ config M54xx config M547x bool "MCF547x" select M54xx + select FPU select MMU_COLDFIRE if MMU select HAVE_CACHE_CB select HAVE_MBAR@@ -265,6 +266,7 @@ config M547x config M548x bool "MCF548x" + select FPU select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB@@ -274,7 +276,7 @@ config M548x config M5441x bool "MCF5441x" - depends on !MMU + select MMU_COLDFIRE if MMU select GENERIC_CLOCKEVENTS select HAVE_CACHE_CB help
Geert Uytterhoeven
maintainerRe: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
In reply to Yannick GICQUELarch/m68k/Kconfig config M68K · line 17
Quoted 10 lines · Yannick GICQUEL
arch/m68k/Kconfig +1
-1@@ -14,7 +14,7 @@ config M68K select GENERIC_IOMAP select GENERIC_STRNCPY_FROM_USER if MMU select GENERIC_STRNLEN_USER if MMU - select FPU if MMU + select FPU if MMU && !COLDFIRE
I'm not too fond of having complex dependencies here...
arch/m68k/Kconfig config M68K · line 19
Quoted 2 lines
arch/m68k/Kconfig +0
-0select ARCH_WANT_IPC_PARSE_VERSION select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
(but we already have examples like the above)
arch/m68k/Kconfig.cpu config M54xx · line 260
Quoted 10 lines
arch/m68k/Kconfig +0
-0select HAVE_FUTEX_CMPXCHG if MMU && FUTEXarch/m68k/Kconfig.cpu +1
-0@@ -257,6 +257,7 @@ config M54xx config M547x bool "MCF547x" select M54xx + select FPU
... perhaps the "select FPU" should be added to M68KCLASSIC, too, so we can get rid of the top one?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
Quoted 20 lines · Geert Uytterhoeven
arch/m68k/Kconfig config M68K · line 17
Quoted 10 lines · Yannick GICQUEL
arch/m68k/Kconfig +1
-1@@ -14,7 +14,7 @@ config M68K select GENERIC_IOMAP select GENERIC_STRNCPY_FROM_USER if MMU select GENERIC_STRNLEN_USER if MMU - select FPU if MMU + select FPU if MMU && !COLDFIREI'm not too fond of having complex dependencies here...
arch/m68k/Kconfig config M68K · line 19
Quoted 2 lines
arch/m68k/Kconfig +0
-0select ARCH_WANT_IPC_PARSE_VERSION select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE(but we already have examples like the above)
Quoted 13 lines
arch/m68k/Kconfig.cpu config M54xx · line 260
Quoted 10 lines
arch/m68k/Kconfig +0
-0select HAVE_FUTEX_CMPXCHG if MMU && FUTEXarch/m68k/Kconfig.cpu +1
-0@@ -257,6 +257,7 @@ config M54xx config M547x bool "MCF547x" select M54xx + select FPU... perhaps the "select FPU" should be added to M68KCLASSIC, too, so we can get rid of the top one?
We use M68KCLASSIC for the non-MMU 68k families as well, and none of those have FPU either. Maybe should we select FPU for each of M68020, M68030, M68040 and M68060 in their configs?
Regards
Greg
Quoted 11 lines
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven
maintainerRe: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
Quoted 13 lines · Greg Ungerer
Quoted 11 lines
arch/m68k/Kconfig.cpu config M54xx · line 260
Quoted 7 lines
arch/m68k/Kconfig.cpu +1
-0@@ -257,6 +257,7 @@ config M54xx config M547x bool "MCF547x" select M54xx + select FPU... perhaps the "select FPU" should be added to M68KCLASSIC, too, so we can get rid of the top one?
Quoted 3 lines
We use M68KCLASSIC for the non-MMU 68k families as well, and none of those have FPU either. Maybe should we select FPU for each of M68020, M68030, M68040 and M68060 in their configs?
Yep, makes sense.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
RFC 2/8 m68k: fix build issue in setup_arch() when no FPU
In reply to Yannick GICQUELWhen MMU is activated, assembler generates an illegal instruction on target without FPU.
Related code under FPU flag condition.
--- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/setup_mm.c +1 -1
@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)* We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#if !defined(CONFIG_M68KFPU_EMU_ONLY ) && defined(CONFIG_FPU )/* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ;
Signature · 1 line
1.9.1.286.g5172cb3
Geert Uytterhoeven
maintainerRe: [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU
arch/m68k/kernel/setup_mm.c void __init setup_arch(char **cmdline_p) · line 251
Quoted 13 lines · Yannick GICQUEL
arch/m68k/kernel/setup_mm.c +1
-1@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)* We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#if !defined(CONFIG_M68KFPU_EMU_ONLY ) && defined(CONFIG_FPU )/* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ;
Should we turn M68KFPU_EMU_ONLY into !FPU in general?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
RFC 3/8 m68k: add dummy dump_fpu() when FPU is not present
In reply to Yannick GICQUELThis is requirement from elfcore.h
No other arch put this one under flag, so this alignment for build with elf binary support to succeed.
--- arch/m68k/kernel/process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/m68k/kernel/process.c +4 -2
@@ -203,9 +203,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, }/* Fill in the fpu structure for a core dump. */ -#ifdef CONFIG_FPU int dump_fpu (struct pt_regs *regs,struct user_m68kfp_struct *fpu) { +#ifdef CONFIG_FPU char fpustate[216 ];if (FPU_IS_EMU ) {
@@ -250,9 +250,11 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) }return 1 ; +#else +return 0 ; +#endif /* CONFIG_FPU */ }EXPORT_SYMBOL (dump_fpu); -#endif /* CONFIG_FPU */ unsigned long get_wchan (struct task_struct *p) {
Signature · 1 line
1.9.1.286.g5172cb3
RFC 4/8 m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
In reply to Yannick GICQUELThis is same code as currently present in m54xx.c file which was initially integrated in 88be3515.
This is not very elegant because of source code duplication but this do the job.
--- arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
arch/m68k/coldfire/m5441x.c +47 -0
@@ -16,6 +16,13 @@#include <asm/mcfdma.h> #include <asm/mcfclk.h> +#ifdef CONFIG_MMU +#include <linux/mm.h> +#include <linux/bootmem.h> +#include <asm/pgalloc.h> +#include <asm/mmu_context.h> +#endif +DEFINE_CLK (0 ,"flexbus" ,2 ,MCF_CLK );DEFINE_CLK (0 ,"mcfcan.0" ,8 ,MCF_CLK );DEFINE_CLK (0 ,"mcfcan.1" ,9 ,MCF_CLK );
@@ -215,8 +222,48 @@ static void __init m5441x_fec_init(void)__raw_writeb (0x03 ,MCFGPIO_PAR_FEC ); } + +#ifdef CONFIG_MMU + +unsigned long num_pages; + +static void __init mcf54xx_bootmem_alloc (void ) +{ +unsigned long start_pfn; +unsigned long memstart; + +/* _rambase and _ramend will be naturally page aligned */ + m68k_memory[0 ].addr = _rambase; + m68k_memory[0 ].size = _ramend - _rambase; + +/* compute total pages in system */ + num_pages = (_ramend - _rambase) >>PAGE_SHIFT ; + +/* page numbers */ + memstart =PAGE_ALIGN (_ramstart); + min_low_pfn = _rambase >>PAGE_SHIFT ; + start_pfn = memstart >>PAGE_SHIFT ; + max_low_pfn = _ramend >>PAGE_SHIFT ; + high_memory = (void *)_ramend; + + m68k_virt_to_node_shift =fls (_ramend - _rambase -1 ) -6 ; +module_fixup (NULL , __start_fixup, __stop_fixup); + +/* setup bootmem data */ +m68k_setup_node (0 ); + memstart +=init_bootmem_node (NODE_DATA (0 ), start_pfn, + min_low_pfn, max_low_pfn); +free_bootmem_node (NODE_DATA (0 ), memstart, _ramend - memstart); +} +#endif /* CONFIG_MMU */ + +void __init config_BSP (char *commandp,int size) { +#ifdef CONFIG_MMU +mcf54xx_bootmem_alloc (); +mmu_context_init (); +#endif m5441x_clk_init (); mach_sched_init = hw_timer_init;m5441x_uarts_init ();
Signature · 1 line
1.9.1.286.g5172cb3
Re: [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
Hi Yannick,
Quoted 4 lines · Yannick GICQUEL
This is same code as currently present in
m54xx.cfile which was initially integrated in88be3515.
This is not very elegant because of source code duplication but this do the job.
Perhaps moving into arch/m68k/mm/mcfmmu.c would be better? No point having two complete copies of the same code. And none if it is actually specific to the 54xx or 5441xx.
Regards
Greg
Quoted 73 lines
Signed-off-by Yannick GICQUEL <[email protected]>--- arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)arch/m68k/coldfire/m5441x.c +47
-0@@ -16,6 +16,13 @@#include <asm/mcfdma.h> #include <asm/mcfclk.h> +#ifdef CONFIG_MMU +#include <linux/mm.h> +#include <linux/bootmem.h> +#include <asm/pgalloc.h> +#include <asm/mmu_context.h> +#endif +DEFINE_CLK (0 ,"flexbus" ,2 ,MCF_CLK );DEFINE_CLK (0 ,"mcfcan.0" ,8 ,MCF_CLK );DEFINE_CLK (0 ,"mcfcan.1" ,9 ,MCF_CLK );@@ -215,8 +222,48 @@ static void __init m5441x_fec_init(void)__raw_writeb (0x03 ,MCFGPIO_PAR_FEC ); } + +#ifdef CONFIG_MMU + +unsigned long num_pages; + +static void __init mcf54xx_bootmem_alloc (void ) +{ +unsigned long start_pfn; +unsigned long memstart; + +/* _rambase and _ramend will be naturally page aligned */ + m68k_memory[0 ].addr = _rambase; + m68k_memory[0 ].size = _ramend - _rambase; + +/* compute total pages in system */ + num_pages = (_ramend - _rambase) >>PAGE_SHIFT ; + +/* page numbers */ + memstart =PAGE_ALIGN (_ramstart); + min_low_pfn = _rambase >>PAGE_SHIFT ; + start_pfn = memstart >>PAGE_SHIFT ; + max_low_pfn = _ramend >>PAGE_SHIFT ; + high_memory = (void *)_ramend; + + m68k_virt_to_node_shift =fls (_ramend - _rambase -1 ) -6 ; +module_fixup (NULL , __start_fixup, __stop_fixup); + +/* setup bootmem data */ +m68k_setup_node (0 ); + memstart +=init_bootmem_node (NODE_DATA (0 ), start_pfn, + min_low_pfn, max_low_pfn); +free_bootmem_node (NODE_DATA (0 ), memstart, _ramend - memstart); +} +#endif /* CONFIG_MMU */ + +void __init config_BSP (char *commandp,int size) { +#ifdef CONFIG_MMU +mcf54xx_bootmem_alloc (); +mmu_context_init (); +#endif m5441x_clk_init (); mach_sched_init = hw_timer_init;m5441x_uarts_init ();
RFC 5/8 m68k: m5441x: fix ACR0 base address when MBAR is not present
In reply to Yannick GICQUEL--- arch/m68k/include/asm/m54xxacr.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/m68k/include/asm/m54xxacr.h +12 -1
@@ -94,8 +94,20 @@* register region as non-cacheable. And then we map all our RAM as * cacheable and supervisor access only. */ +#ifdef CONFIG_M5441x +/* +* MBAR register is not present in this serie +* Periph #0 in 0xe0000000--0x0xefffffff +* Periph #1 in 0xf0000000--0x0xffffffff +* +* Let's hardcode these values for ACR0 +*/ +#define ACR0_MODE (ACR_BA(0xE0000000)+ACR_ADMSK(0x20000000)+ \ + ACR_ENABLE+ACR_SUPER+ACR_CM_OFF_PRE+ACR_SP) +#else #define ACR0_MODE (ACR_BA(CONFIG_MBAR)+ACR_ADMSK(0x1000000)+ \ ACR_ENABLE+ACR_SUPER+ACR_CM_OFF_PRE+ACR_SP) +#endif #if defined(CONFIG_CACHE_COPYBACK )#define ACR1_MODE (ACR_BA(CONFIG_RAMBASE)+ACR_ADMSK(CONFIG_RAMSIZE)+ \ ACR_ENABLE+ACR_SUPER+ACR_SP+ACR_CM_CP)
@@ -106,7 +118,6 @@#define ACR2_MODE 0#define ACR3_MODE (ACR_BA(CONFIG_RAMBASE)+ACR_ADMSK(CONFIG_RAMSIZE)+ \ ACR_ENABLE+ACR_SUPER+ACR_SP) -#else /*
Signature · 1 line
1.9.1.286.g5172cb3
RFC 6/8 m68k: m5441x: set rambar to end of SRAM physical addr space
In reply to Yannick GICQUELEven if SRAM is not used, this is required to avoid inconsistency at runtime. Otherwise, an assertion failed in ld.so during init process execution:
Inconsistency detected by ld.so: rtld.c: 1290: dl_main: Assertion `_rtld_local._dl_rtld_map.l_libname' failed!
--- arch/m68k/coldfire/head.S | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/m68k/coldfire/head.S +9 -0
@@ -151,6 +151,15 @@ _start0: _start: nop /* filler */ +#if defined(CONFIG_M5441x) +#if defined(CONFIG_SRAM_BASE) + movel #(CONFIG_SRAM_BASE+0x221), %d0 +#else + movel #(0x8ff00000+0x221), %d0 +#endif + movec %d0, %rambar1 +#endif + movew #0x2700, %sr /* no interrupts */ movel #CACHE_INIT,%d0 /* disable cache */ movec %d0,%CACR
Signature · 1 line
1.9.1.286.g5172cb3
Re: [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space
Hi Yannick,
Quoted 4 lines · Yannick GICQUEL
Even if SRAM is not used, this is required to avoid inconsistency at runtime. Otherwise, an assertion failed in ld.so during init process execution:
Inconsistency detected by ld.so:
rtld.c: 1290:dl_main: Assertion `_rtld_local._dl_rtld_map.l_libname' failed!
Can you explain further?
Is this really the underlying problem?
Surely the presence of the SRAM block mapped in shouldn't have any impact on running applications.
Where does CONFIG_SRAM_BASE come from?
I didn't see in this series anywhere.
Regards
Greg
Quoted 26 lines
Signed-off-by Yannick GICQUEL <[email protected]>--- arch/m68k/coldfire/head.S | 9 +++++++++ 1 file changed, 9 insertions(+)arch/m68k/coldfire/head.S +9
-0@@ -151,6 +151,15 @@ _start0: _start: nop /* filler */ +#if defined(CONFIG_M5441x) +#if defined(CONFIG_SRAM_BASE) + movel #(CONFIG_SRAM_BASE+0x221), %d0 +#else + movel #(0x8ff00000+0x221), %d0 +#endif + movec %d0, %rambar1 +#endif + movew #0x2700, %sr /* no interrupts */ movel #CACHE_INIT,%d0 /* disable cache */ movec %d0,%CACR
Re: [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space
Hi Greg,
Quoted 6 lines · Greg Ungerer
Hi Yannick,
Quoted 3 lines · Yannick GICQUEL
Even if SRAM is not used, this is required to avoid inconsistency at runtime. Otherwise, an assertion failed in ld.so during init process execution:
Quoted 6 lines
Quoted 1 line
Inconsistency detected by ld.so:
rtld.c: 1290:dl_main: Assertion `_rtld_local._dl_rtld_map.l_libname' failed!Can you explain further?
Is this really the underlying problem?
Surely the presence of the SRAM block mapped in shouldn't have any impact on running applications.
I think this is due to SRAM backdoor default activation on m5441x.
cf. reference manual (p.190):
(...)By default, the RAMBAR is invalid, but the backdoor is enabled. In this state, any core accesses to the SRAM are routed through the backdoor(...)
Also, i think this backdoor must be disabled. In section 4.3.1.2.3, its explained the "the address mode for normal accesses is determined by the MMUBAR, RAMBARs, and ACRs in the priority order listed(...)", before handling these accesses as virtual addresses.
Thus, when the backdoor is enable, the virtual address translation is not performed for the SRAM 64Kb range.
I just realized that i didn't simply try disabling the backdoor by setting RAMBAR to 0. I have just done this test and this seems sufficient to fix the assertion failed at ld.so execution.
Quoted 2 lines
Where does
CONFIG_SRAM_BASEcome from?
I didn't see in this series anywhere.
Old "artifact" from initial FSL BSP ; agreed : it should not be delivered as is.
Also, may be this code could be moved outside head.S and put in a m5441 related file... it need a try before patch update.
Quoted 32 lines
Regards
GregQuoted 26 lines
Signed-off-by Yannick GICQUEL <[email protected]>--- arch/m68k/coldfire/head.S | 9 +++++++++ 1 file changed, 9 insertions(+)arch/m68k/coldfire/head.S +9
-0@@ -151,6 +151,15 @@ _start0: _start: nop /* filler */ +#if defined(CONFIG_M5441x) +#if defined(CONFIG_SRAM_BASE) + movel #(CONFIG_SRAM_BASE+0x221), %d0 +#else + movel #(0x8ff00000+0x221), %d0 +#endif + movec %d0, %rambar1 +#endif + movew #0x2700, %sr /* no interrupts */ movel #CACHE_INIT,%d0 /* disable cache */ movec %d0,%CACR
RFC 7/8 m68k: mmu: add u-boot command line support in setup_arch()
In reply to Yannick GICQUELThis part was ported from setup_no.c
--- arch/m68k/kernel/setup_mm.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+)
arch/m68k/kernel/setup_mm.c +80 -0
@@ -225,6 +225,68 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)#endif } +#if defined(CONFIG_UBOOT ) +/* +* parse_uboot_commandline +* +* Copies u-boot commandline arguments and store them in the proper linux +* variables. +* +* Assumes: +* _init_sp global contains the address in the stack pointer when the +* kernel starts (see head.S::_start) +* +* U-Boot calling convention: +* (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); +* +* _init_sp can be parsed as such +* +* _init_sp+00 = u-boot cmd after jsr into kernel (skip) +* _init_sp+04 = &kernel board_info (residual data) +* _init_sp+08 = &initrd_start +* _init_sp+12 = &initrd_end +* _init_sp+16 = &cmd_start +* _init_sp+20 = &cmd_end +* +* This also assumes that the memory locations pointed to are still +* unmodified. U-boot places them near the end of external SDRAM. +* +* Argument(s): +* commandp = the linux commandline arg container to fill. +* size = the sizeof commandp. +* +* Returns: +*/ +static void __init parse_uboot_commandline (char *commandp,int size) +{ +extern unsigned long _init_sp; +unsigned long *sp; +unsigned long uboot_kbd; +unsigned long uboot_initrd_start, uboot_initrd_end; +unsigned long uboot_cmd_start, uboot_cmd_end; + + + sp = (unsigned long *)_init_sp; + uboot_kbd = sp[1 ]; + uboot_initrd_start = sp[2 ]; + uboot_initrd_end = sp[3 ]; + uboot_cmd_start = sp[4 ]; + uboot_cmd_end = sp[5 ]; + +if (uboot_cmd_start && uboot_cmd_end) +strncpy (commandp, (const char *)uboot_cmd_start, size); +#if defined(CONFIG_BLK_DEV_INITRD ) +if (uboot_initrd_start && uboot_initrd_end && + (uboot_initrd_end > uboot_initrd_start)) { + initrd_start = uboot_initrd_start; + initrd_end = uboot_initrd_end; +printk (KERN_INFO "initrd at 0x%lx:0x%lx\n" , + initrd_start, initrd_end); + } +#endif /* if defined(CONFIG_BLK_DEV_INITRD) */ +} +#endif /* #if defined(CONFIG_UBOOT) */ +void __init setup_arch (char **cmdline_p) {#ifndef CONFIG_SUN3
@@ -274,6 +336,24 @@ void __init setup_arch(char **cmdline_p)strncpy (m68k_command_line,CONFIG_BOOTPARAM_STRING ,CL_SIZE ); m68k_command_line[CL_SIZE -1 ] =0 ;#endif /* CONFIG_BOOTPARAM */ + +#if defined(CONFIG_UBOOT ) +/* CONFIG_UBOOT and CONFIG_BOOTPARAM defined, concatenate cmdline */ +#if defined(CONFIG_BOOTPARAM ) +/* Add the whitespace separator */ + m68k_command_line[strlen (CONFIG_BOOTPARAM_STRING )] =' ' ; +/* Parse uboot command line into the rest of the buffer */ +parse_uboot_commandline ( + &m68k_command_line[(strlen (CONFIG_BOOTPARAM_STRING )+1 )], + (sizeof (m68k_command_line) - + (strlen (CONFIG_BOOTPARAM_STRING )+1 ))); +/* Only CONFIG_UBOOT defined, create cmdline */ +#else +parse_uboot_commandline (&m68k_command_line[0 ],sizeof (m68k_command_line)); +#endif /* CONFIG_BOOTPARAM */ + m68k_command_line[sizeof (m68k_command_line) -1 ] =0 ; +#endif /* CONFIG_UBOOT */ + *cmdline_p = m68k_command_line;memcpy (boot_command_line, *cmdline_p,CL_SIZE );
Signature · 1 line
1.9.1.286.g5172cb3
Re: [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch()
Hi Yannick,
Again no point having two copies of the same code. Perhaps merging of the _mm and _no setup code makes more sense now.
Regards
Greg
Quoted 106 lines · Yannick GICQUEL
This part was ported from
setup_no.cSigned-off-by Yannick GICQUEL <[email protected]>--- arch/m68k/kernel/setup_mm.c | 80 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+)arch/m68k/kernel/setup_mm.c +80
-0@@ -225,6 +225,68 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)#endif } +#if defined(CONFIG_UBOOT ) +/* +* parse_uboot_commandline +* +* Copies u-boot commandline arguments and store them in the proper linux +* variables. +* +* Assumes: +* _init_sp global contains the address in the stack pointer when the +* kernel starts (see head.S::_start) +* +* U-Boot calling convention: +* (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); +* +* _init_sp can be parsed as such +* +* _init_sp+00 = u-boot cmd after jsr into kernel (skip) +* _init_sp+04 = &kernel board_info (residual data) +* _init_sp+08 = &initrd_start +* _init_sp+12 = &initrd_end +* _init_sp+16 = &cmd_start +* _init_sp+20 = &cmd_end +* +* This also assumes that the memory locations pointed to are still +* unmodified. U-boot places them near the end of external SDRAM. +* +* Argument(s): +* commandp = the linux commandline arg container to fill. +* size = the sizeof commandp. +* +* Returns: +*/ +static void __init parse_uboot_commandline (char *commandp,int size) +{ +extern unsigned long _init_sp; +unsigned long *sp; +unsigned long uboot_kbd; +unsigned long uboot_initrd_start, uboot_initrd_end; +unsigned long uboot_cmd_start, uboot_cmd_end; + + + sp = (unsigned long *)_init_sp; + uboot_kbd = sp[1 ]; + uboot_initrd_start = sp[2 ]; + uboot_initrd_end = sp[3 ]; + uboot_cmd_start = sp[4 ]; + uboot_cmd_end = sp[5 ]; + +if (uboot_cmd_start && uboot_cmd_end) +strncpy (commandp, (const char *)uboot_cmd_start, size); +#if defined(CONFIG_BLK_DEV_INITRD ) +if (uboot_initrd_start && uboot_initrd_end && + (uboot_initrd_end > uboot_initrd_start)) { + initrd_start = uboot_initrd_start; + initrd_end = uboot_initrd_end; +printk (KERN_INFO "initrd at 0x%lx:0x%lx\n" , + initrd_start, initrd_end); + } +#endif /* if defined(CONFIG_BLK_DEV_INITRD) */ +} +#endif /* #if defined(CONFIG_UBOOT) */ +void __init setup_arch (char **cmdline_p) {#ifndef CONFIG_SUN3 @@ -274,6 +336,24 @@ void __init setup_arch(char **cmdline_p)strncpy (m68k_command_line,CONFIG_BOOTPARAM_STRING ,CL_SIZE ); m68k_command_line[CL_SIZE -1 ] =0 ;#endif /* CONFIG_BOOTPARAM */ + +#if defined(CONFIG_UBOOT ) +/* CONFIG_UBOOT and CONFIG_BOOTPARAM defined, concatenate cmdline */ +#if defined(CONFIG_BOOTPARAM ) +/* Add the whitespace separator */ + m68k_command_line[strlen (CONFIG_BOOTPARAM_STRING )] =' ' ; +/* Parse uboot command line into the rest of the buffer */ +parse_uboot_commandline ( + &m68k_command_line[(strlen (CONFIG_BOOTPARAM_STRING )+1 )], + (sizeof (m68k_command_line) - + (strlen (CONFIG_BOOTPARAM_STRING )+1 ))); +/* Only CONFIG_UBOOT defined, create cmdline */ +#else +parse_uboot_commandline (&m68k_command_line[0 ],sizeof (m68k_command_line)); +#endif /* CONFIG_BOOTPARAM */ + m68k_command_line[sizeof (m68k_command_line) -1 ] =0 ; +#endif /* CONFIG_UBOOT */ + *cmdline_p = m68k_command_line;memcpy (boot_command_line, *cmdline_p,CL_SIZE );
RFC 8/8 m68k: uImage generation support
In reply to Yannick GICQUELAdding an arch/m68k/boot subdirectory as output dir for generated uImage.
--- arch/m68k/Makefile | 8 +++++++- arch/m68k/boot/Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 arch/m68k/boot/Makefile
arch/m68k/Makefile +7 -1
@@ -118,7 +118,6 @@ core-$(CONFIG_M68360) += arch/m68k/68360/ core-$(CONFIG_M68000) += arch/m68k/68000/ core-$(CONFIG_COLDFIRE) += arch/m68k/coldfire/ - all: zImage lilo: vmlinux
@@ -154,8 +153,15 @@ else bzip2 -1c vmlinux >vmlinux.bz2 endif +boot := arch/m68k/boot + +uImage: vmlinux + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ + archclean: rm -f vmlinux.gz vmlinux.bz2 + $(Q)$(MAKE) $(clean)=$(boot) + install: sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
arch/m68k/boot/Makefile new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.9.1.286.g5172cb3
Hi Yannick,
Quoted 1 line · Yannick GICQUEL
Here is a patchset proposal for MMU support on Coldfire 5441x serie.
Nice.
Quoted 11 lines
This patchset allows building the mcfmmu on chip without FPU, enable the elf binary support and report some code from m54xx to m5441x sources files.
Also, it contains a proposal for uImage generation.
Functional status is OK on kernel v3.14.
But on v4.2-rc1, we observe amap_errexit fail indo_page_fault(). After bisecting, we point out the regression appears after thevm_ops->map_pages()feature integration (introduced in 8c6e50b and later)
I haven't looked in detail into this yet. But I can confirm that it still works fine on a 5475 with MMU enabled.
Some other comments as replies to specific patches.
Regards
Greg
Quoted 28 lines
Your feedbacks are welcome on this.
Best Regards,
YannickYannick GICQUEL (8):
m68k: coldfire: unlink FPU presence from MMU activation
m68k: fix build issue insetup_arch()when no FPU
m68k: add dummydump_fpu()when FPU is not present
m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
m68k: m5441x: fix ACR0 base address when MBAR is not present
m68k: m5441x: set rambar to end of SRAM physical addr space
m68k: mmu: add u-boot command line support insetup_arch()
m68k: uImage generation supportarch/m68k/Kconfig | 2 +- arch/m68k/Kconfig.cpu | 4 +- arch/m68k/Makefile | 8 +++- arch/m68k/boot/Makefile | 45 ++++++++++++++++++++++ arch/m68k/coldfire/head.S | 9 +++++ arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++ arch/m68k/include/asm/m54xxacr.h | 13 ++++++- arch/m68k/kernel/process.c | 6 ++- arch/m68k/kernel/setup_mm.c | 82 +++++++++++++++++++++++++++++++++++++++- 9 files changed, 209 insertions(+), 7 deletions(-)create mode 100644
arch/m68k/boot/Makefile
Hi Greg, Geert,
Sorry for late response and thanks for your reviews and comments,
These patchs can gives an overview of the work that *seem* required for MMU support on 5441x, but clearly there still some unknown behaviour under study. It looks like the address translation is not always took into account by HW, but this needs a deeper investigation which is on going.
This is good to know the 5475 MMU support is Ok on latest kernel version. I have checked deeper in datasheets to study differences. MMU are quite similar, but few differences are present.
At register level, there are additional bits on M5441x serie :
MMUCR[UVE] : User virtual mode enable.
0: Virtual mode activation based on MMUCR[EN], (default) 1: based on MMUCR[EN] && CPU *not* in Supervisor mode.
MMUCR[SAL] : Select ASID location
0: defined by ASID register, (default)
1: defined by MMUAR[9:2]
From my understanding of current CFV4e MMU support, I think the MMUCR[SAL] needs to be set. ASID register is set in head.S but *not* used in cf_tlb_miss() missed.
Regarding MMUCR[UVE], I think the default configuration is coherent with address translation requirement while running in kernel mode.
Another difference between M5441x & 5475 is Peripheral memory mapping which is relative to MBAR ( == 0xff000000 in defconfig ) register on 5475, and fixed on M5441x. Also, physical RAM is accessible from 0x40000000 on m5441x, and starts at 0x0 on 5475.
Don't think it should have an impact on the virtual address translation mechanism, but if for some reason this is faulty or disable at some point, there may be an "overlap" between virtual and physical address space on 5441x which is not present on 5475. Just an assumption...
Other comments in threads as well.
Best Regards,
Yannick
Quoted 60 lines · Greg Ungerer
Hi Yannick,
Quoted 1 line · Yannick GICQUEL
Here is a patchset proposal for MMU support on Coldfire 5441x serie.
Nice.
Quoted 11 lines
This patchset allows building the mcfmmu on chip without FPU, enable the elf binary support and report some code from m54xx to m5441x sources files.
Also, it contains a proposal for uImage generation.
Functional status is OK on kernel v3.14.
But on v4.2-rc1, we observe amap_errexit fail indo_page_fault(). After bisecting, we point out the regression appears after thevm_ops->map_pages()feature integration (introduced in 8c6e50b and later)I haven't looked in detail into this yet. But I can confirm that it still works fine on a 5475 with MMU enabled.
Some other comments as replies to specific patches.
Regards
GregQuoted 29 lines
Your feedbacks are welcome on this.
Best Regards,
YannickYannick GICQUEL (8):
m68k: coldfire: unlink FPU presence from MMU activation
m68k: fix build issue insetup_arch()when no FPU
m68k: add dummydump_fpu()when FPU is not present
m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
m68k: m5441x: fix ACR0 base address when MBAR is not present
m68k: m5441x: set rambar to end of SRAM physical addr space
m68k: mmu: add u-boot command line support insetup_arch()
m68k: uImage generation supportarch/m68k/Kconfig | 2 +- arch/m68k/Kconfig.cpu | 4 +- arch/m68k/Makefile | 8 +++- arch/m68k/boot/Makefile | 45 ++++++++++++++++++++++ arch/m68k/coldfire/head.S | 9 +++++ arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++ arch/m68k/include/asm/m54xxacr.h | 13 ++++++- arch/m68k/kernel/process.c | 6 ++- arch/m68k/kernel/setup_mm.c | 82 +++++++++++++++++++++++++++++++++++++++- 9 files changed, 209 insertions(+), 7 deletions(-)create mode 100644
arch/m68k/boot/Makefile