diff options
author | Robert Jennings <rcj@linux.vnet.ibm.com> | 2008-07-23 14:28:05 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-25 01:44:41 -0400 |
commit | 398778f78b76fb72cb18411487af01dea202709e (patch) | |
tree | d3cecf1e1aa65eb1cbd299c7a01fdc3060fc428d /arch | |
parent | dfc3403f0e5ffb94ee29942f313b87d4061d951b (diff) |
powerpc/pseries: Split retrieval of processor entitlement data into a helper routine
Split the retrieval of processor entitlement data returned in the H_GET_PPP
hcall into its own helper routine.
Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/lparcfg.c | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 86e5b3ed10d8..d82e1fa5ce2a 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
@@ -158,6 +158,18 @@ int h_get_mpp(struct hvcall_mpp_data *mpp_data) | |||
158 | } | 158 | } |
159 | EXPORT_SYMBOL(h_get_mpp); | 159 | EXPORT_SYMBOL(h_get_mpp); |
160 | 160 | ||
161 | struct hvcall_ppp_data { | ||
162 | u64 entitlement; | ||
163 | u64 unallocated_entitlement; | ||
164 | u16 group_num; | ||
165 | u16 pool_num; | ||
166 | u8 capped; | ||
167 | u8 weight; | ||
168 | u8 unallocated_weight; | ||
169 | u16 active_procs_in_pool; | ||
170 | u16 active_system_procs; | ||
171 | }; | ||
172 | |||
161 | /* | 173 | /* |
162 | * H_GET_PPP hcall returns info in 4 parms. | 174 | * H_GET_PPP hcall returns info in 4 parms. |
163 | * entitled_capacity,unallocated_capacity, | 175 | * entitled_capacity,unallocated_capacity, |
@@ -178,20 +190,24 @@ EXPORT_SYMBOL(h_get_mpp); | |||
178 | * XXXX - Active processors in Physical Processor Pool. | 190 | * XXXX - Active processors in Physical Processor Pool. |
179 | * XXXX - Processors active on platform. | 191 | * XXXX - Processors active on platform. |
180 | */ | 192 | */ |
181 | static unsigned int h_get_ppp(unsigned long *entitled, | 193 | static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data) |
182 | unsigned long *unallocated, | ||
183 | unsigned long *aggregation, | ||
184 | unsigned long *resource) | ||
185 | { | 194 | { |
186 | unsigned long rc; | 195 | unsigned long rc; |
187 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; | 196 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
188 | 197 | ||
189 | rc = plpar_hcall(H_GET_PPP, retbuf); | 198 | rc = plpar_hcall(H_GET_PPP, retbuf); |
190 | 199 | ||
191 | *entitled = retbuf[0]; | 200 | ppp_data->entitlement = retbuf[0]; |
192 | *unallocated = retbuf[1]; | 201 | ppp_data->unallocated_entitlement = retbuf[1]; |
193 | *aggregation = retbuf[2]; | 202 | |
194 | *resource = retbuf[3]; | 203 | ppp_data->group_num = (retbuf[2] >> 2 * 8) & 0xffff; |
204 | ppp_data->pool_num = retbuf[2] & 0xffff; | ||
205 | |||
206 | ppp_data->capped = (retbuf[3] >> 6 * 8) & 0x01; | ||
207 | ppp_data->weight = (retbuf[3] >> 5 * 8) & 0xff; | ||
208 | ppp_data->unallocated_weight = (retbuf[3] >> 4 * 8) & 0xff; | ||
209 | ppp_data->active_procs_in_pool = (retbuf[3] >> 2 * 8) & 0xffff; | ||
210 | ppp_data->active_system_procs = retbuf[3] & 0xffff; | ||
195 | 211 | ||
196 | return rc; | 212 | return rc; |
197 | } | 213 | } |
@@ -216,41 +232,40 @@ static unsigned h_pic(unsigned long *pool_idle_time, | |||
216 | */ | 232 | */ |
217 | static void parse_ppp_data(struct seq_file *m) | 233 | static void parse_ppp_data(struct seq_file *m) |
218 | { | 234 | { |
219 | unsigned long h_entitled, h_unallocated; | 235 | struct hvcall_ppp_data ppp_data; |
220 | unsigned long h_aggregation, h_resource; | ||
221 | int rc; | 236 | int rc; |
222 | 237 | ||
223 | rc = h_get_ppp(&h_entitled, &h_unallocated, &h_aggregation, | 238 | rc = h_get_ppp(&ppp_data); |
224 | &h_resource); | ||
225 | if (rc) | 239 | if (rc) |
226 | return; | 240 | return; |
227 | 241 | ||
228 | seq_printf(m, "partition_entitled_capacity=%ld\n", h_entitled); | 242 | seq_printf(m, "partition_entitled_capacity=%ld\n", |
229 | seq_printf(m, "group=%ld\n", (h_aggregation >> 2 * 8) & 0xffff); | 243 | ppp_data.entitlement); |
230 | seq_printf(m, "system_active_processors=%ld\n", | 244 | seq_printf(m, "group=%d\n", ppp_data.group_num); |
231 | (h_resource >> 0 * 8) & 0xffff); | 245 | seq_printf(m, "system_active_processors=%d\n", |
246 | ppp_data.active_system_procs); | ||
232 | 247 | ||
233 | /* pool related entries are apropriate for shared configs */ | 248 | /* pool related entries are apropriate for shared configs */ |
234 | if (lppaca[0].shared_proc) { | 249 | if (lppaca[0].shared_proc) { |
235 | unsigned long pool_idle_time, pool_procs; | 250 | unsigned long pool_idle_time, pool_procs; |
236 | 251 | ||
237 | seq_printf(m, "pool=%ld\n", (h_aggregation >> 0 * 8) & 0xffff); | 252 | seq_printf(m, "pool=%d\n", ppp_data.pool_num); |
238 | 253 | ||
239 | /* report pool_capacity in percentage */ | 254 | /* report pool_capacity in percentage */ |
240 | seq_printf(m, "pool_capacity=%ld\n", | 255 | seq_printf(m, "pool_capacity=%d\n", |
241 | ((h_resource >> 2 * 8) & 0xffff) * 100); | 256 | ppp_data.active_procs_in_pool * 100); |
242 | 257 | ||
243 | h_pic(&pool_idle_time, &pool_procs); | 258 | h_pic(&pool_idle_time, &pool_procs); |
244 | seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time); | 259 | seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time); |
245 | seq_printf(m, "pool_num_procs=%ld\n", pool_procs); | 260 | seq_printf(m, "pool_num_procs=%ld\n", pool_procs); |
246 | } | 261 | } |
247 | 262 | ||
248 | seq_printf(m, "unallocated_capacity_weight=%ld\n", | 263 | seq_printf(m, "unallocated_capacity_weight=%d\n", |
249 | (h_resource >> 4 * 8) & 0xFF); | 264 | ppp_data.unallocated_weight); |
250 | 265 | seq_printf(m, "capacity_weight=%d\n", ppp_data.weight); | |
251 | seq_printf(m, "capacity_weight=%ld\n", (h_resource >> 5 * 8) & 0xFF); | 266 | seq_printf(m, "capped=%d\n", ppp_data.capped); |
252 | seq_printf(m, "capped=%ld\n", (h_resource >> 6 * 8) & 0x01); | 267 | seq_printf(m, "unallocated_capacity=%ld\n", |
253 | seq_printf(m, "unallocated_capacity=%ld\n", h_unallocated); | 268 | ppp_data.unallocated_entitlement); |
254 | } | 269 | } |
255 | 270 | ||
256 | /** | 271 | /** |
@@ -449,31 +464,27 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) | |||
449 | 464 | ||
450 | static ssize_t update_ppp(u64 *entitlement, u8 *weight) | 465 | static ssize_t update_ppp(u64 *entitlement, u8 *weight) |
451 | { | 466 | { |
452 | unsigned long current_entitled; | 467 | struct hvcall_ppp_data ppp_data; |
453 | unsigned long dummy; | 468 | u8 new_weight; |
454 | unsigned long resource; | ||
455 | u8 current_weight, new_weight; | ||
456 | u64 new_entitled; | 469 | u64 new_entitled; |
457 | ssize_t retval; | 470 | ssize_t retval; |
458 | 471 | ||
459 | /* Get our current parameters */ | 472 | /* Get our current parameters */ |
460 | retval = h_get_ppp(¤t_entitled, &dummy, &dummy, &resource); | 473 | retval = h_get_ppp(&ppp_data); |
461 | if (retval) | 474 | if (retval) |
462 | return retval; | 475 | return retval; |
463 | 476 | ||
464 | current_weight = (resource >> 5 * 8) & 0xFF; | ||
465 | |||
466 | if (entitlement) { | 477 | if (entitlement) { |
467 | new_weight = current_weight; | 478 | new_weight = ppp_data.weight; |
468 | new_entitled = *entitlement; | 479 | new_entitled = *entitlement; |
469 | } else if (weight) { | 480 | } else if (weight) { |
470 | new_weight = *weight; | 481 | new_weight = *weight; |
471 | new_entitled = current_entitled; | 482 | new_entitled = ppp_data.entitlement; |
472 | } else | 483 | } else |
473 | return -EINVAL; | 484 | return -EINVAL; |
474 | 485 | ||
475 | pr_debug("%s: current_entitled = %lu, current_weight = %u\n", | 486 | pr_debug("%s: current_entitled = %lu, current_weight = %u\n", |
476 | __FUNCTION__, current_entitled, current_weight); | 487 | __FUNCTION__, ppp_data.entitlement, ppp_data.weight); |
477 | 488 | ||
478 | pr_debug("%s: new_entitled = %lu, new_weight = %u\n", | 489 | pr_debug("%s: new_entitled = %lu, new_weight = %u\n", |
479 | __FUNCTION__, new_entitled, new_weight); | 490 | __FUNCTION__, new_entitled, new_weight); |