1 From 8cd2accb71f5eb8e92d775fc1978d3779875c2e5 Mon Sep 17 00:00:00 2001
2 From: Baoquan He <bhe@redhat.com>
3 Date: Fri, 8 Dec 2023 15:30:34 +0800
4 Subject: [PATCH] mips, kexec: fix the incorrect ifdeffery and dependency of
7 The select of KEXEC for CRASH_DUMP in kernel/Kconfig.kexec will be
8 dropped, then compiling errors will be triggered if below config items are
17 --------------------------------------------------------------------
18 mipsel-linux-ld: kernel/kexec_core.o: in function `kimage_free':
19 kernel/kexec_core.c:(.text+0x2200): undefined reference to `machine_kexec_cleanup'
20 mipsel-linux-ld: kernel/kexec_core.o: in function `__crash_kexec':
21 kernel/kexec_core.c:(.text+0x2480): undefined reference to `machine_crash_shutdown'
22 mipsel-linux-ld: kernel/kexec_core.c:(.text+0x2488): undefined reference to `machine_kexec'
23 mipsel-linux-ld: kernel/kexec_core.o: in function `kernel_kexec':
24 kernel/kexec_core.c:(.text+0x29b8): undefined reference to `machine_shutdown'
25 mipsel-linux-ld: kernel/kexec_core.c:(.text+0x29c0): undefined reference to `machine_kexec'
26 --------------------------------------------------------------------
28 Here, change the dependency of building kexec_core related object files,
29 and the ifdeffery in mips from CONFIG_KEXEC to CONFIG_KEXEC_CORE.
31 Link: https://lkml.kernel.org/r/20231208073036.7884-4-bhe@redhat.com
32 Signed-off-by: Baoquan He <bhe@redhat.com>
33 Reported-by: kernel test robot <lkp@intel.com>
34 Closes: https://lore.kernel.org/oe-kbuild-all/202311302042.sn8cDPIX-lkp@intel.com/
35 Cc: Eric DeVolder <eric_devolder@yahoo.com>
36 Cc: Ignat Korchagin <ignat@cloudflare.com>
37 Cc: Stephen Rothwell <sfr@canb.auug.org.au>
38 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
40 arch/mips/cavium-octeon/smp.c | 4 ++--
41 arch/mips/include/asm/kexec.h | 2 +-
42 arch/mips/include/asm/smp-ops.h | 2 +-
43 arch/mips/include/asm/smp.h | 2 +-
44 arch/mips/kernel/Makefile | 2 +-
45 arch/mips/kernel/smp-bmips.c | 4 ++--
46 arch/mips/kernel/smp-cps.c | 10 +++++-----
47 arch/mips/loongson64/reset.c | 4 ++--
48 arch/mips/loongson64/smp.c | 2 +-
49 9 files changed, 16 insertions(+), 16 deletions(-)
51 --- a/arch/mips/cavium-octeon/smp.c
52 +++ b/arch/mips/cavium-octeon/smp.c
53 @@ -422,7 +422,7 @@ static const struct plat_smp_ops octeon_
54 .cpu_disable = octeon_cpu_disable,
55 .cpu_die = octeon_cpu_die,
58 +#ifdef CONFIG_KEXEC_CORE
59 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
62 @@ -502,7 +502,7 @@ static const struct plat_smp_ops octeon_
63 .cpu_disable = octeon_cpu_disable,
64 .cpu_die = octeon_cpu_die,
67 +#ifdef CONFIG_KEXEC_CORE
68 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
71 --- a/arch/mips/include/asm/kexec.h
72 +++ b/arch/mips/include/asm/kexec.h
73 @@ -31,7 +31,7 @@ static inline void crash_setup_regs(stru
74 prepare_frametrace(newregs);
78 +#ifdef CONFIG_KEXEC_CORE
80 extern unsigned long kexec_args[4];
81 extern int (*_machine_kexec_prepare)(struct kimage *);
82 --- a/arch/mips/include/asm/smp-ops.h
83 +++ b/arch/mips/include/asm/smp-ops.h
84 @@ -35,7 +35,7 @@ struct plat_smp_ops {
85 void (*cpu_die)(unsigned int cpu);
86 void (*cleanup_dead_cpu)(unsigned cpu);
89 +#ifdef CONFIG_KEXEC_CORE
90 void (*kexec_nonboot_cpu)(void);
93 --- a/arch/mips/include/asm/smp.h
94 +++ b/arch/mips/include/asm/smp.h
95 @@ -93,7 +93,7 @@ static inline void __cpu_die(unsigned in
96 extern void __noreturn play_dead(void);
100 +#ifdef CONFIG_KEXEC_CORE
101 static inline void kexec_nonboot_cpu(void)
103 extern const struct plat_smp_ops *mp_ops; /* private */
104 --- a/arch/mips/kernel/Makefile
105 +++ b/arch/mips/kernel/Makefile
106 @@ -90,7 +90,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
108 obj-$(CONFIG_RELOCATABLE) += relocate.o
110 -obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
111 +obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o crash.o
112 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
113 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
114 obj-$(CONFIG_EARLY_PRINTK_8250) += early_printk_8250.o
115 --- a/arch/mips/kernel/smp-bmips.c
116 +++ b/arch/mips/kernel/smp-bmips.c
117 @@ -434,7 +434,7 @@ const struct plat_smp_ops bmips43xx_smp_
118 .cpu_disable = bmips_cpu_disable,
119 .cpu_die = bmips_cpu_die,
122 +#ifdef CONFIG_KEXEC_CORE
123 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
126 @@ -451,7 +451,7 @@ const struct plat_smp_ops bmips5000_smp_
127 .cpu_disable = bmips_cpu_disable,
128 .cpu_die = bmips_cpu_die,
131 +#ifdef CONFIG_KEXEC_CORE
132 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
135 --- a/arch/mips/kernel/smp-cps.c
136 +++ b/arch/mips/kernel/smp-cps.c
137 @@ -395,7 +395,7 @@ static void cps_smp_finish(void)
141 -#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC)
142 +#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC_CORE)
146 @@ -432,7 +432,7 @@ static void cps_shutdown_this_cpu(enum c
151 +#ifdef CONFIG_KEXEC_CORE
153 static void cps_kexec_nonboot_cpu(void)
155 @@ -442,9 +442,9 @@ static void cps_kexec_nonboot_cpu(void)
156 cps_shutdown_this_cpu(CPU_DEATH_POWER);
159 -#endif /* CONFIG_KEXEC */
160 +#endif /* CONFIG_KEXEC_CORE */
162 -#endif /* CONFIG_HOTPLUG_CPU || CONFIG_KEXEC */
163 +#endif /* CONFIG_HOTPLUG_CPU || CONFIG_KEXEC_CORE */
165 #ifdef CONFIG_HOTPLUG_CPU
167 @@ -613,7 +613,7 @@ static const struct plat_smp_ops cps_smp
168 .cpu_die = cps_cpu_die,
169 .cleanup_dead_cpu = cps_cleanup_dead_cpu,
172 +#ifdef CONFIG_KEXEC_CORE
173 .kexec_nonboot_cpu = cps_kexec_nonboot_cpu,
176 --- a/arch/mips/loongson64/reset.c
177 +++ b/arch/mips/loongson64/reset.c
178 @@ -39,7 +39,7 @@ static int firmware_poweroff(struct sys_
183 +#ifdef CONFIG_KEXEC_CORE
185 /* 0X80000000~0X80200000 is safe */
187 @@ -152,7 +152,7 @@ static int __init mips_reboot_setup(void
188 firmware_poweroff, NULL);
192 +#ifdef CONFIG_KEXEC_CORE
193 kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL);
194 if (WARN_ON(!kexec_argv))
196 --- a/arch/mips/loongson64/smp.c
197 +++ b/arch/mips/loongson64/smp.c
198 @@ -883,7 +883,7 @@ const struct plat_smp_ops loongson3_smp_
199 .cpu_disable = loongson3_cpu_disable,
200 .cpu_die = loongson3_cpu_die,
203 +#ifdef CONFIG_KEXEC_CORE
204 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,