]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86: don't build platform hypercall helpers multiple times
authorJan Beulich <jbeulich@suse.com>
Wed, 21 Oct 2015 08:52:28 +0000 (10:52 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 21 Oct 2015 08:52:28 +0000 (10:52 +0200)
... to eliminate the resulting duplicate symbols. This includes
dropping an odd per-CPU variable left from 32-bit days: Now that we
only care about 64-bit builds, converting the uint64_t needing
passing to a void pointer is no problem anymore.

Since the COMPAT handling section needs to be re-organized for this
anyway, also adjust a few other shortcomings (like declarations not
being visible at the point of the respective definition, risking both
to get out of sync).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/platform_hypercall.c
xen/arch/x86/sysctl.c
xen/include/asm-x86/smp.h

index 76262617cf8b14b57e6985b16c49b0fb6a277604..39fa808fde138755e6fa91f7b638713d0f6a2a98 100644 (file)
 #include "cpu/mtrr/mtrr.h"
 #include <xsm/xsm.h>
 
+/* Declarations for items shared with the compat mode handler. */
+extern spinlock_t xenpf_lock;
+
+#define RESOURCE_ACCESS_MAX_ENTRIES 3
+struct resource_access {
+    unsigned int nr_done;
+    unsigned int nr_entries;
+    xenpf_resource_entry_t *entries;
+};
+
+long cpu_frequency_change_helper(void *);
+void check_resource_access(struct resource_access *);
+void resource_access(void *);
+
 #ifndef COMPAT
 typedef long ret_t;
 DEFINE_SPINLOCK(xenpf_lock);
@@ -43,32 +57,12 @@ DEFINE_SPINLOCK(xenpf_lock);
 # define copy_to_compat copy_to_guest
 # undef guest_from_compat_handle
 # define guest_from_compat_handle(x,y) ((x)=(y))
-#else
-extern spinlock_t xenpf_lock;
-#endif
 
-static DEFINE_PER_CPU(uint64_t, freq);
-
-static long cpu_frequency_change_helper(void *data)
+long cpu_frequency_change_helper(void *data)
 {
-    return cpu_frequency_change(this_cpu(freq));
+    return cpu_frequency_change((uint64_t)data);
 }
 
-/* from sysctl.c */
-long cpu_up_helper(void *data);
-long cpu_down_helper(void *data);
-
-/* from core_parking.c */
-long core_parking_helper(void *data);
-uint32_t get_cur_idle_nums(void);
-
-#define RESOURCE_ACCESS_MAX_ENTRIES 3
-struct xen_resource_access {
-    unsigned int nr_done;
-    unsigned int nr_entries;
-    xenpf_resource_entry_t *entries;
-};
-
 static bool_t allow_access_msr(unsigned int msr)
 {
     switch ( msr )
@@ -83,7 +77,7 @@ static bool_t allow_access_msr(unsigned int msr)
     return 0;
 }
 
-static void check_resource_access(struct xen_resource_access *ra)
+void check_resource_access(struct resource_access *ra)
 {
     unsigned int i;
 
@@ -122,9 +116,9 @@ static void check_resource_access(struct xen_resource_access *ra)
     ra->nr_done = i;
 }
 
-static void resource_access(void *info)
+void resource_access(void *info)
 {
-    struct xen_resource_access *ra = info;
+    struct resource_access *ra = info;
     unsigned int i;
     u64 tsc = 0;
 
@@ -185,6 +179,7 @@ static void resource_access(void *info)
 
     ra->nr_done = i;
 }
+#endif
 
 ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
 {
@@ -457,10 +452,9 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
         ret = -EINVAL;
         if ( op->u.change_freq.flags || !cpu_online(op->u.change_freq.cpu) )
             break;
-        per_cpu(freq, op->u.change_freq.cpu) = op->u.change_freq.freq;
         ret = continue_hypercall_on_cpu(op->u.change_freq.cpu,
                                         cpu_frequency_change_helper,
-                                        NULL);
+                                        (void *)op->u.change_freq.freq);
         break;
 
     case XENPF_getidletime:
@@ -734,7 +728,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
 
     case XENPF_resource_op:
     {
-        struct xen_resource_access ra;
+        struct resource_access ra;
         unsigned int cpu;
         XEN_GUEST_HANDLE(xenpf_resource_entry_t) guest_entries;
 
index e54ddac514eefb82641f73dcadb7fda453b4c037..34ee240228f77cd8c182af83beab39c32a7eda03 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/support.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 #include <asm/numa.h>
 #include <xen/nodemask.h>
 #include <xen/cpu.h>
index ea078881c0d90be290d6d3e5aec528a05e09bd3b..fb0f42a6a71e23fc88b6ebd509f4657d5a82ee67 100644 (file)
@@ -58,6 +58,12 @@ int hard_smp_processor_id(void);
 
 void __stop_this_cpu(void);
 
+long cpu_up_helper(void *data);
+long cpu_down_helper(void *data);
+
+long core_parking_helper(void *data);
+uint32_t get_cur_idle_nums(void);
+
 /*
  * The value may be greater than the actual socket number in the system and
  * is required not to change from the initial startup.