* [PATCH 1/8] m68k: move CONFIG_FPU set to per-CPU configuration
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
2016-08-29 11:43 ` [PATCH 2/8] m68k: set appropriate machine type for m5411x SoC platforms Greg Ungerer
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
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
<yannick.gicquel@open.eurogiciel.org>.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/Kconfig | 1 -
arch/m68k/Kconfig.cpu | 6 ++++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 498b567..d140206 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -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
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 967260f..d2219f30 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -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
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 2/8] m68k: set appropriate machine type for m5411x SoC platforms
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
2016-08-29 11:43 ` [PATCH 1/8] m68k: move CONFIG_FPU set to per-CPU configuration Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
2016-08-29 11:43 ` [PATCH 3/8] m68k: report correct FPU type on ColdFire MMU platforms Greg Ungerer
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Create 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.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
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(-)
diff --git a/arch/m68k/coldfire/head.S b/arch/m68k/coldfire/head.S
index 73d92ea..4ba5d562 100644
--- a/arch/m68k/coldfire/head.S
+++ b/arch/m68k/coldfire/head.S
@@ -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
diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m5441xsim.h
index cc798ab..60768b5 100644
--- a/arch/m68k/include/asm/m5441xsim.h
+++ b/arch/m68k/include/asm/m5441xsim.h
@@ -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>
diff --git a/arch/m68k/include/asm/m54xxsim.h b/arch/m68k/include/asm/m54xxsim.h
index a5fbd17..cde0390 100644
--- a/arch/m68k/include/asm/m54xxsim.h
+++ b/arch/m68k/include/asm/m54xxsim.h
@@ -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>
diff --git a/arch/m68k/include/uapi/asm/bootinfo.h b/arch/m68k/include/uapi/asm/bootinfo.h
index cdeb26a0..a48cf54 100644
--- a/arch/m68k/include/uapi/asm/bootinfo.h
+++ b/arch/m68k/include/uapi/asm/bootinfo.h
@@ -81,6 +81,7 @@ struct mem_info {
#define MACH_Q40 10
#define MACH_SUN3X 11
#define MACH_M54XX 12
+#define MACH_M5441X 13
/*
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 5b8ec4d..13f4640 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -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
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 3/8] m68k: report correct FPU type on ColdFire MMU platforms
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
2016-08-29 11:43 ` [PATCH 1/8] m68k: move CONFIG_FPU set to per-CPU configuration Greg Ungerer
2016-08-29 11:43 ` [PATCH 2/8] m68k: set appropriate machine type for m5411x SoC platforms Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
2016-08-29 11:43 ` [PATCH 4/8] m68k: move ColdFire _bootmem_alloc code Greg Ungerer
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Not 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.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
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(-)
diff --git a/arch/m68k/coldfire/head.S b/arch/m68k/coldfire/head.S
index 4ba5d562..bdb472c 100644
--- a/arch/m68k/coldfire/head.S
+++ b/arch/m68k/coldfire/head.S
@@ -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 */
diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m5441xsim.h
index 60768b5..4279c0d 100644
--- a/arch/m68k/include/asm/m5441xsim.h
+++ b/arch/m68k/include/asm/m5441xsim.h
@@ -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>
diff --git a/arch/m68k/include/asm/m54xxsim.h b/arch/m68k/include/asm/m54xxsim.h
index cde0390..7dd6cc4 100644
--- a/arch/m68k/include/asm/m54xxsim.h
+++ b/arch/m68k/include/asm/m54xxsim.h
@@ -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>
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 4/8] m68k: move ColdFire _bootmem_alloc code
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
` (2 preceding siblings ...)
2016-08-29 11:43 ` [PATCH 3/8] m68k: report correct FPU type on ColdFire MMU platforms Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
2016-08-29 11:43 ` [PATCH 5/8] m68k: generalize io memory region setup for ColdFire ACR registers Greg Ungerer
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
The 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).
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
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(-)
diff --git a/arch/m68k/coldfire/m54xx.c b/arch/m68k/coldfire/m54xx.c
index c32f767..386df3b 100644
--- a/arch/m68k/coldfire/m54xx.c
+++ b/arch/m68k/coldfire/m54xx.c
@@ -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;
diff --git a/arch/m68k/include/asm/mcfmmu.h b/arch/m68k/include/asm/mcfmmu.h
index 8824236..10f9930 100644
--- a/arch/m68k/include/asm/mcfmmu.h
+++ b/arch/m68k/include/asm/mcfmmu.h
@@ -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
diff --git a/arch/m68k/mm/mcfmmu.c b/arch/m68k/mm/mcfmmu.c
index f58fafe..87131cd 100644
--- a/arch/m68k/mm/mcfmmu.c
+++ b/arch/m68k/mm/mcfmmu.c
@@ -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
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 5/8] m68k: generalize io memory region setup for ColdFire ACR registers
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
` (3 preceding siblings ...)
2016-08-29 11:43 ` [PATCH 4/8] m68k: move ColdFire _bootmem_alloc code Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
2016-08-29 11:43 ` [PATCH 6/8] m68k: always make available dump_fpu() Greg Ungerer
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
The 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.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
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(-)
diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m5441xsim.h
index 4279c0d..64f60be 100644
--- a/arch/m68k/include/asm/m5441xsim.h
+++ b/arch/m68k/include/asm/m5441xsim.h
@@ -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>
diff --git a/arch/m68k/include/asm/m54xxacr.h b/arch/m68k/include/asm/m54xxacr.h
index 59e1710..c6ac05c 100644
--- a/arch/m68k/include/asm/m54xxacr.h
+++ b/arch/m68k/include/asm/m54xxacr.h
@@ -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)+ \
diff --git a/arch/m68k/include/asm/m54xxsim.h b/arch/m68k/include/asm/m54xxsim.h
index 7dd6cc4..73d937f 100644
--- a/arch/m68k/include/asm/m54xxsim.h
+++ b/arch/m68k/include/asm/m54xxsim.h
@@ -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>
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 6/8] m68k: always make available dump_fpu()
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
` (4 preceding siblings ...)
2016-08-29 11:43 ` [PATCH 5/8] m68k: generalize io memory region setup for ColdFire ACR registers Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
2016-08-29 11:43 ` [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU Greg Ungerer
2016-08-29 11:43 ` [PATCH 8/8] m68k: don't panic if no hardware FPU defined Greg Ungerer
7 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Our 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
<yannick.gicquel@open.eurogiciel.org>.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/kernel/process.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index c55ff71..44ec789 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -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. */
asm volatile ("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)
{
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
` (5 preceding siblings ...)
2016-08-29 11:43 ` [PATCH 6/8] m68k: always make available dump_fpu() Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
2016-08-29 12:53 ` Geert Uytterhoeven
2016-08-29 11:43 ` [PATCH 8/8] m68k: don't panic if no hardware FPU defined Greg Ungerer
7 siblings, 1 reply; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
Most 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).
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/kernel/setup_mm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 13f4640..00290c4 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)
* We should really do our own FPU check at startup.
* [what do we do with buggy 68LC040s? if we have problems
* with them, we should add a test to check_bugs() below] */
-#ifndef CONFIG_M68KFPU_EMU_ONLY
+#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;
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
2016-08-29 11:43 ` [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU Greg Ungerer
@ 2016-08-29 12:53 ` Geert Uytterhoeven
2016-08-29 23:58 ` Greg Ungerer
0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2016-08-29 12:53 UTC (permalink / raw)
To: Greg Ungerer; +Cc: Linux/m68k
Hi Greg,
On Mon, Aug 29, 2016 at 1:43 PM, Greg Ungerer <gerg@linux-m68k.org> wrote:
> Most 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).
>
> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
> ---
> arch/m68k/kernel/setup_mm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index 13f4640..00290c4 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)
> * We should really do our own FPU check at startup.
> * [what do we do with buggy 68LC040s? if we have problems
> * with them, we should add a test to check_bugs() below] */
> -#ifndef CONFIG_M68KFPU_EMU_ONLY
> +#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 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
2016-08-29 12:53 ` Geert Uytterhoeven
@ 2016-08-29 23:58 ` Greg Ungerer
2016-08-30 6:26 ` Geert Uytterhoeven
0 siblings, 1 reply; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 23:58 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Linux/m68k
Hi Geert,
On 29/08/16 22:53, Geert Uytterhoeven wrote:
> Hi Greg,
>
> On Mon, Aug 29, 2016 at 1:43 PM, Greg Ungerer <gerg@linux-m68k.org> wrote:
>> Most 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).
>>
>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>> ---
>> arch/m68k/kernel/setup_mm.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
>> index 13f4640..00290c4 100644
>> --- a/arch/m68k/kernel/setup_mm.c
>> +++ b/arch/m68k/kernel/setup_mm.c
>> @@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)
>> * We should really do our own FPU check at startup.
>> * [what do we do with buggy 68LC040s? if we have problems
>> * with them, we should add a test to check_bugs() below] */
>> -#ifndef CONFIG_M68KFPU_EMU_ONLY
>> +#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
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
2016-08-29 23:58 ` Greg Ungerer
@ 2016-08-30 6:26 ` Geert Uytterhoeven
2016-08-30 7:30 ` Greg Ungerer
0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2016-08-30 6:26 UTC (permalink / raw)
To: Greg Ungerer; +Cc: Linux/m68k
Hi Greg,
On Tue, Aug 30, 2016 at 1:58 AM, Greg Ungerer <gerg@linux-m68k.org> wrote:
> On 29/08/16 22:53, Geert Uytterhoeven wrote:
>> On Mon, Aug 29, 2016 at 1:43 PM, Greg Ungerer <gerg@linux-m68k.org> wrote:
>>> Most 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).
>>>
>>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>>> ---
>>> arch/m68k/kernel/setup_mm.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
>>> index 13f4640..00290c4 100644
>>> --- a/arch/m68k/kernel/setup_mm.c
>>> +++ b/arch/m68k/kernel/setup_mm.c
>>> @@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)
>>> * We should really do our own FPU check at startup.
>>> * [what do we do with buggy 68LC040s? if we have problems
>>> * with them, we should add a test to check_bugs() below] */
>>> -#ifndef CONFIG_M68KFPU_EMU_ONLY
>>> +#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)
(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 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU
2016-08-30 6:26 ` Geert Uytterhoeven
@ 2016-08-30 7:30 ` Greg Ungerer
0 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-30 7:30 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Linux/m68k
Hi Geert,
On 30/08/16 16:26, Geert Uytterhoeven wrote:
> Hi Greg,
>
> On Tue, Aug 30, 2016 at 1:58 AM, Greg Ungerer <gerg@linux-m68k.org> wrote:
>> On 29/08/16 22:53, Geert Uytterhoeven wrote:
>>> On Mon, Aug 29, 2016 at 1:43 PM, Greg Ungerer <gerg@linux-m68k.org> wrote:
>>>> Most 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).
>>>>
>>>> Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
>>>> ---
>>>> arch/m68k/kernel/setup_mm.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
>>>> index 13f4640..00290c4 100644
>>>> --- a/arch/m68k/kernel/setup_mm.c
>>>> +++ b/arch/m68k/kernel/setup_mm.c
>>>> @@ -245,7 +245,7 @@ void __init setup_arch(char **cmdline_p)
>>>> * We should really do our own FPU check at startup.
>>>> * [what do we do with buggy 68LC040s? if we have problems
>>>> * with them, we should add a test to check_bugs() below] */
>>>> -#ifndef CONFIG_M68KFPU_EMU_ONLY
>>>> +#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)
>
> (with the missing "Y" added)
Yep :-)
> 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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 8/8] m68k: don't panic if no hardware FPU defined
2016-08-29 11:43 [PATCH 0/8] m68k: prepare to support ColdFire M5441x MMU enabled Greg Ungerer
` (6 preceding siblings ...)
2016-08-29 11:43 ` [PATCH 7/8] m68k: only generate FPU instructions of CONFIG_FPU Greg Ungerer
@ 2016-08-29 11:43 ` Greg Ungerer
7 siblings, 0 replies; 13+ messages in thread
From: Greg Ungerer @ 2016-08-29 11:43 UTC (permalink / raw)
To: linux-m68k; +Cc: Greg Ungerer
If 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.
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
---
arch/m68k/kernel/setup_mm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 00290c4..a01d4a0 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -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");
--
1.9.1
^ permalink raw reply related [flat|nested] 13+ messages in thread