Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pseries: convert CMO probe to papr_sysparm API

Convert the direct invocation of the ibm,get-system-parameter RTAS
function to papr_sysparm_get().

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230125-b4-powerpc-rtas-queue-v3-15-26929c8cce78@linux.ibm.com

authored by

Nathan Lynch and committed by
Michael Ellerman
b8dc7177 419e27f3

+6 -17
+6 -17
arch/powerpc/platforms/pseries/setup.c
··· 57 57 #include <asm/pmc.h> 58 58 #include <asm/xics.h> 59 59 #include <asm/xive.h> 60 + #include <asm/papr-sysparm.h> 60 61 #include <asm/ppc-pci.h> 61 62 #include <asm/i8259.h> 62 63 #include <asm/udbg.h> ··· 942 941 */ 943 942 static void __init pSeries_cmo_feature_init(void) 944 943 { 945 - const s32 token = rtas_token("ibm,get-system-parameter"); 944 + static struct papr_sysparm_buf buf __initdata; 945 + static_assert(sizeof(buf.val) >= CMO_MAXLENGTH); 946 946 char *ptr, *key, *value, *end; 947 - int call_status; 948 947 int page_order = IOMMU_PAGE_SHIFT_4K; 949 948 950 949 pr_debug(" -> fw_cmo_feature_init()\n"); 951 950 952 - do { 953 - spin_lock(&rtas_data_buf_lock); 954 - call_status = rtas_call(token, 3, 1, NULL, 955 - CMO_CHARACTERISTICS_TOKEN, 956 - __pa(rtas_data_buf), 957 - RTAS_DATA_BUF_SIZE); 958 - if (call_status == 0) 959 - break; 960 - spin_unlock(&rtas_data_buf_lock); 961 - } while (rtas_busy_delay(call_status)); 962 - 963 - if (call_status != 0) { 951 + if (papr_sysparm_get(PAPR_SYSPARM_COOP_MEM_OVERCOMMIT_ATTRS, &buf)) { 964 952 pr_debug("CMO not available\n"); 965 953 pr_debug(" <- fw_cmo_feature_init()\n"); 966 954 return; 967 955 } 968 956 969 - end = rtas_data_buf + CMO_MAXLENGTH - 2; 970 - ptr = rtas_data_buf + 2; /* step over strlen value */ 957 + end = &buf.val[CMO_MAXLENGTH]; 958 + ptr = &buf.val[0]; 971 959 key = value = ptr; 972 960 973 961 while (*ptr && (ptr <= end)) { ··· 1002 1012 } else 1003 1013 pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP, 1004 1014 CMO_SecPSP); 1005 - spin_unlock(&rtas_data_buf_lock); 1006 1015 pr_debug(" <- fw_cmo_feature_init()\n"); 1007 1016 } 1008 1017