libs/guest: Move struct xc_cpu_policy into xg_private.h
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 10 Jun 2021 11:57:42 +0000 (12:57 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 15 Jun 2021 19:50:32 +0000 (20:50 +0100)
... so tests can peek at the internals, without the structure being generally
available to users of the library.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
tools/libs/guest/xg_cpuid_x86.c
tools/libs/guest/xg_private.h

index ec5a47fde4ada1b607dc2d2a7a1739251c1549e8..e01d657e0394556729def6296df0079140ee2eac 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <limits.h>
-#include "xc_private.h"
+#include "xg_private.h"
 #include "xc_bitops.h"
 #include <xen/hvm/params.h>
 #include <xen-tools/libs.h>
@@ -34,18 +34,9 @@ enum {
 
 #include <xen/asm/x86-vendors.h>
 
-#include <xen/lib/x86/cpu-policy.h>
-
 #define bitmaskof(idx)      (1u << ((idx) & 31))
 #define featureword_of(idx) ((idx) >> 5)
 
-struct xc_cpu_policy {
-    struct cpuid_policy cpuid;
-    struct msr_policy msr;
-    xen_cpuid_leaf_t leaves[CPUID_MAX_SERIALISED_LEAVES];
-    xen_msr_entry_t entries[MSR_MAX_SERIALISED_ENTRIES];
-};
-
 int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps)
 {
     DECLARE_SYSCTL;
index 03d765da211f6bd230229394cfb288eda6f685f8..28441ee13ff77027b2d19d3a5bdaa8d4ec697533 100644 (file)
@@ -168,4 +168,15 @@ int pin_table(xc_interface *xch, unsigned int type, unsigned long mfn,
 #define M2P_SIZE(_m)    ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)
 #define M2P_CHUNKS(_m)  (M2P_SIZE((_m)) >> M2P_SHIFT)
 
+#if defined(__x86_64__) || defined(__i386__)
+#include <xen/lib/x86/cpu-policy.h>
+
+struct xc_cpu_policy {
+    struct cpuid_policy cpuid;
+    struct msr_policy msr;
+    xen_cpuid_leaf_t leaves[CPUID_MAX_SERIALISED_LEAVES];
+    xen_msr_entry_t entries[MSR_MAX_SERIALISED_ENTRIES];
+};
+#endif /* x86 */
+
 #endif /* XG_PRIVATE_H */