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

powerpc/pseries: Generalize hcall_vphn()

H_HOME_NODE_ASSOCIATIVITY hcall can take two different flags and return
different associativity information in each case. Generalize the
existing hcall_vphn() function to take flags as an argument and to
return the result. Update the only existing user to pass the proper
arguments.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Naveen N. Rao and committed by
Michael Ellerman
ef34e0ef 06220d78

+21 -14
+8
arch/powerpc/mm/book3s64/vphn.h
··· 11 11 */ 12 12 #define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1) 13 13 14 + /* 15 + * The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags: 16 + * 1 for retrieving associativity information for a guest cpu 17 + * 2 for retrieving associativity information for a host/hypervisor cpu 18 + */ 19 + #define VPHN_FLAG_VCPU 1 20 + #define VPHN_FLAG_PCPU 2 21 + 14 22 extern int vphn_unpack_associativity(const long *packed, __be32 *unpacked); 15 23 16 24 #endif
+13 -14
arch/powerpc/mm/numa.c
··· 1087 1087 static int topology_timer_secs = 1; 1088 1088 static int topology_inited; 1089 1089 1090 + static long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity) 1091 + { 1092 + long rc; 1093 + long retbuf[PLPAR_HCALL9_BUFSIZE] = {0}; 1094 + 1095 + rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, cpu); 1096 + vphn_unpack_associativity(retbuf, associativity); 1097 + 1098 + return rc; 1099 + } 1100 + 1090 1101 /* 1091 1102 * Change polling interval for associativity changes. 1092 1103 */ ··· 1176 1165 * Retrieve the new associativity information for a virtual processor's 1177 1166 * home node. 1178 1167 */ 1179 - static long hcall_vphn(unsigned long cpu, __be32 *associativity) 1180 - { 1181 - long rc; 1182 - long retbuf[PLPAR_HCALL9_BUFSIZE] = {0}; 1183 - u64 flags = 1; 1184 - int hwcpu = get_hard_smp_processor_id(cpu); 1185 - 1186 - rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, hwcpu); 1187 - vphn_unpack_associativity(retbuf, associativity); 1188 - 1189 - return rc; 1190 - } 1191 - 1192 1168 static long vphn_get_associativity(unsigned long cpu, 1193 1169 __be32 *associativity) 1194 1170 { 1195 1171 long rc; 1196 1172 1197 - rc = hcall_vphn(cpu, associativity); 1173 + rc = hcall_vphn(get_hard_smp_processor_id(cpu), 1174 + VPHN_FLAG_VCPU, associativity); 1198 1175 1199 1176 switch (rc) { 1200 1177 case H_FUNCTION: