1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Wed, 14 Jun 2023 01:39:33 +0200
4 Subject: [PATCH] sh/cpu: Switch to arch_cpu_finalize_init()
6 check_bugs() is about to be phased out. Switch over to the new
7 arch_cpu_finalize_init() implementation.
11 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
12 Link: https://lore.kernel.org/r/20230613224545.371697797@linutronix.de
14 (cherry picked from commit 01eb454e9bfe593f320ecbc9aaec60bf87cd453d)
16 Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
17 Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
18 Acked-by: Stefan Bader <stefan.bader@canonical.com>
19 Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
20 (cherry picked from commit 5228732d7ec3b9d13ee33b613dd3ed9c7f6a4695)
21 Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
24 arch/sh/include/asm/bugs.h | 74 ---------------------------------
25 arch/sh/include/asm/processor.h | 2 +
26 arch/sh/kernel/idle.c | 1 +
27 arch/sh/kernel/setup.c | 55 ++++++++++++++++++++++++
28 5 files changed, 59 insertions(+), 74 deletions(-)
29 delete mode 100644 arch/sh/include/asm/bugs.h
31 diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
32 index 101a0d094a66..b0284730e761 100644
35 @@ -7,6 +7,7 @@ config SUPERH
36 select ARCH_HAVE_CUSTOM_GPIO_H
37 select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
38 select ARCH_HAS_BINFMT_FLAT if !MMU
39 + select ARCH_HAS_CPU_FINALIZE_INIT
40 select ARCH_HAS_CURRENT_STACK_POINTER
41 select ARCH_HAS_GIGANTIC_PAGE
42 select ARCH_HAS_GCOV_PROFILE_ALL
43 diff --git a/arch/sh/include/asm/bugs.h b/arch/sh/include/asm/bugs.h
44 deleted file mode 100644
45 index fe52abb69cea..000000000000
46 --- a/arch/sh/include/asm/bugs.h
49 -/* SPDX-License-Identifier: GPL-2.0 */
50 -#ifndef __ASM_SH_BUGS_H
51 -#define __ASM_SH_BUGS_H
54 - * This is included by init/main.c to check for architecture-dependent bugs.
57 - * void check_bugs(void);
61 - * I don't know of any Super-H bugs yet.
64 -#include <asm/processor.h>
66 -extern void select_idle_routine(void);
68 -static void __init check_bugs(void)
70 - extern unsigned long loops_per_jiffy;
71 - char *p = &init_utsname()->machine[2]; /* "sh" */
73 - select_idle_routine();
75 - current_cpu_data.loops_per_jiffy = loops_per_jiffy;
77 - switch (current_cpu_data.family) {
78 - case CPU_FAMILY_SH2:
81 - case CPU_FAMILY_SH2A:
85 - case CPU_FAMILY_SH3:
88 - case CPU_FAMILY_SH4:
91 - case CPU_FAMILY_SH4A:
95 - case CPU_FAMILY_SH4AL_DSP:
104 - case CPU_FAMILY_UNKNOWN:
106 - * Specifically use CPU_FAMILY_UNKNOWN rather than
107 - * default:, so we're able to have the compiler whine
108 - * about unhandled enumerations.
113 - printk("CPU: %s\n", get_cpu_subtype(¤t_cpu_data));
115 -#ifndef __LITTLE_ENDIAN__
116 - /* 'eb' means 'Endian Big' */
122 -#endif /* __ASM_SH_BUGS_H */
123 diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
124 index 85a6c1c3c16e..73fba7c922f9 100644
125 --- a/arch/sh/include/asm/processor.h
126 +++ b/arch/sh/include/asm/processor.h
127 @@ -166,6 +166,8 @@ extern unsigned int instruction_size(unsigned int insn);
128 #define instruction_size(insn) (2)
131 +void select_idle_routine(void);
133 #endif /* __ASSEMBLY__ */
135 #include <asm/processor_32.h>
136 diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
137 index f59814983bd5..a80b2a5b25c7 100644
138 --- a/arch/sh/kernel/idle.c
139 +++ b/arch/sh/kernel/idle.c
141 #include <linux/irqflags.h>
142 #include <linux/smp.h>
143 #include <linux/atomic.h>
144 +#include <asm/processor.h>
146 #include <asm/bl_bit.h>
148 diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
149 index af977ec4ca5e..cf7c0f72f293 100644
150 --- a/arch/sh/kernel/setup.c
151 +++ b/arch/sh/kernel/setup.c
154 #include <asm/mmu_context.h>
155 #include <asm/mmzone.h>
156 +#include <asm/processor.h>
157 #include <asm/sparsemem.h>
158 #include <asm/platform_early.h>
160 @@ -354,3 +355,57 @@ int test_mode_pin(int pin)
162 return sh_mv.mv_mode_pins() & pin;
165 +void __init arch_cpu_finalize_init(void)
167 + char *p = &init_utsname()->machine[2]; /* "sh" */
169 + select_idle_routine();
171 + current_cpu_data.loops_per_jiffy = loops_per_jiffy;
173 + switch (current_cpu_data.family) {
174 + case CPU_FAMILY_SH2:
177 + case CPU_FAMILY_SH2A:
181 + case CPU_FAMILY_SH3:
184 + case CPU_FAMILY_SH4:
187 + case CPU_FAMILY_SH4A:
191 + case CPU_FAMILY_SH4AL_DSP:
200 + case CPU_FAMILY_UNKNOWN:
202 + * Specifically use CPU_FAMILY_UNKNOWN rather than
203 + * default:, so we're able to have the compiler whine
204 + * about unhandled enumerations.
209 + pr_info("CPU: %s\n", get_cpu_subtype(¤t_cpu_data));
211 +#ifndef __LITTLE_ENDIAN__
212 + /* 'eb' means 'Endian Big' */