On 04.03.2026 20:53, Kevin Lampis wrote:
> struct cpuinfo_x86
> .x86 => .family
> .x86_vendor => .vendor
> .x86_model => .model
> .x86_mask => .stepping
>
> No functional change.
>
> This work is part of making Xen safe for Intel family 18/19.
>
> Signed-off-by: Kevin Lampis <[email protected]>
> ---
> Inside core2_vpmu_init() there is a check for family == 6.
> Should this be extended to family 18/19?
Likely, but again in a separate change.
> --- a/xen/arch/x86/cpu/mtrr/generic.c
> +++ b/xen/arch/x86/cpu/mtrr/generic.c
> @@ -218,9 +218,9 @@ static void __init print_mtrr_state(const char *level)
> printk("%s %u disabled\n", level, i);
> }
>
> - if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
> - boot_cpu_data.x86 >= 0xf) ||
> - boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
> + if ((boot_cpu_data.vendor == X86_VENDOR_AMD &&
> + boot_cpu_data.family >= 0xf) ||
> + boot_cpu_data.vendor == X86_VENDOR_HYGON) {
> uint64_t syscfg, tom2;
Just to mention (not insisting on a change), the >= 0xf could be dropped,
as older CPUs aren't 64-bit capable.
> --- a/xen/arch/x86/cpu/vpmu.c
> +++ b/xen/arch/x86/cpu/vpmu.c
> @@ -398,7 +398,7 @@ int vpmu_load(struct vcpu *v, bool from_guest)
> static int vpmu_arch_initialise(struct vcpu *v)
> {
> struct vpmu_struct *vpmu = vcpu_vpmu(v);
> - uint8_t vendor = current_cpu_data.x86_vendor;
> + uint8_t vendor = current_cpu_data.vendor;
Imo we should take the opportunity to change this variable to unsigned int.
> @@ -815,7 +815,7 @@ static struct notifier_block cpu_nfb = {
>
> static int __init cf_check vpmu_init(void)
> {
> - int vendor = current_cpu_data.x86_vendor;
> + int vendor = current_cpu_data.vendor;
Perhaps this one as well then.
> --- a/xen/arch/x86/cpu/vpmu_intel.c
> +++ b/xen/arch/x86/cpu/vpmu_intel.c
> @@ -917,7 +917,9 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
> return ERR_PTR(-EINVAL);
> }
>
> - if ( current_cpu_data.x86 != 6 )
> + /* XXX Does this need to be changed to include family 18/19?
> + * Is the core2_ function name misleading? */
> + if ( current_cpu_data.family != 6 )
> {
As indicated before, such comments better wouldn't be added here, imo. With it
dropped and preferably with the type adjustments above (happy to carry out
while committing, as long as you agree):
Acked-by: Jan Beulich <[email protected]>
Jan