x86: don't build platform hypercall helpers multiple times ... 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 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -34,6 +34,20 @@ #include "cpu/mtrr/mtrr.h" #include +/* 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 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 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_PA 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_PA 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; --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include --- a/xen/include/asm-x86/smp.h +++ b/xen/include/asm-x86/smp.h @@ -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.