|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] x86/cpu-policy: Remove cpu_policy.x86_vendor
c520286a53 ("x86: Reject CPU policies with vendors other than the
host's") made x86_cpu_policies_are_compatible() reject any guest CPU
policy whose vendor doesn't match the host's, and that check runs
before a policy is ever installed. Every cpu_policy visible to a
running domain, or to any other in-hypervisor consumer (the
raw/host/pv_max/hvm_max policies, all derived from the host's own
CPUID), therefore now necessarily has the same vendor as
boot_cpu_data.x86_vendor.
The cached x86_vendor field is thus redundant, so we drop it, and
x86_cpu_policy_recalc_synth() along with it, since that function's
only job was to compute it.
The lib/x86 code shared with the toolstack and the emulator's
standalone test suite has no boot_cpu_data to fall back on (and isn't
covered by the same guarantee), so those few spots compute the vendor
from basic.vendor_ebx/ecx/edx via x86_cpuid_lookup_vendor() instead of
caching it.
No functional change.
Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: ODIN Thomas <thomas.odin@xxxxxxxxxx>
---
tools/fuzz/cpu-policy/afl-policy-fuzzer.c | 3 +-
tools/libs/guest/xg_cpuid_x86.c | 4 ++-
tools/tests/x86_emulator/test_x86_emulator.c | 35 ++++++++++++-------
xen/arch/x86/cpu-policy.c | 13 +++----
xen/arch/x86/cpu/mcheck/mce_intel.c | 3 +-
xen/arch/x86/cpuid.c | 2 +-
xen/arch/x86/domain.c | 3 +-
xen/arch/x86/hvm/hvm.c | 2 +-
xen/arch/x86/hvm/ioreq.c | 3 +-
xen/arch/x86/include/asm/guest_pt.h | 4 ++-
.../x86/lib/cpu-policy/copy-from-buffer.c | 2 --
xen/arch/x86/lib/cpu-policy/cpuid.c | 8 -----
xen/arch/x86/msr.c | 33 ++++++++++-------
xen/arch/x86/x86_emulate/private.h | 5 ++-
xen/arch/x86/x86_emulate/x86_emulate.c | 7 ++--
xen/include/xen/lib/x86/cpu-policy.h | 8 -----
16 files changed, 70 insertions(+), 65 deletions(-)
diff --git a/tools/fuzz/cpu-policy/afl-policy-fuzzer.c
b/tools/fuzz/cpu-policy/afl-policy-fuzzer.c
index b890308fb891..0befe135ab66 100644
--- a/tools/fuzz/cpu-policy/afl-policy-fuzzer.c
+++ b/tools/fuzz/cpu-policy/afl-policy-fuzzer.c
@@ -40,7 +40,7 @@ static void check_policy(struct cpu_policy *cp)
cp->basic.raw[7] = EMPTY_LEAF;
cp->basic.raw[0xb] = EMPTY_LEAF;
cp->basic.raw[0xd] = EMPTY_LEAF;
- data_end = offsetof(typeof(*cp), x86_vendor) + sizeof(cp->x86_vendor);
+ data_end = offsetof(typeof(*cp), hv2_limit) + sizeof(cp->hv2_limit);
if ( data_end < sizeof(*cp) )
memset((void *)cp + data_end, 0, sizeof(*cp) - data_end);
@@ -49,7 +49,6 @@ static void check_policy(struct cpu_policy *cp)
* serialisation.
*/
x86_cpu_policy_clear_out_of_range_leaves(cp);
- x86_cpu_policy_recalc_synth(cp);
/* Serialise... */
rc = x86_cpuid_copy_to_buffer(cp, leaves, &nr_leaves);
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 0db6d77cd801..588fb4707ee1 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -731,7 +731,9 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t
domid, bool restore,
else if ( !(p->policy.basic.lppp & 0x80) )
p->policy.basic.lppp *= 2;
- switch ( p->policy.x86_vendor )
+ switch ( x86_cpuid_lookup_vendor(p->policy.basic.vendor_ebx,
+ p->policy.basic.vendor_ecx,
+ p->policy.basic.vendor_edx) )
{
case X86_VENDOR_INTEL:
for ( i = 0; (p->policy.cache.subleaf[i].type &&
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c
b/tools/tests/x86_emulator/test_x86_emulator.c
index dfadc0262468..cacfb0a55bb3 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -843,8 +843,10 @@ static void zap_fpsel(unsigned int *env, bool is_32bit)
env[3] &= ~0xffff;
}
- if ( cpu_policy.x86_vendor != X86_VENDOR_AMD &&
- cpu_policy.x86_vendor != X86_VENDOR_HYGON )
+ if ( !(x86_cpuid_lookup_vendor(cpu_policy.basic.vendor_ebx,
+ cpu_policy.basic.vendor_ecx,
+ cpu_policy.basic.vendor_edx) &
+ (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
return;
if ( is_32bit )
@@ -968,7 +970,7 @@ int main(int argc, char **argv)
bool stack_exec;
int rc;
#ifdef __x86_64__
- unsigned int vendor_native;
+ struct cpuid_leaf vendor_native;
#else
unsigned int bcdres_native, bcdres_emul;
#endif
@@ -1606,18 +1608,25 @@ int main(int argc, char **argv)
goto fail;
printf("okay\n");
- vendor_native = cpu_policy.x86_vendor;
- for ( cpu_policy.x86_vendor = X86_VENDOR_AMD; ; )
- {
- unsigned int v = cpu_policy.x86_vendor == X86_VENDOR_INTEL;
- const char *vendor = cpu_policy.x86_vendor == X86_VENDOR_INTEL ?
"Intel" : "AMD";
+ vendor_native = cpu_policy.basic.raw[0];
+ cpu_policy.basic.vendor_ebx = X86_VENDOR_AMD_EBX;
+ cpu_policy.basic.vendor_ecx = X86_VENDOR_AMD_ECX;
+ cpu_policy.basic.vendor_edx = X86_VENDOR_AMD_EDX;
+ for ( ; ; )
+ {
+ unsigned int vendor = x86_cpuid_lookup_vendor(
+ cpu_policy.basic.vendor_ebx, cpu_policy.basic.vendor_ecx,
+ cpu_policy.basic.vendor_edx);
+ unsigned int v = vendor == X86_VENDOR_INTEL;
+ const char *vendor_name = vendor == X86_VENDOR_INTEL ? "Intel" : "AMD";
uint64_t *stk = (void *)res + MMAP_SZ - 16;
regs.rcx = 2;
for ( i = 0; i < ARRAY_SIZE(vendor_tests); ++i )
{
printf("%-*s",
- 40 - printf("Testing %s [%s]", vendor_tests[i].descr,
vendor),
+ 40 - printf("Testing %s [%s]", vendor_tests[i].descr,
+ vendor_name),
"...");
memcpy(instr, vendor_tests[i].opcode, vendor_tests[i].opc_len[v]);
regs.eflags = EFLAGS_ALWAYS_SET;
@@ -1646,11 +1655,13 @@ int main(int argc, char **argv)
printf("okay\n");
}
- if ( cpu_policy.x86_vendor == X86_VENDOR_INTEL )
+ if ( vendor == X86_VENDOR_INTEL )
break;
- cpu_policy.x86_vendor = X86_VENDOR_INTEL;
+ cpu_policy.basic.vendor_ebx = X86_VENDOR_INTEL_EBX;
+ cpu_policy.basic.vendor_ecx = X86_VENDOR_INTEL_ECX;
+ cpu_policy.basic.vendor_edx = X86_VENDOR_INTEL_EDX;
}
- cpu_policy.x86_vendor = vendor_native;
+ cpu_policy.basic.raw[0] = vendor_native;
printf("%-40s", "Testing cmpbxadd %rbx,%r9,(%rdx)...");
if ( stack_exec && cpu_has_cmpccxadd )
diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index e797585528d0..9e70ffe6c3be 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -279,7 +279,7 @@ static void recalculate_misc(struct cpu_policy *p)
p->extd.raw[0x8].d = 0;
- switch ( p->x86_vendor )
+ switch ( boot_cpu_data.x86_vendor )
{
case X86_VENDOR_INTEL:
p->basic.l2_nr_queries = 1; /* Fixed to 1 query. */
@@ -341,9 +341,6 @@ void calculate_raw_cpu_policy(void)
x86_cpu_policy_fill_native(p);
- /* Nothing good will come from Xen and libx86 disagreeing on vendor. */
- ASSERT(p->x86_vendor == boot_cpu_data.vendor);
-
/*
* Clear the truly dynamic fields.
*
@@ -994,14 +991,12 @@ void recalculate_cpuid_policy(struct domain *d)
return;
}
- p->x86_vendor = x86_cpuid_lookup_vendor(
- p->basic.vendor_ebx, p->basic.vendor_ecx, p->basic.vendor_edx);
-
p->basic.max_leaf = min(p->basic.max_leaf, max->basic.max_leaf);
p->feat.max_subleaf = min(p->feat.max_subleaf, max->feat.max_subleaf);
p->extd.max_leaf = 0x80000000U | min(p->extd.max_leaf & 0xffff,
- ((p->x86_vendor & (X86_VENDOR_AMD |
-
X86_VENDOR_HYGON))
+ ((boot_cpu_data.x86_vendor &
+ (X86_VENDOR_AMD |
+ X86_VENDOR_HYGON))
? CPUID_GUEST_NR_EXTD_AMD
: CPUID_GUEST_NR_EXTD_INTEL) - 1);
diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c
b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 673e608376d0..440a6f84c97b 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -1018,7 +1018,6 @@ int vmce_intel_wrmsr(struct vcpu *v, uint32_t msr,
uint64_t val)
int vmce_intel_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
{
- const struct cpu_policy *cp = v->domain->arch.cpu_policy;
unsigned int bank = msr - MSR_IA32_MC0_CTL2;
switch ( msr )
@@ -1036,7 +1035,7 @@ int vmce_intel_rdmsr(const struct vcpu *v, uint32_t msr,
uint64_t *val)
return 1;
}
- if ( !(cp->x86_vendor & X86_VENDOR_INTEL) )
+ if ( !(boot_cpu_data.x86_vendor & X86_VENDOR_INTEL) )
return 0;
if ( bank < GUEST_MC_BANK_NUM )
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index a9aeb2d268ad..9ba57d68475e 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -483,7 +483,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
case 0x80000001U:
/* SYSCALL is hidden outside of long mode on Intel. */
- if ( p->x86_vendor == X86_VENDOR_INTEL &&
+ if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
is_hvm_domain(d) && !hvm_long_mode_active(v) )
res->d &= ~cpufeat_mask(X86_FEATURE_SYSCALL);
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 2407c575d9fb..5a0ec3d9ad37 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -424,7 +424,8 @@ void domain_cpu_policy_changed(struct domain *d)
* If not emulating AMD or Hygon, clear the duplicated features
* in e1d.
*/
- if ( !(p->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
edx &= ~CPUID_COMMON_1D_FEATURES;
switch ( boot_cpu_data.vendor )
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 95247e772d09..3dc18ec2c9b6 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2681,7 +2681,7 @@ bool hvm_vcpu_virtual_to_linear(
else if ( last_byte > reg->limit )
goto out; /* last byte is beyond limit */
else if ( last_byte < offset &&
- v->domain->arch.cpuid->x86_vendor == X86_VENDOR_AMD )
+ boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
goto out; /* access wraps */
}
diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index a5fa97e149ba..8705bc22c260 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -17,6 +17,7 @@
#include <xen/trace.h>
#include <xen/vpci.h>
+#include <asm/cpufeature.h>
#include <asm/hvm/emulate.h>
#include <asm/hvm/hvm.h>
#include <asm/hvm/vmx/vmx.h>
@@ -286,7 +287,7 @@ bool arch_ioreq_server_get_type_addr(const struct domain *d,
*addr = ((uint64_t)sbdf.sbdf << 32) | reg;
/* AMD extended configuration space access? */
if ( CF8_ADDR_HI(cf8) &&
- d->arch.cpuid->x86_vendor == X86_VENDOR_AMD &&
+ boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
(x86_fam = get_cpu_family(
d->arch.cpuid->basic.raw_fms, NULL, NULL)) >= 0x10 &&
x86_fam < 0x17 )
diff --git a/xen/arch/x86/include/asm/guest_pt.h
b/xen/arch/x86/include/asm/guest_pt.h
index 21473f9bbc74..b204340f8d45 100644
--- a/xen/arch/x86/include/asm/guest_pt.h
+++ b/xen/arch/x86/include/asm/guest_pt.h
@@ -20,6 +20,8 @@
#error GUEST_PAGING_LEVELS not defined
#endif
+#include <asm/cpufeature.h>
+
/* Override get_gfn to work with gfn_t */
#undef get_gfn
#define get_gfn(d, g, t) get_gfn_type((d), gfn_x(g), (t), P2M_ALLOC)
@@ -314,7 +316,7 @@ static always_inline bool guest_l4e_rsvd_bits(const struct
vcpu *v,
guest_l4e_t l4e)
{
return l4e.l4 & (guest_rsvd_bits(v) | GUEST_L4_PAGETABLE_RSVD |
- ((v->domain->arch.cpuid->x86_vendor == X86_VENDOR_AMD)
+ ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
? _PAGE_GLOBAL : 0));
}
#endif /* GUEST_PAGING_LEVELS >= 4 */
diff --git a/xen/arch/x86/lib/cpu-policy/copy-from-buffer.c
b/xen/arch/x86/lib/cpu-policy/copy-from-buffer.c
index 24f7bc79d2bd..09d7a845da45 100644
--- a/xen/arch/x86/lib/cpu-policy/copy-from-buffer.c
+++ b/xen/arch/x86/lib/cpu-policy/copy-from-buffer.c
@@ -143,8 +143,6 @@ int x86_cpuid_copy_from_buffer(struct cpu_policy *p,
}
}
- x86_cpu_policy_recalc_synth(p);
-
return 0;
out_of_range:
diff --git a/xen/arch/x86/lib/cpu-policy/cpuid.c
b/xen/arch/x86/lib/cpu-policy/cpuid.c
index 3162e795bc21..44f3468e7f70 100644
--- a/xen/arch/x86/lib/cpu-policy/cpuid.c
+++ b/xen/arch/x86/lib/cpu-policy/cpuid.c
@@ -108,12 +108,6 @@ void x86_cpu_featureset_to_policy(
p->extd.e21c = fs[FEATURESET_e21c];
}
-void x86_cpu_policy_recalc_synth(struct cpu_policy *p)
-{
- p->x86_vendor = x86_cpuid_lookup_vendor(
- p->basic.vendor_ebx, p->basic.vendor_ecx, p->basic.vendor_edx);
-}
-
void x86_cpu_policy_fill_native(struct cpu_policy *p)
{
unsigned int i;
@@ -234,8 +228,6 @@ void x86_cpu_policy_fill_native(struct cpu_policy *p)
if ( p->feat.arch_caps )
rdmsrl(MSR_ARCH_CAPABILITIES, p->arch_caps.raw);
#endif
-
- x86_cpu_policy_recalc_synth(p);
}
void x86_cpu_policy_clear_out_of_range_leaves(struct cpu_policy *p)
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index e9fa02a03f71..a9f29e136e52 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -158,8 +158,8 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
* The MSR has existed on all Intel parts since before the 64bit days,
* and is implemented by other vendors.
*/
- if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR |
- X86_VENDOR_SHANGHAI)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR | X86_VENDOR_SHANGHAI)) )
goto gp_fault;
*val = IA32_FEATURE_CONTROL_LOCK;
@@ -235,7 +235,8 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
*/
case MSR_IA32_PERF_STATUS:
case MSR_IA32_PERF_CTL:
- if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
goto gp_fault;
*val = 0;
@@ -244,7 +245,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
goto gp_fault;
case MSR_IA32_THERM_STATUS:
- if ( cp->x86_vendor != X86_VENDOR_INTEL )
+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
goto gp_fault;
*val = 0;
break;
@@ -301,7 +302,8 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
case MSR_K8_IORR_MASK1:
case MSR_K8_TSEG_BASE:
case MSR_K8_TSEG_MASK:
- if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
goto gp_fault;
if ( !is_hardware_domain(d) )
return X86EMUL_UNHANDLEABLE;
@@ -313,14 +315,16 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t
*val)
break;
case MSR_K8_HWCR:
- if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
goto gp_fault;
*val = 0;
break;
case MSR_FAM10H_MMIO_CONF_BASE:
if ( !is_hardware_domain(d) ||
- !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
+ !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ||
rdmsr_safe(msr, val) )
goto gp_fault;
@@ -337,7 +341,8 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
break;
case MSR_AMD64_DE_CFG:
- if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
goto gp_fault;
*val = AMD64_DE_CFG_LFENCE_SERIALISE;
break;
@@ -460,7 +465,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
* for backwards compatiblity, the OS should write 0 to it before
* trying to access the current microcode version.
*/
- if ( cp->x86_vendor != X86_VENDOR_INTEL || val != 0 )
+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || val != 0 )
goto gp_fault;
break;
@@ -470,7 +475,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
* to AMD CPUs as well (at least the architectural/CPUID part does).
*/
if ( is_pv_domain(d) ||
- cp->x86_vendor != X86_VENDOR_AMD )
+ boot_cpu_data.x86_vendor != X86_VENDOR_AMD )
goto gp_fault;
break;
@@ -482,7 +487,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
* by any CPUID bit.
*/
if ( is_pv_domain(d) ||
- cp->x86_vendor != X86_VENDOR_INTEL )
+ boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
goto gp_fault;
break;
@@ -552,7 +557,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
* a cpufreq controller dom0 which has full access.
*/
case MSR_IA32_PERF_CTL:
- if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) )
goto gp_fault;
if ( likely(!is_cpufreq_controller(d)) || wrmsr_safe(msr, val) == 0 )
@@ -662,7 +668,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
* OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP:
* https://www.illumos.org/issues/12998 - drop writes.
*/
- if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
+ if ( !(boot_cpu_data.x86_vendor &
+ (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
goto gp_fault;
break;
diff --git a/xen/arch/x86/x86_emulate/private.h
b/xen/arch/x86/x86_emulate/private.h
index ff0f3eba0e72..af4ec5979af2 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -520,7 +520,10 @@ in_protmode(
static inline bool
_amd_like(const struct cpu_policy *cp)
{
- return cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON);
+ unsigned int vendor = x86_cpuid_lookup_vendor(
+ cp->basic.vendor_ebx, cp->basic.vendor_ecx, cp->basic.vendor_edx);
+
+ return vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON);
}
static inline bool
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c
b/xen/arch/x86/x86_emulate/x86_emulate.c
index 20d90904b5f7..c45a1db20ac6 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3185,8 +3185,11 @@ x86_emulate(
* in fact risking to make guest OSes vulnerable to the equivalent of
* XSA-7 (CVE-2012-0217).
*/
- generate_exception_if(cp->x86_vendor == X86_VENDOR_INTEL &&
- op_bytes == 8 &&
!is_canonical_address(_regs.rcx),
+ generate_exception_if(x86_cpuid_lookup_vendor(
+ cp->basic.vendor_ebx, cp->basic.vendor_ecx,
+ cp->basic.vendor_edx) == X86_VENDOR_INTEL &&
+ op_bytes == 8 &&
+ !is_canonical_address(_regs.rcx),
X86_EXC_GP, 0);
#endif
diff --git a/xen/include/xen/lib/x86/cpu-policy.h
b/xen/include/xen/lib/x86/cpu-policy.h
index d29e3803591d..455397233401 100644
--- a/xen/include/xen/lib/x86/cpu-policy.h
+++ b/xen/include/xen/lib/x86/cpu-policy.h
@@ -385,9 +385,6 @@ struct cpu_policy
/* Toolstack selected Hypervisor max_leaf (if non-zero). */
uint8_t hv_limit, hv2_limit;
-
- /* Value calculated from raw data above. */
- uint8_t x86_vendor;
};
struct cpu_policy_errors
@@ -429,11 +426,6 @@ static inline uint64_t cpu_policy_xstates(const struct
cpu_policy *p)
*/
const uint32_t *x86_cpu_policy_lookup_deep_deps(uint32_t feature);
-/**
- * Recalculate the content in a CPU policy which is derived from raw data.
- */
-void x86_cpu_policy_recalc_synth(struct cpu_policy *p);
-
/**
* Fill CPU policy using the native CPUID/RDMSR instruction.
*
--
2.56.1
--
Thomas Odin | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |