]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/pseries: Generalize hcall_vphn()
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Wed, 3 Jul 2019 17:03:58 +0000 (22:33 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 4 Jul 2019 12:23:38 +0000 (22:23 +1000)
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>
arch/powerpc/mm/book3s64/vphn.h
arch/powerpc/mm/numa.c

index f0b93c2dd578202a360a846ad9b4ce4081700b6f..f7ff1e0c3801dd4ef6cdff9f0d28df0346ae92e6 100644 (file)
  */
 #define VPHN_ASSOC_BUFSIZE (VPHN_REGISTER_COUNT*sizeof(u64)/sizeof(u16) + 1)
 
+/*
+ * The H_HOME_NODE_ASSOCIATIVITY hcall takes two values for flags:
+ * 1 for retrieving associativity information for a guest cpu
+ * 2 for retrieving associativity information for a host/hypervisor cpu
+ */
+#define VPHN_FLAG_VCPU 1
+#define VPHN_FLAG_PCPU 2
+
 extern int vphn_unpack_associativity(const long *packed, __be32 *unpacked);
 
 #endif
index 57e64273cb33b31899cd43608627fa715ccd5a56..57f006b6214ba0d19ebfe5e766e99ea42126df40 100644 (file)
@@ -1087,6 +1087,17 @@ static void reset_topology_timer(void);
 static int topology_timer_secs = 1;
 static int topology_inited;
 
+static long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity)
+{
+       long rc;
+       long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
+
+       rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, cpu);
+       vphn_unpack_associativity(retbuf, associativity);
+
+       return rc;
+}
+
 /*
  * Change polling interval for associativity changes.
  */
@@ -1165,25 +1176,13 @@ static int update_cpu_associativity_changes_mask(void)
  * Retrieve the new associativity information for a virtual processor's
  * home node.
  */
-static long hcall_vphn(unsigned long cpu, __be32 *associativity)
-{
-       long rc;
-       long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
-       u64 flags = 1;
-       int hwcpu = get_hard_smp_processor_id(cpu);
-
-       rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, retbuf, flags, hwcpu);
-       vphn_unpack_associativity(retbuf, associativity);
-
-       return rc;
-}
-
 static long vphn_get_associativity(unsigned long cpu,
                                        __be32 *associativity)
 {
        long rc;
 
-       rc = hcall_vphn(cpu, associativity);
+       rc = hcall_vphn(get_hard_smp_processor_id(cpu),
+                               VPHN_FLAG_VCPU, associativity);
 
        switch (rc) {
        case H_FUNCTION: