]>
Commit | Line | Data |
---|---|---|
bdae2828 GKH |
1 | From e4d54f71d29997344b4c4c8d47708240f9f23a5c Mon Sep 17 00:00:00 2001 |
2 | From: Stewart Smith <stewart@linux.vnet.ibm.com> | |
3 | Date: Wed, 9 Dec 2015 17:18:20 +1100 | |
4 | Subject: powerpc/powernv: remove FW_FEATURE_OPALv3 and just use FW_FEATURE_OPAL | |
5 | ||
6 | From: Stewart Smith <stewart@linux.vnet.ibm.com> | |
7 | ||
8 | commit e4d54f71d29997344b4c4c8d47708240f9f23a5c upstream. | |
9 | ||
10 | Long ago, only in the lab, there was OPALv1 and OPALv2. Now there is | |
11 | just OPALv3, with nobody ever expecting anything on pre-OPALv3 to | |
12 | be cared about or supported by mainline kernels. | |
13 | ||
14 | So, let's remove FW_FEATURE_OPALv3 and instead use FW_FEATURE_OPAL | |
15 | exclusively. | |
16 | ||
17 | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> | |
18 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> | |
19 | Signed-off-by: Mike Galbraith <mgalbraith@suse.de> | |
20 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | ||
22 | --- | |
23 | arch/powerpc/include/asm/firmware.h | 3 - | |
24 | arch/powerpc/platforms/powernv/eeh-powernv.c | 4 - | |
25 | arch/powerpc/platforms/powernv/idle.c | 2 | |
26 | arch/powerpc/platforms/powernv/opal-xscom.c | 2 | |
27 | arch/powerpc/platforms/powernv/opal.c | 25 ++++----- | |
28 | arch/powerpc/platforms/powernv/pci-ioda.c | 2 | |
29 | arch/powerpc/platforms/powernv/setup.c | 8 +- | |
30 | arch/powerpc/platforms/powernv/smp.c | 74 +++++++++++---------------- | |
31 | drivers/cpufreq/powernv-cpufreq.c | 2 | |
32 | drivers/cpuidle/cpuidle-powernv.c | 2 | |
33 | 10 files changed, 54 insertions(+), 70 deletions(-) | |
34 | ||
35 | --- a/arch/powerpc/include/asm/firmware.h | |
36 | +++ b/arch/powerpc/include/asm/firmware.h | |
37 | @@ -51,7 +51,6 @@ | |
38 | #define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000) | |
39 | #define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000) | |
40 | #define FW_FEATURE_PRRN ASM_CONST(0x0000000200000000) | |
41 | -#define FW_FEATURE_OPALv3 ASM_CONST(0x0000000400000000) | |
42 | ||
43 | #ifndef __ASSEMBLY__ | |
44 | ||
45 | @@ -69,7 +68,7 @@ enum { | |
46 | FW_FEATURE_SET_MODE | FW_FEATURE_BEST_ENERGY | | |
47 | FW_FEATURE_TYPE1_AFFINITY | FW_FEATURE_PRRN, | |
48 | FW_FEATURE_PSERIES_ALWAYS = 0, | |
49 | - FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv3, | |
50 | + FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL, | |
51 | FW_FEATURE_POWERNV_ALWAYS = 0, | |
52 | FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, | |
53 | FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, | |
54 | --- a/arch/powerpc/platforms/powernv/eeh-powernv.c | |
55 | +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c | |
56 | @@ -48,8 +48,8 @@ static int pnv_eeh_init(void) | |
57 | struct pci_controller *hose; | |
58 | struct pnv_phb *phb; | |
59 | ||
60 | - if (!firmware_has_feature(FW_FEATURE_OPALv3)) { | |
61 | - pr_warn("%s: OPALv3 is required !\n", | |
62 | + if (!firmware_has_feature(FW_FEATURE_OPAL)) { | |
63 | + pr_warn("%s: OPAL is required !\n", | |
64 | __func__); | |
65 | return -EINVAL; | |
66 | } | |
67 | --- a/arch/powerpc/platforms/powernv/idle.c | |
68 | +++ b/arch/powerpc/platforms/powernv/idle.c | |
69 | @@ -242,7 +242,7 @@ static int __init pnv_init_idle_states(v | |
70 | if (cpuidle_disable != IDLE_NO_OVERRIDE) | |
71 | goto out; | |
72 | ||
73 | - if (!firmware_has_feature(FW_FEATURE_OPALv3)) | |
74 | + if (!firmware_has_feature(FW_FEATURE_OPAL)) | |
75 | goto out; | |
76 | ||
77 | power_mgt = of_find_node_by_path("/ibm,opal/power-mgt"); | |
78 | --- a/arch/powerpc/platforms/powernv/opal-xscom.c | |
79 | +++ b/arch/powerpc/platforms/powernv/opal-xscom.c | |
80 | @@ -126,7 +126,7 @@ static const struct scom_controller opal | |
81 | ||
82 | static int opal_xscom_init(void) | |
83 | { | |
84 | - if (firmware_has_feature(FW_FEATURE_OPALv3)) | |
85 | + if (firmware_has_feature(FW_FEATURE_OPAL)) | |
86 | scom_init(&opal_scom_controller); | |
87 | return 0; | |
88 | } | |
89 | --- a/arch/powerpc/platforms/powernv/opal.c | |
90 | +++ b/arch/powerpc/platforms/powernv/opal.c | |
91 | @@ -98,10 +98,9 @@ int __init early_init_dt_scan_opal(unsig | |
92 | pr_debug("OPAL Entry = 0x%llx (sizep=%p runtimesz=%d)\n", | |
93 | opal.size, sizep, runtimesz); | |
94 | ||
95 | - powerpc_firmware_features |= FW_FEATURE_OPAL; | |
96 | if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) { | |
97 | - powerpc_firmware_features |= FW_FEATURE_OPALv3; | |
98 | - pr_info("OPAL V3 detected !\n"); | |
99 | + powerpc_firmware_features |= FW_FEATURE_OPAL; | |
100 | + pr_info("OPAL detected !\n"); | |
101 | } else { | |
102 | panic("OPAL != V3 detected, no longer supported.\n"); | |
103 | } | |
104 | @@ -348,17 +347,15 @@ int opal_put_chars(uint32_t vtermno, con | |
105 | * enough room and be done with it | |
106 | */ | |
107 | spin_lock_irqsave(&opal_write_lock, flags); | |
108 | - if (firmware_has_feature(FW_FEATURE_OPALv3)) { | |
109 | - rc = opal_console_write_buffer_space(vtermno, &olen); | |
110 | - len = be64_to_cpu(olen); | |
111 | - if (rc || len < total_len) { | |
112 | - spin_unlock_irqrestore(&opal_write_lock, flags); | |
113 | - /* Closed -> drop characters */ | |
114 | - if (rc) | |
115 | - return total_len; | |
116 | - opal_poll_events(NULL); | |
117 | - return -EAGAIN; | |
118 | - } | |
119 | + rc = opal_console_write_buffer_space(vtermno, &olen); | |
120 | + len = be64_to_cpu(olen); | |
121 | + if (rc || len < total_len) { | |
122 | + spin_unlock_irqrestore(&opal_write_lock, flags); | |
123 | + /* Closed -> drop characters */ | |
124 | + if (rc) | |
125 | + return total_len; | |
126 | + opal_poll_events(NULL); | |
127 | + return -EAGAIN; | |
128 | } | |
129 | ||
130 | /* We still try to handle partial completions, though they | |
131 | --- a/arch/powerpc/platforms/powernv/pci-ioda.c | |
132 | +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |
133 | @@ -344,7 +344,7 @@ static void __init pnv_ioda_parse_m64_wi | |
134 | return; | |
135 | } | |
136 | ||
137 | - if (!firmware_has_feature(FW_FEATURE_OPALv3)) { | |
138 | + if (!firmware_has_feature(FW_FEATURE_OPAL)) { | |
139 | pr_info(" Firmware too old to support M64 window\n"); | |
140 | return; | |
141 | } | |
142 | --- a/arch/powerpc/platforms/powernv/setup.c | |
143 | +++ b/arch/powerpc/platforms/powernv/setup.c | |
144 | @@ -140,8 +140,8 @@ static void pnv_show_cpuinfo(struct seq_ | |
145 | if (root) | |
146 | model = of_get_property(root, "model", NULL); | |
147 | seq_printf(m, "machine\t\t: PowerNV %s\n", model); | |
148 | - if (firmware_has_feature(FW_FEATURE_OPALv3)) | |
149 | - seq_printf(m, "firmware\t: OPAL v3\n"); | |
150 | + if (firmware_has_feature(FW_FEATURE_OPAL)) | |
151 | + seq_printf(m, "firmware\t: OPAL\n"); | |
152 | else | |
153 | seq_printf(m, "firmware\t: BML\n"); | |
154 | of_node_put(root); | |
155 | @@ -270,9 +270,9 @@ static void pnv_kexec_cpu_down(int crash | |
156 | { | |
157 | xics_kexec_teardown_cpu(secondary); | |
158 | ||
159 | - /* On OPAL v3, we return all CPUs to firmware */ | |
160 | + /* On OPAL, we return all CPUs to firmware */ | |
161 | ||
162 | - if (!firmware_has_feature(FW_FEATURE_OPALv3)) | |
163 | + if (!firmware_has_feature(FW_FEATURE_OPAL)) | |
164 | return; | |
165 | ||
166 | if (secondary) { | |
167 | --- a/arch/powerpc/platforms/powernv/smp.c | |
168 | +++ b/arch/powerpc/platforms/powernv/smp.c | |
169 | @@ -61,14 +61,15 @@ static int pnv_smp_kick_cpu(int nr) | |
170 | unsigned long start_here = | |
171 | __pa(ppc_function_entry(generic_secondary_smp_init)); | |
172 | long rc; | |
173 | + uint8_t status; | |
174 | ||
175 | BUG_ON(nr < 0 || nr >= NR_CPUS); | |
176 | ||
177 | /* | |
178 | - * If we already started or OPALv3 is not supported, we just | |
179 | + * If we already started or OPAL is not supported, we just | |
180 | * kick the CPU via the PACA | |
181 | */ | |
182 | - if (paca[nr].cpu_start || !firmware_has_feature(FW_FEATURE_OPALv3)) | |
183 | + if (paca[nr].cpu_start || !firmware_has_feature(FW_FEATURE_OPAL)) | |
184 | goto kick; | |
185 | ||
186 | /* | |
187 | @@ -77,55 +78,42 @@ static int pnv_smp_kick_cpu(int nr) | |
188 | * first time. OPAL v3 allows us to query OPAL to know if it | |
189 | * has the CPUs, so we do that | |
190 | */ | |
191 | - if (firmware_has_feature(FW_FEATURE_OPALv3)) { | |
192 | - uint8_t status; | |
193 | - | |
194 | - rc = opal_query_cpu_status(pcpu, &status); | |
195 | - if (rc != OPAL_SUCCESS) { | |
196 | - pr_warn("OPAL Error %ld querying CPU %d state\n", | |
197 | - rc, nr); | |
198 | - return -ENODEV; | |
199 | - } | |
200 | + rc = opal_query_cpu_status(pcpu, &status); | |
201 | + if (rc != OPAL_SUCCESS) { | |
202 | + pr_warn("OPAL Error %ld querying CPU %d state\n", rc, nr); | |
203 | + return -ENODEV; | |
204 | + } | |
205 | ||
206 | - /* | |
207 | - * Already started, just kick it, probably coming from | |
208 | - * kexec and spinning | |
209 | - */ | |
210 | - if (status == OPAL_THREAD_STARTED) | |
211 | - goto kick; | |
212 | + /* | |
213 | + * Already started, just kick it, probably coming from | |
214 | + * kexec and spinning | |
215 | + */ | |
216 | + if (status == OPAL_THREAD_STARTED) | |
217 | + goto kick; | |
218 | ||
219 | - /* | |
220 | - * Available/inactive, let's kick it | |
221 | - */ | |
222 | - if (status == OPAL_THREAD_INACTIVE) { | |
223 | - pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n", | |
224 | - nr, pcpu); | |
225 | - rc = opal_start_cpu(pcpu, start_here); | |
226 | - if (rc != OPAL_SUCCESS) { | |
227 | - pr_warn("OPAL Error %ld starting CPU %d\n", | |
228 | - rc, nr); | |
229 | - return -ENODEV; | |
230 | - } | |
231 | - } else { | |
232 | - /* | |
233 | - * An unavailable CPU (or any other unknown status) | |
234 | - * shouldn't be started. It should also | |
235 | - * not be in the possible map but currently it can | |
236 | - * happen | |
237 | - */ | |
238 | - pr_devel("OPAL: CPU %d (HW 0x%x) is unavailable" | |
239 | - " (status %d)...\n", nr, pcpu, status); | |
240 | + /* | |
241 | + * Available/inactive, let's kick it | |
242 | + */ | |
243 | + if (status == OPAL_THREAD_INACTIVE) { | |
244 | + pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n", nr, pcpu); | |
245 | + rc = opal_start_cpu(pcpu, start_here); | |
246 | + if (rc != OPAL_SUCCESS) { | |
247 | + pr_warn("OPAL Error %ld starting CPU %d\n", rc, nr); | |
248 | return -ENODEV; | |
249 | } | |
250 | } else { | |
251 | /* | |
252 | - * On OPAL v2, we just kick it and hope for the best, | |
253 | - * we must not test the error from opal_start_cpu() or | |
254 | - * we would fail to get CPUs from kexec. | |
255 | + * An unavailable CPU (or any other unknown status) | |
256 | + * shouldn't be started. It should also | |
257 | + * not be in the possible map but currently it can | |
258 | + * happen | |
259 | */ | |
260 | - opal_start_cpu(pcpu, start_here); | |
261 | + pr_devel("OPAL: CPU %d (HW 0x%x) is unavailable" | |
262 | + " (status %d)...\n", nr, pcpu, status); | |
263 | + return -ENODEV; | |
264 | } | |
265 | - kick: | |
266 | + | |
267 | +kick: | |
268 | return smp_generic_kick_cpu(nr); | |
269 | } | |
270 | ||
271 | --- a/drivers/cpufreq/powernv-cpufreq.c | |
272 | +++ b/drivers/cpufreq/powernv-cpufreq.c | |
273 | @@ -592,7 +592,7 @@ static int __init powernv_cpufreq_init(v | |
274 | int rc = 0; | |
275 | ||
276 | /* Don't probe on pseries (guest) platforms */ | |
277 | - if (!firmware_has_feature(FW_FEATURE_OPALv3)) | |
278 | + if (!firmware_has_feature(FW_FEATURE_OPAL)) | |
279 | return -ENODEV; | |
280 | ||
281 | /* Discover pstates from device tree and init */ | |
282 | --- a/drivers/cpuidle/cpuidle-powernv.c | |
283 | +++ b/drivers/cpuidle/cpuidle-powernv.c | |
284 | @@ -282,7 +282,7 @@ static int powernv_idle_probe(void) | |
285 | if (cpuidle_disable != IDLE_NO_OVERRIDE) | |
286 | return -ENODEV; | |
287 | ||
288 | - if (firmware_has_feature(FW_FEATURE_OPALv3)) { | |
289 | + if (firmware_has_feature(FW_FEATURE_OPAL)) { | |
290 | cpuidle_state_table = powernv_states; | |
291 | /* Device tree can indicate more idle states */ | |
292 | max_idle_state = powernv_add_idle_states(); |