m68k: prepare to support ColdFire M5441x MMU enabled
Subsystems (2)
Greg Ungerer
maintainercover m68k: prepare to support ColdFire M5441x MMU enabled
The following changes are in preparation for supporting the ColdFire M5441x SoC with its MMU enabled. (It is already supported in the no-MMU mode).
Quite a few relate to the ability to run with no FPU hardware (and no software emulation of FP). I have taken CONFIG_FPU to mean that we expect a hardware FPU to be present - and we generate code to support that in the kernel. If CONFIG_FPU is not defined we generate no support code (so no use of FPU specific instructions). That is mostly what the code already did, but not comepletely.
I don't actually enable the M5441x to run with MMU enabled in this series. I don't have that hardware, so I can't verify that it actually works. But these changes don't break the m547x, so I expect all is ok. With the extra MMU enabling configuration line added you can cleanly build for the M5441x with MMU enabled after this series though.
These patches are based on the ideas from Yannick Gicquel's <[email protected]> patches from some time back.
Regards
Greg
arch/m68k/Kconfig | 1 arch/m68k/Kconfig.cpu | 6 +++++ arch/m68k/coldfire/head.S | 8 +++--- arch/m68k/coldfire/m54xx.c | 40 ---------------------------------- arch/m68k/include/asm/m5441xsim.h | 4 +++ arch/m68k/include/asm/m54xxacr.h | 2 - arch/m68k/include/asm/m54xxsim.h | 4 +++ arch/m68k/include/asm/mcfmmu.h | 1 arch/m68k/include/uapi/asm/bootinfo.h | 1 arch/m68k/kernel/process.c | 4 +-- arch/m68k/kernel/setup_mm.c | 5 ++-- arch/m68k/mm/mcfmmu.c | 31 +++++++++++++++++++++++++- 12 files changed, 57 insertions(+), 50 deletions(-)
Greg Ungerer
maintainerPATCH 1/8 m68k: move CONFIG_FPU set to per-CPU configuration
Move the selection of CONFIG_FPU to each CPU type configuration.
Currently for m68k we have a global set of CONFIG_FPU based on if CONFIG_MMU is enabled or not. There is at least one CPU family we support (m5441x) that has an MMU but has no FPU hardware. So we need to be able to have CONFIG_MMU set and CONFIG_FPU not set.
Whether we build for a CPU with MMU enabled or not doesn't change the fact that it has FPU hardware support. Our current non-MMU builds have never had CONIG_FPU enabled - and in fact the kernel will not compile with that set and CONFIG_MMU not set at the moment. It is easy enough to fix this - but it would involve a structure change to sigcontext.h, and that is a user space exported header (so ABI change).
This change makes no configuration visible changes, and all configs end up with the same configuration settings as before.
This change based on changes and discussion from Yannick Gicquel <[email protected]>.
--- arch/m68k/Kconfig | 1 - arch/m68k/Kconfig.cpu | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-)
arch/m68k/Kconfig +0 -1
@@ -14,7 +14,6 @@ config M68K select GENERIC_IOMAP select GENERIC_STRNCPY_FROM_USER if MMU select GENERIC_STRNLEN_USER if MMU - select FPU if MMU select ARCH_WANT_IPC_PARSE_VERSION select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
arch/m68k/Kconfig.cpu +6 -0
@@ -62,6 +62,7 @@ config MCPU32 config M68020 bool "68020 support" depends on MMU + select FPU select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68020
@@ -72,6 +73,7 @@ config M68020 config M68030 bool "68030 support" depends on MMU && !MMU_SUN3 + select FPU select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68030
@@ -81,6 +83,7 @@ config M68030 config M68040 bool "68040 support" depends on MMU && !MMU_SUN3 + select FPU select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68LC040
@@ -91,6 +94,7 @@ config M68040 config M68060 bool "68060 support" depends on MMU && !MMU_SUN3 + select FPU select CPU_HAS_ADDRESS_SPACES help If you anticipate running this kernel on a computer with a MC68060
@@ -259,6 +263,7 @@ config M547x bool "MCF547x" select M54xx select MMU_COLDFIRE if MMU + select FPU if MMU select HAVE_CACHE_CB select HAVE_MBAR select CPU_NO_EFFICIENT_FFS
@@ -268,6 +273,7 @@ config M547x config M548x bool "MCF548x" select MMU_COLDFIRE if MMU + select FPU if MMU select M54xx select HAVE_CACHE_CB select HAVE_MBAR
Signature · 1 line
1.9.1
Greg Ungerer
maintainerPATCH 2/8 m68k: set appropriate machine type for m5411x SoC platforms
In reply to Greg UngererCreate a new machine type for platforms based around the ColdFire 5441x SoC family. Set that machine type on startup when building for this platform type.
Currently the ColdFire head.S hard codes a M54xx machine type at startup - since that is the only platform type currently supported with MMU enabled. The m5441x has an MMU and this change forms part of the support required to run it with the MMU enabled.
--- arch/m68k/coldfire/head.S | 4 ++-- arch/m68k/include/asm/m5441xsim.h | 1 + arch/m68k/include/asm/m54xxsim.h | 1 + arch/m68k/include/uapi/asm/bootinfo.h | 1 + arch/m68k/kernel/setup_mm.c | 1 + 5 files changed, 6 insertions(+), 2 deletions(-)
arch/m68k/coldfire/head.S +2 -2
@@ -282,8 +282,8 @@ _clear_bss: 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 */ + movel #MACHINE,%d0 + movel %d0,m68k_machtype /* Mark machine type */ lea init_task,%a2 /* Set "current" init task */ #endif
arch/m68k/include/asm/m5441xsim.h +1 -0
@@ -10,6 +10,7 @@#define CPU_NAME "COLDFIRE(m5441x)"#define CPU_INSTR_PER_JIFFY 2#define MCF_BUSCLK (MCF_CLK / 2) +#define MACHINE MACH_M5441X#include <asm/m54xxacr.h>
arch/m68k/include/asm/m54xxsim.h +1 -0
@@ -8,6 +8,7 @@#define CPU_NAME "COLDFIRE(m54xx)"#define CPU_INSTR_PER_JIFFY 2#define MCF_BUSCLK (MCF_CLK / 2) +#define MACHINE MACH_M54XX#include <asm/m54xxacr.h>
arch/m68k/include/uapi/asm/bootinfo.h +1 -0
@@ -81,6 +81,7 @@ struct mem_info {#define MACH_Q40 10#define MACH_SUN3X 11#define MACH_M54XX 12 +#define MACH_M5441X 13/*
arch/m68k/kernel/setup_mm.c +1 -0
@@ -341,6 +341,7 @@ void __init setup_arch(char **cmdline_p)#endif #ifdef CONFIG_COLDFIRE case MACH_M54XX : +case MACH_M5441X :config_BSP (NULL ,0 );break ;#endif
Signature · 1 line
1.9.1
Greg Ungerer
maintainerPATCH 3/8 m68k: report correct FPU type on ColdFire MMU platforms
In reply to Greg UngererNot all ColdFire SoC parts that have an MMU also have an FPU - so set an FPU type (via m68k_fputype) appropriate for the configured platform.
With this set correctly /proc/cpuinfo will report FPU "none" on devices that don't have one. And kernel code paths that initialize FPU hardware will now only execute if an FPU is actually present.
--- arch/m68k/coldfire/head.S | 4 ++-- arch/m68k/include/asm/m5441xsim.h | 1 + arch/m68k/include/asm/m54xxsim.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
arch/m68k/coldfire/head.S +2 -2
@@ -280,8 +280,8 @@ _clear_bss: 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 #FPUTYPE,%d0 + movel %d0,m68k_fputype /* Mark FPU type */ movel #MACHINE,%d0 movel %d0,m68k_machtype /* Mark machine type */ lea init_task,%a2 /* Set "current" init task */
arch/m68k/include/asm/m5441xsim.h +1 -0
@@ -11,6 +11,7 @@#define CPU_INSTR_PER_JIFFY 2#define MCF_BUSCLK (MCF_CLK / 2)#define MACHINE MACH_M5441X +#define FPUTYPE 0#include <asm/m54xxacr.h>
arch/m68k/include/asm/m54xxsim.h +1 -0
@@ -9,6 +9,7 @@#define CPU_INSTR_PER_JIFFY 2#define MCF_BUSCLK (MCF_CLK / 2)#define MACHINE MACH_M54XX +#define FPUTYPE FPU_COLDFIRE#include <asm/m54xxacr.h>
Signature · 1 line
1.9.1
Greg Ungerer
maintainerPATCH 4/8 m68k: move ColdFire _bootmem_alloc code
In reply to Greg UngererThe early ColdFire bootmem_alloc() code is currently only included in the board support for the Coldire 54xx platforms. It will be used on all ColdFire MMU enabled platforms as others are supported. So move the mcf54xx_bootmem_alloc() function to be generally available to all MMU enabled ColdFire parts (and use a more generic name for it).
--- arch/m68k/coldfire/m54xx.c | 40 +--------------------------------------- arch/m68k/include/asm/mcfmmu.h | 1 + arch/m68k/mm/mcfmmu.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 40 deletions(-)
arch/m68k/coldfire/m54xx.c +1 -39
@@ -25,7 +25,6 @@#include <asm/m54xxgpt.h> #ifdef CONFIG_MMU #include <asm/mmu_context.h> -#include <linux/pfn.h> #endif /***************************************************************************/
@@ -78,47 +77,10 @@ static void mcf54xx_reset(void)/***************************************************************************/ -#ifdef CONFIG_MMU - -unsigned long num_pages; - -static void __init mcf54xx_bootmem_alloc (void ) -{ -unsigned long start_pfn; -unsigned long memstart; - -/* _rambase and _ramend will be naturally page aligned */ - m68k_memory[0 ].addr = _rambase; - m68k_memory[0 ].size = _ramend - _rambase; - -/* compute total pages in system */ - num_pages =PFN_DOWN (_ramend - _rambase); - -/* page numbers */ - memstart =PAGE_ALIGN (_ramstart); - min_low_pfn =PFN_DOWN (_rambase); - start_pfn =PFN_DOWN (memstart); - max_pfn = max_low_pfn =PFN_DOWN (_ramend); - high_memory = (void *)_ramend; - - m68k_virt_to_node_shift =fls (_ramend - _rambase -1 ) -6 ; -module_fixup (NULL , __start_fixup, __stop_fixup); - -/* setup bootmem data */ -m68k_setup_node (0 ); - memstart +=init_bootmem_node (NODE_DATA (0 ), start_pfn, - min_low_pfn, max_low_pfn); -free_bootmem_node (NODE_DATA (0 ), memstart, _ramend - memstart); -} - -#endif /* CONFIG_MMU */ - -/***************************************************************************/ -void __init config_BSP (char *commandp,int size) {#ifdef CONFIG_MMU -mcf54xx_bootmem_alloc (); +cf_bootmem_alloc ();mmu_context_init ();#endif mach_reset = mcf54xx_reset;
arch/m68k/include/asm/mcfmmu.h +1 -0
@@ -105,6 +105,7 @@ static inline void mmu_write(u32 a, u32 v) __asm__ __volatile__ ("nop"); } +void cf_bootmem_alloc (void );int cf_tlb_miss (struct pt_regs *regs,int write,int dtlb,int extension_word);#endif
arch/m68k/mm/mcfmmu.c +30 -1
@@ -27,7 +27,7 @@ mm_context_t next_mmu_context;unsigned long context_map[LAST_CONTEXT /BITS_PER_LONG +1 ];atomic_t nr_free_contexts;struct mm_struct *context_mm[LAST_CONTEXT +1 ]; -extern unsigned long num_pages; +unsigned long num_pages;/* * ColdFire paging_init derived from sun3.
@@ -150,6 +150,35 @@ int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word)return 0 ; } +void __init cf_bootmem_alloc (void ) +{ +unsigned long start_pfn; +unsigned long memstart; + +/* _rambase and _ramend will be naturally page aligned */ + m68k_memory[0 ].addr = _rambase; + m68k_memory[0 ].size = _ramend - _rambase; + +/* compute total pages in system */ + num_pages =PFN_DOWN (_ramend - _rambase); + +/* page numbers */ + memstart =PAGE_ALIGN (_ramstart); + min_low_pfn =PFN_DOWN (_rambase); + start_pfn =PFN_DOWN (memstart); + max_pfn = max_low_pfn =PFN_DOWN (_ramend); + high_memory = (void *)_ramend; + + m68k_virt_to_node_shift =fls (_ramend - _rambase -1 ) -6 ; +module_fixup (NULL , __start_fixup, __stop_fixup); + +/* setup bootmem data */ +m68k_setup_node (0 ); + memstart +=init_bootmem_node (NODE_DATA (0 ), start_pfn, + min_low_pfn, max_low_pfn); +free_bootmem_node (NODE_DATA (0 ), memstart, _ramend - memstart); +} +/* * Initialize the context management stuff. * The following was taken from arch/ppc/mmu_context.c
Signature · 1 line
1.9.1
Greg Ungerer
maintainerPATCH 5/8 m68k: generalize io memory region setup for ColdFire ACR registers
In reply to Greg UngererThe ACR registers of the ColdFire define at a macro level what regions of the addresses space should have caching or other attribute types applied.
Currently for the MMU enabled setups we map the interal IO peripheral addres space as uncachable based on the define for the MBAR address (CONFIG_MBAR). Not all ColdFire SoC use a programmable MBAR register address. Some parts have fixed addressing for their internal peripheral registers.
Generalize the way we get the internal peripheral base address so all types can be accomodated in the ACR definitions. Each ColdFire SoC type now sets its IO memory base and size definitions (which may be based on MBAR) which are then used in the ACR definitions.
--- arch/m68k/include/asm/m5441xsim.h | 2 ++ arch/m68k/include/asm/m54xxacr.h | 2 +- arch/m68k/include/asm/m54xxsim.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-)
arch/m68k/include/asm/m5441xsim.h +2 -0
@@ -12,6 +12,8 @@#define MCF_BUSCLK (MCF_CLK / 2)#define MACHINE MACH_M5441X#define FPUTYPE 0 +#define IOMEMBASE 0xe0000000 +#define IOMEMSIZE 0x20000000#include <asm/m54xxacr.h>
arch/m68k/include/asm/m54xxacr.h +1 -1
@@ -94,7 +94,7 @@* 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)+ \ +#define ACR0_MODE (ACR_BA(IOMEMBASE)+ACR_ADMSK(IOMEMSIZE)+ \ ACR_ENABLE+ACR_SUPER+ACR_CM_OFF_PRE+ACR_SP)#if defined(CONFIG_CACHE_COPYBACK )#define ACR1_MODE (ACR_BA(CONFIG_RAMBASE)+ACR_ADMSK(CONFIG_RAMSIZE)+ \
arch/m68k/include/asm/m54xxsim.h +2 -0
@@ -10,6 +10,8 @@#define MCF_BUSCLK (MCF_CLK / 2)#define MACHINE MACH_M54XX#define FPUTYPE FPU_COLDFIRE +#define IOMEMBASE MCF_MBAR +#define IOMEMSIZE 0x01000000#include <asm/m54xxacr.h>
Signature · 1 line
1.9.1
Greg Ungerer
maintainerPATCH 6/8 m68k: always make available dump_fpu()
In reply to Greg UngererOur local m68k architecture dump_fpu() is conditionally compiled in on CONFIG_FPU. That is OK for all existing MMU enabled CPU types, but won't handle the case for some ColdFire SoC CPU parts that we want to support that have no FPU hardware.
dump_fpu() is expected to be present by the ELF loader, so we must always have it available and exported.
Modify the position of the conditional to allow supporting the case where CONFIG_FPU is not defined.
This change based on changes and discussion from Yannick Gicquel <[email protected]>.
--- arch/m68k/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/m68k/kernel/process.c +2 -2
@@ -203,7 +203,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, }/* Fill in the fpu structure for a core dump. */ -#ifdef CONFIG_FPU int dump_fpu (struct pt_regs *regs,struct user_m68kfp_struct *fpu) {char fpustate[216 ];
@@ -222,6 +221,7 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)return 1 ; } +#ifdef CONFIG_FPU /* First dump the fpu context to avoid protocol violation. */ asmvolatile ("fsave %0" ::"m" (fpustate[0 ]) :"memory" );if (!CPU_IS_060 ? !fpustate[0 ] : !fpustate[2 ])
@@ -248,11 +248,11 @@ int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu) : "m" (fpu->fpregs[0]) : "memory"); } +#endif /* CONFIG_FPU */ return 1 ; }EXPORT_SYMBOL (dump_fpu); -#endif /* CONFIG_FPU */ unsigned long get_wchan (struct task_struct *p) {
Signature · 1 line
1.9.1
Greg Ungerer
maintainerPATCH 7/8 m68k: only generate FPU instructions of CONFIG_FPU
In reply to Greg UngererMost of the m68k code that supports a hardware FPU is surrounded by CONFIG_FPU. Except this setup code in setup_mm.c. Be consistent and surround these hardware FPU instructions with CONFIG_FPU instead of a check based on CONFIG_M68KFPU_EMU_ONLY.
The side effect of this is that we can now compile a kernel with no m68k/ColdFire hardware support FPU instructions at all (if we do not define CONFIG_FPU).
--- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/setup_mm.c +1 -1
@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)* We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#ifdef CONFIG_FPU /* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ;
Signature · 1 line
1.9.1
Geert Uytterhoeven
maintainerRe: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
Hi Greg,
Quoted 19 lines · Greg Ungerer
Most of the m68k code that supports a hardware FPU is surrounded by
CONFIG_FPU. Except this setup code insetup_mm.c. Be consistent and surround these hardware FPU instructions withCONFIG_FPUinstead of a check based onCONFIG_M68KFPU_EMU_ONLY.The side effect of this is that we can now compile a kernel with no m68k/ColdFire hardware support FPU instructions at all (if we do not define
CONFIG_FPU).Signed-off-by Greg Ungerer <[email protected]>--- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/m68k/kernel/setup_mm.c +0
-0
arch/m68k/kernel/setup_mm.c void __init setup_arch(char **cmdline_p) · line 251
Quoted 8 lines
arch/m68k/kernel/setup_mm.c +1
-1@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)* We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#ifdef CONFIG_FPU /* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ;
This piece of code is now compiled in if CONFIG_M68KFPU_EMU_ONLY=y?
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
Greg Ungerer
maintainerRe: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
Hi Geert,
Quoted 17 lines · Geert Uytterhoeven
Hi Greg,
Quoted 14 lines · Greg Ungerer
Most of the m68k code that supports a hardware FPU is surrounded by
CONFIG_FPU. Except this setup code insetup_mm.c. Be consistent and surround these hardware FPU instructions withCONFIG_FPUinstead of a check based onCONFIG_M68KFPU_EMU_ONLY.The side effect of this is that we can now compile a kernel with no m68k/ColdFire hardware support FPU instructions at all (if we do not define
CONFIG_FPU).Signed-off-by Greg Ungerer <[email protected]>--- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
arch/m68k/kernel/setup_mm.c void __init setup_arch(char **cmdline_p) · line 251
Quoted 13 lines
arch/m68k/kernel/setup_mm.c +1
-1@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)* We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#ifdef CONFIG_FPU /* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ;This piece of code is now compiled in if
CONFIG_M68KFPU_EMU_ONLY=y?
Yes, that is true. In that scenario I would expect m68k_fputype to be 0. So it wouldn't be executed.
The problem for me on ColdFire is that we currently do not support the FPU emulation (the assembler for it is not ColdFire clean). So in this case here we can't have CONFIG_M68KFPU_EMU_ONLY=y.
Would you prefer if it became:
#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU_ONL)
For the existing classic m68k machines they always currently have CONFIG_FPU set. So that would be no change for them. And for the ColdFire machines that do not have FPU hardware we are good because CONFIG_FPU won't be set.
Regards
Greg
Geert Uytterhoeven
maintainerRe: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
Hi Greg,
Quoted 35 lines · Greg Ungerer
Quoted 15 lines · Geert Uytterhoeven
Quoted 14 lines · Greg Ungerer
Most of the m68k code that supports a hardware FPU is surrounded by
CONFIG_FPU. Except this setup code insetup_mm.c. Be consistent and surround these hardware FPU instructions withCONFIG_FPUinstead of a check based onCONFIG_M68KFPU_EMU_ONLY.The side effect of this is that we can now compile a kernel with no m68k/ColdFire hardware support FPU instructions at all (if we do not define
CONFIG_FPU).Signed-off-by Greg Ungerer <[email protected]>--- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 15 lines
arch/m68k/kernel/setup_mm.c void __init setup_arch(char **cmdline_p) · line 251
Quoted 13 lines
arch/m68k/kernel/setup_mm.c +1
-1@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)* We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#ifdef CONFIG_FPU /* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ;This piece of code is now compiled in if
CONFIG_M68KFPU_EMU_ONLY=y?Yes, that is true. In that scenario I would expect
m68k_fputypeto be 0. So it wouldn't be executed.
Quoted 7 lines
The problem for me on ColdFire is that we currently do not support the FPU emulation (the assembler for it is not ColdFire clean). So in this case here we can't have
CONFIG_M68KFPU_EMU_ONLY=y.Would you prefer if it became:
#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU_ONL)
(with the missing "Y" added)
Yes, I prefer not to change the semantics of M68KFPU_EMU_ONLY, whose help text states:
"This option prevents any floating-point instructions from being
compiled into the kernel"
Thanks!
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
Greg Ungerer
maintainerRe: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
Hi Geert,
Quoted 42 lines · Geert Uytterhoeven
Hi Greg,
Quoted 39 lines · Greg Ungerer
Quoted 15 lines · Geert Uytterhoeven
Quoted 14 lines · Greg Ungerer
Most of the m68k code that supports a hardware FPU is surrounded by
CONFIG_FPU. Except this setup code insetup_mm.c. Be consistent and surround these hardware FPU instructions withCONFIG_FPUinstead of a check based onCONFIG_M68KFPU_EMU_ONLY.The side effect of this is that we can now compile a kernel with no m68k/ColdFire hardware support FPU instructions at all (if we do not define
CONFIG_FPU).Signed-off-by Greg Ungerer <[email protected]>--- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 15 lines
arch/m68k/kernel/setup_mm.c void __init setup_arch(char **cmdline_p) · line 251
Quoted 13 lines
arch/m68k/kernel/setup_mm.c +1
-1@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)* We should really do our own FPU check at startup. * [what do we do with buggy 68LC040s? if we have problems * with them, we should add a test to check_bugs() below] */ -#ifndef CONFIG_M68KFPU_EMU_ONLY +#ifdef CONFIG_FPU /* clear the fpu if we have one */ if (m68k_fputype & (FPU_68881 |FPU_68882 |FPU_68040 |FPU_68060 |FPU_COLDFIRE )) {volatile int zero =0 ;This piece of code is now compiled in if
CONFIG_M68KFPU_EMU_ONLY=y?Yes, that is true. In that scenario I would expect
m68k_fputypeto be 0. So it wouldn't be executed.The problem for me on ColdFire is that we currently do not support the FPU emulation (the assembler for it is not ColdFire clean). So in this case here we can't have
CONFIG_M68KFPU_EMU_ONLY=y.
Quoted 5 lines
Quoted 3 lines
Would you prefer if it became:
#if defined(CONFIG_FPU) && !defined(CONFIG_M68KFPU_EMU_ONL)(with the missing "Y" added)
Yep :-)
Quoted 5 lines
Yes, I prefer not to change the semantics of
M68KFPU_EMU_ONLY, whose help text states:"This option prevents any floating-point instructions from being
compiled into the kernel"
Ok, makes sense. I'll change an repost that patch.
Thanks!
Greg
Greg Ungerer
maintainerPATCH 8/8 m68k: don't panic if no hardware FPU defined
In reply to Greg UngererIf we boot up and find no hardware FPU we panic and die.
Change this behavior to be that if we boot up and we _expect_ a hardware FPU to be present then panic. Don't panic if we don't actually expect to have any hardware FPU.
This lets us compile a kernel without FPU if we really choose too.
--- arch/m68k/kernel/setup_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/setup_mm.c +1 -1
@@ -549,7 +549,7 @@ module_init(proc_hardware_init);void check_bugs (void ) { -#ifndef CONFIG_M68KFPU_EMU +#if defined(CONFIG_FPU ) && !defined(CONFIG_M68KFPU_EMU )if (m68k_fputype ==0 ) {pr_emerg ("*** YOU DO NOT HAVE A FLOATING POINT UNIT, " "WHICH IS REQUIRED BY LINUX/M68K ***\n" );
Signature · 1 line
1.9.1