* [PATCH 1/3] m68k: move coldfire MMU initialization code
2017-09-08 7:00 [PATCH 0/3] m68k: coldfire MMU fixes Greg Ungerer
@ 2017-09-08 7:00 ` Greg Ungerer
2017-09-08 7:01 ` [PATCH 2/3] m68k: fix ColdFire node shift size calculation Greg Ungerer
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Greg Ungerer @ 2017-09-08 7:00 UTC (permalink / raw)
To: linux-m68k; +Cc: geert, Greg Ungerer
The M54[78]x ColdFire parts are not the only members of the ColdFire family
that have an MMU. But currently some of the early MMU initialization code
is inside the startup code specific to only the ColdFire M54[78]x parts.
Move that early ColdFire MMU init code so that it is run for other ColdFire
parts running with MMU enabled.
Specifically this means that the MMU initialization code will now also be
run for the ColdFire M5441x parts when running with MMU enabled.
The code move meant that the extern definition for the mmu_context_init()
function had to be moved as well. To make it clear that is ColdFire specific
I have renamed that with a "cf_" in front of it and put its extern definition
in the mcfmmu.h (which is already included by the setup code).
Reported-by: Angelo Dureghello <angelo@sysam.it>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/coldfire/m54xx.c | 4 ----
arch/m68k/include/asm/mcfmmu.h | 1 +
arch/m68k/include/asm/mmu_context.h | 1 -
arch/m68k/kernel/setup_mm.c | 2 ++
arch/m68k/mm/mcfmmu.c | 2 +-
5 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/m68k/coldfire/m54xx.c b/arch/m68k/coldfire/m54xx.c
index c552851..704efea 100644
--- a/arch/m68k/coldfire/m54xx.c
+++ b/arch/m68k/coldfire/m54xx.c
@@ -95,10 +95,6 @@ static void mcf54xx_reset(void)
void __init config_BSP(char *commandp, int size)
{
-#ifdef CONFIG_MMU
- cf_bootmem_alloc();
- mmu_context_init();
-#endif
mach_reset = mcf54xx_reset;
mach_sched_init = hw_timer_init;
m54xx_uarts_init();
diff --git a/arch/m68k/include/asm/mcfmmu.h b/arch/m68k/include/asm/mcfmmu.h
index 10f9930..283352a 100644
--- a/arch/m68k/include/asm/mcfmmu.h
+++ b/arch/m68k/include/asm/mcfmmu.h
@@ -106,6 +106,7 @@ static inline void mmu_write(u32 a, u32 v)
}
void cf_bootmem_alloc(void);
+void cf_mmu_context_init(void);
int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word);
#endif
diff --git a/arch/m68k/include/asm/mmu_context.h b/arch/m68k/include/asm/mmu_context.h
index 4a6ae6d..00c28b1 100644
--- a/arch/m68k/include/asm/mmu_context.h
+++ b/arch/m68k/include/asm/mmu_context.h
@@ -91,7 +91,6 @@ static inline void activate_mm(struct mm_struct *active_mm,
#define deactivate_mm(tsk, mm) do { } while (0)
-extern void mmu_context_init(void);
#define prepare_arch_switch(next) load_ksp_mmu(next)
static inline void load_ksp_mmu(struct task_struct *task)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 7a2c212..e79b068 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -343,6 +343,8 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_COLDFIRE
case MACH_M54XX:
case MACH_M5441X:
+ cf_bootmem_alloc();
+ cf_mmu_context_init();
config_BSP(NULL, 0);
break;
#endif
diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
index 87131cd..12fe55b 100644
--- a/arch/m68k/mm/mcfmmu.c
+++ b/arch/m68k/mm/mcfmmu.c
@@ -183,7 +183,7 @@ void __init cf_bootmem_alloc(void)
* Initialize the context management stuff.
* The following was taken from arch/ppc/mmu_context.c
*/
-void __init mmu_context_init(void)
+void __init cf_mmu_context_init(void)
{
/*
* Some processors have too few contexts to reserve one for
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] m68k: fix ColdFire node shift size calculation
2017-09-08 7:00 [PATCH 0/3] m68k: coldfire MMU fixes Greg Ungerer
2017-09-08 7:00 ` [PATCH 1/3] m68k: move coldfire MMU initialization code Greg Ungerer
@ 2017-09-08 7:01 ` Greg Ungerer
2017-09-08 7:01 ` [PATCH 3/3] m68k: allow ColdFire m5441x parts to run with MMU enabled Greg Ungerer
2017-09-08 22:33 ` [PATCH 0/3] m68k: coldfire MMU fixes Angelo Dureghello
3 siblings, 0 replies; 6+ messages in thread
From: Greg Ungerer @ 2017-09-08 7:01 UTC (permalink / raw)
To: linux-m68k; +Cc: geert, Greg Ungerer
The m68k pg_data_table is a fix size array defined in arch/m68k/mm/init.c.
Index numbers within it are defined based on memory size. But for Coldfire
these don't take into account a non-zero physical RAM base address, and this
causes us to access past the end of this array at system start time.
Change the node shift calculation so that we keep the index inside its range.
Reported-by: Angelo Dureghello <angelo@sysam.it>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/mm/mcfmmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
index 12fe55b..61e148e 100644
--- a/arch/m68k/mm/mcfmmu.c
+++ b/arch/m68k/mm/mcfmmu.c
@@ -169,7 +169,7 @@ void __init cf_bootmem_alloc(void)
max_pfn = max_low_pfn = PFN_DOWN(_ramend);
high_memory = (void *)_ramend;
- m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
+ m68k_virt_to_node_shift = fls(_ramend - 1) - 6;
module_fixup(NULL, __start_fixup, __stop_fixup);
/* setup bootmem data */
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] m68k: allow ColdFire m5441x parts to run with MMU enabled
2017-09-08 7:00 [PATCH 0/3] m68k: coldfire MMU fixes Greg Ungerer
2017-09-08 7:00 ` [PATCH 1/3] m68k: move coldfire MMU initialization code Greg Ungerer
2017-09-08 7:01 ` [PATCH 2/3] m68k: fix ColdFire node shift size calculation Greg Ungerer
@ 2017-09-08 7:01 ` Greg Ungerer
2017-09-08 22:33 ` [PATCH 0/3] m68k: coldfire MMU fixes Angelo Dureghello
3 siblings, 0 replies; 6+ messages in thread
From: Greg Ungerer @ 2017-09-08 7:01 UTC (permalink / raw)
To: linux-m68k; +Cc: geert, Greg Ungerer
The Freescale ColdFire M5441x system-on-chip parts have full paged MMU
hardware support. So far though we have only allowed them to be
configured for use in non-MMU mode.
All required kernel changes to support operation of the M5441x parts
with MMU enabled have been pushed into the kernel, so now we can allow
it to be configured and used with the MMU enabled.
I don't actually have any M5441x based hardware so I can't do any real
testing on this. The changes up to now were based on Yannick Gicquel
initial patches to support this. Is anybody out there able to test
this properly? I won't push this any further until we have some
confirmation that it all works as expected.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/Kconfig.cpu | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index d2219f30..4dc51c0 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -283,7 +283,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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] m68k: coldfire MMU fixes
2017-09-08 7:00 [PATCH 0/3] m68k: coldfire MMU fixes Greg Ungerer
` (2 preceding siblings ...)
2017-09-08 7:01 ` [PATCH 3/3] m68k: allow ColdFire m5441x parts to run with MMU enabled Greg Ungerer
@ 2017-09-08 22:33 ` Angelo Dureghello
2017-09-11 3:08 ` Greg Ungerer
3 siblings, 1 reply; 6+ messages in thread
From: Angelo Dureghello @ 2017-09-08 22:33 UTC (permalink / raw)
To: Greg Ungerer, linux-m68k; +Cc: geert
Dear Greg,
On 08/09/2017 09:00, Greg Ungerer wrote:
> The following patch series fixes some issues with the initialization phase
> of the ColdFire MMU system startup. With these fixes applied we can also
> enable and run the ColdFire 5441x family of parts with their MMU enabled.
>
> arch/m68k/Kconfig.cpu | 2 +-
> arch/m68k/coldfire/m54xx.c | 4 ----
> arch/m68k/include/asm/mcfmmu.h | 1 +
> arch/m68k/include/asm/mmu_context.h | 1 -
> arch/m68k/kernel/setup_mm.c | 2 ++
> arch/m68k/mm/mcfmmu.c | 4 ++--
> 6 files changed, 6 insertions(+), 8 deletions(-)
>
I just applied this patchset to fresh master and re-verified that enabling
MMU works on my mcf54415 based board.
Tested-by: Angelo Dureghello <angelo@sysam.it>
Regards,
Angelo Dureghello
> --
> 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] 6+ messages in thread* Re: [PATCH 0/3] m68k: coldfire MMU fixes
2017-09-08 22:33 ` [PATCH 0/3] m68k: coldfire MMU fixes Angelo Dureghello
@ 2017-09-11 3:08 ` Greg Ungerer
0 siblings, 0 replies; 6+ messages in thread
From: Greg Ungerer @ 2017-09-11 3:08 UTC (permalink / raw)
To: Angelo Dureghello, linux-m68k; +Cc: geert
Hi Angelo,
On 09/09/17 08:33, Angelo Dureghello wrote:
> Dear Greg,
>
> On 08/09/2017 09:00, Greg Ungerer wrote:
>> The following patch series fixes some issues with the initialization phase
>> of the ColdFire MMU system startup. With these fixes applied we can also
>> enable and run the ColdFire 5441x family of parts with their MMU enabled.
>>
>> arch/m68k/Kconfig.cpu | 2 +-
>> arch/m68k/coldfire/m54xx.c | 4 ----
>> arch/m68k/include/asm/mcfmmu.h | 1 +
>> arch/m68k/include/asm/mmu_context.h | 1 -
>> arch/m68k/kernel/setup_mm.c | 2 ++
>> arch/m68k/mm/mcfmmu.c | 4 ++--
>> 6 files changed, 6 insertions(+), 8 deletions(-)
>>
>
> I just applied this patchset to fresh master and re-verified that enabling
> MMU works on my mcf54415 based board.
>
> Tested-by: Angelo Dureghello <angelo@sysam.it>
Thats great, thanks Angelo. I will add your tested-by tags to the commits.
Regards
Greg
^ permalink raw reply [flat|nested] 6+ messages in thread