6d3c7d04fe91e19d3b004768ae3873520ddf7458
[openwrt/staging/wigyori.git] /
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
5 CONFIG_KEXEC
6
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
9 set:
10
11 ===
12 CONFIG_CRASH_CORE=y
13 CONFIG_KEXEC_CORE=y
14 CONFIG_CRASH_DUMP=y
15 ===
16
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 --------------------------------------------------------------------
27
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.
30
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>
39 ---
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(-)
50
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,
56 #endif
57 -#ifdef CONFIG_KEXEC
58 +#ifdef CONFIG_KEXEC_CORE
59 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
60 #endif
61 };
62 @@ -502,7 +502,7 @@ static const struct plat_smp_ops octeon_
63 .cpu_disable = octeon_cpu_disable,
64 .cpu_die = octeon_cpu_die,
65 #endif
66 -#ifdef CONFIG_KEXEC
67 +#ifdef CONFIG_KEXEC_CORE
68 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
69 #endif
70 };
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);
75 }
76
77 -#ifdef CONFIG_KEXEC
78 +#ifdef CONFIG_KEXEC_CORE
79 struct kimage;
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);
87 #endif
88 -#ifdef CONFIG_KEXEC
89 +#ifdef CONFIG_KEXEC_CORE
90 void (*kexec_nonboot_cpu)(void);
91 #endif
92 };
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);
97 #endif
98
99 -#ifdef CONFIG_KEXEC
100 +#ifdef CONFIG_KEXEC_CORE
101 static inline void kexec_nonboot_cpu(void)
102 {
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
107
108 obj-$(CONFIG_RELOCATABLE) += relocate.o
109
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,
120 #endif
121 -#ifdef CONFIG_KEXEC
122 +#ifdef CONFIG_KEXEC_CORE
123 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
124 #endif
125 };
126 @@ -451,7 +451,7 @@ const struct plat_smp_ops bmips5000_smp_
127 .cpu_disable = bmips_cpu_disable,
128 .cpu_die = bmips_cpu_die,
129 #endif
130 -#ifdef CONFIG_KEXEC
131 +#ifdef CONFIG_KEXEC_CORE
132 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
133 #endif
134 };
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)
138 local_irq_enable();
139 }
140
141 -#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC)
142 +#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_KEXEC_CORE)
143
144 enum cpu_death {
145 CPU_DEATH_HALT,
146 @@ -432,7 +432,7 @@ static void cps_shutdown_this_cpu(enum c
147 }
148 }
149
150 -#ifdef CONFIG_KEXEC
151 +#ifdef CONFIG_KEXEC_CORE
152
153 static void cps_kexec_nonboot_cpu(void)
154 {
155 @@ -442,9 +442,9 @@ static void cps_kexec_nonboot_cpu(void)
156 cps_shutdown_this_cpu(CPU_DEATH_POWER);
157 }
158
159 -#endif /* CONFIG_KEXEC */
160 +#endif /* CONFIG_KEXEC_CORE */
161
162 -#endif /* CONFIG_HOTPLUG_CPU || CONFIG_KEXEC */
163 +#endif /* CONFIG_HOTPLUG_CPU || CONFIG_KEXEC_CORE */
164
165 #ifdef CONFIG_HOTPLUG_CPU
166
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,
170 #endif
171 -#ifdef CONFIG_KEXEC
172 +#ifdef CONFIG_KEXEC_CORE
173 .kexec_nonboot_cpu = cps_kexec_nonboot_cpu,
174 #endif
175 };
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_
179 return NOTIFY_DONE;
180 }
181
182 -#ifdef CONFIG_KEXEC
183 +#ifdef CONFIG_KEXEC_CORE
184
185 /* 0X80000000~0X80200000 is safe */
186 #define MAX_ARGS 64
187 @@ -152,7 +152,7 @@ static int __init mips_reboot_setup(void
188 firmware_poweroff, NULL);
189 }
190
191 -#ifdef CONFIG_KEXEC
192 +#ifdef CONFIG_KEXEC_CORE
193 kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL);
194 if (WARN_ON(!kexec_argv))
195 return -ENOMEM;
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,
201 #endif
202 -#ifdef CONFIG_KEXEC
203 +#ifdef CONFIG_KEXEC_CORE
204 .kexec_nonboot_cpu = kexec_nonboot_cpu_jump,
205 #endif
206 };