diff options
-rw-r--r-- | arch/powerpc/include/asm/hvcall.h | 22 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 28 |
2 files changed, 42 insertions, 8 deletions
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index fbe2932fa9e9..6251a4b10be7 100644 --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h | |||
@@ -291,6 +291,28 @@ struct hvcall_mpp_data { | |||
291 | }; | 291 | }; |
292 | 292 | ||
293 | int h_get_mpp(struct hvcall_mpp_data *); | 293 | int h_get_mpp(struct hvcall_mpp_data *); |
294 | |||
295 | #ifdef CONFIG_PPC_PSERIES | ||
296 | extern int CMO_PrPSP; | ||
297 | extern int CMO_SecPSP; | ||
298 | extern unsigned long CMO_PageSize; | ||
299 | |||
300 | static inline int cmo_get_primary_psp(void) | ||
301 | { | ||
302 | return CMO_PrPSP; | ||
303 | } | ||
304 | |||
305 | static inline int cmo_get_secondary_psp(void) | ||
306 | { | ||
307 | return CMO_SecPSP; | ||
308 | } | ||
309 | |||
310 | static inline unsigned long cmo_get_page_size(void) | ||
311 | { | ||
312 | return CMO_PageSize; | ||
313 | } | ||
314 | #endif /* CONFIG_PPC_PSERIES */ | ||
315 | |||
294 | #endif /* __ASSEMBLY__ */ | 316 | #endif /* __ASSEMBLY__ */ |
295 | #endif /* __KERNEL__ */ | 317 | #endif /* __KERNEL__ */ |
296 | #endif /* _ASM_POWERPC_HVCALL_H */ | 318 | #endif /* _ASM_POWERPC_HVCALL_H */ |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 063a0d2fba30..3ce8a139b85d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -68,6 +68,9 @@ | |||
68 | #include "plpar_wrappers.h" | 68 | #include "plpar_wrappers.h" |
69 | #include "pseries.h" | 69 | #include "pseries.h" |
70 | 70 | ||
71 | int CMO_PrPSP = -1; | ||
72 | int CMO_SecPSP = -1; | ||
73 | unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT); | ||
71 | 74 | ||
72 | int fwnmi_active; /* TRUE if an FWNMI handler is present */ | 75 | int fwnmi_active; /* TRUE if an FWNMI handler is present */ |
73 | 76 | ||
@@ -325,8 +328,7 @@ void pSeries_cmo_feature_init(void) | |||
325 | { | 328 | { |
326 | char *ptr, *key, *value, *end; | 329 | char *ptr, *key, *value, *end; |
327 | int call_status; | 330 | int call_status; |
328 | int PrPSP = -1; | 331 | int page_order = IOMMU_PAGE_SHIFT; |
329 | int SecPSP = -1; | ||
330 | 332 | ||
331 | pr_debug(" -> fw_cmo_feature_init()\n"); | 333 | pr_debug(" -> fw_cmo_feature_init()\n"); |
332 | spin_lock(&rtas_data_buf_lock); | 334 | spin_lock(&rtas_data_buf_lock); |
@@ -365,21 +367,31 @@ void pSeries_cmo_feature_init(void) | |||
365 | break; | 367 | break; |
366 | } | 368 | } |
367 | 369 | ||
368 | if (0 == strcmp(key, "PrPSP")) | 370 | if (0 == strcmp(key, "CMOPageSize")) |
369 | PrPSP = simple_strtol(value, NULL, 10); | 371 | page_order = simple_strtol(value, NULL, 10); |
372 | else if (0 == strcmp(key, "PrPSP")) | ||
373 | CMO_PrPSP = simple_strtol(value, NULL, 10); | ||
370 | else if (0 == strcmp(key, "SecPSP")) | 374 | else if (0 == strcmp(key, "SecPSP")) |
371 | SecPSP = simple_strtol(value, NULL, 10); | 375 | CMO_SecPSP = simple_strtol(value, NULL, 10); |
372 | value = key = ptr + 1; | 376 | value = key = ptr + 1; |
373 | } | 377 | } |
374 | ptr++; | 378 | ptr++; |
375 | } | 379 | } |
376 | 380 | ||
377 | if (PrPSP != -1 || SecPSP != -1) { | 381 | /* Page size is returned as the power of 2 of the page size, |
382 | * convert to the page size in bytes before returning | ||
383 | */ | ||
384 | CMO_PageSize = 1 << page_order; | ||
385 | pr_debug("CMO_PageSize = %lu\n", CMO_PageSize); | ||
386 | |||
387 | if (CMO_PrPSP != -1 || CMO_SecPSP != -1) { | ||
378 | pr_info("CMO enabled\n"); | 388 | pr_info("CMO enabled\n"); |
379 | pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP); | 389 | pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP, |
390 | CMO_SecPSP); | ||
380 | powerpc_firmware_features |= FW_FEATURE_CMO; | 391 | powerpc_firmware_features |= FW_FEATURE_CMO; |
381 | } else | 392 | } else |
382 | pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP); | 393 | pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP, |
394 | CMO_SecPSP); | ||
383 | spin_unlock(&rtas_data_buf_lock); | 395 | spin_unlock(&rtas_data_buf_lock); |
384 | pr_debug(" <- fw_cmo_feature_init()\n"); | 396 | pr_debug(" <- fw_cmo_feature_init()\n"); |
385 | } | 397 | } |