x86/cpu-policy: Update vendor/family/model logic

Switch to the new fields and constants.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2025-07-21 12:40:11 +01:00
1 parent 0a7eb0c47f
commit e2ebfbbc98
2 files changed
+9 -13

No files matched your search

+8 -11
View File
@@ -342,7 +342,7 @@ 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.x86_vendor);
ASSERT(p->x86_vendor == boot_cpu_data.vendor);
/*
* Clear the truly dynamic fields. These vary with the in-context XCR0
@@ -417,7 +417,7 @@ static void __init guest_common_default_leaves(struct cpu_policy *p)
static void __init guest_common_max_feature_adjustments(uint32_t *fs)
{
switch ( boot_cpu_data.x86_vendor )
switch ( boot_cpu_data.vendor )
{
case X86_VENDOR_INTEL:
/*
@@ -460,8 +460,7 @@ static void __init guest_common_max_feature_adjustments(uint32_t *fs)
* We hid CLWB in the host policy to stop Xen using it, but VMs which
* have previously seen the CLWB feature can safely run on this CPU.
*/
if ( boot_cpu_data.x86 == 6 &&
boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X &&
if ( boot_cpu_data.vfm == INTEL_SKYLAKE_X &&
raw_cpu_policy.feat.clwb )
__set_bit(X86_FEATURE_CLWB, fs);
@@ -506,7 +505,7 @@ static void __init guest_common_max_feature_adjustments(uint32_t *fs)
static void __init guest_common_default_feature_adjustments(uint32_t *fs)
{
switch ( boot_cpu_data.x86_vendor )
switch ( boot_cpu_data.vendor )
{
case X86_VENDOR_INTEL:
/*
@@ -520,8 +519,7 @@ static void __init guest_common_default_feature_adjustments(uint32_t *fs)
* (cpuid="host,rdrand=1") in the VM's config file, and VMs which were
* previously using RDRAND can migrate in.
*/
if ( boot_cpu_data.x86 == 6 &&
boot_cpu_data.x86_model == INTEL_FAM6_IVYBRIDGE &&
if ( boot_cpu_data.vfm == INTEL_IVYBRIDGE &&
cpu_has_rdrand && !is_forced_cpu_cap(X86_FEATURE_RDRAND) )
__clear_bit(X86_FEATURE_RDRAND, fs);
@@ -548,8 +546,7 @@ static void __init guest_common_default_feature_adjustments(uint32_t *fs)
* it to the max policy to let VMs migrate in. Re-hide it in the
* default policy to disuade VMs from using it in the common case.
*/
if ( boot_cpu_data.x86 == 6 &&
boot_cpu_data.x86_model == INTEL_FAM6_SKYLAKE_X &&
if ( boot_cpu_data.vfm == INTEL_SKYLAKE_X &&
raw_cpu_policy.feat.clwb )
__clear_bit(X86_FEATURE_CLWB, fs);
@@ -755,7 +752,7 @@ static void __init calculate_hvm_max_policy(void)
* long mode (and init_amd() has cleared it out of host capabilities), but
* HVM guests are able if running in protected mode.
*/
if ( (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
if ( (boot_cpu_data.vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
raw_cpu_policy.basic.sep )
__set_bit(X86_FEATURE_SEP, fs);
@@ -983,7 +980,7 @@ void recalculate_cpuid_policy(struct domain *d)
if ( is_pv_32bit_domain(d) )
{
__clear_bit(X86_FEATURE_LM, max_fs);
if ( !(boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
if ( !(boot_cpu_data.vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
__clear_bit(X86_FEATURE_SYSCALL, max_fs);
}
+1 -2
View File
@@ -672,8 +672,7 @@ static void cf_check init_intel(struct cpuinfo_x86 *c)
* latter is not impacted. Hide CLWB to cause Xen to fall back to
* using CLFLUSHOPT instead.
*/
if (c == &boot_cpu_data &&
c->x86 == 6 && c->x86_model == INTEL_FAM6_SKYLAKE_X)
if (c == &boot_cpu_data && c->vfm == INTEL_SKYLAKE_X)
setup_clear_cpu_cap(X86_FEATURE_CLWB);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.