1 /* Common data structures and functions consumed by hypervisor and toolstack */ 2 #ifndef XEN_LIB_X86_POLICIES_H 3 #define XEN_LIB_X86_POLICIES_H 4 5 #include <xen/lib/x86/cpuid.h> 6 #include <xen/lib/x86/msr.h> 7 8 struct cpu_policy 9 { 10 struct cpuid_policy *cpuid; 11 struct msr_policy *msr; 12 }; 13 14 struct cpu_policy_errors 15 { 16 uint32_t leaf, subleaf; 17 uint32_t msr; 18 }; 19 20 #define INIT_CPU_POLICY_ERRORS { -1, -1, -1 } 21 22 /* 23 * Calculate whether two policies are compatible. 24 * 25 * i.e. Can a VM configured with @guest run on a CPU supporting @host. 26 * 27 * @param host A cpu_policy describing the hardware capabilities. 28 * @param guest A cpu_policy describing the intended VM configuration. 29 * @param err Optional hint for error diagnostics. 30 * @returns -errno 31 * 32 * For typical usage, @host should be a system policy. In the case that an 33 * incompatibility is detected, the optional err pointer may identify the 34 * problematic leaf/subleaf and/or MSR. 35 */ 36 int x86_cpu_policies_are_compatible(const struct cpu_policy *host, 37 const struct cpu_policy *guest, 38 struct cpu_policy_errors *err); 39 40 #endif /* !XEN_LIB_X86_POLICIES_H */ 41 42 /* 43 * Local variables: 44 * mode: C 45 * c-file-style: "BSD" 46 * c-basic-offset: 4 47 * tab-width: 4 48 * indent-tabs-mode: nil 49 * End: 50 */ 51