* [RFC 0/8] m5441x: mmu support patchset
@ 2015-07-08 9:51 Yannick GICQUEL
2015-07-08 9:51 ` [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation Yannick GICQUEL
` (8 more replies)
0 siblings, 9 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
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
--
1.9.1.286.g5172cb3
^ permalink raw reply [flat|nested] 21+ messages in thread
* [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 13:36 ` Greg Ungerer
2015-07-08 14:03 ` Geert Uytterhoeven
2015-07-08 9:51 ` [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU Yannick GICQUEL
` (7 subsequent siblings)
8 siblings, 2 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
m5441x coldfire chips contains a MMU and no FPU.
This patch allow building this chip with MMU activated.
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/Kconfig | 2 +-
arch/m68k/Kconfig.cpu | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 2dd8f63..d704c16 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -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
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 33013df..3661eb4 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -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
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
2015-07-08 9:51 ` [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 14:04 ` Geert Uytterhoeven
2015-07-08 9:51 ` [RFC 3/8] m68k: add dummy dump_fpu() when FPU is not present Yannick GICQUEL
` (6 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
When MMU is activated, assembler generates an illegal
instruction on target without FPU.
Related code under FPU flag condition.
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/kernel/setup_mm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 5b8ec4d..0bc6f77 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -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;
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC 3/8] m68k: add dummy dump_fpu() when FPU is not present
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
2015-07-08 9:51 ` [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation Yannick GICQUEL
2015-07-08 9:51 ` [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 9:51 ` [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code Yannick GICQUEL
` (5 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
This is requirement from elfcore.h
No other arch put this one under flag, so this alignment
for build with elf binary support to succeed.
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/kernel/process.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index c55ff71..03e29a4 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -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)
{
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
` (2 preceding siblings ...)
2015-07-08 9:51 ` [RFC 3/8] m68k: add dummy dump_fpu() when FPU is not present Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 13:45 ` Greg Ungerer
2015-07-08 9:51 ` [RFC 5/8] m68k: m5441x: fix ACR0 base address when MBAR is not present Yannick GICQUEL
` (4 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
This 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.
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c
index 98a13cc..5924a21 100644
--- a/arch/m68k/coldfire/m5441x.c
+++ b/arch/m68k/coldfire/m5441x.c
@@ -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();
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC 5/8] m68k: m5441x: fix ACR0 base address when MBAR is not present
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
` (3 preceding siblings ...)
2015-07-08 9:51 ` [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 9:51 ` [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space Yannick GICQUEL
` (3 subsequent siblings)
8 siblings, 0 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/include/asm/m54xxacr.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/m68k/include/asm/m54xxacr.h b/arch/m68k/include/asm/m54xxacr.h
index 6d13cae..e79f48e 100644
--- a/arch/m68k/include/asm/m54xxacr.h
+++ b/arch/m68k/include/asm/m54xxacr.h
@@ -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
/*
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
` (4 preceding siblings ...)
2015-07-08 9:51 ` [RFC 5/8] m68k: m5441x: fix ACR0 base address when MBAR is not present Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 13:53 ` Greg Ungerer
2015-07-08 9:51 ` [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch() Yannick GICQUEL
` (2 subsequent siblings)
8 siblings, 1 reply; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
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!
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/coldfire/head.S | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/m68k/coldfire/head.S b/arch/m68k/coldfire/head.S
index fa31be2..bf39885 100644
--- a/arch/m68k/coldfire/head.S
+++ b/arch/m68k/coldfire/head.S
@@ -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
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch()
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
` (5 preceding siblings ...)
2015-07-08 9:51 ` [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 14:03 ` Greg Ungerer
2015-07-08 9:51 ` [RFC 8/8] m68k: uImage generation support Yannick GICQUEL
2015-07-08 14:07 ` [RFC 0/8] m5441x: mmu support patchset Greg Ungerer
8 siblings, 1 reply; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
This part was ported from setup_no.c
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/kernel/setup_mm.c | 80 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 0bc6f77..94be970 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -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);
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [RFC 8/8] m68k: uImage generation support
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
` (6 preceding siblings ...)
2015-07-08 9:51 ` [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch() Yannick GICQUEL
@ 2015-07-08 9:51 ` Yannick GICQUEL
2015-07-08 14:07 ` [RFC 0/8] m5441x: mmu support patchset Greg Ungerer
8 siblings, 0 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-08 9:51 UTC (permalink / raw)
To: linux-m68k
Adding an arch/m68k/boot subdirectory as output dir
for generated uImage.
Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
---
arch/m68k/Makefile | 8 +++++++-
arch/m68k/boot/Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
create mode 100644 arch/m68k/boot/Makefile
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 0b29dcf..bf5cbdd 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -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)"
diff --git a/arch/m68k/boot/Makefile b/arch/m68k/boot/Makefile
new file mode 100644
index 0000000..af0b110
--- /dev/null
+++ b/arch/m68k/boot/Makefile
@@ -0,0 +1,45 @@
+#
+# arch/m68k/boot/Makefile
+#
+# based on initial file from Freescale m5441x BSP
+#
+# This file is subject to the terms and conditions of the GNU General Public
+# License. See the file "COPYING" in the main directory of this archive
+# for more details.
+#
+
+MKIMAGE := $(srctree)/scripts/mkuboot.sh
+
+#
+# Assign safe dummy values if these variables are not defined,
+# in order to suppress error message.
+#
+CONFIG_KERNELBASE ?= 0x40020000
+
+targets := uImage
+
+UIMAGE_LOADADDR := $(CONFIG_KERNELBASE)
+UIMAGE_ENTRYADDR := $(CONFIG_KERNELBASE)
+UIMAGE_COMPRESSION ?= none
+
+export UIMAGE_LOADADDR UIMAGE_ENTRYADDR UIMAGE_COMPRESSION
+
+ifeq ($(UIMAGE_COMPRESSION),gzip)
+UIMAGE_SRCBIN := $(obj)/vmlinux.bin.gz
+else
+UIMAGE_SRCBIN := $(obj)/vmlinux.bin
+endif
+
+$(obj)/uImage: $(UIMAGE_SRCBIN) FORCE
+ $(call if_changed,uimage)
+ @echo ' Image $@ is ready'
+
+OBJCOPYFLAGS_vmlinux.bin := -I elf32-m68k -O binary
+$(obj)/vmlinux.bin: vmlinux FORCE
+ $(call if_changed,objcopy)
+
+$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
+ $(call if_changed,gzip)
+
+clean-files += uImage vmlinux.bin vmlinux.bin.gz
+
--
1.9.1.286.g5172cb3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
2015-07-08 9:51 ` [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation Yannick GICQUEL
@ 2015-07-08 13:36 ` Greg Ungerer
2015-07-17 10:46 ` Yannick GICQUEL
2015-07-08 14:03 ` Geert Uytterhoeven
1 sibling, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2015-07-08 13:36 UTC (permalink / raw)
To: Yannick GICQUEL, linux-m68k
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
On 08/07/15 19:51, Yannick GICQUEL wrote:
> m5441x coldfire chips contains a MMU and no FPU.
> This patch allow building this chip with MMU activated.
>
> Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
> ---
> arch/m68k/Kconfig | 2 +-
> arch/m68k/Kconfig.cpu | 4 +++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index 2dd8f63..d704c16 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -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
> diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
> index 33013df..3661eb4 100644
> --- a/arch/m68k/Kconfig.cpu
> +++ b/arch/m68k/Kconfig.cpu
> @@ -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
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code
2015-07-08 9:51 ` [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code Yannick GICQUEL
@ 2015-07-08 13:45 ` Greg Ungerer
0 siblings, 0 replies; 21+ messages in thread
From: Greg Ungerer @ 2015-07-08 13:45 UTC (permalink / raw)
To: Yannick GICQUEL, linux-m68k
Hi Yannick,
On 08/07/15 19:51, Yannick GICQUEL wrote:
> This 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.
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
> Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
> ---
> arch/m68k/coldfire/m5441x.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c
> index 98a13cc..5924a21 100644
> --- a/arch/m68k/coldfire/m5441x.c
> +++ b/arch/m68k/coldfire/m5441x.c
> @@ -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();
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space
2015-07-08 9:51 ` [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space Yannick GICQUEL
@ 2015-07-08 13:53 ` Greg Ungerer
2015-07-17 10:47 ` Yannick GICQUEL
0 siblings, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2015-07-08 13:53 UTC (permalink / raw)
To: Yannick GICQUEL, linux-m68k
Hi Yannick,
On 08/07/15 19:51, Yannick GICQUEL wrote:
> 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
> Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
> ---
> arch/m68k/coldfire/head.S | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/arch/m68k/coldfire/head.S b/arch/m68k/coldfire/head.S
> index fa31be2..bf39885 100644
> --- a/arch/m68k/coldfire/head.S
> +++ b/arch/m68k/coldfire/head.S
> @@ -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
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch()
2015-07-08 9:51 ` [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch() Yannick GICQUEL
@ 2015-07-08 14:03 ` Greg Ungerer
0 siblings, 0 replies; 21+ messages in thread
From: Greg Ungerer @ 2015-07-08 14:03 UTC (permalink / raw)
To: Yannick GICQUEL, linux-m68k
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
On 08/07/15 19:51, Yannick GICQUEL wrote:
> This part was ported from setup_no.c
>
> Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
> ---
> arch/m68k/kernel/setup_mm.c | 80 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 80 insertions(+)
>
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index 0bc6f77..94be970 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -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);
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
2015-07-08 9:51 ` [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation Yannick GICQUEL
2015-07-08 13:36 ` Greg Ungerer
@ 2015-07-08 14:03 ` Geert Uytterhoeven
2015-07-08 14:12 ` Greg Ungerer
1 sibling, 1 reply; 21+ messages in thread
From: Geert Uytterhoeven @ 2015-07-08 14:03 UTC (permalink / raw)
To: Yannick GICQUEL; +Cc: Linux/m68k
On Wed, Jul 8, 2015 at 11:51 AM, Yannick GICQUEL
<yannick.gicquel@open.eurogiciel.org> wrote:
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index 2dd8f63..d704c16 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -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...
> select ARCH_WANT_IPC_PARSE_VERSION
> select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
(but we already have examples like the above)
> select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
> diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
> index 33013df..3661eb4 100644
> --- a/arch/m68k/Kconfig.cpu
> +++ b/arch/m68k/Kconfig.cpu
> @@ -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 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU
2015-07-08 9:51 ` [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU Yannick GICQUEL
@ 2015-07-08 14:04 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2015-07-08 14:04 UTC (permalink / raw)
To: Yannick GICQUEL; +Cc: Linux/m68k
On Wed, Jul 8, 2015 at 11:51 AM, Yannick GICQUEL
<yannick.gicquel@open.eurogiciel.org> wrote:
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index 5b8ec4d..0bc6f77 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -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 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 0/8] m5441x: mmu support patchset
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
` (7 preceding siblings ...)
2015-07-08 9:51 ` [RFC 8/8] m68k: uImage generation support Yannick GICQUEL
@ 2015-07-08 14:07 ` Greg Ungerer
2015-07-17 10:30 ` Yannick GICQUEL
8 siblings, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2015-07-08 14:07 UTC (permalink / raw)
To: Yannick GICQUEL, linux-m68k
Hi Yannick,
On 08/07/15 19:51, Yannick GICQUEL wrote:
> Here is a patchset proposal for MMU support on Coldfire 5441x serie.
Nice.
> 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)
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
> 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
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
2015-07-08 14:03 ` Geert Uytterhoeven
@ 2015-07-08 14:12 ` Greg Ungerer
2015-07-08 14:20 ` Geert Uytterhoeven
0 siblings, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2015-07-08 14:12 UTC (permalink / raw)
To: Geert Uytterhoeven, Yannick GICQUEL; +Cc: Linux/m68k
On 09/07/15 00:03, Geert Uytterhoeven wrote:
> On Wed, Jul 8, 2015 at 11:51 AM, Yannick GICQUEL
> <yannick.gicquel@open.eurogiciel.org> wrote:
>> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
>> index 2dd8f63..d704c16 100644
>> --- a/arch/m68k/Kconfig
>> +++ b/arch/m68k/Kconfig
>> @@ -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...
>
>> select ARCH_WANT_IPC_PARSE_VERSION
>> select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
>
> (but we already have examples like the above)
>
>> select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
>> diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
>> index 33013df..3661eb4 100644
>> --- a/arch/m68k/Kconfig.cpu
>> +++ b/arch/m68k/Kconfig.cpu
>> @@ -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
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
2015-07-08 14:12 ` Greg Ungerer
@ 2015-07-08 14:20 ` Geert Uytterhoeven
0 siblings, 0 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2015-07-08 14:20 UTC (permalink / raw)
To: Greg Ungerer; +Cc: Yannick GICQUEL, Linux/m68k
On Wed, Jul 8, 2015 at 4:12 PM, Greg Ungerer <gregungerer@westnet.com.au> wrote:
>>> --- a/arch/m68k/Kconfig.cpu
>>> +++ b/arch/m68k/Kconfig.cpu
>>> @@ -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?
Yep, makes sense.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 0/8] m5441x: mmu support patchset
2015-07-08 14:07 ` [RFC 0/8] m5441x: mmu support patchset Greg Ungerer
@ 2015-07-17 10:30 ` Yannick GICQUEL
0 siblings, 0 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-17 10:30 UTC (permalink / raw)
To: Greg Ungerer, linux-m68k, Geert Uytterhoeven; +Cc: yannick.gicquel
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
Le 08/07/2015 16:07, Greg Ungerer a écrit :
> Hi Yannick,
>
> On 08/07/15 19:51, Yannick GICQUEL wrote:
>> Here is a patchset proposal for MMU support on Coldfire 5441x serie.
>
> Nice.
>
>
>> 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)
>
> 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
>
>
>> 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
>>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation
2015-07-08 13:36 ` Greg Ungerer
@ 2015-07-17 10:46 ` Yannick GICQUEL
0 siblings, 0 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-17 10:46 UTC (permalink / raw)
To: Greg Ungerer, linux-m68k
Hi Greg,
Ok with that.
Source code rework and feature activation are two different things.
Keep it in mind for future...
Regards,
Yannick
Le 08/07/2015 15:36, Greg Ungerer a écrit :
> 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
>
>
> On 08/07/15 19:51, Yannick GICQUEL wrote:
>> m5441x coldfire chips contains a MMU and no FPU.
>> This patch allow building this chip with MMU activated.
>>
>> Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
>> ---
>> arch/m68k/Kconfig | 2 +-
>> arch/m68k/Kconfig.cpu | 4 +++-
>> 2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
>> index 2dd8f63..d704c16 100644
>> --- a/arch/m68k/Kconfig
>> +++ b/arch/m68k/Kconfig
>> @@ -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
>> diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
>> index 33013df..3661eb4 100644
>> --- a/arch/m68k/Kconfig.cpu
>> +++ b/arch/m68k/Kconfig.cpu
>> @@ -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
>>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space
2015-07-08 13:53 ` Greg Ungerer
@ 2015-07-17 10:47 ` Yannick GICQUEL
0 siblings, 0 replies; 21+ messages in thread
From: Yannick GICQUEL @ 2015-07-17 10:47 UTC (permalink / raw)
To: Greg Ungerer, linux-m68k; +Cc: yannick.gicquel
Hi Greg,
Le 08/07/2015 15:53, Greg Ungerer a écrit :
> Hi Yannick,
>
> On 08/07/15 19:51, Yannick GICQUEL wrote:
>> 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.
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.
> Where does CONFIG_SRAM_BASE come 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.
> Regards
> Greg
>
>
>
>> Signed-off-by: Yannick GICQUEL <yannick.gicquel@gmail.com>
>> ---
>> arch/m68k/coldfire/head.S | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/m68k/coldfire/head.S b/arch/m68k/coldfire/head.S
>> index fa31be2..bf39885 100644
>> --- a/arch/m68k/coldfire/head.S
>> +++ b/arch/m68k/coldfire/head.S
>> @@ -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
>>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2015-07-17 10:47 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08 9:51 [RFC 0/8] m5441x: mmu support patchset Yannick GICQUEL
2015-07-08 9:51 ` [RFC 1/8] m68k: coldfire: unlink FPU presence from MMU activation Yannick GICQUEL
2015-07-08 13:36 ` Greg Ungerer
2015-07-17 10:46 ` Yannick GICQUEL
2015-07-08 14:03 ` Geert Uytterhoeven
2015-07-08 14:12 ` Greg Ungerer
2015-07-08 14:20 ` Geert Uytterhoeven
2015-07-08 9:51 ` [RFC 2/8] m68k: fix build issue in setup_arch() when no FPU Yannick GICQUEL
2015-07-08 14:04 ` Geert Uytterhoeven
2015-07-08 9:51 ` [RFC 3/8] m68k: add dummy dump_fpu() when FPU is not present Yannick GICQUEL
2015-07-08 9:51 ` [RFC 4/8] m68k: m5441x: add ColdFire 5441x CPU MMU memory init code Yannick GICQUEL
2015-07-08 13:45 ` Greg Ungerer
2015-07-08 9:51 ` [RFC 5/8] m68k: m5441x: fix ACR0 base address when MBAR is not present Yannick GICQUEL
2015-07-08 9:51 ` [RFC 6/8] m68k: m5441x: set rambar to end of SRAM physical addr space Yannick GICQUEL
2015-07-08 13:53 ` Greg Ungerer
2015-07-17 10:47 ` Yannick GICQUEL
2015-07-08 9:51 ` [RFC 7/8] m68k: mmu: add u-boot command line support in setup_arch() Yannick GICQUEL
2015-07-08 14:03 ` Greg Ungerer
2015-07-08 9:51 ` [RFC 8/8] m68k: uImage generation support Yannick GICQUEL
2015-07-08 14:07 ` [RFC 0/8] m5441x: mmu support patchset Greg Ungerer
2015-07-17 10:30 ` Yannick GICQUEL
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).