m68k: ColdFire MMU support
Subsystems (5)
v4 cover m68k: ColdFire MMU support
Hi All,
This is version 4 of a patch set that adds support for running the V4e ColdFire cores with their MMU enabled. Just more little cleanups over version 3. Changes include:
. rebased onto 3.2-rc6
. modified ioremap bit changes
. properly "extern"ed the _ram_* variables
. cleaned up include list in mcfmmu.c
. cleaned up the ZONE_* memory setup
. some checkpatch cleanups
This patch set is based on 3.2-rc6 with all the recent patches I have sent here applied first. It is available as a git tree for easier testing, just pull this tree, with the cfmmu branch:
git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git cfmmu
I have pulled these changes into the for-next branch on this tree too. So they will get some linux-next testing from now on as well.
All m68k defconfigs compile. Run tested on FireBee/5475, M5208EVB and under AranyM.
Regards
Greg
PATCH v4 1/35 m68k: add machine and CPU definitions for ColdFire cores
From: Greg Ungerer <[email protected]>
Create machine and CPU definitions to support the ColdFire CPU family members that have a virtual memory management unit.
The ColdFire V4e core contains an MMU, and it is quite different to any other 68k family members.
--- arch/m68k/include/asm/setup.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
arch/m68k/include/asm/setup.h +14 -0
@@ -40,6 +40,7 @@#define MACH_HP300 9#define MACH_Q40 10#define MACH_SUN3X 11 +#define MACH_M54XX 12#define COMMAND_LINE_SIZE 256
@@ -211,23 +212,27 @@ extern unsigned long m68k_machtype;#define CPUB_68030 1#define CPUB_68040 2#define CPUB_68060 3 +#define CPUB_COLDFIRE 4#define CPU_68020 (1<<CPUB_68020)#define CPU_68030 (1<<CPUB_68030)#define CPU_68040 (1<<CPUB_68040)#define CPU_68060 (1<<CPUB_68060) +#define CPU_COLDFIRE (1<<CPUB_COLDFIRE)#define FPUB_68881 0#define FPUB_68882 1#define FPUB_68040 2/* Internal FPU */ #define FPUB_68060 3/* Internal FPU */ #define FPUB_SUNFPA 4/* Sun-3 FPA */ +#define FPUB_COLDFIRE 5/* ColdFire FPU */ #define FPU_68881 (1<<FPUB_68881)#define FPU_68882 (1<<FPUB_68882)#define FPU_68040 (1<<FPUB_68040)#define FPU_68060 (1<<FPUB_68060)#define FPU_SUNFPA (1<<FPUB_SUNFPA) +#define FPU_COLDFIRE (1<<FPUB_COLDFIRE)#define MMUB_68851 0#define MMUB_68030 1/* Internal MMU */
@@ -235,6 +240,7 @@ extern unsigned long m68k_machtype;#define MMUB_68060 3/* Internal MMU */ #define MMUB_APOLLO 4/* Custom Apollo */ #define MMUB_SUN3 5/* Custom Sun-3 */ +#define MMUB_COLDFIRE 6/* Internal MMU */ #define MMU_68851 (1<<MMUB_68851)#define MMU_68030 (1<<MMUB_68030)
@@ -242,6 +248,7 @@ extern unsigned long m68k_machtype;#define MMU_68060 (1<<MMUB_68060)#define MMU_SUN3 (1<<MMUB_SUN3)#define MMU_APOLLO (1<<MMUB_APOLLO) +#define MMU_COLDFIRE (1<<MMUB_COLDFIRE)#ifdef __KERNEL__
@@ -341,6 +348,13 @@ extern int m68k_is040or060;# endif #endif +#if !defined(CONFIG_COLDFIRE ) +# define CPU_IS_COLDFIRE (0) +#else +# define CPU_IS_COLDFIRE (1) +# define MMU_IS_COLDFIRE (1) +#endif +#define CPU_TYPE (m68k_cputype)#ifdef CONFIG_M68KFPU_EMU
Signature · 1 line
1.7.0.4
PATCH v4 2/35 m68k: show ColdFire CPU/FPU/MMU type
In reply to [email protected]From: Greg Ungerer <[email protected]>
Update the show_cpuinfo() code to display info about ColdFire cores.
--- arch/m68k/kernel/setup_mm.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/m68k/kernel/setup_mm.c +8 -0
@@ -388,6 +388,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)#define LOOP_CYCLES_68030 (8)#define LOOP_CYCLES_68040 (3)#define LOOP_CYCLES_68060 (1) +#define LOOP_CYCLES_COLDFIRE (2)if (CPU_IS_020 ) { cpu ="68020" ;
@@ -401,6 +402,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) }else if (CPU_IS_060 ) { cpu ="68060" ; clockfactor =LOOP_CYCLES_68060 ; + }else if (CPU_IS_COLDFIRE ) { + cpu ="ColdFire" ; + clockfactor =LOOP_CYCLES_COLDFIRE ; }else { cpu ="680x0" ; clockfactor =0 ;
@@ -419,6 +423,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) fpu ="68060" ; else if (m68k_fputype & FPU_SUNFPA) fpu ="Sun FPA" ; + else if (m68k_fputype & FPU_COLDFIRE) + fpu ="ColdFire" ; else fpu ="none" ;#endif
@@ -435,6 +441,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) mmu ="Sun-3" ; else if (m68k_mmutype & MMU_APOLLO) mmu ="Apollo" ; + else if (m68k_mmutype & MMU_COLDFIRE) + mmu ="ColdFire" ; else mmu ="unknown" ;
Signature · 1 line
1.7.0.4
PATCH v4 3/35 m68k: definitions for the ColdFire V4e MMU hardware
In reply to [email protected]From: Greg Ungerer <[email protected]>
Basic register level definitions to support the internal MMU of the V4e ColdFire cores.
--- arch/m68k/include/asm/mcfmmu.h | 110 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 110 insertions(+), 0 deletions(-) create mode 100644 arch/m68k/include/asm/mcfmmu.h
arch/m68k/include/asm/mcfmmu.h new file +110 -0
@@ -0,0 +1,110 @@ +/* +* mcfmmu.h -- definitions for the ColdFire v4e MMU +* +* (C) Copyright 2011, Greg Ungerer <[email protected]> +* +* 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. +*/ + +#ifndef MCFMMU_H +#define MCFMMU_H + +/* +* The MMU support registers are mapped into the address space using +* the processor MMUBASE register. We used a fixed address for mapping, +* there doesn't seem any need to make this configurable yet. +*/ +#define MMUBASE 0xfe000000 + +/* +* The support registers of the MMU. Names are the sames as those +* used in the Freescale v4e documentation. +*/ +#define MMUCR (MMUBASE + 0x00)/* Control register */ +#define MMUOR (MMUBASE + 0x04)/* Operation register */ +#define MMUSR (MMUBASE + 0x08)/* Status register */ +#define MMUAR (MMUBASE + 0x10)/* TLB Address register */ +#define MMUTR (MMUBASE + 0x14)/* TLB Tag register */ +#define MMUDR (MMUBASE + 0x18)/* TLB Data register */ + +/* +* MMU Control register bit flags +*/ +#define MMUCR_EN 0x00000001/* Virtual mode enable */ +#define MMUCR_ASM 0x00000002/* Address space mode */ + +/* +* MMU Operation register. +*/ +#define MMUOR_UAA 0x00000001/* Update allocatiom address */ +#define MMUOR_ACC 0x00000002/* TLB access */ +#define MMUOR_RD 0x00000004/* TLB access read */ +#define MMUOR_WR 0x00000000/* TLB access write */ +#define MMUOR_ADR 0x00000008/* TLB address select */ +#define MMUOR_ITLB 0x00000010/* ITLB operation */ +#define MMUOR_CAS 0x00000020/* Clear non-locked ASID TLBs */ +#define MMUOR_CNL 0x00000040/* Clear non-locked TLBs */ +#define MMUOR_CA 0x00000080/* Clear all TLBs */ +#define MMUOR_STLB 0x00000100/* Search TLBs */ +#define MMUOR_AAN 16/* TLB allocation address */ +#define MMUOR_AAMASK 0xffff0000/* AA mask */ + +/* +* MMU Status register. +*/ +#define MMUSR_HIT 0x00000002/* Search TLB hit */ +#define MMUSR_WF 0x00000008/* Write access fault */ +#define MMUSR_RF 0x00000010/* Read access fault */ +#define MMUSR_SPF 0x00000020/* Supervisor protect fault */ + +/* +* MMU Read/Write Tag register. +*/ +#define MMUTR_V 0x00000001/* Valid */ +#define MMUTR_SG 0x00000002/* Shared global */ +#define MMUTR_IDN 2/* Address Space ID */ +#define MMUTR_IDMASK 0x000003fc/* ASID mask */ +#define MMUTR_VAN 10/* Virtual Address */ +#define MMUTR_VAMASK 0xfffffc00/* VA mask */ + +/* +* MMU Read/Write Data register. +*/ +#define MMUDR_LK 0x00000002/* Lock entry */ +#define MMUDR_X 0x00000004/* Execute access enable */ +#define MMUDR_W 0x00000008/* Write access enable */ +#define MMUDR_R 0x00000010/* Read access enable */ +#define MMUDR_SP 0x00000020/* Supervisor access enable */ +#define MMUDR_CM_CWT 0x00000000/* Cachable write thru */ +#define MMUDR_CM_CCB 0x00000040/* Cachable copy back */ +#define MMUDR_CM_NCP 0x00000080/* Non-cachable precise */ +#define MMUDR_CM_NCI 0x000000c0/* Non-cachable imprecise */ +#define MMUDR_SZ_1MB 0x00000000/* 1MB page size */ +#define MMUDR_SZ_4KB 0x00000100/* 4kB page size */ +#define MMUDR_SZ_8KB 0x00000200/* 8kB page size */ +#define MMUDR_SZ_1KB 0x00000300/* 1kB page size */ +#define MMUDR_PAN 10/* Physical address */ +#define MMUDR_PAMASK 0xfffffc00/* PA mask */ + +#ifndef __ASSEMBLY__ + +/* +* Simple access functions for the MMU registers. Nothing fancy +* currently required, just simple 32bit access. +*/ +static inline u32 mmu_read (u32 a) +{ +return *((volatile u32 *) a); +} + +static inline void mmu_write (u32 a,u32 v) +{ + *((volatile u32 *) a) = v; + __asm__ __volatile__ ("nop" ); +} + +#endif + +#endif /* MCFMMU_H */
Signature · 1 line
1.7.0.4
PATCH v4 4/35 m68k: make interrupt definitions conditional on correct CPU types
In reply to [email protected]From: Greg Ungerer <[email protected]>
The interrupt handling support defines and code is not so much conditional on an MMU being present (CONFIG_MMU), as it is on which type of CPU we are building for. So make the code conditional on the CPU types instead. The current irq.h is mostly specific to the interrupt code for the 680x0 CPUs, so it should only be used for them.
--- arch/m68k/include/asm/irq.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/m68k/include/asm/irq.h +3 -2
@@ -25,7 +25,8 @@#define NR_IRQS 0#endif -#ifdef CONFIG_MMU +#if defined(CONFIG_M68020 ) || defined(CONFIG_M68030 ) || \ + defined(CONFIG_M68040 ) || defined(CONFIG_M68060 )/* * Interrupt source definitions
@@ -80,7 +81,7 @@ extern unsigned int irq_canonicalize(unsigned int irq);#else #define irq_canonicalize (irq) (irq) -#endif /* CONFIG_MMU */ +#endif /* !(CONFIG_M68020 || CONFIG_M68030 || CONFIG_M68040 || CONFIG_M68060) */ asmlinkage void do_IRQ(int irq, struct pt_regs *regs);extern atomic_t irq_err_count;
Signature · 1 line
1.7.0.4
PATCH v4 5/35 m68k: add TASK definitions for ColdFires running with MMU
In reply to [email protected]From: Greg Ungerer <[email protected]>
Add appropriate TASK_SIZE and TASK_UNMAPPED_BASE definitions for running on ColdFire V4e cores with MMU enabled.
--- arch/m68k/include/asm/processor.h | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-)
arch/m68k/include/asm/processor.h +10 -6
@@ -48,10 +48,12 @@ static inline void wrusp(unsigned long usp)* so don't change it unless you know what you are doing. */ #ifdef CONFIG_MMU -#ifndef CONFIG_SUN3 -#define TASK_SIZE (0xF0000000UL) -#else +#if defined(CONFIG_COLDFIRE ) +#define TASK_SIZE (0xC0000000UL) +#elif defined(CONFIG_SUN3 )#define TASK_SIZE (0x0E000000UL) +#else +#define TASK_SIZE (0xF0000000UL)#endif #else #define TASK_SIZE (0xFFFFFFFFUL)
@@ -66,10 +68,12 @@ static inline void wrusp(unsigned long usp)* space during mmap's. */ #ifdef CONFIG_MMU -#ifndef CONFIG_SUN3 -#define TASK_UNMAPPED_BASE 0xC0000000UL -#else +#if defined(CONFIG_COLDFIRE ) +#define TASK_UNMAPPED_BASE 0x60000000UL +#elif defined(CONFIG_SUN3 )#define TASK_UNMAPPED_BASE 0x0A000000UL +#else +#define TASK_UNMAPPED_BASE 0xC0000000UL#endif #define TASK_UNMAPPED_ALIGN (addr, off) PAGE_ALIGN(addr)#else
Signature · 1 line
1.7.0.4
PATCH v4 6/35 m68k: modify user space access functions to support ColdFire CPUs
In reply to [email protected]From: Greg Ungerer <[email protected]>
Modify the user space access functions to support the ColdFire V4e cores running with MMU enabled.
The ColdFire processors do not support the "moves" instruction used by the traditional 680x0 processors for moving data into and out of another address space. They only support the notion of a single address space, and you use the usual "move" instruction to access that.
Create a new config symbol (CONFIG_CPU_HAS_ADDRESS_SPACES) to mark the CPU types that support separate address spaces, and thus also support the sfc/dfc registers and the "moves" instruction that go along with that.
The code is almost identical for user space access, so lets just use a define to choose either the "move" or "moves" in the assembler code.
--- arch/m68k/Kconfig | 3 ++ arch/m68k/Kconfig.cpu | 4 +++ arch/m68k/include/asm/segment.h | 4 +- arch/m68k/include/asm/uaccess_mm.h | 42 ++++++++++++++++++++++++----------- arch/m68k/lib/uaccess.c | 22 +++++++++--------- 5 files changed, 49 insertions(+), 26 deletions(-)
arch/m68k/Kconfig +3 -0
@@ -66,6 +66,9 @@ config CPU_HAS_NO_BITFIELDS config CPU_HAS_NO_MULDIV64 bool +config CPU_HAS_ADDRESS_SPACES + bool + config HZ int default 1000 if CLEOPATRA
arch/m68k/Kconfig.cpu +4 -0
@@ -38,6 +38,7 @@ config M68020 bool "68020 support" depends on MMU select GENERIC_ATOMIC64 + select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68020 processor, say Y. Otherwise, say N. Note that the 68020 requires a
@@ -48,6 +49,7 @@ config M68030 bool "68030 support" depends on MMU && !MMU_SUN3 select GENERIC_ATOMIC64 + select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68030 processor, say Y. Otherwise, say N. Note that a MC68EC030 will not
@@ -57,6 +59,7 @@ config M68040 bool "68040 support" depends on MMU && !MMU_SUN3 select GENERIC_ATOMIC64 + select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68LC040 or MC68040 processor, say Y. Otherwise, say N. Note that an
@@ -67,6 +70,7 @@ config M68060 bool "68060 support" depends on MMU && !MMU_SUN3 select GENERIC_ATOMIC64 + select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68060 processor, say Y. Otherwise, say N.
arch/m68k/include/asm/segment.h +2 -2
@@ -31,7 +31,7 @@ typedef struct {static inline mm_segment_t get_fs (void ) { -#ifdef CONFIG_MMU +#ifdef CONFIG_CPU_HAS_ADDRESS_SPACES mm_segment_t _v; __asm__ ("movec %/dfc,%0" :"=r" (_v.seg):);
@@ -49,7 +49,7 @@ static inline mm_segment_t get_ds(void)static inline void set_fs (mm_segment_t val) { -#ifdef CONFIG_MMU +#ifdef CONFIG_CPU_HAS_ADDRESS_SPACES __asm__ __volatile__ ("movec %0,%/sfc\n\t" "movec %0,%/dfc\n\t" :/* no outputs */ :"r" (val.seg) :"memory" );
arch/m68k/include/asm/uaccess_mm.h +29 -13
95 lines not on this page · raw message
arch/m68k/lib/uaccess.c +11 -11
@@ -15,17 +15,17 @@ unsigned long __generic_copy_from_user(void *to, const void __user *from, asmvolatile ("\n" " tst.l %0\n" " jeq 2f\n" -"1: moves.l (%1)+,%3\n" +"1: " MOVES ".l (%1)+,%3\n" " move.l %3,(%2)+\n" " subq.l #1,%0\n" " jne 1b\n" "2: btst #1,%5\n" " jeq 4f\n" -"3: moves.w (%1)+,%3\n" +"3: " MOVES ".w (%1)+,%3\n" " move.w %3,(%2)+\n" "4: btst #0,%5\n" " jeq 6f\n" -"5: moves.b (%1)+,%3\n" +"5: " MOVES ".b (%1)+,%3\n" " move.b %3,(%2)+\n" "6:\n" " .section .fixup,\"ax\"\n"
@@ -68,17 +68,17 @@ unsigned long __generic_copy_to_user(void __user *to, const void *from," tst.l %0\n" " jeq 4f\n" "1: move.l (%1)+,%3\n" -"2: moves.l %3,(%2)+\n" +"2: " MOVES ".l %3,(%2)+\n" "3: subq.l #1,%0\n" " jne 1b\n" "4: btst #1,%5\n" " jeq 6f\n" " move.w (%1)+,%3\n" -"5: moves.w %3,(%2)+\n" +"5: " MOVES ".w %3,(%2)+\n" "6: btst #0,%5\n" " jeq 8f\n" " move.b (%1)+,%3\n" -"7: moves.b %3,(%2)+\n" +"7: " MOVES ".b %3,(%2)+\n" "8:\n" " .section .fixup,\"ax\"\n" " .even\n"
@@ -115,7 +115,7 @@ long strncpy_from_user(char *dst, const char __user *src, long count)return count; asmvolatile ("\n" -"1: moves.b (%2)+,%4\n" +"1: " MOVES ".b (%2)+,%4\n" " move.b %4,(%1)+\n" " jeq 2f\n" " subq.l #1,%3\n"
@@ -152,7 +152,7 @@ long strnlen_user(const char __user *src, long n) asmvolatile ("\n" "1: subq.l #1,%1\n" " jmi 3f\n" -"2: moves.b (%0)+,%2\n" +"2: " MOVES ".b (%0)+,%2\n" " tst.b %2\n" " jne 1b\n" " jra 4f\n"
@@ -188,15 +188,15 @@ unsigned long __clear_user(void __user *to, unsigned long n) asmvolatile ("\n" " tst.l %0\n" " jeq 3f\n" -"1: moves.l %2,(%1)+\n" +"1: " MOVES ".l %2,(%1)+\n" "2: subq.l #1,%0\n" " jne 1b\n" "3: btst #1,%4\n" " jeq 5f\n" -"4: moves.w %2,(%1)+\n" +"4: " MOVES ".w %2,(%1)+\n" "5: btst #0,%4\n" " jeq 7f\n" -"6: moves.b %2,(%1)\n" +"6: " MOVES ".b %2,(%1)\n" "7:\n" " .section .fixup,\"ax\"\n" " .even\n"
Signature · 1 line
1.7.0.4
Re: [PATCH 06/35] m68k: modify user space access functions to support ColdFire CPUs
Quoted 14 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
Modify the user space access functions to support the ColdFire V4e cores running with MMU enabled.
The ColdFire processors do not support the "moves" instruction used by the traditional 680x0 processors for moving data into and out of another address space. They only support the notion of a single address space, and you use the usual "move" instruction to access that.
Create a new config symbol (
CONFIG_CPU_HAS_ADDRESS_SPACES) to mark the CPU types that support separate address spaces, and thus also support the sfc/dfc registers and the "moves" instruction that go along with that.
Quoted 6 lines
The code is almost identical for user space access, so lets just use a define to choose either the "move" or "moves" in the assembler code.
Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>
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
PATCH v4 7/35 m68k: use addr_limit checking for m68k CPUs that do no support address spaces
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire CPU family, and the original 68000, do not support separate address spaces like the other 680x0 CPU types. Modify the set_fs()/get_fs() functions and macros to use a thread_info addr_limit for address space checking. This is pretty much what all other architectures that do not support separate setable address spaces do.
--- arch/m68k/include/asm/segment.h | 30 ++++++++++++++++-------------- arch/m68k/include/asm/thread_info.h | 3 +++ 2 files changed, 19 insertions(+), 14 deletions(-)
arch/m68k/include/asm/segment.h +16 -14
@@ -22,23 +22,26 @@ typedef struct { } mm_segment_t;#define MAKE_MM_SEG (s) ((mm_segment_t) { (s) }) -#define USER_DS MAKE_MM_SEG(__USER_DS) -#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS) +#ifdef CONFIG_CPU_HAS_ADDRESS_SPACES /* * Get/set the SFC/DFC registers for MOVES instructions */ +#define USER_DS MAKE_MM_SEG(__USER_DS) +#define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS)static inline mm_segment_t get_fs (void ) { -#ifdef CONFIG_CPU_HAS_ADDRESS_SPACES mm_segment_t _v; __asm__ ("movec %/dfc,%0" :"=r" (_v.seg):); -return _v; -#else -return USER_DS ; -#endif +} + +static inline void set_fs (mm_segment_t val) +{ + __asm__ __volatile__ ("movec %0,%/sfc\n\t" +"movec %0,%/dfc\n\t" + :/* no outputs */ :"r" (val.seg) :"memory" ); }static inline mm_segment_t get_ds (void )
@@ -47,14 +50,13 @@ static inline mm_segment_t get_ds(void) return KERNEL_DS; } -static inline void set_fs (mm_segment_t val) -{ -#ifdef CONFIG_CPU_HAS_ADDRESS_SPACES - __asm__ __volatile__ ("movec %0,%/sfc\n\t" -"movec %0,%/dfc\n\t" - :/* no outputs */ :"r" (val.seg) :"memory" ); +#else +#define USER_DS MAKE_MM_SEG(TASK_SIZE) +#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) +#define get_ds () (KERNEL_DS) +#define get_fs () (current_thread_info()->addr_limit) +#define set_fs (x) (current_thread_info()->addr_limit = (x))#endif -}#define segment_eq (a,b) ((a).seg == (b).seg)
arch/m68k/include/asm/thread_info.h +3 -0
@@ -3,6 +3,7 @@#include <asm/types.h> #include <asm/page.h> +#include <asm/segment.h> /* * On machines with 4k pages we default to an 8k thread size, though we
@@ -26,6 +27,7 @@ struct thread_info {struct task_struct *task;/* main task structure */ unsigned long flags;struct exec_domain *exec_domain;/* execution domain */ +mm_segment_t addr_limit;/* thread address space */ int preempt_count;/* 0 => preemptable, <0 => BUG */ __u32 cpu;/* should always be 0 on m68k */ unsigned long tp_value;/* thread pointer */
@@ -39,6 +41,7 @@ struct thread_info { { \ .task = &tsk, \ .exec_domain = &default_exec_domain, \ + .addr_limit = KERNEL_DS, \ .preempt_count = INIT_PREEMPT_COUNT, \ .restart_block = { \ .fn = do_no_restart_syscall, \
Signature · 1 line
1.7.0.4
Geert Uytterhoeven
maintainerRe: [PATCH 07/35] m68k: use addr_limit checking for m68k CPUs that do no support address spaces
Quoted 26 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
The ColdFire CPU family, and the original 68000, do not support separate address spaces like the other 680x0 CPU types. Modify the set_fs()/get_fs() functions and macros to use a
thread_infoaddr_limitfor address space checking. This is pretty much what all other architectures that do not support separate setable address spaces do.Signed-off-by Alexander Stein <[email protected]>Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>arch/m68k/include/asm/thread_info.h +1
-0@@ -3,6 +3,7 @@ #include <asm/types.h> #include <asm/page.h> +#include <asm/segment.h> /** On machines with 4k pages we default to an 8k thread size, though we @@ -26,6 +27,7 @@ struct thread_info {
Quoted 4 lines
struct
task_struct*task; /* main task structure */ unsigned long flags;
structexec_domain*exec_domain; /* execution domain */
+mm_segment_taddr_limit; /* thread address space */
Shouldn't the above be protected by #ifndef CONFIG_CPU_HAS_ADDRESS_SPACES?
arch/m68k/include/asm/thread_info.h struct thread_info { · line 44
Quoted 8 lines
int
preempt_count; /* 0 => preemptable, <0 => BUG */__u32cpu; /* should always be 0 on m68k */ unsigned longtp_value; /* thread pointer */arch/m68k/include/asm/thread_info.h +1
-0@@ -39,6 +41,7 @@ struct thread_info { { \ .task = &tsk, \ .exec_domain = &default_exec_domain, \ + .addr_limit = KERNEL_DS, \
Same here
arch/m68k/include/asm/thread_info.h struct thread_info { · line 47
Quoted 3 lines
arch/m68k/include/asm/thread_info.h +0
-0.preempt_count = INIT_PREEMPT_COUNT, \ .restart_block = { \ .fn = do_no_restart_syscall, \
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: [PATCH 07/35] m68k: use addr_limit checking for m68k CPUs that do no support address spaces
Hi Geert,
Quoted 24 lines · Geert Uytterhoeven
Quoted 23 lines · On Fri, Dec 23, 2011 at 04:15,<[email protected]> wrote:
From: Greg Ungerer<[email protected]>
The ColdFire CPU family, and the original 68000, do not support separate address spaces like the other 680x0 CPU types. Modify the set_fs()/get_fs() functions and macros to use a
thread_infoaddr_limitfor address space checking. This is pretty much what all other architectures that do not support separate setable address spaces do.Signed-off-by Alexander Stein<[email protected]>Signed-off-by Greg Ungerer<[email protected]>Acked-by Matt Waddel<[email protected]>Acked-by Kurt Mahan<[email protected]>arch/m68k/include/asm/thread_info.h +1
-0@@ -3,6 +3,7 @@#include <asm/types.h> #include <asm/page.h> +#include <asm/segment.h>
Quoted 9 lines
arch/m68k/include/asm/thread_info.h struct thread_info { · line 30
Quoted 7 lines
arch/m68k/include/asm/thread_info.h +1
-0/* * On machines with 4k pages we default to an 8k thread size, though we @@ -26,6 +27,7 @@ struct thread_info {struct task_struct *task;/* main task structure */ unsigned long flags;struct exec_domain *exec_domain;/* execution domain */ +mm_segment_t addr_limit;/* thread address space */ Shouldn't the above be protected by #ifndef
CONFIG_CPU_HAS_ADDRESS_SPACES?
It could be. For the sake of not uglying the code with any more "ifdef"s I left it in for all cases. Would you prefer it be conditional?
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close, FAX: +61 7 3891 3630 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
PATCH v4 8/35 m68k: init the MMU hardware for the 54xx ColdFire
In reply to [email protected]From: Greg Ungerer <[email protected]>
The 54xx ColdFire CPU family has an internal MMU. Up to now though we have only supported running on them with the MMU disabled.
Add code to the 54xx ColdFire init sequence to initialize the bootmem used by the usual MMU m68k code for paging init.
--- arch/m68k/platform/coldfire/head.S | 47 +++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-)
arch/m68k/platform/coldfire/head.S +46 -1
@@ -3,7 +3,7 @@ /* * head.S -- common startup code for ColdFire CPUs. * - * (C) Copyright 1999-2010, Greg Ungerer <[email protected]>. + * (C) Copyright 1999-2011, Greg Ungerer <[email protected]>. */ /*****************************************************************************/
@@ -13,6 +13,7 @@ #include <asm/asm-offsets.h> #include <asm/coldfire.h> #include <asm/mcfsim.h> +#include <asm/mcfmmu.h> #include <asm/thread_info.h> /*****************************************************************************/
@@ -135,6 +136,14 @@ _init_sp: __HEAD +#ifdef CONFIG_MMU +_start0: + jmp _start +.global kernel_pg_dir +.equ kernel_pg_dir,_start0 +.equ .,_start0+0x1000 +#endif + /* * This is the codes first entry point. This is where it all * begins...
@@ -197,6 +206,26 @@ _start: movec %d0,%CACR nop +#ifdef CONFIG_MMU + /* + * Identity mapping for the kernel region. + */ + movel #(MMUBASE+1),%d0 /* enable MMUBAR registers */ + movec %d0,%MMUBAR + movel #MMUOR_CA,%d0 /* clear TLB entries */ + movel %d0,MMUOR + movel #0,%d0 /* set ASID to 0 */ + movec %d0,%asid + + movel #MMUCR_EN,%d0 /* Enable the identity map */ + movel %d0,MMUCR + nop /* sync i-pipeline */ + + movel #_vstart,%a0 /* jump to "virtual" space */ + jmp %a0@ +_vstart: +#endif /* CONFIG_MMU */ + #ifdef CONFIG_ROMFS_FS /* * Move ROM filesystem above bss :-)
@@ -242,6 +271,22 @@ _clear_bss: lea init_thread_union,%a0 lea THREAD_SIZE(%a0),%sp +#ifdef CONFIG_MMU +.global m68k_cputype +.global m68k_mmutype +.global m68k_fputype +.global m68k_machtype + movel #CPU_COLDFIRE,%d0 + movel %d0,m68k_cputype /* Mark us as a ColdFire */ + movel #MMU_COLDFIRE,%d0 + movel %d0,m68k_mmutype + movel #FPU_COLDFIRE,%d0 + movel %d0,m68k_fputype + movel #MACH_M54XX,%d0 + movel %d0,m68k_machtype /* Mark us as a 54xx machine */ + lea init_task,%a2 /* Set "current" init task */ +#endif + /* * Assember start up done, start code proper. */
Signature · 1 line
1.7.0.4
PATCH v4 9/35 m68k: add ColdFire 54xx CPU MMU memory init code
In reply to [email protected]From: Greg Ungerer <[email protected]>
Add code to the 54xx ColdFire CPU init to setup memory ready for the m68k paged memory start up.
Some of the RAM variables that were specific to the non-mmu code paths now need to be used during this setup, so when CONFIG_MMU is enabled. Move these out of page_no.h and into page.h.
--- arch/m68k/include/asm/page.h | 4 +++ arch/m68k/include/asm/page_no.h | 3 -- arch/m68k/platform/54xx/config.c | 47 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-)
arch/m68k/include/asm/page.h +4 -0
@@ -36,6 +36,10 @@ typedef struct page *pgtable_t;#define __pgd (x) ((pgd_t) { (x) } )#define __pgprot (x) ((pgprot_t) { (x) } ) +extern unsigned long _rambase; +extern unsigned long _ramstart; +extern unsigned long _ramend; +#endif /* !__ASSEMBLY__ */ #ifdef CONFIG_MMU
arch/m68k/include/asm/page_no.h +0 -3
@@ -5,9 +5,6 @@extern unsigned long memory_start;extern unsigned long memory_end; -extern unsigned long _rambase; -extern unsigned long _ramstart; -extern unsigned long _ramend;#define get_user_page (vaddr) __get_free_page(GFP_KERNEL)#define free_user_page (page, addr) free_page(addr)
arch/m68k/platform/54xx/config.c +47 -0
66 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH 09/35] m68k: add ColdFire 54xx CPU MMU memory init code
Quoted 5 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
Add code to the 54xx ColdFire CPU init to setup memory ready for the m68k paged memory start up.
Quoted 7 lines
Some of the RAM variables that were specific to the non-mmu code paths now need to be used during this setup, so when
CONFIG_MMUis enabled. Move these out ofpage_no.hand intopage.h.Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>
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
PATCH v4 10/35 m68k: set register a2 to current if MMU enabled on ColdFire
In reply to [email protected]From: Greg Ungerer <[email protected]>
Virtual memory m68k systems build with register a2 dedicated to being the current proc pointer (non-MMU don't do this). Add code to the ColdFire interrupt and exception processing to set this on entry, and at context switch time. We use the same GET_CURRENT() macro that MMU enabled code uses - modifying it so that the assembler is ColdFire clean.
--- arch/m68k/include/asm/entry.h | 10 +++++++++- arch/m68k/kernel/entry_no.S | 3 +++ arch/m68k/platform/coldfire/entry.S | 6 +++++- 3 files changed, 17 insertions(+), 2 deletions(-)
arch/m68k/include/asm/entry.h +9 -1
@@ -222,16 +222,24 @@* Non-MMU systems do not reserve %a2 in this way, and this definition is * not used for them. */ +#ifdef CONFIG_MMU +#define curptr a2#define GET_CURRENT (tmp) get_current tmp .macro get_current reg=%d0 movel %sp,\reg - andw #-THREAD_SIZE,\reg + andl #-THREAD_SIZE,\reg movel \reg,%curptr movel %curptr@,%curptr .endm +#else + +#define GET_CURRENT (tmp) + +#endif /* CONFIG_MMU */ +#else /* C source */ #define STR (X ) STR1(X)
arch/m68k/kernel/entry_no.S +3 -0
@@ -44,6 +44,7 @@ ENTRY(buserr) SAVE_ALL_INT + GET_CURRENT(%d0) movel %sp,%sp@- /* stack frame pointer argument */ jsr buserr_c addql #4,%sp
@@ -51,6 +52,7 @@ ENTRY(buserr) ENTRY(trap) SAVE_ALL_INT + GET_CURRENT(%d0) movel %sp,%sp@- /* stack frame pointer argument */ jsr trap_c addql #4,%sp
@@ -61,6 +63,7 @@ ENTRY(trap) .globl dbginterrupt ENTRY(dbginterrupt) SAVE_ALL_INT + GET_CURRENT(%d0) movel %sp,%sp@- /* stack frame pointer argument */ jsr dbginterrupt_c addql #4,%sp
arch/m68k/platform/coldfire/entry.S +5 -1
@@ -62,6 +62,7 @@ enosys: ENTRY(system_call) SAVE_ALL_SYS move #0x2000,%sr /* enable intrs again */ + GET_CURRENT(%d2) cmpl #NR_syscalls,%d0 jcc enosys
@@ -165,6 +166,7 @@ Lsignal_return: */ ENTRY(inthandler) SAVE_ALL_INT + GET_CURRENT(%d2) movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */ andl #0x03fc,%d0 /* mask out vector only */
@@ -190,7 +192,9 @@ ENTRY(resume) movel %sp,%a0@(TASK_THREAD+THREAD_KSP) /* save kernel stack pointer */ RDUSP /* movel %usp,%a3 */ movel %a3,%a0@(TASK_THREAD+THREAD_USP) /* save thread user stack */ - +#ifdef CONFIG_MMU + movel %a1,%a2 /* set new current */ +#endif movel %a1@(TASK_THREAD+THREAD_USP),%a3 /* restore thread user stack */ WRUSP /* movel %a3,%usp */ movel %a1@(TASK_THREAD+THREAD_KSP),%sp /* restore new kernel stack */
Signature · 1 line
1.7.0.4
Re: [PATCH 10/35] m68k: set register a2 to current if MMU enabled on ColdFire
Quoted 11 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
Virtual memory m68k systems build with register a2 dedicated to being the current proc pointer (non-MMU don't do this). Add code to the ColdFire interrupt and exception processing to set this on entry, and at context switch time. We use the same
GET_CURRENT()macro that MMU enabled code uses - modifying it so that the assembler is ColdFire clean.Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>
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
PATCH v4 11/35 m68k: page table support definitions and code for ColdFire MMU
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire V4e MMU is nothing like any of the other m68k MMU's. So we need to create a set of definitions and support routines for the kernels paging functions.
This is largely taken from Freescales BSP code for this (though it was a 2.6.25 kernel). I have cleaned it up alot from the original.
--- arch/m68k/include/asm/mcf_pgtable.h | 425 +++++++++++++++++++++++++++++++++++ 1 files changed, 425 insertions(+), 0 deletions(-) create mode 100644 arch/m68k/include/asm/mcf_pgtable.h
arch/m68k/include/asm/mcf_pgtable.h new file +425 -0
@@ -0,0 +1,425 @@ +#ifndef _MCF_PGTABLE_H +#define _MCF_PGTABLE_H + +#include <asm/mcfmmu.h> +#include <asm/page.h> + +/* +* MMUDR bits, in proper place. We write these directly into the MMUDR +* after masking from the pte. +*/ +#define CF_PAGE_LOCKED MMUDR_LK/* 0x00000002 */ +#define CF_PAGE_EXEC MMUDR_X/* 0x00000004 */ +#define CF_PAGE_WRITABLE MMUDR_W/* 0x00000008 */ +#define CF_PAGE_READABLE MMUDR_R/* 0x00000010 */ +#define CF_PAGE_SYSTEM MMUDR_SP/* 0x00000020 */ +#define CF_PAGE_COPYBACK MMUDR_CM_CCB/* 0x00000040 */ +#define CF_PAGE_NOCACHE MMUDR_CM_NCP/* 0x00000080 */ + +#define CF_CACHEMASK (~MMUDR_CM_CCB) +#define CF_PAGE_MMUDR_MASK 0x000000fe + +#define _PAGE_NOCACHE030 CF_PAGE_NOCACHE + +/* +* MMUTR bits, need shifting down. +*/ +#define CF_PAGE_MMUTR_MASK 0x00000c00 +#define CF_PAGE_MMUTR_SHIFT 10 + +#define CF_PAGE_VALID (MMUTR_V << CF_PAGE_MMUTR_SHIFT) +#define CF_PAGE_SHARED (MMUTR_SG << CF_PAGE_MMUTR_SHIFT) + +/* +* Fake bits, not implemented in CF, will get masked out before +* hitting hardware. +*/ +#define CF_PAGE_DIRTY 0x00000001 +#define CF_PAGE_FILE 0x00000200 +#define CF_PAGE_ACCESSED 0x00001000 + +#define _PAGE_CACHE040 0x020/* 68040 cache mode, cachable, copyback */ +#define _PAGE_NOCACHE_S 0x040/* 68040 no-cache mode, serialized */ +#define _PAGE_NOCACHE 0x060/* 68040 cache mode, non-serialized */ +#define _PAGE_CACHE040W 0x000/* 68040 cache mode, cachable, write-through */ +#define _DESCTYPE_MASK 0x003 +#define _CACHEMASK040 (~0x060) +#define _PAGE_GLOBAL040 0x400/* 68040 global bit, used for kva descs */ + +/* +* Externally used page protection values. +*/ +#define _PAGE_PRESENT (CF_PAGE_VALID) +#define _PAGE_ACCESSED (CF_PAGE_ACCESSED) +#define _PAGE_DIRTY (CF_PAGE_DIRTY) +#define _PAGE_READWRITE (CF_PAGE_READABLE \ + | CF_PAGE_WRITABLE \ + | CF_PAGE_SYSTEM \ + | CF_PAGE_SHARED) + +/* +* Compound page protection values. +*/ +#define PAGE_NONE __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED) + +#define PAGE_SHARED __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_SHARED) + +#define PAGE_INIT __pgprot(CF_PAGE_VALID \ + | CF_PAGE_READABLE \ + | CF_PAGE_WRITABLE \ + | CF_PAGE_EXEC \ + | CF_PAGE_SYSTEM) + +#define PAGE_KERNEL __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE \ + | CF_PAGE_WRITABLE \ + | CF_PAGE_EXEC \ + | CF_PAGE_SYSTEM) + +#define PAGE_COPY __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE \ + | CF_PAGE_DIRTY) + +/* +* Page protections for initialising protection_map. See mm/mmap.c +* for use. In general, the bit positions are xwr, and P-items are +* private, the S-items are shared. +*/ +#define __P000 PAGE_NONE +#define __P001 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE) +#define __P010 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_WRITABLE) +#define __P011 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE \ + | CF_PAGE_WRITABLE) +#define __P100 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_EXEC) +#define __P101 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE \ + | CF_PAGE_EXEC) +#define __P110 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_WRITABLE \ + | CF_PAGE_EXEC) +#define __P111 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE \ + | CF_PAGE_WRITABLE \ + | CF_PAGE_EXEC) + +#define __S000 PAGE_NONE +#define __S001 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE) +#define __S010 PAGE_SHARED +#define __S011 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_SHARED \ + | CF_PAGE_READABLE) +#define __S100 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_EXEC) +#define __S101 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_READABLE \ + | CF_PAGE_EXEC) +#define __S110 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_SHARED \ + | CF_PAGE_EXEC) +#define __S111 __pgprot(CF_PAGE_VALID \ + | CF_PAGE_ACCESSED \ + | CF_PAGE_SHARED \ + | CF_PAGE_READABLE \ + | CF_PAGE_EXEC) + +#define PTE_MASK PAGE_MASK +#define CF_PAGE_CHG_MASK (PTE_MASK | CF_PAGE_ACCESSED | CF_PAGE_DIRTY) + +#ifndef __ASSEMBLY__ + +/* +* Conversion functions: convert a page and protection to a page entry, +* and a page entry and page directory to the page they refer to. +*/ +#define mk_pte (page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) + +static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) +{ +pte_val (pte) = (pte_val (pte) &CF_PAGE_CHG_MASK ) |pgprot_val (newprot); +return pte; +} + +#define pmd_set (pmdp, ptep) do {} while (0) + +static inline void pgd_set (pgd_t *pgdp,pmd_t *pmdp) +{ +pgd_val (*pgdp) =virt_to_phys (pmdp); +} + +#define __pte_page (pte) ((unsigned long) (pte_val(pte) & PAGE_MASK)) +#define __pmd_page (pmd) ((unsigned long) (pmd_val(pmd))) + +static inline int pte_none (pte_t pte) +{ +return !pte_val (pte); +} + +static inline int pte_present (pte_t pte) +{ +return pte_val (pte) &CF_PAGE_VALID ; +} + +static inline void pte_clear (struct mm_struct *mm,unsigned long addr, +pte_t *ptep) +{ +pte_val (*ptep) =0 ; +} + +#define pte_pagenr (pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT) +#define pte_page (pte) virt_to_page(__pte_page(pte)) + +static inline int pmd_none2 (pmd_t *pmd) {return !pmd_val (*pmd); } +#define pmd_none (pmd) pmd_none2(&(pmd)) +static inline int pmd_bad2 (pmd_t *pmd) {return 0 ; } +#define pmd_bad (pmd) pmd_bad2(&(pmd)) +#define pmd_present (pmd) (!pmd_none2(&(pmd))) +static inline void pmd_clear (pmd_t *pmdp) {pmd_val (*pmdp) =0 ; } + +static inline int pgd_none (pgd_t pgd) {return 0 ; } +static inline int pgd_bad (pgd_t pgd) {return 0 ; } +static inline int pgd_present (pgd_t pgd) {return 1 ; } +static inline void pgd_clear (pgd_t *pgdp) {} + +#define pte_ERROR (e) \ + printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \ + __FILE__, __LINE__, pte_val(e)) +#define pmd_ERROR (e) \ + printk(KERN_ERR "%s:%d: bad pmd %08lx.\n", \ + __FILE__, __LINE__, pmd_val(e)) +#define pgd_ERROR (e) \ + printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \ + __FILE__, __LINE__, pgd_val(e)) + +/* +* The following only work if pte_present() is true. +* Undefined behaviour if not... +* [we have the full set here even if they don't change from m68k] +*/ +static inline int pte_read (pte_t pte) +{ +return pte_val (pte) &CF_PAGE_READABLE ; +} + +static inline int pte_write (pte_t pte) +{ +return pte_val (pte) &CF_PAGE_WRITABLE ; +} + +static inline int pte_exec (pte_t pte) +{ +return pte_val (pte) &CF_PAGE_EXEC ; +} + +static inline int pte_dirty (pte_t pte) +{ +return pte_val (pte) &CF_PAGE_DIRTY ; +} + +static inline int pte_young (pte_t pte) +{ +return pte_val (pte) &CF_PAGE_ACCESSED ; +} + +static inline int pte_file (pte_t pte) +{ +return pte_val (pte) &CF_PAGE_FILE ; +} + +static inline int pte_special (pte_t pte) +{ +return 0 ; +} + +static inline pte_t pte_wrprotect (pte_t pte) +{ +pte_val (pte) &= ~CF_PAGE_WRITABLE ; +return pte; +} + +static inline pte_t pte_rdprotect (pte_t pte) +{ +pte_val (pte) &= ~CF_PAGE_READABLE ; +return pte; +} + +static inline pte_t pte_exprotect (pte_t pte) +{ +pte_val (pte) &= ~CF_PAGE_EXEC ; +return pte; +} + +static inline pte_t pte_mkclean (pte_t pte) +{ +pte_val (pte) &= ~CF_PAGE_DIRTY ; +return pte; +} + +static inline pte_t pte_mkold (pte_t pte) +{ +pte_val (pte) &= ~CF_PAGE_ACCESSED ; +return pte; +} + +static inline pte_t pte_mkwrite (pte_t pte) +{ +pte_val (pte) |=CF_PAGE_WRITABLE ; +return pte; +} + +static inline pte_t pte_mkread (pte_t pte) +{ +pte_val (pte) |=CF_PAGE_READABLE ; +return pte; +} + +static inline pte_t pte_mkexec (pte_t pte) +{ +pte_val (pte) |=CF_PAGE_EXEC ; +return pte; +} + +static inline pte_t pte_mkdirty (pte_t pte) +{ +pte_val (pte) |=CF_PAGE_DIRTY ; +return pte; +} + +static inline pte_t pte_mkyoung (pte_t pte) +{ +pte_val (pte) |=CF_PAGE_ACCESSED ; +return pte; +} + +static inline pte_t pte_mknocache (pte_t pte) +{ +pte_val (pte) |=0x80 | (pte_val (pte) & ~0x40 ); +return pte; +} + +static inline pte_t pte_mkcache (pte_t pte) +{ +pte_val (pte) &= ~CF_PAGE_NOCACHE ; +return pte; +} + +static inline pte_t pte_mkspecial (pte_t pte) +{ +return pte; +} + +#define swapper_pg_dir kernel_pg_dir +extern pgd_t kernel_pg_dir[PTRS_PER_PGD ]; + +/* +* Find an entry in a pagetable directory. +*/ +#define pgd_index (address) ((address) >> PGDIR_SHIFT) +#define pgd_offset (mm, address) ((mm)->pgd + pgd_index(address)) + +/* +* Find an entry in a kernel pagetable directory. +*/ +#define pgd_offset_k (address) pgd_offset(&init_mm, address) + +/* +* Find an entry in the second-level pagetable. +*/ +static inline pmd_t *pmd_offset (pgd_t *pgd,unsigned long address) +{ +return (pmd_t *) pgd; +} + +/* +* Find an entry in the third-level pagetable. +*/ +#define __pte_offset (address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_offset_kernel (dir, address) \ + ((pte_t *) __pmd_page(*(dir)) + __pte_offset(address)) + +/* +* Disable caching for page at given kernel virtual address. +*/ +static inline void nocache_page (void *vaddr) +{ +pgd_t *dir; +pmd_t *pmdp; +pte_t *ptep; +unsigned long addr = (unsigned long ) vaddr; + + dir =pgd_offset_k (addr); + pmdp =pmd_offset (dir, addr); + ptep =pte_offset_kernel (pmdp, addr); + *ptep =pte_mknocache (*ptep); +} + +/* +* Enable caching for page at given kernel virtual address. +*/ +static inline void cache_page (void *vaddr) +{ +pgd_t *dir; +pmd_t *pmdp; +pte_t *ptep; +unsigned long addr = (unsigned long ) vaddr; + + dir =pgd_offset_k (addr); + pmdp =pmd_offset (dir, addr); + ptep =pte_offset_kernel (pmdp, addr); + *ptep =pte_mkcache (*ptep); +} + +#define PTE_FILE_MAX_BITS 21 +#define PTE_FILE_SHIFT 11 + +static inline unsigned long pte_to_pgoff (pte_t pte) +{ +return pte_val (pte) >>PTE_FILE_SHIFT ; +} + +static inline pte_t pgoff_to_pte (unsigned pgoff) +{ +return __pte ((pgoff <<PTE_FILE_SHIFT ) +CF_PAGE_FILE ); +} + +/* +* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) +*/ +#define __swp_type (x) ((x).val & 0xFF) +#define __swp_offset (x) ((x).val >> PTE_FILE_SHIFT) +#define __swp_entry (typ, off) ((swp_entry_t) { (typ) | \ + (off << PTE_FILE_SHIFT) }) +#define __pte_to_swp_entry (pte) ((swp_entry_t) { pte_val(pte) }) +#define __swp_entry_to_pte (x) (__pte((x).val)) + +#define pmd_page (pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) + +#define pte_offset_map (pmdp, addr) ((pte_t *)__pmd_page(*pmdp) + \ + __pte_offset(addr)) +#define pte_unmap (pte) ((void) 0) +#define pfn_pte (pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) +#define pte_pfn (pte) (pte_val(pte) >> PAGE_SHIFT) + +#endif /* !__ASSEMBLY__ */ +#endif /* _MCF_PGTABLE_H */
Signature · 1 line
1.7.0.4
PATCH v4 12/35 m68k: add page table size definitions for ColdFire V4e MMU
In reply to [email protected]From: Greg Ungerer <[email protected]>
Define the page table size and attributes for the ColdFire V4e MMU. Also setup the vmalloc and kmap regions we will use.
--- arch/m68k/include/asm/pgtable_mm.h | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-)
arch/m68k/include/asm/pgtable_mm.h +24 -6
@@ -40,6 +40,8 @@/* PGDIR_SHIFT determines what a third-level page table entry can map */ #ifdef CONFIG_SUN3 #define PGDIR_SHIFT 17 +#elif defined(CONFIG_COLDFIRE ) +#define PGDIR_SHIFT 22#else #define PGDIR_SHIFT 25#endif
@@ -54,6 +56,10 @@#define PTRS_PER_PTE 16#define PTRS_PER_PMD 1#define PTRS_PER_PGD 2048 +#elif defined(CONFIG_COLDFIRE ) +#define PTRS_PER_PTE 512 +#define PTRS_PER_PMD 1 +#define PTRS_PER_PGD 1024#else #define PTRS_PER_PTE 1024#define PTRS_PER_PMD 8
@@ -66,12 +72,22 @@#ifdef CONFIG_SUN3 #define KMAP_START 0x0DC00000#define KMAP_END 0x0E000000 +#elif defined(CONFIG_COLDFIRE ) +#define KMAP_START 0xe0000000 +#define KMAP_END 0xf0000000#else #define KMAP_START 0xd0000000#define KMAP_END 0xf0000000#endif -#ifndef CONFIG_SUN3 +#ifdef CONFIG_SUN3 +extern unsigned long m68k_vmalloc_end; +#define VMALLOC_START 0x0f800000 +#define VMALLOC_END m68k_vmalloc_end +#elif defined(CONFIG_COLDFIRE ) +#define VMALLOC_START 0xd0000000 +#define VMALLOC_END 0xe0000000 +#else /* Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the * physical memory until the kernel virtual memory starts. That means that
@@ -82,11 +98,7 @@#define VMALLOC_OFFSET (8*1024*1024)#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))#define VMALLOC_END KMAP_START -#else -extern unsigned long m68k_vmalloc_end; -#define VMALLOC_START 0x0f800000 -#define VMALLOC_END m68k_vmalloc_end -#endif /* CONFIG_SUN3 */ +#endif /* zero page used for uninitialized stuff */ extern void *empty_zero_page;
@@ -130,6 +142,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,#ifdef CONFIG_SUN3 #include <asm/sun3_pgtable.h> +#elif defined(CONFIG_COLDFIRE ) +#include <asm/mcf_pgtable.h> #else #include <asm/motorola_pgtable.h> #endif
@@ -138,6 +152,9 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,/* * Macro to mark a page protection value as "uncacheable". */ +#ifdef CONFIG_COLDFIRE +# define pgprot_noncached (prot) (__pgprot(pgprot_val(prot) | CF_PAGE_NOCACHE)) +#else #ifdef SUN3_PAGE_NOCACHE # define __SUN3_PAGE_NOCACHE SUN3_PAGE_NOCACHE#else
@@ -152,6 +169,7 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \ : (prot))) +#endif /* CONFIG_COLDFIRE */ #include <asm-generic/pgtable.h> #endif /* !__ASSEMBLY__ */
Signature · 1 line
1.7.0.4
PATCH v4 13/35 m68k: add ColdFire paging exception handling code
In reply to [email protected]From: Greg Ungerer <[email protected]>
Add code to traps.c to handle MMU exceptions for the ColdFire. Most of this code is from the 2.6.25 kernel BSP code released by Freescale.
--- arch/m68k/kernel/traps.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 104 insertions(+), 0 deletions(-)
arch/m68k/kernel/traps.c +104 -0
@@ -706,6 +706,88 @@ create_atc_entry:#endif /* CPU_M68020_OR_M68030 */ #endif /* !CONFIG_SUN3 */ +#if defined(CONFIG_COLDFIRE ) && defined(CONFIG_MMU ) +#include <asm/mcfmmu.h> + +/* +* The following table converts the FS encoding of a ColdFire +* exception stack frame into the error_code value needed by +* do_fault. +*/ +static const unsigned char fs_err_code[] = { +0 ,/* 0000 */ +0 ,/* 0001 */ +0 ,/* 0010 */ +0 ,/* 0011 */ +1 ,/* 0100 */ +0 ,/* 0101 */ +0 ,/* 0110 */ +0 ,/* 0111 */ +2 ,/* 1000 */ +3 ,/* 1001 */ +2 ,/* 1010 */ +0 ,/* 1011 */ +1 ,/* 1100 */ +1 ,/* 1101 */ +0 ,/* 1110 */ +0 /* 1111 */ +}; + +static inline void access_errorcf (unsigned int fs,struct frame *fp) +{ +unsigned long mmusr, addr; +unsigned int err_code; +int need_page_fault; + + mmusr =mmu_read (MMUSR ); + addr =mmu_read (MMUAR ); + +/* +* error_code: +* bit 0 == 0 means no page found, 1 means protection fault +* bit 1 == 0 means read, 1 means write +*/ +switch (fs) { +case 5 :/* 0101 TLB opword X miss */ + need_page_fault =cf_tlb_miss (&fp->ptregs,0 ,0 ,0 ); + addr = fp->ptregs.pc; +break ; +case 6 :/* 0110 TLB extension word X miss */ + need_page_fault =cf_tlb_miss (&fp->ptregs,0 ,0 ,1 ); + addr = fp->ptregs.pc +sizeof (long ); +break ; +case 10 :/* 1010 TLB W miss */ + need_page_fault =cf_tlb_miss (&fp->ptregs,1 ,1 ,0 ); +break ; +case 14 :/* 1110 TLB R miss */ + need_page_fault =cf_tlb_miss (&fp->ptregs,0 ,1 ,0 ); +break ; +default : +/* 0000 Normal */ +/* 0001 Reserved */ +/* 0010 Interrupt during debug service routine */ +/* 0011 Reserved */ +/* 0100 X Protection */ +/* 0111 IFP in emulator mode */ +/* 1000 W Protection*/ +/* 1001 Write error*/ +/* 1011 Reserved*/ +/* 1100 R Protection*/ +/* 1101 R Protection*/ +/* 1111 OEP in emulator mode*/ + need_page_fault =1 ; +break ; + } + +if (need_page_fault) { + err_code = fs_err_code[fs]; +if ((fs ==13 ) && (mmusr &MMUSR_WF ))/* rd-mod-wr access */ + err_code |=2 ;/* bit1 - write, bit0 - protection */ +do_page_fault (&fp->ptregs, addr, err_code); + } +} +#endif /* CONFIG_COLDFIRE CONFIG_MMU */ + asmlinkage void buserr_c(struct frame *fp) {/* Only set esp0 if coming from user mode */
@@ -716,6 +798,28 @@ asmlinkage void buserr_c(struct frame *fp)printk ("*** Bus Error *** Format is %x\n" , fp->ptregs.format);#endif +#if defined(CONFIG_COLDFIRE ) && defined(CONFIG_MMU ) +if (CPU_IS_COLDFIRE ) { +unsigned int fs; + fs = (fp->ptregs.vector &0x3 ) | + ((fp->ptregs.vector &0xc00 ) >>8 ); +switch (fs) { +case 0x5 : +case 0x6 : +case 0x7 : +case 0x9 : +case 0xa : +case 0xd : +case 0xe : +case 0xf : +access_errorcf (fs, fp); +return ; +default : +break ; + } + } +#endif /* CONFIG_COLDFIRE && CONFIG_MMU */ +switch (fp->ptregs.format) {#if defined (CONFIG_M68060 )case 4 :/* 68060 access error */
Signature · 1 line
1.7.0.4
PATCH v4 14/35 m68k: add cache support for V4e ColdFire cores running with MMU enabled
In reply to [email protected]From: Greg Ungerer <[email protected]>
Add code to deal with instruction, data and branch caches of the V4e ColdFire cores when they are running with the MMU enabled.
This code is loosely based on Freescales changes for the caches of the V4e ColdFire in the 2.6.25 kernel BSP. That code was originally by Kurt Mahan <[email protected]> (now <[email protected]>).
--- arch/m68k/include/asm/cacheflush_mm.h | 88 +++++++++++++++++++++++++++++++-- arch/m68k/mm/cache.c | 24 ++++++++- 2 files changed, 104 insertions(+), 8 deletions(-)
arch/m68k/include/asm/cacheflush_mm.h +83 -5
@@ -2,23 +2,89 @@#define _M68K_CACHEFLUSH_H#include <linux/mm.h> +#ifdef CONFIG_COLDFIRE +#include <asm/mcfsim.h> +#endif /* cache code */ #define FLUSH_I_AND_D (0x00000808)#define FLUSH_I (0x00000008) +#ifndef ICACHE_MAX_ADDR +#define ICACHE_MAX_ADDR 0 +#define ICACHE_SET_MASK 0 +#define DCACHE_MAX_ADDR 0 +#define DCACHE_SETMASK 0 +#endif + +static inline void flush_cf_icache (unsigned long start,unsigned long end) +{ +unsigned long set; + +for (set = start; set <= end; set += (0x10 -3 )) { + __asm__ __volatile__ ( +"cpushl %%ic,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%ic,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%ic,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%ic,(%0)" + :"=a" (set) + :"a" (set)); + } +} + +static inline void flush_cf_dcache (unsigned long start,unsigned long end) +{ +unsigned long set; + +for (set = start; set <= end; set += (0x10 -3 )) { + __asm__ __volatile__ ( +"cpushl %%dc,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%dc,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%dc,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%dc,(%0)" + :"=a" (set) + :"a" (set)); + } +} + +static inline void flush_cf_bcache (unsigned long start,unsigned long end) +{ +unsigned long set; + +for (set = start; set <= end; set += (0x10 -3 )) { + __asm__ __volatile__ ( +"cpushl %%bc,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%bc,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%bc,(%0)\n\t" +"addq%.l #1,%0\n\t" +"cpushl %%bc,(%0)" + :"=a" (set) + :"a" (set)); + } +} +/* * Cache handling functions */ static inline void flush_icache (void ) { -if (CPU_IS_040_OR_060 ) +if (CPU_IS_COLDFIRE ) { +flush_cf_icache (0 ,ICACHE_MAX_ADDR ); + }else if (CPU_IS_040_OR_060 ) { asmvolatile ("nop\n" " .chip 68040\n" " cpusha %bc\n" " .chip 68k" ); -else { + }else {unsigned long tmp; asmvolatile ("movec %%cacr,%0\n" " or.w %1,%0\n"
@@ -51,12 +117,14 @@ extern void cache_push_v(unsigned long vaddr, int len);process changes. */ #define __flush_cache_all () \ ({ \ - if (CPU_IS_040_OR_060) \ + if (CPU_IS_COLDFIRE) { \ + flush_cf_dcache(0, DCACHE_MAX_ADDR); \ + } else if (CPU_IS_040_OR_060) { \ __asm__ __volatile__("nop\n\t" \ ".chip 68040\n\t" \ "cpusha %dc\n\t" \ ".chip 68k"); \ - else { \ + } else { \ unsigned long _tmp; \ __asm__ __volatile__("movec %%cacr,%0\n\t" \ "orw %1,%0\n\t" \
@@ -112,7 +180,17 @@ static inline void flush_cache_page(struct vm_area_struct *vma, unsigned long vm/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */ static inline void __flush_page_to_ram (void *vaddr) { -if (CPU_IS_040_OR_060 ) { +if (CPU_IS_COLDFIRE ) { +unsigned long addr, start, end; + addr = ((unsigned long ) vaddr) & ~(PAGE_SIZE -1 ); + start = addr &ICACHE_SET_MASK ; + end = (addr +PAGE_SIZE -1 ) &ICACHE_SET_MASK ; +if (start > end) { +flush_cf_bcache (0 , end); + end =ICACHE_MAX_ADDR ; + } +flush_cf_bcache (start, end); + }else if (CPU_IS_040_OR_060 ) { __asm__ __volatile__("nop\n\t" ".chip 68040\n\t" "cpushp %%bc,(%0)\n\t"
arch/m68k/mm/cache.c +21 -3
@@ -74,8 +74,16 @@ static unsigned long virt_to_phys_slow(unsigned long vaddr)/* RZ: use cpush %bc instead of cpush %dc, cinv %ic */ void flush_icache_range (unsigned long address,unsigned long endaddr) { - -if (CPU_IS_040_OR_060 ) { +if (CPU_IS_COLDFIRE ) { +unsigned long start, end; + start = address &ICACHE_SET_MASK ; + end = endaddr &ICACHE_SET_MASK ; +if (start > end) { +flush_cf_icache (0 , end); + end =ICACHE_MAX_ADDR ; + } +flush_cf_icache (start, end); + }else if (CPU_IS_040_OR_060 ) { address &=PAGE_MASK ; do {
@@ -100,7 +108,17 @@ EXPORT_SYMBOL(flush_icache_range);void flush_icache_user_range (struct vm_area_struct *vma,struct page *page,unsigned long addr,int len) { -if (CPU_IS_040_OR_060 ) { +if (CPU_IS_COLDFIRE ) { +unsigned long start, end; + start = addr &ICACHE_SET_MASK ; + end = (addr + len) &ICACHE_SET_MASK ; +if (start > end) { +flush_cf_icache (0 , end); + end =ICACHE_MAX_ADDR ; + } +flush_cf_icache (start, end); + + }else if (CPU_IS_040_OR_060 ) { asmvolatile ("nop\n\t" ".chip 68040\n\t" "cpushp %%bc,(%0)\n\t"
Signature · 1 line
1.7.0.4
PATCH v4 15/35 m68k: modify ColdFire 54xx cache support for MMU enabled
In reply to [email protected]From: Greg Ungerer <[email protected]>
Modify the cache setup for the ColdFire 54xx parts when running with the MMU enabled.
We want to map the peripheral register space (MBAR region) as non cacheable. And create an identity mapping for all of RAM for the kernel.
--- arch/m68k/include/asm/m54xxacr.h | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-)
arch/m68k/include/asm/m54xxacr.h +31 -1
@@ -39,8 +39,12 @@#define ACR_CM_OFF_PRE 0x00000040/* No cache, precise */ #define ACR_CM_OFF_IMP 0x00000060/* No cache, imprecise */ #define ACR_CM 0x00000060/* Cache mode mask */ +#define ACR_SP 0x00000008/* Supervisor protect */ #define ACR_WPROTECT 0x00000004/* Write protect */ +#define ACR_BA (x) ((x) & 0xff000000) +#define ACR_ADMSK (x) ((((x) - 1) & 0xff000000) >> 8) +#if defined(CONFIG_M5407 )#define ICACHE_SIZE 0x4000/* instruction - 16k */
@@ -56,6 +60,11 @@#define CACHE_LINE_SIZE 0x0010/* 16 bytes */ #define CACHE_WAYS 4/* 4 ways */ +#define ICACHE_SET_MASK ((ICACHE_SIZE / 64 - 1) << CACHE_WAYS) +#define DCACHE_SET_MASK ((DCACHE_SIZE / 64 - 1) << CACHE_WAYS) +#define ICACHE_MAX_ADDR ICACHE_SET_MASK +#define DCACHE_MAX_ADDR DCACHE_SET_MASK +/* * Version 4 cores have a true harvard style separate instruction * and data cache. Enable data and instruction caches, also enable write
@@ -73,6 +82,27 @@#else #define CACHE_MODE (CACR_DEC+CACR_DESB+CACR_DDCM_P+CACR_BEC+CACR_IEC+CACR_EUSP)#endif +#define CACHE_INIT (CACR_DCINVA+CACR_BCINVA+CACR_ICINVA) + +#if defined(CONFIG_MMU ) +/* +* If running with the MMU enabled then we need to map the internal +* register region as non-cacheable. And then we map all our RAM as +* cacheable and supervisor access only. +*/ +#define ACR0_MODE (ACR_BA(CONFIG_MBAR)+ACR_ADMSK(0x1000000)+ \ + ACR_ENABLE+ACR_SUPER+ACR_CM_OFF_PRE+ACR_SP) +#define ACR1_MODE (ACR_BA(CONFIG_RAMBASE)+ACR_ADMSK(CONFIG_RAMSIZE)+ \ + ACR_ENABLE+ACR_SUPER+ACR_SP) +#define ACR2_MODE 0 +#define ACR3_MODE (ACR_BA(CONFIG_RAMBASE)+ACR_ADMSK(CONFIG_RAMSIZE)+ \ + ACR_ENABLE+ACR_SUPER+ACR_SP) + +#else + +/* +* For the non-MMU enabled case we map all of RAM as cacheable. +*/ #if defined(CONFIG_CACHE_COPYBACK )#define DATA_CACHE_MODE (ACR_ENABLE+ACR_ANY+ACR_CM_CP)#else
@@ -80,7 +110,6 @@#endif #define INSN_CACHE_MODE (ACR_ENABLE+ACR_ANY) -#define CACHE_INIT (CACR_DCINVA+CACR_BCINVA+CACR_ICINVA)#define CACHE_INVALIDATE (CACHE_MODE+CACR_DCINVA+CACR_BCINVA+CACR_ICINVA)#define CACHE_INVALIDATEI (CACHE_MODE+CACR_BCINVA+CACR_ICINVA)#define CACHE_INVALIDATED (CACHE_MODE+CACR_DCINVA)
@@ -94,4 +123,5 @@#define CACHE_PUSH #endif +#endif /* CONFIG_MMU */ #endif /* m54xxacr_h */
Signature · 1 line
1.7.0.4
PATCH v4 16/35 m68k: add TLB flush support for the ColdFire V4e MMU hardware
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire V4e MMU is unlike any of the other m68k MMU hardware. It needs its own TLB flush support code.
--- arch/m68k/include/asm/tlbflush.h | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-)
arch/m68k/include/asm/tlbflush.h +17 -6
@@ -5,10 +5,13 @@#ifndef CONFIG_SUN3 #include <asm/current.h> +#include <asm/mcfmmu.h> static inline void flush_tlb_kernel_page (void *addr) { -if (CPU_IS_040_OR_060 ) { +if (CPU_IS_COLDFIRE ) { +mmu_write (MMUOR ,MMUOR_CNL ); + }else if (CPU_IS_040_OR_060 ) {mm_segment_t old_fs =get_fs ();set_fs (KERNEL_DS ); __asm__ __volatile__(".chip 68040\n\t"
@@ -25,12 +28,15 @@ static inline void flush_tlb_kernel_page(void *addr)*/ static inline void __flush_tlb (void ) { -if (CPU_IS_040_OR_060 ) +if (CPU_IS_COLDFIRE ) { +mmu_write (MMUOR ,MMUOR_CNL ); + }else if (CPU_IS_040_OR_060 ) { __asm__ __volatile__(".chip 68040\n\t" "pflushan\n\t" ".chip 68k" ); -else if (CPU_IS_020_OR_030 ) + }else if (CPU_IS_020_OR_030 ) { __asm__ __volatile__("pflush #0,#4" ); + } }static inline void __flush_tlb040_one (unsigned long addr)
@@ -43,7 +49,9 @@ static inline void __flush_tlb040_one(unsigned long addr)static inline void __flush_tlb_one (unsigned long addr) { -if (CPU_IS_040_OR_060 ) +if (CPU_IS_COLDFIRE ) +mmu_write (MMUOR ,MMUOR_CNL ); +else if (CPU_IS_040_OR_060 )__flush_tlb040_one (addr);else if (CPU_IS_020_OR_030 ) __asm__ __volatile__("pflush #0,#4,(%0)" : :"a" (addr));
@@ -56,12 +64,15 @@ static inline void __flush_tlb_one(unsigned long addr)*/ static inline void flush_tlb_all (void ) { -if (CPU_IS_040_OR_060 ) +if (CPU_IS_COLDFIRE ) { +mmu_write (MMUOR ,MMUOR_CNL ); + }else if (CPU_IS_040_OR_060 ) { __asm__ __volatile__(".chip 68040\n\t" "pflusha\n\t" ".chip 68k" ); -else if (CPU_IS_020_OR_030 ) + }else if (CPU_IS_020_OR_030 ) { __asm__ __volatile__("pflusha" ); + } }static inline void flush_tlb_mm (struct mm_struct *mm)
Signature · 1 line
1.7.0.4
PATCH v4 17/35 m68k: define PAGE_OFFSET_RAW for ColdFire CPU with MMU enabled
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire CPU configurations need PAGE_OFFSET_RAW set to the base of their RAM. It doesn't matter if they are running with the MMU enabled or disabled, it is always set to the base of RAM.
We can keep the choices simple here and key of CONFIG_RAMBASE. If it is defined we are on a plaftorm (ColdFire or other non-MMU systems) which have a configurable RAM base, just use it.
--- arch/m68k/include/asm/page_offset.h | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
arch/m68k/include/asm/page_offset.h +3 -5
@@ -1,11 +1,9 @@/* This handles the memory map.. */ -#ifdef CONFIG_MMU -#ifndef CONFIG_SUN3 +#if defined(CONFIG_RAMBASE ) +#define PAGE_OFFSET_RAW CONFIG_RAMBASE +#elif !defined(CONFIG_SUN3 )#define PAGE_OFFSET_RAW 0x00000000#else #define PAGE_OFFSET_RAW 0x0E000000#endif -#else -#define PAGE_OFFSET_RAW CONFIG_RAMBASE -#endif
Signature · 1 line
1.7.0.4
Re: [PATCH 17/35] m68k: define PAGE_OFFSET_RAW for ColdFire CPU with MMU enabled
Quoted 6 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
The ColdFire CPU configurations need
PAGE_OFFSET_RAWset to the base of their RAM. It doesn't matter if they are running with the MMU enabled or disabled, it is always set to the base of RAM.
Quoted 8 lines
We can keep the choices simple here and key of
CONFIG_RAMBASE. If it is defined we are on a plaftorm (ColdFire or other non-MMU systems) which have a configurable RAM base, just use it.Reported-by Alexander Stein <[email protected]>Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>
but see below ...
arch/m68k/include/asm/page_offset.h line 11
Quoted 12 lines
arch/m68k/include/asm/page_offset.h +3
-2-#ifdef CONFIG_MMU -#ifndef CONFIG_SUN3 +#if defined(CONFIG_RAMBASE ) +#define PAGE_OFFSET_RAW CONFIG_RAMBASE +#elif !defined(CONFIG_SUN3 )#define
PAGE_OFFSET_RAW0x00000000 #else
#definePAGE_OFFSET_RAW0x0E000000 #endifarch/m68k/include/asm/page_offset.h +0
-3-#else -#define PAGE_OFFSET_RAW CONFIG_RAMBASE -#endif
To avoid alternating between defined and !defined, I'd suggest writing it instead like:
#if defined(CONFIG_RAMBASE)
#define PAGE_OFFSET_RAW CONFIG_RAMBASE
#elif defined(CONFIG_SUN3)
#define PAGE_OFFSET_RAW 0x0E000000
#else
#define PAGE_OFFSET_RAW 0x00000000
#endif
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: [PATCH 17/35] m68k: define PAGE_OFFSET_RAW for ColdFire CPU with MMU enabled
Hi Geert,
Quoted 36 lines · Geert Uytterhoeven
Quoted 6 lines · On Fri, Dec 23, 2011 at 04:15,<[email protected]> wrote:
From: Greg Ungerer<[email protected]>
The ColdFire CPU configurations need
PAGE_OFFSET_RAWset to the base of their RAM. It doesn't matter if they are running with the MMU enabled or disabled, it is always set to the base of RAM.Quoted 8 lines
We can keep the choices simple here and key of
CONFIG_RAMBASE. If it is defined we are on a plaftorm (ColdFire or other non-MMU systems) which have a configurable RAM base, just use it.Reported-by Alexander Stein<[email protected]>Signed-off-by Greg Ungerer<[email protected]>Acked-by Matt Waddel<[email protected]>Acked-by Kurt Mahan<[email protected]>but see below ...
arch/m68k/include/asm/page_offset.h line 11
Quoted 12 lines
arch/m68k/include/asm/page_offset.h +3
-5-#ifdef CONFIG_MMU -#ifndef CONFIG_SUN3 +#if defined(CONFIG_RAMBASE ) +#define PAGE_OFFSET_RAW CONFIG_RAMBASE +#elif !defined(CONFIG_SUN3 )#define PAGE_OFFSET_RAW 0x00000000#else #define PAGE_OFFSET_RAW 0x0E000000#endif -#else -#define PAGE_OFFSET_RAW CONFIG_RAMBASE -#endif To avoid alternating between defined and !defined, I'd suggest writing it instead like:
Quoted 7 lines
#if
defined(CONFIG_RAMBASE)
#definePAGE_OFFSET_RAWCONFIG_RAMBASE
#elifdefined(CONFIG_SUN3)
#definePAGE_OFFSET_RAW0x0E000000
#else
#definePAGE_OFFSET_RAW0x00000000
#endif
Yep, absolutely, that is nicer. I'll change it to this.
Thanks
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close, FAX: +61 7 3891 3630 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
PATCH v4 18/35 m68k: set ColdFire MMU page size
In reply to [email protected]From: Greg Ungerer <[email protected]>
We use the ColdFire V4e MMU page size of 8KiB. Define PAGE_SHIFT appropriately.
--- arch/m68k/include/asm/page.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/m68k/include/asm/page.h +3 -3
@@ -6,10 +6,10 @@#include <asm/page_offset.h> /* PAGE_SHIFT determines the page size */ -#ifndef CONFIG_SUN3 -#define PAGE_SHIFT (12) +#if defined(CONFIG_SUN3 ) || defined(CONFIG_COLDFIRE ) +#define PAGE_SHIFT 13#else -#define PAGE_SHIFT (13) +#define PAGE_SHIFT 12#endif #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1))
Signature · 1 line
1.7.0.4
PATCH v4 19/35 m68k: MMU enabled ColdFire needs 8k ELF alignment
In reply to [email protected]From: Greg Ungerer <[email protected]>
Like the SUN3 hardware MMU the ColdFire MMU uses 8k pages. So we want our ELF page size alingment to also be 8k. Modify the ELF alignment setting.
--- arch/m68k/include/asm/elf.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/m68k/include/asm/elf.h +3 -3
@@ -59,10 +59,10 @@ typedef struct user_m68kfp_struct elf_fpregset_t;is actually used on ASV. */ #define ELF_PLAT_INIT (_r, load_addr) _r->a1 = 0 -#ifndef CONFIG_SUN3 -#define ELF_EXEC_PAGESIZE 4096 -#else +#if defined(CONFIG_SUN3 ) || defined(CONFIG_COLDFIRE )#define ELF_EXEC_PAGESIZE 8192 +#else +#define ELF_EXEC_PAGESIZE 4096#endif /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
Signature · 1 line
1.7.0.4
PATCH v4 20/35 m68k: ColdFire V4e MMU context support code
In reply to [email protected]From: Greg Ungerer <[email protected]>
Add code to manage the context's of the ColdFire V4e MMU. This code is mostly taken from the Freescale 2.6.35 kernel BSP for MMU enabled ColdFire.
--- arch/m68k/include/asm/atomic.h | 10 ++ arch/m68k/include/asm/mmu_context.h | 250 ++++++++++++++++++++++++++++------- 2 files changed, 211 insertions(+), 49 deletions(-)
arch/m68k/include/asm/atomic.h +10 -0
@@ -55,6 +55,16 @@ static inline int atomic_dec_and_test(atomic_t *v)return c !=0 ; } +static inline int atomic_dec_and_test_lt (atomic_t *v) +{ +char c; + __asm__ __volatile__( +"subql #1,%1; slt %0" + :"=d" (c),"=m" (*v) + :"m" (*v)); +return c !=0 ; +} +static inline int atomic_inc_and_test (atomic_t *v) {char c;
arch/m68k/include/asm/mmu_context.h +201 -49
263 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v4 21/35 m68k: use tracehook_report_syscall_entry/exit for ColdFire MMU ptrace path
In reply to [email protected]From: Greg Ungerer <[email protected]>
The existing ColdFire code (which is all non-mmu) for system call entry and exit uses the more modern tracehook_report_syscall_entry()/exit() into the ptrace code. Now that we are supporting ColdFire with MMU we need the same hooks for these.
--- arch/m68k/kernel/ptrace_mm.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
arch/m68k/kernel/ptrace_mm.c +18 -0
@@ -18,6 +18,7 @@#include <linux/ptrace.h> #include <linux/user.h> #include <linux/signal.h> +#include <linux/tracehook.h> #include <asm/uaccess.h> #include <asm/page.h>
@@ -275,3 +276,20 @@ asmlinkage void syscall_trace(void) current->exit_code =0 ; } } + +#ifdef CONFIG_COLDFIRE +asmlinkage int syscall_trace_enter(void) +{ +int ret =0 ; + +if (test_thread_flag (TIF_SYSCALL_TRACE )) + ret =tracehook_report_syscall_entry (task_pt_regs (current)); +return ret; +} + +asmlinkage void syscall_trace_leave(void) +{ +if (test_thread_flag (TIF_SYSCALL_TRACE )) +tracehook_report_syscall_exit (task_pt_regs (current),0 ); +} +#endif /* CONFIG_COLDFIRE */
Signature · 1 line
1.7.0.4
PATCH v4 22/35 m68k: modify cache push and clear code for ColdFire with MMU enable
In reply to [email protected]From: Greg Ungerer <[email protected]>
The cache push and clear code only need to flush the branch cache on the write-through cache setup of the ColdFire V4e with MMU enabled.
--- arch/m68k/mm/memory.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
arch/m68k/mm/memory.c +6 -2
@@ -203,7 +203,9 @@ static inline void pushcl040(unsigned long paddr)void cache_clear (unsigned long paddr,int len) { -if (CPU_IS_040_OR_060 ) { +if (CPU_IS_COLDFIRE ) { +flush_cf_bcache (0 ,DCACHE_MAX_ADDR ); + }else if (CPU_IS_040_OR_060 ) {int tmp;/*
@@ -250,7 +252,9 @@ EXPORT_SYMBOL(cache_clear);void cache_push (unsigned long paddr,int len) { -if (CPU_IS_040_OR_060 ) { +if (CPU_IS_COLDFIRE ) { +flush_cf_bcache (0 ,DCACHE_MAX_ADDR ); + }else if (CPU_IS_040_OR_060 ) {int tmp =PAGE_SIZE ;/*
Signature · 1 line
1.7.0.4
PATCH v4 23/35 m68k: use ColdFire MMU read/write bit flags when ioremapping
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire MMU has separate read and write bits, unlike the Motorola m68k MMU which has a single read-only bit.
Define a _PAGE_READWRITE value for the Motorola MMU, which is 0, so we can unconditionaly include that in the page table entry bits when setting up ioremapped pages.
--- arch/m68k/include/asm/motorola_pgtable.h | 1 + arch/m68k/mm/kmap.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletions(-)
arch/m68k/include/asm/motorola_pgtable.h +1 -0
@@ -8,6 +8,7 @@#define _PAGE_PRESENT 0x001#define _PAGE_SHORT 0x002#define _PAGE_RONLY 0x004 +#define _PAGE_READWRITE 0x000#define _PAGE_ACCESSED 0x008#define _PAGE_DIRTY 0x010#define _PAGE_SUPER 0x080/* 68040 supervisor only */
arch/m68k/mm/kmap.c +2 -1
@@ -171,7 +171,8 @@ void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflabreak ; } }else { - physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); + physaddr |= (_PAGE_PRESENT | _PAGE_ACCESSED | + _PAGE_DIRTY | _PAGE_READWRITE);switch (cacheflag) {case IOMAP_NOCACHE_SER :case IOMAP_NOCACHE_NONSER :
Signature · 1 line
1.7.0.4
Re: [PATCH 23/35] m68k: use ColdFire MMU read/write bit flags when ioremapping
Quoted 5 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
The ColdFire MMU has separate read and write bits, unlike the Motorola m68k MMU which has a single read-only bit.
Quoted 7 lines
Define a
_PAGE_READWRITEvalue for the Motorola MMU, which is 0, so we can unconditionaly include that in the page table entry bits when setting up ioremapped pages.Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>
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
PATCH v4 24/35 m68k: ColdFire V4e MMU paging init code and miss handler
In reply to [email protected]From: Greg Ungerer <[email protected]>
The different ColdFire V4e MMU requires its own dedicated paging init code, and a TLB miss handler for its software driven TLB.
--- arch/m68k/include/asm/mcfmmu.h | 2 + arch/m68k/mm/mcfmmu.c | 198 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+), 0 deletions(-) create mode 100644 arch/m68k/mm/mcfmmu.c
arch/m68k/include/asm/mcfmmu.h +2 -0
@@ -105,6 +105,8 @@ static inline void mmu_write(u32 a, u32 v) __asm__ __volatile__ ("nop" ); } +int cf_tlb_miss (struct pt_regs *regs,int write,int dtlb,int extension_word); +#endif #endif /* MCFMMU_H */
arch/m68k/mm/mcfmmu.c new file +198 -0
198 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v4 25/35 m68k: compile appropriate mm arch files for ColdFire MMU support
In reply to [email protected]From: Greg Ungerer <[email protected]>
Create a config symbol to enable when using a ColdFire MMU. We then use that to only compile the necessary arch mm files.
--- arch/m68k/Kconfig | 5 ++++- arch/m68k/mm/Makefile | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-)
arch/m68k/Kconfig +4 -1
@@ -88,9 +88,12 @@ config MMU config MMU_MOTOROLA bool +config MMU_COLDFIRE + bool + config MMU_SUN3 bool - depends on MMU && !MMU_MOTOROLA + depends on MMU && !MMU_MOTOROLA && !MMU_COLDFIRE menu "Platform setup"
arch/m68k/mm/Makefile +5 -3
@@ -4,6 +4,8 @@ obj-y := init.o -obj-$(CONFIG_MMU) += cache.o fault.o hwtest.o -obj-$(CONFIG_MMU_MOTOROLA) += kmap.o memory.o motorola.o -obj-$(CONFIG_MMU_SUN3) += sun3kmap.o sun3mmu.o +obj-$(CONFIG_MMU) += cache.o fault.o +obj-$(CONFIG_MMU_MOTOROLA) += kmap.o memory.o motorola.o hwtest.o +obj-$(CONFIG_MMU_SUN3) += sun3kmap.o sun3mmu.o hwtest.o +obj-$(CONFIG_MMU_COLDFIRE) += kmap.o memory.o mcfmmu.o +
Signature · 1 line
1.7.0.4
PATCH v4 26/35 m68k: create ColdFire MMU pgalloc code
In reply to [email protected]From: Greg Ungerer <[email protected]>
Add code to support the ColdFire V4e MMU pgalloc functions.
--- arch/m68k/include/asm/mcf_pgalloc.h | 102 +++++++++++++++++++++++++++++++++++ arch/m68k/include/asm/pgalloc.h | 4 +- 2 files changed, 105 insertions(+), 1 deletions(-) create mode 100644 arch/m68k/include/asm/mcf_pgalloc.h
arch/m68k/include/asm/mcf_pgalloc.h new file +102 -0
@@ -0,0 +1,102 @@ +#ifndef M68K_MCF_PGALLOC_H +#define M68K_MCF_PGALLOC_H + +#include <asm/tlb.h> +#include <asm/tlbflush.h> + +extern inline void pte_free_kernel (struct mm_struct *mm,pte_t *pte) +{ +free_page ((unsigned long ) pte); +} + +extern const char bad_pmd_string[]; + +extern inline pte_t *pte_alloc_one_kernel (struct mm_struct *mm, +unsigned long address) +{ +unsigned long page =__get_free_page (GFP_DMA |__GFP_REPEAT); + +if (!page) +return NULL ; + +memset ((void *)page,0 ,PAGE_SIZE ); +return (pte_t *) (page); +} + +extern inline pmd_t *pmd_alloc_kernel (pgd_t *pgd,unsigned long address) +{ +return (pmd_t *) pgd; +} + +#define pmd_alloc_one_fast (mm, address) ({ BUG(); ((pmd_t *)1); }) +#define pmd_alloc_one (mm, address) ({ BUG(); ((pmd_t *)2); }) + +#define pte_alloc_one_fast (mm, addr) pte_alloc_one(mm, addr) + +#define pmd_populate (mm, pmd, page) (pmd_val(*pmd) = \ + (unsigned long)(page_address(page))) + +#define pmd_populate_kernel (mm, pmd, pte) (pmd_val(*pmd) = (unsigned long)(pte)) + +#define pmd_pgtable (pmd) pmd_page(pmd) + +static inline void __pte_free_tlb (struct mmu_gather *tlb,pgtable_t page, +unsigned long address) +{ +__free_page (page); +} + +#define __pmd_free_tlb (tlb, pmd, address) do { } while (0) + +static inline struct page *pte_alloc_one (struct mm_struct *mm, +unsigned long address) +{ +struct page *page =alloc_pages (GFP_DMA |__GFP_REPEAT,0 ); +pte_t *pte; + +if (!page) +return NULL ; + + pte =kmap (page); +if (pte) { +clear_page (pte); +__flush_page_to_ram (pte); +flush_tlb_kernel_page (pte); +nocache_page (pte); + } +kunmap (page); + +return page; +} + +extern inline void pte_free (struct mm_struct *mm,struct page *page) +{ +__free_page (page); +} + +/* +* In our implementation, each pgd entry contains 1 pmd that is never allocated +* or freed. pgd_present is always 1, so this should never be called. -NL +*/ +#define pmd_free (mm, pmd) BUG() + +static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) +{ +free_page ((unsigned long ) pgd); +} + +static inline pgd_t *pgd_alloc (struct mm_struct *mm) +{ +pgd_t *new_pgd; + + new_pgd = (pgd_t *)__get_free_page (GFP_DMA | __GFP_NOWARN); +if (!new_pgd) +return NULL ; +memcpy (new_pgd, swapper_pg_dir,PAGE_SIZE ); +memset (new_pgd,0 ,PAGE_OFFSET >>PGDIR_SHIFT ); +return new_pgd; +} + +#define pgd_populate (mm, pmd, pte) BUG() + +#endif /* M68K_MCF_PGALLOC_H */
arch/m68k/include/asm/pgalloc.h +3 -1
@@ -7,7 +7,9 @@#ifdef CONFIG_MMU #include <asm/virtconvert.h> -#ifdef CONFIG_SUN3 +#if defined(CONFIG_COLDFIRE ) +#include <asm/mcf_pgalloc.h> +#elif defined(CONFIG_SUN3 )#include <asm/sun3_pgalloc.h> #else #include <asm/motorola_pgalloc.h>
Signature · 1 line
1.7.0.4
PATCH v4 27/35 m68k: use non-MMU entry.S code when compiling for ColdFire CPU
In reply to [email protected]From: Greg Ungerer <[email protected]>
No matter whether we are configured for non-MMU or MMU enabled if we are compiling for ColdFire CPU we always use the entry_no.S code.
--- arch/m68k/kernel/entry.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/m68k/kernel/entry.S +1 -1
@@ -1,4 +1,4 @@ -#ifdef CONFIG_MMU +#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) #include "entry_mm.S" #else #include "entry_no.S"
Signature · 1 line
1.7.0.4
PATCH v4 28/35 m68k: add code to setup a ColdFire 54xx platform when MMU enabled
In reply to [email protected]From: Greg Ungerer <[email protected]>
We use the same setup code for ColdFire MMU enabled platforms as standard m68k. So add support for it to setup our 54xx ColdFire platforms. They do not support the same bootinfo parsing as other m68k platforms.
--- arch/m68k/kernel/setup_mm.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
arch/m68k/kernel/setup_mm.c +7 -1
@@ -221,7 +221,8 @@ void __init setup_arch(char **cmdline_p)#endif /* The bootinfo is located right after the kernel bss */ -m68k_parse_bootinfo ((const struct bi_record *)_end); +if (!CPU_IS_COLDFIRE ) +m68k_parse_bootinfo ((const struct bi_record *)_end);if (CPU_IS_040 ) m68k_is040or060 =4 ;
@@ -327,6 +328,11 @@ void __init setup_arch(char **cmdline_p)config_sun3x ();break ;#endif +#ifdef CONFIG_COLDFIRE +case MACH_M54XX : +config_BSP (NULL ,0 ); +break ; +#endif default :panic ("No configuration setup" ); }
Signature · 1 line
1.7.0.4
PATCH v4 29/35 m68k: ColdFire with MMU enabled uses same clocking code as non-MMU
In reply to [email protected]From: Greg Ungerer <[email protected]>
We want to use the same timer support code for ColdFire CPU's when running with MMU enabled or not. So use the same time_no.c code even when the MMU is enabled for ColdFire. This also means we do not want CONFIG_ARCH_USES_GETTIMEOFFSET set, since that code is only in time_mm.c.
--- arch/m68k/Kconfig | 2 +- arch/m68k/kernel/time.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/Kconfig +1 -1
@@ -48,7 +48,7 @@ config TIME_LOW_RES default y config ARCH_USES_GETTIMEOFFSET - def_bool MMU + def_bool MMU && !COLDFIRE config NO_IOPORT def_bool y
arch/m68k/kernel/time.c +1 -1
@@ -1,4 +1,4 @@ -#ifdef CONFIG_MMU +#if defined(CONFIG_MMU ) && !defined(CONFIG_COLDFIRE )#include "time_mm.c" #else #include "time_no.c"
Signature · 1 line
1.7.0.4
Re: [PATCH 29/35] m68k: ColdFire with MMU enabled uses same clocking code as non-MMU
Quoted 10 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
We want to use the same timer support code for ColdFire CPU's when running with MMU enabled or not. So use the same
time_no.ccode even when the MMU is enabled for ColdFire. This also means we do not wantCONFIG_ARCH_USES_GETTIMEOFFSETset, since that code is only intime_mm.c.Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>
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
PATCH v4 30/35 m68k: use non-MMU linker script for ColdFire MMU builds
In reply to [email protected]From: Greg Ungerer <[email protected]>
Use the non-MMU linker script for ColdFire builds when we are building for MMU enabled. The image layout is correct for loading on existing ColdFire dev boards. The only addition required to the current non-MMU linker script is to add support for the fixup section.
--- arch/m68k/kernel/vmlinux-nommu.lds | 8 ++++++++ arch/m68k/kernel/vmlinux.lds.S | 2 +- 2 files changed, 9 insertions(+), 1 deletions(-)
arch/m68k/kernel/vmlinux-nommu.lds +8 -0
@@ -69,6 +69,7 @@ SECTIONS { SCHED_TEXT LOCK_TEXT *(.text..lock) + *(.fixup) . = ALIGN(16); /* Exception table */ __start___ex_table = .;
@@ -161,6 +162,13 @@ SECTIONS { _edata = . ; } > DATA + .m68k_fixup : { + __start_fixup = .; + *(.m68k_fixup) + __stop_fixup = .; + } > DATA + NOTES > DATA + .init.text : { . = ALIGN(PAGE_SIZE); __init_begin = .;
arch/m68k/kernel/vmlinux.lds.S +1 -1
@@ -1,4 +1,4 @@ -#ifdef CONFIG_MMU +#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE) PHDRS { text PT_LOAD FILEHDR PHDRS FLAGS (7);
Signature · 1 line
1.7.0.4
PATCH v4 31/35 m68k: adjustments to stack frame for ColdFire with MMU enabled
In reply to [email protected]From: Greg Ungerer <[email protected]>
The exception return stack adjustment required by ColdFire when running with the MMU enabled is not completely identical to 680x0 processors. Specifically the format type 4 stack frame doesn't need any stack adjustment on exception return. And the ColdFire always must return with a frame type of 4, not 0.
--- arch/m68k/kernel/signal_mm.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-)
arch/m68k/kernel/signal_mm.c +15 -2
@@ -56,7 +56,11 @@ static const int frame_extra_sizes[16] = { [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */ [2] = sizeof(((struct frame *)0)->un.fmt2), [3] = sizeof(((struct frame *)0)->un.fmt3), +#ifdef CONFIG_COLDFIRE + [4] = 0, +#else [4] = sizeof(((struct frame *)0)->un.fmt4), +#endif [5] = -1, /* sizeof(((struct frame *)0)->un.fmt5), */ [6] = -1, /* sizeof(((struct frame *)0)->un.fmt6), */ [7] = sizeof(((struct frame *)0)->un.fmt7),
@@ -84,7 +88,11 @@ int handle_kernel_fault(struct pt_regs *regs) regs->stkadj = frame_extra_sizes[regs->format]; tregs = (struct pt_regs *)((long )regs + regs->stkadj); tregs->vector = regs->vector; +#ifdef CONFIG_COLDFIRE + tregs->format =4 ; +#else tregs->format =0 ; +#endif tregs->pc = fixup->fixup; tregs->sr = regs->sr;
@@ -336,8 +344,12 @@ static int mangle_kernel_stack(struct pt_regs *regs, int formatvec, regs->format = formatvec >>12 ; regs->vector = formatvec &0xfff ;#define frame_offset (sizeof(struct pt_regs)+sizeof(struct switch_stack)) - __asm__ __volatile__ - (" movel %0,%/a0\n\t" + __asm__ __volatile__ ( +#ifdef CONFIG_COLDFIRE + " movel %0,%/sp\n\t" + " bra ret_from_signal\n" +#else +" movel %0,%/a0\n\t" " subl %1,%/a0\n\t" /* make room on stack */ " movel %/a0,%/sp\n\t" /* set stack pointer */ /* move switch_stack and pt_regs */
@@ -350,6 +362,7 @@ static int mangle_kernel_stack(struct pt_regs *regs, int formatvec, "2: movel %4@+,%/a0@+\n\t" " dbra %1,2b\n\t" " bral ret_from_signal\n" +#endif : /* no outputs, it doesn't ever return */ : "a" (sw), "d" (fsize), "d" (frame_offset/4-1),"n" (frame_offset),"a" (buf + fsize/4 )
Signature · 1 line
1.7.0.4
PATCH v4 32/35 m68k: add ColdFire FPU support for the V4e ColdFire CPU's
In reply to [email protected]From: Greg Ungerer <[email protected]>
The V4e ColdFire CPU family also has an integrated FPU (as well as the MMU). So add code to support this hardware along side the existing m68k FPU code.
The ColdFire FPU is of course different to all previous 68k FP units. It is close in operation to the 68060, but not completely compatible. The biggest issue to deal with is that the ColdFire FPU multi-move instructions are different. It does not support multi-moving the FP control registers, and the multi-move of the FP data registers uses a different instruction mnemonic.
--- arch/m68k/include/asm/fpu.h | 2 + arch/m68k/kernel/process_mm.c | 59 ++++++++++++---- arch/m68k/kernel/setup_mm.c | 2 +- arch/m68k/kernel/signal_mm.c | 157 +++++++++++++++++++++++++++------------- 4 files changed, 154 insertions(+), 66 deletions(-)
arch/m68k/include/asm/fpu.h +2 -0
@@ -12,6 +12,8 @@#define FPSTATESIZE (96)#elif defined(CONFIG_M68KFPU_EMU )#define FPSTATESIZE (28) +#elif defined(CONFIG_COLDFIRE ) && defined(CONFIG_MMU ) +#define FPSTATESIZE (16)#elif defined(CONFIG_M68060 )#define FPSTATESIZE (12)#else
arch/m68k/kernel/process_mm.c +45 -14
77 lines not on this page · raw message
arch/m68k/kernel/setup_mm.c +1 -1
@@ -236,7 +236,7 @@ void __init setup_arch(char **cmdline_p)* with them, we should add a test to check_bugs() below] */ #ifndef CONFIG_M68KFPU_EMU_ONLY /* clear the fpu if we have one */ -if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 )) { +if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ; asmvolatile ("frestore %0" : :"m" (zero)); }
arch/m68k/kernel/signal_mm.c +106 -51
243 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Geert Uytterhoeven
maintainerRe: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
arch/m68k/kernel/signal_mm.c static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * · line 619
Quoted 9 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
arch/m68k/kernel/signal_mm.c +1
-4@@ -570,15 +616,12 @@ static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * return err; } - __asm__ volatile (".chip 68k/68881\n\t" - "fsave %0\n\t" - ".chip 68k" - : : "m" (*fpstate) : "memory"); + __asm__ volatile ("fsave %0" : : "m" (*fpstate) : "memory");
This change breaks one of my test configs, which builds for 68040 only:
{standard input}: Assembler messages:
{standard input}:475: Error: invalid instruction for this architecture; needs 68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060], cpu32 [68330, 68331, 68332, 68333, 68334, 68336, 68340, 68341, 68349, 68360], 547x [5470, 5471, 5472, 5473, 5474, 5475], 548x [5480, 5481, 5482, 5483, 5484, 5485] -- statement `fsave -540(%fp)' ignored
You can reproduce it by taking e.g. amiga_defconfig and disabling all of CONFIG_M68[236]0, or by manually compiling arch/m68k/kernel/signal.c with "-m68040" added (that's what 68040-only does).
By convention, we always switch to the needed CPU type using the ".chip" directive, and switch back to generic 68k afterwards. So I'd expect it to fail for all my builds, but it only does for the 68040-only ones...
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: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
Hi Geert,
Quoted 21 lines · Geert Uytterhoeven
Review static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * · line 619
Quoted 9 lines · On Fri, Dec 23, 2011 at 04:15,<[email protected]> wrote:
(quoted diff) +1
-4@@ -570,15 +616,12 @@ static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * á á á á á á á áreturn err; á á á á} - á á á __asm__ volatile (".chip 68k/68881\n\t" - á á á á á á á á á á á á "fsave %0\n\t" - á á á á á á á á á á á á ".chip 68k" - á á á á á á á á á á á á : : "m" (*fpstate) : "memory"); + á á á __asm__ volatile ("fsave %0" : : "m" (*fpstate) : "memory");This change breaks one of my test configs, which builds for 68040 only:
{standard input}: Assembler messages:
{standard input}:475: Error: invalid instruction for this architecture; needs 68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060], cpu32 [68330, 68331, 68332, 68333, 68334, 68336, 68340, 68341, 68349, 68360], 547x [5470, 5471, 5472, 5473, 5474, 5475], 548x [5480, 5481, 5482, 5483, 5484, 5485] -- statement `fsave -540(%fp)' ignored
Quoted 7 lines
You can reproduce it by taking e.g.
amiga_defconfigand disabling all of CONFIG_M68[236]0, or by manually compilingarch/m68k/kernel/signal.cwith "-m68040" added (that's what 68040-only does).By convention, we always switch to the needed CPU type using the ".chip" directive, and switch back to generic 68k afterwards. So I'd expect it to fail for all my builds, but it only does for the 68040-only ones...
Ok, I'll need to dig into this one again then :-)
I think the problem for me was that the the switch back using ".chip 68k" is no longer correct when compiling for ColdFire.
I'll have a closer look tomorrow when I have some time.
Thanks
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close, FAX: +61 7 3891 3630 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Re: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
In reply to Geert UytterhoevenHi Geert,
Quoted 21 lines · Geert Uytterhoeven
arch/m68k/kernel/signal_mm.c static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * · line 619
Quoted 9 lines · On Fri, Dec 23, 2011 at 04:15,<[email protected]> wrote:
arch/m68k/kernel/signal_mm.c +1
-4@@ -570,15 +616,12 @@ static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *return err; } - __asm__volatile (".chip 68k/68881\n\t" -"fsave %0\n\t" -".chip 68k" - : :"m" (*fpstate) :"memory" ); + __asm__volatile ("fsave %0" : :"m" (*fpstate) :"memory" );This change breaks one of my test configs, which builds for 68040 only:
{standard input}: Assembler messages:
{standard input}:475: Error: invalid instruction for this architecture; needs 68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060], cpu32 [68330, 68331, 68332, 68333, 68334, 68336, 68340, 68341, 68349, 68360], 547x [5470, 5471, 5472, 5473, 5474, 5475], 548x [5480, 5481, 5482, 5483, 5484, 5485] -- statement `fsave -540(%fp)' ignored
Quoted 7 lines
You can reproduce it by taking e.g.
amiga_defconfigand disabling all of CONFIG_M68[236]0, or by manually compilingarch/m68k/kernel/signal.cwith "-m68040" added (that's what 68040-only does).By convention, we always switch to the needed CPU type using the ".chip" directive, and switch back to generic 68k afterwards. So I'd expect it to fail for all my builds, but it only does for the 68040-only ones...
Yeah, the fail or not cases do seem strange here. But at the heart of it all it is the switching back to 68k that causes problems. And I think it is larger than just the ColdFire case.
If we are compiling specifically for a 68040 machine, where we put a -m68040 switch on the command line, isn't all these ".chip 68k" lines going to undo the CPU choice - and result in us now compiling large parts of the code for the default 68020 instead of the chosen 68040?
Now I realize that for the most part this probably isn't a big deal on any of the 68020/68030/68040/68060 (I don't know if gcc does any clever code optimizations based on those differences).
It is a big deal we are building ColdFire, switching to 68k code generation is wrong... and of course doesn't work.
I can easily fix this specific case. The calls to fsave and frestore just need to be surrounded by a CPU_IS_COLDFIRE check. So the code ends up looking like this:
if (CPU_IS_COLDFIRE) {
__asm__ volatile ("fsave %0"
: : "m" (*sc->sc_fpstate) : "memory");
} else {
__asm__ volatile (".chip 68k/68881\n\t"
"fsave %0\n\t"
".chip 68k"
: : "m" (*sc->sc_fpstate) : "memory");
}And that now seems to compile for all the cases I tried (so good for ColdFire, good for pure 68040 and mixed 68020/68030/68040/68060). I have updated the patches based on this, and pushed them back up to git.kernel.org.
I am still concerned about the use of ".chip 68k" in general though. Just not sure how we can avoid it. I guess there is no way to jus t revert to the original CPU choice?
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Geert Uytterhoeven
maintainerRe: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
Hi Greg,
Quoted 5 lines · Greg Ungerer
If we are compiling specifically for a 68040 machine, where we put a -m68040 switch on the command line, isn't all these ".chip 68k" lines going to undo the CPU choice - and result in us now compiling large parts of the code for the default 68020 instead of the chosen 68040?
No, it's a directive for the assembler, not for the compiler. It may cause issues for mnemonics (generated by the compiler) that exist for both classic and coldfire, but have different opcodes. Do these actually exist?
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: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
Hi Geert,
Quoted 8 lines · Geert Uytterhoeven
Quoted 5 lines · Greg Ungerer
If we are compiling specifically for a 68040 machine, where we put a -m68040 switch on the command line, isn't all these ".chip 68k" lines going to undo the CPU choice - and result in us now compiling large parts of the code for the default 68020 instead of the chosen 68040?
No, it's a directive for the assembler, not for the compiler.
Good point :-)
Quoted 3 lines
It may cause issues for mnemonics (generated by the compiler) that exist for both classic and coldfire, but have different opcodes. Do these actually exist?
None that I could find.
But the compiler might generate code that is coldfire only. And with that ".chip m68k" directive there it will error out. (Actually more likely - and this I have seen - is that some of the asm code that is coldfire specific trips it up). There is a handful of new and different instructions in newer ColdFires.
But even still, compiling with -m68040 causes gcc to generate different code than compiling without it (so effectively with m68020). In cases I looked at the instructions used where still fine to run on either, so nothing specific to the 68040 was generated. But if anything ever was then again the ".chip 68k" would cause an error out. I guess there isn't much extra in the 68040... move16, anything else? I guess gcc will never generate that in practice, so it is not a problem.
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close, FAX: +61 7 3891 3630 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Re: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
Quoted 8 lines · Greg Ungerer
But even still, compiling with -m68040 causes gcc to generate different code than compiling without it (so effectively with m68020). In cases I looked at the instructions used where still fine to run on either, so nothing specific to the 68040 was generated. But if anything ever was then again the ".chip 68k" would cause an error out. I guess there isn't much extra in the 68040... move16, anything else? I guess gcc will never generate that in practice, so it is not a problem.
The only 040 specific insn that gcc would generate are the fpu insns, but the kernel does not use any floating point.
Andreas.
Signature · 3 lines
Andreas Schwab, [email protected] GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
Re: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
In reply to Greg UngererQuoted 12 lines · Greg Ungerer
if (CPU_IS_COLDFIRE) {
__asm__ volatile ("fsave %0"
: : "m" (*sc->sc_fpstate) :
"memory");
} else {
__asm__ volatile (".chip 68k/68881\n\t"
"fsave %0\n\t"
".chip 68k"
: : "m" (*sc->sc_fpstate) :
"memory");
}Quoted 3 lines
I am still concerned about the use of ".chip 68k" in general though. Just not sure how we can avoid it. I guess there is no way to jus t revert to the original CPU choice?
#define CPU "68040"
_asm__ volatile (".chip 68k/68881\n\t"
"fsave %0\n\t"
".chip " CPU
: : "m" (*sc->sc_fpstate) : "memory");Josh
Re: [PATCH 32/35] m68k: add ColdFire FPU support for the V4e ColdFire CPU's
Hi Joshua,
Quoted 18 lines · Joshua Juran
Quoted 12 lines · Greg Ungerer
if (CPU_IS_COLDFIRE) { __asm__ volatile ("fsave %0" : : "m" (*sc->sc_fpstate) : "memory"); } else { __asm__ volatile (".chip 68k/68881\n\t" "fsave %0\n\t" ".chip 68k" : : "m" (*sc->sc_fpstate) : "memory"); }Quoted 3 lines
I am still concerned about the use of ".chip 68k" in general though. Just not sure how we can avoid it. I guess there is no way to jus t revert to the original CPU choice?
Quoted 6 lines
#define CPU "68040"
_asm__ volatile (".chip 68k/68881\n\t"
"fsave %0\n\t" ".chip " CPU : : "m" (*sc->sc_fpstate) : "memory");
Possibly.
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close, FAX: +61 7 3891 3630 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
PATCH v4 33/35 m68k: do not use m68k startup or interrupt code for ColdFire CPU's
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire CPUs have their own startup and interrupt code (in the platform/coldfire directory), and do not use the general m68k startup and interrupt code. So if CONFIG_COLDFIRE is true do not compile the general code for them.
--- arch/m68k/kernel/Makefile | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/m68k/kernel/Makefile +3 -1
@@ -4,13 +4,15 @@ extra-$(CONFIG_MMU) := head.o extra-$(CONFIG_SUN3) := sun3-head.o +extra-$(CONFIG_COLDFIRE):= extra-y += vmlinux.lds obj-y := entry.o init_task.o irq.o m68k_ksyms.o module.o process.o ptrace.o obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o +ifndef CONFIG_COLDFIRE obj-$(CONFIG_MMU) += ints.o vectors.o - +endif ifndef CONFIG_MMU_SUN3 obj-y += dma.o endif
Signature · 1 line
1.7.0.4
Geert Uytterhoeven
maintainerRe: [PATCH 33/35] m68k: do not use m68k startup or interrupt code for ColdFire CPU's
Quoted 20 lines · On Fri, Dec 23, 2011 at 04:15, <[email protected]> wrote:
From: Greg Ungerer <[email protected]>
The ColdFire CPUs have their own startup and interrupt code (in the platform/coldfire directory), and do not use the general m68k startup and interrupt code. So if
CONFIG_COLDFIREis true do not compile the general code for them.Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>---
arch/m68k/kernel/Makefile | 4 +++-1 files changed, 3 insertions(+), 1 deletions(-)arch/m68k/kernel/Makefile +0
-0@@ -4,13 +4,15 @@
Quoted 3 lines
extra-$(CONFIG_MMU) := head.o
extra-$(CONFIG_SUN3) := sun3-head.o
+extra-$(CONFIG_COLDFIRE):=
Why do you need the line above?
arch/m68k/kernel/Makefile line 15
Quoted 9 lines
extra-y +=
vmlinux.ldsobj-y := entry.o init_task.o irq.o m68k_ksyms.o module.o process.o ptrace.o obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o
+ifndef
CONFIG_COLDFIRE
obj-$(CONFIG_MMU) += ints.o vectors.oarch/m68k/kernel/Makefile +1
-1- +endif
Alternatively:
obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o
obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o
Quoted 3 lines
ifndef
CONFIG_MMU_SUN3
obj-y += dma.o
endif
Hmm, here it's more difficult to get rid of the "ifndef", as there's no CONFIG_NOMMU.
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: [PATCH 33/35] m68k: do not use m68k startup or interrupt code for ColdFire CPU's
Hi Geert,
Quoted 21 lines · Geert Uytterhoeven
Quoted 20 lines · On Fri, Dec 23, 2011 at 04:15,<[email protected]> wrote:
From: Greg Ungerer<[email protected]>
The ColdFire CPUs have their own startup and interrupt code (in the platform/coldfire directory), and do not use the general m68k startup and interrupt code. So if
CONFIG_COLDFIREis true do not compile the general code for them.Signed-off-by Greg Ungerer<[email protected]>Acked-by Matt Waddel<[email protected]>Acked-by Kurt Mahan<[email protected]>--- arch/m68k/kernel/Makefile | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)arch/m68k/kernel/Makefile +0
-0@@ -4,13 +4,15 @@
Quoted 5 lines
arch/m68k/kernel/Makefile
Quoted 3 lines
arch/m68k/kernel/Makefile +1
-0extra-$(CONFIG_MMU) := head.o extra-$(CONFIG_SUN3) := sun3-head.o +extra-$(CONFIG_COLDFIRE) :=Why do you need the line above?
That is to avoid using a "#ifndef CONFIG_COLDFIRE" around these. This entry clears out extra-y for the case when both CONFIG_MMU and CONFIG_COLDFIRE are set.
Quoted 10 lines
arch/m68k/kernel/Makefile line 15
Quoted 7 lines
arch/m68k/kernel/Makefile +2
-1obj-y := entry.o init_task.o irq.o m68k_ksyms.o module.o process.o ptrace.o obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o +ifndef CONFIG_COLDFIRE obj-$(CONFIG_MMU) += ints.o vectors.o - +endifAlternatively:
Quoted 2 lines
obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o
obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o
Yes, that looks nice. I'll change it to that.
Quoted 6 lines
arch/m68k/kernel/Makefile line 18
Quoted 3 lines
arch/m68k/kernel/Makefile +0
-0ifndef CONFIG_MMU_SUN3 obj-y += dma.o endifHmm, here it's more difficult to get rid of the "ifndef", as there's no
CONFIG_NOMMU.
Yes, unfortunately, I couldn't see anyway to not use the "ifndef" here.
Thanks
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close, FAX: +61 7 3891 3630 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Geert Uytterhoeven
maintainerRe: [PATCH 33/35] m68k: do not use m68k startup or interrupt code for ColdFire CPU's
Quoted 9 lines · Greg Ungerer
Quoted 5 lines
Quoted 3 lines
extra-$(CONFIG_MMU) := head.o
extra-$(CONFIG_SUN3) := sun3-head.o
+extra-$(CONFIG_COLDFIRE) :=Why do you need the line above?
That is to avoid using a "#ifndef
CONFIG_COLDFIRE" around these. This entry clears out extra-y for the case when bothCONFIG_MMUandCONFIG_COLDFIREare set.
Ooh, that's ugly, and easily overlooked (I missed it). So you don't want head.o for Coldfire. What about
extra-$(CONFIG_MMU_MOTOROLA) := head.o
extra-$(CONFIG_SUN3) := sun3-head.o
?
But since head.o is not really about MMU or not, but about the machine, perhaps it should be explicitly written as
extra-$(CONFIG_AMIGA) := head.o
extra-$(CONFIG_ATARI) := head.o
...
extra-$(CONFIG_SUN3X) := head.o
?
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: [PATCH 33/35] m68k: do not use m68k startup or interrupt code for ColdFire CPU's
Hi Geert,
Quoted 19 lines · Geert Uytterhoeven
Quoted 9 lines · Greg Ungerer
Quoted 5 lines
Quoted 3 lines
áextra-$(CONFIG_MMU) á á á á á á:= head.o
áextra-$(CONFIG_SUN3) á := sun3-head.o
+extra-$(CONFIG_COLDFIRE) á á á :=Why do you need the line above?
That is to avoid using a "#ifndef
CONFIG_COLDFIRE" around these. This entry clears out extra-y for the case when bothCONFIG_MMUandCONFIG_COLDFIREare set.Ooh, that's ugly, and easily overlooked (I missed it). So you don't want head.o for Coldfire. What about
extra-$(CONFIG_MMU_MOTOROLA) := head.o
extra-$(CONFIG_SUN3) := sun3-head.o?
Quoted 7 lines
But since head.o is not really about MMU or not, but about the machine, perhaps it should be explicitly written as
extra-$(CONFIG_AMIGA) := head.o
extra-$(CONFIG_ATARI) := head.o
...
extra-$(CONFIG_SUN3X) := head.o
I am happy to do it either way. The second option here will need a longer list. I count 8 machines that use head.o (assuming VME is a single machine type) and 1 that uses sun3-head.o. At least the first option above just has the 2 lines.
What is your preference?
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Geert Uytterhoeven
maintainerRe: [PATCH 33/35] m68k: do not use m68k startup or interrupt code for ColdFire CPU's
Hi Greg,
Quoted 29 lines · Greg Ungerer
Quoted 19 lines · Geert Uytterhoeven
Quoted 9 lines · Greg Ungerer
Quoted 5 lines
Quoted 3 lines
áextra-$(CONFIG_MMU) á á á á á á:= head.o
áextra-$(CONFIG_SUN3) á := sun3-head.o
+extra-$(CONFIG_COLDFIRE) á á á :=Why do you need the line above?
That is to avoid using a "#ifndef
CONFIG_COLDFIRE" around these. This entry clears out extra-y for the case when bothCONFIG_MMUandCONFIG_COLDFIREare set.Ooh, that's ugly, and easily overlooked (I missed it). So you don't want head.o for Coldfire. What about
extra-$(CONFIG_MMU_MOTOROLA) := head.o
extra-$(CONFIG_SUN3) := sun3-head.o?
Quoted 7 lines
But since head.o is not really about MMU or not, but about the machine, perhaps it should be explicitly written as
extra-$(CONFIG_AMIGA) := head.o
extra-$(CONFIG_ATARI) := head.o
...
extra-$(CONFIG_SUN3X) := head.o
Quoted 6 lines
I am happy to do it either way. The second option here will need a longer list. I count 8 machines that use head.o (assuming VME is a single machine type) and 1 that uses sun3-head.o. At least the first option above just has the 2 lines.
What is your preference?
The latter, as people are experimenting with MMU-less machines now.
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: [PATCH 33/35] m68k: do not use m68k startup or interrupt code for ColdFire CPU's
Hi Geert,
Quoted 32 lines · Geert Uytterhoeven
Hi Greg,
Quoted 29 lines · Greg Ungerer
Quoted 26 lines · Geert Uytterhoeven
Quoted 9 lines · On Tue, Dec 27, 2011 at 13:24, Greg Ungerer<[email protected]> áwrote:
Quoted 5 lines
Quoted 3 lines
├Ãextra-$(CONFIG_MMU) ├à ├à ├à ├à ├à ├Ã:= head.o ├Ãextra-$(CONFIG_SUN3) Å := sun3-head.o +extra-$(CONFIG_COLDFIRE) Å Å Å :=
Why do you need the line above?
That is to avoid using a "#ifndef
CONFIG_COLDFIRE" around these. This entry clears out extra-y for the case when bothCONFIG_MMUandCONFIG_COLDFIREare set.Ooh, that's ugly, and easily overlooked (I missed it). So you don't want head.o for Coldfire. What about
extra-$(CONFIG_MMU_MOTOROLA) := head.o
extra-$(CONFIG_SUN3) á := sun3-head.o?
But since head.o is not really about MMU or not, but about the machine, perhaps it should be explicitly written as
extra-$(CONFIG_AMIGA) := head.o
extra-$(CONFIG_ATARI) := head.o
...
extra-$(CONFIG_SUN3X) := head.o
Quoted 8 lines
Quoted 6 lines
I am happy to do it either way. The second option here will need a longer list. I count 8 machines that use head.o (assuming VME is a single machine type) and 1 that uses sun3-head.o. At least the first option above just has the 2 lines.
What is your preference?
The latter, as people are experimenting with MMU-less machines now.
Yep, done. I will send the revised patch here soon.
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
PATCH v4 34/35 m68k: add ColdFire with MMU enabled support to the m68k mem init code
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire has similar setup requirements to the SUN3 code, so we use that.
--- arch/m68k/mm/init_mm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/m68k/mm/init_mm.c +1 -1
@@ -139,7 +139,7 @@ void __init mem_init(void) } } -#ifndef CONFIG_SUN3 +#if !defined(CONFIG_SUN3 ) && !defined(CONFIG_COLDFIRE )/* insert pointer tables allocated so far into the tablelist */ init_pointer_table ((unsigned long )kernel_pg_dir);for (i =0 ; i <PTRS_PER_PGD ; i++) {
Signature · 1 line
1.7.0.4
PATCH v4 35/35 m68k: allow ColdFire 547x and 548x CPUs to be built with MMU enabled
In reply to [email protected]From: Greg Ungerer <[email protected]>
The ColdFire 547x and 548x CPUs have internal MMU hardware. All code to support this is now in, so we can build kernels with it enabled.
--- arch/m68k/Kconfig.cpu | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/Kconfig.cpu +2 -2
@@ -226,8 +226,8 @@ config M54xx config M547x bool "MCF547x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBAR
@@ -236,8 +236,8 @@ config M547x config M548x bool "MCF548x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBAR
Signature · 1 line
1.7.0.4
Geert Uytterhoeven
maintainerRe: [PATCH 35/35] m68k: allow ColdFire 547x and 548x CPUs to be built with MMU enabled
Hi Greg,
Quoted 28 lines · On Fri, 23 Dec 2011, [email protected] wrote:
From: Greg Ungerer <[email protected]>
The ColdFire 547x and 548x CPUs have internal MMU hardware. All code to support this is now in, so we can build kernels with it enabled.
Signed-off-by Greg Ungerer <[email protected]>Acked-by Matt Waddel <[email protected]>Acked-by Kurt Mahan <[email protected]>--- arch/m68k/Kconfig.cpu | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/m68k/Kconfig.cpu +1
-1@@ -226,8 +226,8 @@ config M54xx config M547x bool "MCF547x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBAR
arch/m68k/Kconfig.cpu config M547x · line 243
Quoted 9 lines
arch/m68k/Kconfig.cpu +1
-1@@ -236,8 +236,8 @@ config M547x config M548x bool "MCF548x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBAR
This breaks allmodconfig, which now tries to build a hybrid classic/coldfire kernel, which is not supported.
In addition, M54xx kernels with e.g. Amiga or Atari support won't build neither (I think, I haven't tried --- We may want to reconsider later as there do exist Coldfire accelerator cards for some machines).
At first I tried to fix it transparently by introducing CONFIG_M68KCLASSIC and using a combination of select and depends, cfr. Sun3 MMU support, but that failed due to a circular Kconfig dependency.
So I came up with the patch below. Note that some defconfigs must be regenerated, as they may create configs without CPU support.
Quoted 1 line
From
c56cfe6a186f45a88ffc3e628be4649ae51e61adMon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Mon, 26 Dec 2011 19:57:33 +0100
Subject: [PATCH] m68k/Kconfig: Separate classic m68k and coldfire early
While you can build multiplatform kernels for machines with classic m68k processors, you cannot mix support for classic m68k and coldfire processors. To avoid such hybrid kernels, introduce CONFIG_M68KCLASSIC as an antipole for CONFIG_COLDFIRE, and make all specific processor support depend on one of them.
All classic m68k machine support also needs to depend on this.
The defaults (CONFIG_M68KCLASSIC if MMU, CONFIG_COLDFIRE if !MMU) are chosen such to make most of the existing configs build and work.
--- arch/m68k/Kconfig.cpu | 63 +++++++++++++++++++++++++-------------------- arch/m68k/Kconfig.machine | 4 +++ 2 files changed, 39 insertions(+), 28 deletions(-)
arch/m68k/Kconfig.cpu +35 -28
@@ -1,5 +1,34 @@ comment "Processor Type" +config M68KCLASSIC + bool "Classic M68K CPU family support" + default y if MMU + help + The Freescale (was Motorola) M68K family of processors implements + the full 68000 processor instruction set. + If you anticipate running this kernel on a computer with a classic + MC68xxx processor, say Y. Otherwise, say N. + +config COLDFIRE + bool "Coldfire CPU family support" + depends on !M68KCLASSIC + select GENERIC_GPIO + select ARCH_REQUIRE_GPIOLIB + select CPU_HAS_NO_BITFIELDS + select CPU_HAS_NO_MULDIV64 + select GENERIC_CSUM + default y if !MMU + help + The Freescale ColdFire family of processors is a modern derivitive + of the 68000 processor family. They are mainly targeted at embedded + applications, and are all System-On-Chip (SOC) devices, as opposed + to stand alone CPUs. They implement a subset of the original 68000 + processor instruction set. + If you anticipate running this kernel on a computer with a ColdFire + processor, say Y. Otherwise, say N. + +if M68KCLASSIC + config M68000 bool select CPU_HAS_NO_BITFIELDS
@@ -20,20 +49,6 @@ config MCPU32 based on the 68020 processor. For the most part it is used in System-On-Chip parts, and does not contain a paging MMU. -config COLDFIRE - bool - select GENERIC_GPIO - select ARCH_REQUIRE_GPIOLIB - select CPU_HAS_NO_BITFIELDS - select CPU_HAS_NO_MULDIV64 - select GENERIC_CSUM - help - The Freescale ColdFire family of processors is a modern derivitive - of the 68000 processor family. They are mainly targeted at embedded - applications, and are all System-On-Chip (SOC) devices, as opposed - to stand alone CPUs. They implement a subset of the original 68000 - processor instruction set. - config M68020 bool "68020 support" depends on MMU
@@ -103,10 +118,13 @@ config M68360 help Motorola 68360 processor support. +endif # M68KCLASSIC + +if COLDFIRE + config M5206 bool "MCF5206" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help
@@ -115,7 +133,6 @@ config M5206 config M5206e bool "MCF5206e" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help
@@ -124,7 +141,6 @@ config M5206e config M520x bool "MCF520x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT help
@@ -133,7 +149,6 @@ config M520x config M523x bool "MCF523x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT select HAVE_IPSBAR
@@ -143,7 +158,6 @@ config M523x config M5249 bool "MCF5249" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help
@@ -155,7 +169,6 @@ config M527x config M5271 bool "MCF5271" depends on !MMU - select COLDFIRE select M527x select HAVE_CACHE_SPLIT select HAVE_IPSBAR
@@ -166,7 +179,6 @@ config M5271 config M5272 bool "MCF5272" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help
@@ -175,7 +187,6 @@ config M5272 config M5275 bool "MCF5275" depends on !MMU - select COLDFIRE select M527x select HAVE_CACHE_SPLIT select HAVE_IPSBAR
@@ -186,7 +197,6 @@ config M5275 config M528x bool "MCF528x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT select HAVE_IPSBAR
@@ -196,7 +206,6 @@ config M528x config M5307 bool "MCF5307" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_CACHE_CB select HAVE_MBAR
@@ -206,7 +215,6 @@ config M5307 config M532x bool "MCF532x" depends on !MMU - select COLDFIRE select HAVE_CACHE_CB help Freescale (Motorola) ColdFire 532x processor support.
@@ -214,7 +222,6 @@ config M532x config M5407 bool "MCF5407" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_CACHE_CB select HAVE_MBAR
@@ -226,7 +233,6 @@ config M54xx config M547x bool "MCF547x" - select COLDFIRE select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB
@@ -236,7 +242,6 @@ config M547x config M548x bool "MCF548x" - select COLDFIRE select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB
@@ -244,6 +249,8 @@ config M548x help Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support. +endif # COLDFIRE + comment "Processor Specific Options"
arch/m68k/Kconfig.machine +4 -0
@@ -1,5 +1,7 @@ comment "Machine Types" +if M68KCLASSIC + config AMIGA bool "Amiga support" depends on MMU
@@ -130,6 +132,8 @@ config SUN3 If you don't want to compile a kernel exclusively for a Sun 3, say N. +endif # M68KCLASSIC + config PILOT bool
Signature · 12 lines
1.7.0.4
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 TorvaldsGeert Uytterhoeven
maintainerRe: [PATCH 35/35] m68k: allow ColdFire 547x and 548x CPUs to be built with MMU enabled
Quoted 29 lines · Geert Uytterhoeven
From: Geert Uytterhoeven <[email protected]>
Date: Mon, 26 Dec 2011 19:57:33 +0100
Subject: [PATCH] m68k/Kconfig: Separate classic m68k and coldfire earlyWhile you can build multiplatform kernels for machines with classic m68k processors, you cannot mix support for classic m68k and coldfire processors. To avoid such hybrid kernels, introduce
CONFIG_M68KCLASSICas an antipole forCONFIG_COLDFIRE, and make all specific processor support depend on one of them.
All classic m68k machine support also needs to depend on this.The defaults (
CONFIG_M68KCLASSICif MMU,CONFIG_COLDFIREif !MMU) are chosen such to make most of the existing configs build and work.Signed-off-by Geert Uytterhoeven <[email protected]>--- arch/m68k/Kconfig.cpu | 63 +++++++++++++++++++++++++-------------------- arch/m68k/Kconfig.machine | 4 +++ 2 files changed, 39 insertions(+), 28 deletions(-)arch/m68k/Kconfig.cpu +2
-0@@ -1,5 +1,34 @@ comment "Processor Type" +config M68KCLASSIC + bool "Classic M68K CPU family support"
arch/m68k/Kconfig.cpu line 14
Quoted 10 lines
arch/m68k/Kconfig.cpu +10
-0+ default y if MMU + help + The Freescale (was Motorola) M68K family of processors implements + the full 68000 processor instruction set. + If you anticipate running this kernel on a computer with a classic + MC68xxx processor, say Y. Otherwise, say N. + +config COLDFIRE + bool "Coldfire CPU family support" + depends on !M68KCLASSIC
A choice may be a better choice:
Quoted 1 line
From
c9a9a0b9402b2f09da33a963cadff7a6c507a70bMon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Mon, 26 Dec 2011 20:22:40 +0100
Subject: [PATCH] m68k/Kconfig: Make CONFIG_M68KCLASSIC/CONFIG_COLDFIRE a choice
--- arch/m68k/Kconfig.cpu | 30 +++++++++++++++++------------- 1 files changed, 17 insertions(+), 13 deletions(-)
arch/m68k/Kconfig.cpu +17 -13
@@ -1,31 +1,35 @@ comment "Processor Type" -config M68KCLASSIC - bool "Classic M68K CPU family support" - default y if MMU +choice + prompt "CPU family support" + default M68KCLASSIC if MMU + default COLDFIRE if !MMU help The Freescale (was Motorola) M68K family of processors implements the full 68000 processor instruction set. + The Freescale ColdFire family of processors is a modern derivitive + of the 68000 processor family. They are mainly targeted at embedded + applications, and are all System-On-Chip (SOC) devices, as opposed + to stand alone CPUs. They implement a subset of the original 68000 + processor instruction set. If you anticipate running this kernel on a computer with a classic - MC68xxx processor, say Y. Otherwise, say N. + MC68xxx processor, select M68KCLASSIC. + If you anticipate running this kernel on a computer with a ColdFire + processor, select COLDFIRE. + +config M68KCLASSIC + bool "Classic M68K CPU family support" config COLDFIRE bool "Coldfire CPU family support" - depends on !M68KCLASSIC select GENERIC_GPIO select ARCH_REQUIRE_GPIOLIB select CPU_HAS_NO_BITFIELDS select CPU_HAS_NO_MULDIV64 select GENERIC_CSUM - default y if !MMU help - The Freescale ColdFire family of processors is a modern derivitive - of the 68000 processor family. They are mainly targeted at embedded - applications, and are all System-On-Chip (SOC) devices, as opposed - to stand alone CPUs. They implement a subset of the original 68000 - processor instruction set. - If you anticipate running this kernel on a computer with a ColdFire - processor, say Y. Otherwise, say N. + +endchoice if M68KCLASSIC
Signature · 12 lines
1.7.0.4
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 TorvaldsRe: [PATCH 35/35] m68k: allow ColdFire 547x and 548x CPUs to be built with MMU enabled
In reply to Geert UytterhoevenHi Geert,
Quoted 48 lines · Geert Uytterhoeven
Hi Greg,
Quoted 28 lines · On Fri, 23 Dec 2011, [email protected] wrote:
From: Greg Ungerer<[email protected]>
The ColdFire 547x and 548x CPUs have internal MMU hardware. All code to support this is now in, so we can build kernels with it enabled.
Signed-off-by Greg Ungerer<[email protected]>Acked-by Matt Waddel<[email protected]>Acked-by Kurt Mahan<[email protected]>--- arch/m68k/Kconfig.cpu | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/m68k/Kconfig.cpu +1
-1@@ -226,8 +226,8 @@ config M54xx config M547x bool "MCF547x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBARarch/m68k/Kconfig.cpu config M547x · line 243
Quoted 9 lines
arch/m68k/Kconfig.cpu +1
-1@@ -236,8 +236,8 @@ config M547x config M548x bool "MCF548x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBARThis breaks allmodconfig, which now tries to build a hybrid classic/coldfire kernel, which is not supported.
In addition, M54xx kernels with e.g. Amiga or Atari support won't build neither (I think, I haven't tried --- We may want to reconsider later as there do exist Coldfire accelerator cards for some machines).
Quoted 6 lines
At first I tried to fix it transparently by introducing
CONFIG_M68KCLASSICand using a combination of select and depends, cfr. Sun3 MMU support, but that failed due to a circularKconfigdependency.So I came up with the patch below. Note that some defconfigs must be regenerated, as they may create configs without CPU support.
Yep, that makes sense. I had considered during development of these patches if we needed something like a M68KCLASSIC define. Looks like we do :-)
I applied this patch before the the 0035 patch that created this problem. So that should keep everything able to build (and bisectable) with allmodconfig. I also squashed the change to use "choice" into this patch as well.
When I get another minute I'll look at updating the defconfigs based on this too.
Thanks!
Greg
Quoted 230 lines
from
c56cfe6a186f45a88ffc3e628be4649ae51e61adMon Sep 17 00:00:00 2001
From: Geert Uytterhoeven<[email protected]>
Date: Mon, 26 Dec 2011 19:57:33 +0100
Subject: [PATCH] m68k/Kconfig: Separate classic m68k and coldfire earlyWhile you can build multiplatform kernels for machines with classic m68k processors, you cannot mix support for classic m68k and coldfire processors. To avoid such hybrid kernels, introduce
CONFIG_M68KCLASSICas an antipole forCONFIG_COLDFIRE, and make all specific processor support depend on one of them.
All classic m68k machine support also needs to depend on this.The defaults (
CONFIG_M68KCLASSICif MMU,CONFIG_COLDFIREif !MMU) are chosen such to make most of the existing configs build and work.Signed-off-by Geert Uytterhoeven<[email protected]>--- arch/m68k/Kconfig.cpu | 63 +++++++++++++++++++++++++-------------------- arch/m68k/Kconfig.machine | 4 +++ 2 files changed, 39 insertions(+), 28 deletions(-)arch/m68k/Kconfig.cpu +35
-28@@ -1,5 +1,34 @@ comment "Processor Type" +config M68KCLASSIC + bool "Classic M68K CPU family support" + default y if MMU + help + The Freescale (was Motorola) M68K family of processors implements + the full 68000 processor instruction set. + If you anticipate running this kernel on a computer with a classic + MC68xxx processor, say Y. Otherwise, say N. + +config COLDFIRE + bool "Coldfire CPU family support" + depends on !M68KCLASSIC + select GENERIC_GPIO + select ARCH_REQUIRE_GPIOLIB + select CPU_HAS_NO_BITFIELDS + select CPU_HAS_NO_MULDIV64 + select GENERIC_CSUM + default y if !MMU + help + The Freescale ColdFire family of processors is a modern derivitive + of the 68000 processor family. They are mainly targeted at embedded + applications, and are all System-On-Chip (SOC) devices, as opposed + to stand alone CPUs. They implement a subset of the original 68000 + processor instruction set. + If you anticipate running this kernel on a computer with a ColdFire + processor, say Y. Otherwise, say N. + +if M68KCLASSIC + config M68000 bool select CPU_HAS_NO_BITFIELDS@@ -20,20 +49,6 @@ config MCPU32 based on the 68020 processor. For the most part it is used in System-On-Chip parts, and does not contain a paging MMU. -config COLDFIRE - bool - select GENERIC_GPIO - select ARCH_REQUIRE_GPIOLIB - select CPU_HAS_NO_BITFIELDS - select CPU_HAS_NO_MULDIV64 - select GENERIC_CSUM - help - The Freescale ColdFire family of processors is a modern derivitive - of the 68000 processor family. They are mainly targeted at embedded - applications, and are all System-On-Chip (SOC) devices, as opposed - to stand alone CPUs. They implement a subset of the original 68000 - processor instruction set. - config M68020 bool "68020 support" depends on MMU@@ -103,10 +118,13 @@ config M68360 help Motorola 68360 processor support. +endif # M68KCLASSIC + +if COLDFIRE + config M5206 bool "MCF5206" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -115,7 +133,6 @@ config M5206 config M5206e bool "MCF5206e" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -124,7 +141,6 @@ config M5206e config M520x bool "MCF520x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT help@@ -133,7 +149,6 @@ config M520x config M523x bool "MCF523x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -143,7 +158,6 @@ config M523x config M5249 bool "MCF5249" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -155,7 +169,6 @@ config M527x config M5271 bool "MCF5271" depends on !MMU - select COLDFIRE select M527x select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -166,7 +179,6 @@ config M5271 config M5272 bool "MCF5272" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -175,7 +187,6 @@ config M5272 config M5275 bool "MCF5275" depends on !MMU - select COLDFIRE select M527x select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -186,7 +197,6 @@ config M5275 config M528x bool "MCF528x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -196,7 +206,6 @@ config M528x config M5307 bool "MCF5307" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_CACHE_CB select HAVE_MBAR@@ -206,7 +215,6 @@ config M5307 config M532x bool "MCF532x" depends on !MMU - select COLDFIRE select HAVE_CACHE_CB help Freescale (Motorola) ColdFire 532x processor support.@@ -214,7 +222,6 @@ config M532x config M5407 bool "MCF5407" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_CACHE_CB select HAVE_MBAR@@ -226,7 +233,6 @@ config M54xx config M547x bool "MCF547x" - select COLDFIRE select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB@@ -236,7 +242,6 @@ config M547x config M548x bool "MCF548x" - select COLDFIRE select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB@@ -244,6 +249,8 @@ config M548x help Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support. +endif # COLDFIRE + comment "Processor Specific Options"arch/m68k/Kconfig.machine +4
-0@@ -1,5 +1,7 @@ comment "Machine Types" +if M68KCLASSIC + config AMIGA bool "Amiga support" depends on MMU@@ -130,6 +132,8 @@ config SUN3 If you don't want to compile a kernel exclusively for a Sun 3, say N. +endif # M68KCLASSIC + config PILOT bool
Signature · 5 lines
------------------------------------------------------------------------ Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Re: [PATCH 35/35] m68k: allow ColdFire 547x and 548x CPUs to be built with MMU enabled
Hi Geert,
Quoted 58 lines · Greg Ungerer
Quoted 46 lines · Geert Uytterhoeven
Quoted 28 lines · On Fri, 23 Dec 2011, [email protected] wrote:
From: Greg Ungerer<[email protected]>
The ColdFire 547x and 548x CPUs have internal MMU hardware. All code to support this is now in, so we can build kernels with it enabled.
Signed-off-by Greg Ungerer<[email protected]>Acked-by Matt Waddel<[email protected]>Acked-by Kurt Mahan<[email protected]>--- arch/m68k/Kconfig.cpu | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/m68k/Kconfig.cpu +1
-1@@ -226,8 +226,8 @@ config M54xx config M547x bool "MCF547x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBARarch/m68k/Kconfig.cpu config M547x · line 243
Quoted 9 lines
arch/m68k/Kconfig.cpu +1
-1@@ -236,8 +236,8 @@ config M547x config M548x bool "MCF548x" - depends on !MMU select COLDFIRE + select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBARThis breaks allmodconfig, which now tries to build a hybrid classic/coldfire kernel, which is not supported.
In addition, M54xx kernels with e.g. Amiga or Atari support won't build neither (I think, I haven't tried --- We may want to reconsider later as there do exist Coldfire accelerator cards for some machines).
Quoted 6 lines
At first I tried to fix it transparently by introducing
CONFIG_M68KCLASSICand using a combination of select and depends, cfr. Sun3 MMU support, but that failed due to a circularKconfigdependency.So I came up with the patch below. Note that some defconfigs must be regenerated, as they may create configs without CPU support.
Yep, that makes sense. I had considered during development of these patches if we needed something like a M68KCLASSIC define. Looks like we do :-)
Quoted 7 lines
I applied this patch before the the 0035 patch that created this problem. So that should keep everything able to build (and bisectable) with allmodconfig. I also squashed the change to use "choice" into this patch as well.
When I get another minute I'll look at updating the defconfigs based on this too.
Ran through all the defconfigs again, and with the choice change none of them needed updating. They all build with the correct CPU choices in place.
Nice work :-)
Regards
Greg
Quoted 232 lines
Quoted 230 lines
from
c56cfe6a186f45a88ffc3e628be4649ae51e61adMon Sep 17 00:00:00 2001
From: Geert Uytterhoeven<[email protected]>
Date: Mon, 26 Dec 2011 19:57:33 +0100
Subject: [PATCH] m68k/Kconfig: Separate classic m68k and coldfire earlyWhile you can build multiplatform kernels for machines with classic m68k processors, you cannot mix support for classic m68k and coldfire processors. To avoid such hybrid kernels, introduce
CONFIG_M68KCLASSICas an antipole forCONFIG_COLDFIRE, and make all specific processor support depend on one of them.
All classic m68k machine support also needs to depend on this.The defaults (
CONFIG_M68KCLASSICif MMU,CONFIG_COLDFIREif !MMU) are chosen such to make most of the existing configs build and work.Signed-off-by Geert Uytterhoeven<[email protected]>--- arch/m68k/Kconfig.cpu | 63 +++++++++++++++++++++++++-------------------- arch/m68k/Kconfig.machine | 4 +++ 2 files changed, 39 insertions(+), 28 deletions(-)arch/m68k/Kconfig.cpu +35
-28@@ -1,5 +1,34 @@ comment "Processor Type" +config M68KCLASSIC + bool "Classic M68K CPU family support" + default y if MMU + help + The Freescale (was Motorola) M68K family of processors implements + the full 68000 processor instruction set. + If you anticipate running this kernel on a computer with a classic + MC68xxx processor, say Y. Otherwise, say N. + +config COLDFIRE + bool "Coldfire CPU family support" + depends on !M68KCLASSIC + select GENERIC_GPIO + select ARCH_REQUIRE_GPIOLIB + select CPU_HAS_NO_BITFIELDS + select CPU_HAS_NO_MULDIV64 + select GENERIC_CSUM + default y if !MMU + help + The Freescale ColdFire family of processors is a modern derivitive + of the 68000 processor family. They are mainly targeted at embedded + applications, and are all System-On-Chip (SOC) devices, as opposed + to stand alone CPUs. They implement a subset of the original 68000 + processor instruction set. + If you anticipate running this kernel on a computer with a ColdFire + processor, say Y. Otherwise, say N. + +if M68KCLASSIC + config M68000 bool select CPU_HAS_NO_BITFIELDS@@ -20,20 +49,6 @@ config MCPU32 based on the 68020 processor. For the most part it is used in System-On-Chip parts, and does not contain a paging MMU. -config COLDFIRE - bool - select GENERIC_GPIO - select ARCH_REQUIRE_GPIOLIB - select CPU_HAS_NO_BITFIELDS - select CPU_HAS_NO_MULDIV64 - select GENERIC_CSUM - help - The Freescale ColdFire family of processors is a modern derivitive - of the 68000 processor family. They are mainly targeted at embedded - applications, and are all System-On-Chip (SOC) devices, as opposed - to stand alone CPUs. They implement a subset of the original 68000 - processor instruction set. - config M68020 bool "68020 support" depends on MMU@@ -103,10 +118,13 @@ config M68360 help Motorola 68360 processor support. +endif # M68KCLASSIC + +if COLDFIRE + config M5206 bool "MCF5206" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -115,7 +133,6 @@ config M5206 config M5206e bool "MCF5206e" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -124,7 +141,6 @@ config M5206e config M520x bool "MCF520x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT help@@ -133,7 +149,6 @@ config M520x config M523x bool "MCF523x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -143,7 +158,6 @@ config M523x config M5249 bool "MCF5249" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -155,7 +169,6 @@ config M527x config M5271 bool "MCF5271" depends on !MMU - select COLDFIRE select M527x select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -166,7 +179,6 @@ config M5271 config M5272 bool "MCF5272" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_MBAR help@@ -175,7 +187,6 @@ config M5272 config M5275 bool "MCF5275" depends on !MMU - select COLDFIRE select M527x select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -186,7 +197,6 @@ config M5275 config M528x bool "MCF528x" depends on !MMU - select COLDFIRE select GENERIC_CLOCKEVENTS select HAVE_CACHE_SPLIT select HAVE_IPSBAR@@ -196,7 +206,6 @@ config M528x config M5307 bool "MCF5307" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_CACHE_CB select HAVE_MBAR@@ -206,7 +215,6 @@ config M5307 config M532x bool "MCF532x" depends on !MMU - select COLDFIRE select HAVE_CACHE_CB help Freescale (Motorola) ColdFire 532x processor support.@@ -214,7 +222,6 @@ config M532x config M5407 bool "MCF5407" depends on !MMU - select COLDFIRE select COLDFIRE_SW_A7 select HAVE_CACHE_CB select HAVE_MBAR@@ -226,7 +233,6 @@ config M54xx config M547x bool "MCF547x" - select COLDFIRE select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB@@ -236,7 +242,6 @@ config M547x config M548x bool "MCF548x" - select COLDFIRE select MMU_COLDFIRE if MMU select M54xx select HAVE_CACHE_CB@@ -244,6 +249,8 @@ config M548x help Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support. +endif # COLDFIRE + comment "Processor Specific Options"arch/m68k/Kconfig.machine +4
-0@@ -1,5 +1,7 @@ comment "Machine Types" +if M68KCLASSIC + config AMIGA bool "Amiga support" depends on MMU@@ -130,6 +132,8 @@ config SUN3 If you don't want to compile a kernel exclusively for a Sun 3, say N. +endif # M68KCLASSIC + config PILOT bool
Signature · 5 lines
------------------------------------------------------------------------ Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com