tools/libs: move cpu policy related prototypes to xenguest.h
PATCH v2 1/1 tools/libs: move cpu policy related prototypes to xenguest.h
Do this before adding any more stuff to xg_cpuid_x86.c.
The placement in xenctrl.h is wrong, as they are implemented by the xenguest library. Note that xg_cpuid_x86.c needs to include xg_private.h, and in turn also fix xg_private.h to include xc_bitops.h. The bitops definition of BITS_PER_LONG needs to be changed to not be an expression, so that xxhash.h can use it in a preprocessor if directive.
As a result also modify xen-cpuid and the ocaml stubs to include xenguest.h.
Reported-by Andrew Cooper <[email protected]>
Signed-off-by Roger Pau Monné <[email protected]>
Acked-by Andrew Cooper <[email protected]>
---
Changes since v1:
- Include xenguest.h in ocaml stubs.
- Change BITS_PER_LONG definition in xc_bitops.h.
--- tools/include/xenctrl.h | 55 ---------------------------- tools/include/xenguest.h | 56 +++++++++++++++++++++++++++++ tools/libs/ctrl/xc_bitops.h | 6 +++- tools/libs/guest/xg_cpuid_x86.c | 3 +- tools/libs/guest/xg_private.h | 1 + tools/misc/xen-cpuid.c | 1 + tools/ocaml/libs/xc/xenctrl_stubs.c | 1 + 7 files changed, 65 insertions(+), 58 deletions(-)
tools/include/xenctrl.h +0 -55
@@ -2589,61 +2589,6 @@ int xc_psr_get_domain_data(xc_interface *xch, uint32_t domid, uint64_t *data);int xc_psr_get_hw_info (xc_interface *xch,uint32_t socket,xc_psr_feat_type type,xc_psr_hw_info *hw_info); - -typedef struct xc_cpu_policy xc_cpu_policy_t ; - -/* Create and free a xc_cpu_policy object. */ -xc_cpu_policy_t *xc_cpu_policy_init (void ); -void xc_cpu_policy_destroy (xc_cpu_policy_t *policy); - -/* Retrieve a system policy, or get/set a domains policy. */ -int xc_cpu_policy_get_system (xc_interface *xch,unsigned int policy_idx, -xc_cpu_policy_t *policy); -int xc_cpu_policy_get_domain (xc_interface *xch,uint32_t domid, -xc_cpu_policy_t *policy); -int xc_cpu_policy_set_domain (xc_interface *xch,uint32_t domid, -xc_cpu_policy_t *policy); - -/* Manipulate a policy via architectural representations. */ -int xc_cpu_policy_serialise (xc_interface *xch,const xc_cpu_policy_t *policy, -xen_cpuid_leaf_t *leaves,uint32_t *nr_leaves, -xen_msr_entry_t *msrs,uint32_t *nr_msrs); -int xc_cpu_policy_update_cpuid (xc_interface *xch,xc_cpu_policy_t *policy, -const xen_cpuid_leaf_t *leaves, -uint32_t nr); -int xc_cpu_policy_update_msrs (xc_interface *xch,xc_cpu_policy_t *policy, -const xen_msr_entry_t *msrs,uint32_t nr); - -/* Compatibility calculations. */ -bool xc_cpu_policy_is_compatible (xc_interface *xch,xc_cpu_policy_t *host, -xc_cpu_policy_t *guest); - -int xc_get_cpu_levelling_caps (xc_interface *xch,uint32_t *caps); -int xc_get_cpu_featureset (xc_interface *xch,uint32_t index, -uint32_t *nr_features,uint32_t *featureset); - -int xc_cpu_policy_get_size (xc_interface *xch,uint32_t *nr_leaves, -uint32_t *nr_msrs); -int xc_set_domain_cpu_policy (xc_interface *xch,uint32_t domid, -uint32_t nr_leaves,xen_cpuid_leaf_t *leaves, -uint32_t nr_msrs,xen_msr_entry_t *msrs, -uint32_t *err_leaf_p,uint32_t *err_subleaf_p, -uint32_t *err_msr_p); - -uint32_t xc_get_cpu_featureset_size (void ); - -enum xc_static_cpu_featuremask { -XC_FEATUREMASK_KNOWN , -XC_FEATUREMASK_SPECIAL , -XC_FEATUREMASK_PV_MAX , -XC_FEATUREMASK_PV_DEF , -XC_FEATUREMASK_HVM_SHADOW_MAX , -XC_FEATUREMASK_HVM_SHADOW_DEF , -XC_FEATUREMASK_HVM_HAP_MAX , -XC_FEATUREMASK_HVM_HAP_DEF , -}; -const uint32_t *xc_get_static_cpu_featuremask (enum xc_static_cpu_featuremask ); -#endif int xc_livepatch_upload(xc_interface *xch,
tools/include/xenguest.h +56 -0
60 lines not on this page · raw message
tools/libs/ctrl/xc_bitops.h +5 -1
@@ -6,7 +6,11 @@#include <stdlib.h> #include <string.h> -#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#ifdef __LP64__ +#define BITS_PER_LONG 64 +#else +#define BITS_PER_LONG 32 +#endif #define BITMAP_ENTRY (_nr,_bmap) ((_bmap))[(_nr) / 8]#define BITMAP_SHIFT (_nr) ((_nr) % 8)
tools/libs/guest/xg_cpuid_x86.c +1 -2
@@ -22,8 +22,7 @@#include <stdlib.h> #include <stdbool.h> #include <limits.h> -#include "xc_private.h" -#include "xc_bitops.h" +#include "xg_private.h" #include <xen/hvm/params.h> #include <xen-tools/libs.h>
tools/libs/guest/xg_private.h +1 -0
@@ -27,6 +27,7 @@#include <sys/stat.h> #include "xc_private.h" +#include "xc_bitops.h" #include "xenguest.h" #include <xen/memory.h>
tools/misc/xen-cpuid.c +1 -0
@@ -8,6 +8,7 @@#include <inttypes.h> #include <xenctrl.h> +#include <xenguest.h> #include <xen-tools/libs.h>
tools/ocaml/libs/xc/xenctrl_stubs.c +1 -0
@@ -32,6 +32,7 @@#define XC_WANT_COMPAT_MAP_FOREIGN_API #include <xenctrl.h> +#include <xenguest.h> #include <xen-tools/libs.h> #include "mmap_stubs.h"
Signature · 1 line
2.31.1