Skip to contentSkip to conversation

Remove x86 prefixed names from cpuinfo

PATCH Superseded Kevin Lampis 3 participants 16 messages Mar 4 – Mar 10

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Remove x86 prefixed names from cpuinfo

Remove x86 prefixed names from cpuinfo and all the places it is used. This work is part of making Xen safe for Intel family 18/19.

Kevin Lampis (6):
x86: Remove x86 prefixed names from mcheck code
x86: Remove x86 prefixed names from acpi code
x86: Remove x86 prefixed names from hvm code
x86: Remove x86 prefixed names from x86/cpu/ files
x86: Remove x86 prefixed names misc
x86: Remove x86 prefixed names from cpuinfo

 xen/arch/x86/acpi/cpu_idle.c             |  20 +-
 xen/arch/x86/acpi/cpufreq/acpi.c         |   2 +-
 xen/arch/x86/acpi/cpufreq/cpufreq.c      |   4 +-
 xen/arch/x86/acpi/cpufreq/powernow.c     |   4 +-
 xen/arch/x86/alternative.c               |   8 +-
 xen/arch/x86/apic.c                      |   2 +-
 xen/arch/x86/cpu/centaur.c               |   4 +-
 xen/arch/x86/cpu/hygon.c                 |   4 +-
 xen/arch/x86/cpu/intel_cacheinfo.c       |   6 +-
 xen/arch/x86/cpu/mcheck/amd_nonfatal.c   |   2 +-
 xen/arch/x86/cpu/mcheck/mcaction.c       |   2 +-
 xen/arch/x86/cpu/mcheck/mce.c            |  35 ++-
 xen/arch/x86/cpu/mcheck/mce.h            |   2 +-
 xen/arch/x86/cpu/mcheck/mce_amd.c        |  16 +-
 xen/arch/x86/cpu/mcheck/mce_intel.c      |   5 +-
 xen/arch/x86/cpu/mcheck/non-fatal.c      |   2 +-
 xen/arch/x86/cpu/mcheck/vmce.c           |   8 +-
 xen/arch/x86/cpu/mtrr/generic.c          |   6 +-
 xen/arch/x86/cpu/mwait-idle.c            |   4 +-
 xen/arch/x86/cpu/vpmu.c                  |   4 +-
 xen/arch/x86/cpu/vpmu_amd.c              |   6 +-
 xen/arch/x86/cpu/vpmu_intel.c            |   6 +-
 xen/arch/x86/cpuid.c                     |   2 +-
 xen/arch/x86/dom0_build.c                |   4 +-
 xen/arch/x86/domain.c                    |  12 +-
 xen/arch/x86/e820.c                      |   2 +-
 xen/arch/x86/hvm/hvm.c                   |   2 +-
 xen/arch/x86/hvm/svm/svm.c               |   6 +-
 xen/arch/x86/hvm/vmx/vmcs.c              |   4 +-
 xen/arch/x86/hvm/vmx/vmx.c               | 278 +++++++++++------------
 xen/arch/x86/i8259.c                     |   2 +-
 xen/arch/x86/include/asm/cpufeature.h    |   5 -
 xen/arch/x86/irq.c                       |   4 +-
 xen/arch/x86/mpparse.c                   |   6 +-
 xen/arch/x86/msr.c                       |   4 +-
 xen/arch/x86/nmi.c                       |  12 +-
 xen/arch/x86/platform_hypercall.c        |   8 +-
 xen/arch/x86/pv/domain.c                 |   2 +-
 xen/arch/x86/setup.c                     |   6 +-
 xen/arch/x86/traps-setup.c               |   4 +-
 xen/arch/x86/tsx.c                       |   4 +-
 xen/drivers/passthrough/amd/iommu_init.c |   6 +-
 42 files changed, 256 insertions(+), 269 deletions(-)
Signature · 1 line
2.51.1
#1 lore raw

PATCH 1/6 x86: Remove x86 prefixed names from mcheck code

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.

---
Changes since v1:
- mcheck_init() check for family != 5 instead of 6 and 15
- mce_firstbank() match vfm range
- mce_is_broadcast() add vendor check as well as >= INTEL_CORE_YONAH

This supersedes the individual posting
https://lore.kernel.org/xen-devel/[email protected]/

---
 xen/arch/x86/cpu/mcheck/amd_nonfatal.c |  2 +-
 xen/arch/x86/cpu/mcheck/mcaction.c     |  2 +-
 xen/arch/x86/cpu/mcheck/mce.c          | 35 +++++++++++---------------
 xen/arch/x86/cpu/mcheck/mce.h          |  2 +-
 xen/arch/x86/cpu/mcheck/mce_amd.c      | 16 ++++++------
 xen/arch/x86/cpu/mcheck/mce_intel.c    |  5 +---
 xen/arch/x86/cpu/mcheck/non-fatal.c    |  2 +-
 xen/arch/x86/cpu/mcheck/vmce.c         |  8 +++---
 8 files changed, 32 insertions(+), 40 deletions(-)
xen/arch/x86/cpu/mcheck/amd_nonfatal.c +1 -1
index 7d48c9ab5f..fb52639e13 100644
@@ -191,7 +191,7 @@ static void cf_check mce_amd_work_fn(void *data)
 
 void __init amd_nonfatal_mcheck_init(struct cpuinfo_x86 *c)
 {
-	if (!(c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
+	if (!(c->vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)))
 		return;
 
 	/* Assume we are on K8 or newer AMD or Hygon CPU here */
xen/arch/x86/cpu/mcheck/mcaction.c +1 -1
index bf7a0de965..236424569a 100644
@@ -101,7 +101,7 @@ mc_memerr_dhandler(struct mca_binfo *binfo,
                       * not always precise. In that case, fallback to broadcast.
                       */
                      global->mc_domid != bank->mc_domid ||
-                     (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+                     (boot_cpu_data.vendor == X86_VENDOR_INTEL &&
                       (!(global->mc_gstatus & MCG_STATUS_LMCE) ||
                        !(d->vcpu[mc_vcpuid]->arch.vmce.mcg_ext_ctl &
                          MCG_EXT_CTL_LMCE_EN))) )
xen/arch/x86/cpu/mcheck/mce.c +15 -20
index 9a91807cfb..901a71157a 100644
@@ -23,6 +23,7 @@
 #include <asm/apic.h>
 #include <asm/msr.h>
 #include <asm/p2m.h>
+#include <asm/intel-family.h>
 
 #include "mce.h"
 #include "barrier.h"
@@ -334,7 +335,7 @@ mcheck_mca_logout(enum mca_source who, struct mca_banks *bankmask,
                 mca_init_global(mc_flags, mig);
                 /* A hook here to get global extended msrs */
                 if ( IS_ENABLED(CONFIG_INTEL) &&
-                     boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+                     boot_cpu_data.vendor == X86_VENDOR_INTEL )
                     intel_get_extended_msrs(mig, mci);
             }
         }
@@ -564,8 +565,7 @@ bool mce_available(const struct cpuinfo_x86 *c)
  */
 unsigned int mce_firstbank(struct cpuinfo_x86 *c)
 {
-    return c->x86 == 6 &&
-           c->x86_vendor == X86_VENDOR_INTEL && c->x86_model < 0x1a;
+    return c->vfm >= INTEL_PENTIUM_PRO && c->vfm < INTEL_NEHALEM_EP;
 }
 
 static int show_mca_info(int inited, struct cpuinfo_x86 *c)
@@ -596,7 +596,7 @@ static int show_mca_info(int inited, struct cpuinfo_x86 *c)
         case mcheck_amd_famXX:
         case mcheck_hygon:
             printk("%s%s Fam%xh machine check reporting enabled\n",
-                   prefix, type_str[inited], c->x86);
+                   prefix, type_str[inited], c->family);
             break;
 
         case mcheck_none:
@@ -766,7 +766,7 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
     else if ( cpu_bank_alloc(cpu) )
         panic("Insufficient memory for MCE bank allocations\n");
 
-    switch ( c->x86_vendor )
+    switch ( c->vendor )
     {
 #ifdef CONFIG_AMD
     case X86_VENDOR_AMD:
@@ -777,13 +777,8 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
 
 #ifdef CONFIG_INTEL
     case X86_VENDOR_INTEL:
-        switch ( c->x86 )
-        {
-        case 6:
-        case 15:
+        if ( c->family != 5 )
             inited = intel_mcheck_init(c, bsp);
-            break;
-        }
         break;
 #endif
 
@@ -882,7 +877,7 @@ static void x86_mcinfo_apei_save(
     memset(&m, 0, sizeof(struct mce));
 
     m.cpu = mc_global->mc_coreid;
-    m.cpuvendor = xen2linux_vendor(boot_cpu_data.x86_vendor);
+    m.cpuvendor = xen2linux_vendor(boot_cpu_data.vendor);
     m.cpuid = cpuid_eax(1);
     m.socketid = mc_global->mc_socketid;
     m.apicid = mc_global->mc_apicid;
@@ -983,10 +978,10 @@ static void cf_check __maybe_unused do_mc_get_cpu_info(void *v)
                         &xcp->mc_apicid, &xcp->mc_ncores,
                         &xcp->mc_ncores_active, &xcp->mc_nthreads);
     xcp->mc_cpuid_level = c->cpuid_level;
-    xcp->mc_family = c->x86;
-    xcp->mc_vendor = xen2linux_vendor(c->x86_vendor);
-    xcp->mc_model = c->x86_model;
-    xcp->mc_step = c->x86_mask;
+    xcp->mc_family = c->family;
+    xcp->mc_vendor = xen2linux_vendor(c->vendor);
+    xcp->mc_model = c->model;
+    xcp->mc_step = c->stepping;
     xcp->mc_cache_size = c->x86_cache_size;
     xcp->mc_cache_alignment = c->x86_cache_alignment;
     memcpy(xcp->mc_vendorid, c->x86_vendor_id, sizeof xcp->mc_vendorid);
@@ -1142,7 +1137,7 @@ static bool __maybe_unused x86_mc_msrinject_verify(struct xen_mc_msrinject *mci)
 
         if ( IS_MCA_BANKREG(reg, mci->mcinj_cpunr) )
         {
-            if ( c->x86_vendor == X86_VENDOR_AMD )
+            if ( c->vendor == X86_VENDOR_AMD )
             {
                 /*
                  * On AMD we can set MCi_STATUS_WREN in the
@@ -1177,15 +1172,15 @@ static bool __maybe_unused x86_mc_msrinject_verify(struct xen_mc_msrinject *mci)
             case MSR_F10_MC4_MISC1:
             case MSR_F10_MC4_MISC2:
             case MSR_F10_MC4_MISC3:
-                if ( c->x86_vendor != X86_VENDOR_AMD )
+                if ( c->vendor != X86_VENDOR_AMD )
                     reason = "only supported on AMD";
-                else if ( c->x86 < 0x10 )
+                else if ( c->family < 0x10 )
                     reason = "only supported on AMD Fam10h+";
                 break;
 
             /* MSRs that the HV will take care of */
             case MSR_K8_HWCR:
-                if ( c->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
+                if ( c->vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
                     reason = "HV will operate HWCR";
                 else
                     reason = "only supported on AMD or Hygon";
xen/arch/x86/cpu/mcheck/mce.h +1 -1
index 920b075355..3b61b12487 100644
@@ -137,7 +137,7 @@ void x86_mcinfo_dump(struct mc_info *mi);
 
 static inline int mce_vendor_bank_msr(const struct vcpu *v, uint32_t msr)
 {
-    switch (boot_cpu_data.x86_vendor) {
+    switch (boot_cpu_data.vendor) {
     case X86_VENDOR_INTEL:
         if (msr >= MSR_IA32_MC0_CTL2 &&
             msr < MSR_IA32_MCx_CTL2(v->arch.vmce.mcg_cap & MCG_CAP_COUNT) )
xen/arch/x86/cpu/mcheck/mce_amd.c +8 -8
index 25c29eb3d2..2d17832d9c 100644
@@ -160,17 +160,17 @@ mcequirk_lookup_amd_quirkdata(const struct cpuinfo_x86 *c)
 {
     unsigned int i;
 
-    BUG_ON(c->x86_vendor != X86_VENDOR_AMD);
+    BUG_ON(c->vendor != X86_VENDOR_AMD);
 
     for ( i = 0; i < ARRAY_SIZE(mce_amd_quirks); i++ )
     {
-        if ( c->x86 != mce_amd_quirks[i].cpu_family )
+        if ( c->family != mce_amd_quirks[i].cpu_family )
             continue;
         if ( (mce_amd_quirks[i].cpu_model != ANY) &&
-             (mce_amd_quirks[i].cpu_model != c->x86_model) )
+             (mce_amd_quirks[i].cpu_model != c->model) )
             continue;
         if ( (mce_amd_quirks[i].cpu_stepping != ANY) &&
-             (mce_amd_quirks[i].cpu_stepping != c->x86_mask) )
+             (mce_amd_quirks[i].cpu_stepping != c->stepping) )
                 continue;
         return mce_amd_quirks[i].quirk;
     }
@@ -291,13 +291,13 @@ amd_mcheck_init(const struct cpuinfo_x86 *c, bool bsp)
     uint32_t i;
     enum mcequirk_amd_flags quirkflag = 0;
 
-    if ( c->x86_vendor != X86_VENDOR_HYGON )
+    if ( c->vendor != X86_VENDOR_HYGON )
         quirkflag = mcequirk_lookup_amd_quirkdata(c);
 
     /* Assume that machine check support is available.
      * The minimum provided support is at least the K8. */
     if ( bsp )
-        mce_handler_init(c->x86 == 0xf ? &k8_callbacks : &k10_callbacks);
+        mce_handler_init(c->family == 0xf ? &k8_callbacks : &k10_callbacks);
 
     for ( i = 0; i < this_cpu(nr_mce_banks); i++ )
     {
@@ -311,7 +311,7 @@ amd_mcheck_init(const struct cpuinfo_x86 *c, bool bsp)
         }
     }
 
-    if ( c->x86 == 0xf )
+    if ( c->family == 0xf )
         return mcheck_amd_k8;
 
     if ( quirkflag == MCEQUIRK_F10_GART )
@@ -337,6 +337,6 @@ amd_mcheck_init(const struct cpuinfo_x86 *c, bool bsp)
             ppin_msr = MSR_AMD_PPIN;
     }
 
-    return c->x86_vendor == X86_VENDOR_HYGON ?
+    return c->vendor == X86_VENDOR_HYGON ?
             mcheck_hygon : mcheck_amd_famXX;
 }
xen/arch/x86/cpu/mcheck/mce_intel.c +1 -4
index 839a0e5ba9..4d6b7d588e 100644
@@ -711,10 +711,7 @@ static bool mce_is_broadcast(struct cpuinfo_x86 *c)
      * DisplayFamily_DisplayModel encoding of 06H_EH and above,
      * a MCA signal is broadcast to all logical processors in the system
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL && c->x86 == 6 &&
-         c->x86_model >= 0xe )
-        return true;
-    return false;
+    return c->vendor == X86_VENDOR_INTEL && c->vfm >= INTEL_CORE_YONAH;
 }
 
 static bool intel_enable_lmce(void)
xen/arch/x86/cpu/mcheck/non-fatal.c +1 -1
index a9ee9bb94f..4e7c64abef 100644
@@ -23,7 +23,7 @@ static int __init cf_check init_nonfatal_mce_checker(void)
 	/*
 	 * Check for non-fatal errors every MCE_RATE s
 	 */
-	switch (c->x86_vendor) {
+	switch (c->vendor) {
 #ifdef CONFIG_AMD
 	case X86_VENDOR_AMD:
 	case X86_VENDOR_HYGON:
xen/arch/x86/cpu/mcheck/vmce.c +4 -4
index 1a7e92506a..84776aeec8 100644
@@ -45,7 +45,7 @@ void vmce_init_vcpu(struct vcpu *v)
     int i;
 
     /* global MCA MSRs init */
-    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+    if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
         v->arch.vmce.mcg_cap = INTEL_GUEST_MCG_CAP;
     else
         v->arch.vmce.mcg_cap = AMD_GUEST_MCG_CAP;
@@ -63,7 +63,7 @@ int vmce_restore_vcpu(struct vcpu *v, const struct hvm_vmce_vcpu *ctxt)
 {
     unsigned long guest_mcg_cap;
 
-    if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+    if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
         guest_mcg_cap = INTEL_GUEST_MCG_CAP | MCG_LMCE_P;
     else
         guest_mcg_cap = AMD_GUEST_MCG_CAP;
@@ -136,7 +136,7 @@ static int bank_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
         break;
 
     default:
-        switch ( boot_cpu_data.x86_vendor )
+        switch ( boot_cpu_data.vendor )
         {
 #ifdef CONFIG_INTEL
         case X86_VENDOR_CENTAUR:
@@ -273,7 +273,7 @@ static int bank_mce_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
         break;
 
     default:
-        switch ( boot_cpu_data.x86_vendor )
+        switch ( boot_cpu_data.vendor )
         {
 #ifdef CONFIG_INTEL
         case X86_VENDOR_INTEL:
Signature · 1 line
2.51.1
#2 lore raw

Re: [PATCH 1/6] x86: Remove x86 prefixed names from mcheck code

Quoted 6 lines · Kevin Lampis

struct cpuinfo_x86
.x86 => .family
.x86_vendor => .vendor
.x86_model => .model
.x86_mask => .stepping

Quoted 8 lines

No functional change.

This work is part of making Xen safe for Intel family 18/19.

---
Changes since v1:
- mcheck_init() check for family != 5 instead of 6 and 15

Imo this wants splitting off, to have its own description. In particular, there's no 64-bit CPU with family 5, afaia.

xen/arch/x86/cpu/mcheck/mce.c bool mce_available(const struct cpuinfo_x86 *c) · line 569

Quoted 8 lines
xen/arch/x86/cpu/mcheck/mce.c +1 -2
@@ -564,8 +565,7 @@ bool mce_available(const struct cpuinfo_x86 *c)
  */
 unsigned int mce_firstbank(struct cpuinfo_x86 *c)
 {
-    return c->x86 == 6 &&
-           c->x86_vendor == X86_VENDOR_INTEL && c->x86_model < 0x1a;
+    return c->vfm >= INTEL_PENTIUM_PRO && c->vfm < INTEL_NEHALEM_EP;
 }

Wouldn't this better be

    return c->vendor == X86_VENDOR_INTEL && c->vfm < INTEL_NEHALEM_EP;

similar to how you have it in mce_is_broadcast()?

Independently there's the question whether this is correct, seeing that INTEL_CORE2_DUNNINGTON > INTEL_NEHALEM_EP. But if a change was needed for this, it would want to be a separate patch anyway.

xen/arch/x86/cpu/mcheck/mce_intel.c static bool mce_is_broadcast(struct cpuinfo_x86 *c) · line 715

Quoted 12 lines
xen/arch/x86/cpu/mcheck/mce_intel.c +1 -4
@@ -711,10 +711,7 @@ static bool mce_is_broadcast(struct cpuinfo_x86 *c)
      * DisplayFamily_DisplayModel encoding of 06H_EH and above,
      * a MCA signal is broadcast to all logical processors in the system
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL && c->x86 == 6 &&
-         c->x86_model >= 0xe )
-        return true;
-    return false;
+    return c->vendor == X86_VENDOR_INTEL && c->vfm >= INTEL_CORE_YONAH;
 }

Is anything below Yonah 64-bit capable? Even Yonah itself isn't 64-bit capable afaics, so perhaps again this check can be simplified in a preferably separate change (possibly folded with the P5 related adjustment above)?

Jan

#3 lore raw

PATCH 2/6 x86: Remove x86 prefixed names from acpi code

In reply to Kevin Lampis

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.

---
Inside do_get_hw_residencies()
there is an explicit check for c->family != 6
Do we need to add family 18/19 support here?

---
 xen/arch/x86/acpi/cpu_idle.c         | 20 ++++++++++----------
 xen/arch/x86/acpi/cpufreq/acpi.c     |  2 +-
 xen/arch/x86/acpi/cpufreq/cpufreq.c  |  4 ++--
 xen/arch/x86/acpi/cpufreq/powernow.c |  4 ++--
 4 files changed, 15 insertions(+), 15 deletions(-)
xen/arch/x86/acpi/cpu_idle.c +10 -10
index 0b3d0631dd..1d2ef776fe 100644
@@ -178,10 +178,11 @@ static void cf_check do_get_hw_residencies(void *arg)
     struct cpuinfo_x86 *c = &current_cpu_data;
     struct hw_residencies *hw_res = arg;
 
-    if ( c->x86_vendor != X86_VENDOR_INTEL || c->x86 != 6 )
+    /* XXX Does this need to be extented to include fam 18/19? */
+    if ( c->vendor != X86_VENDOR_INTEL || c->family != 6 )
         return;
 
-    switch ( c->x86_model )
+    switch ( c->model )
     {
     /* 4th generation Intel Core (Haswell) */
     case 0x45:
@@ -915,7 +916,7 @@ void cf_check acpi_dead_idle(void)
             mwait(cx->address, 0);
         }
     }
-    else if ( (current_cpu_data.x86_vendor &
+    else if ( (current_cpu_data.vendor &
                (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
               cx->entry_method == ACPI_CSTATE_EM_SYSIO )
     {
@@ -1042,8 +1043,8 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
     flags->bm_check = 0;
     if ( num_online_cpus() == 1 )
         flags->bm_check = 1;
-    else if ( (c->x86_vendor == X86_VENDOR_INTEL) ||
-              ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 0x15)) )
+    else if ( (c->vendor == X86_VENDOR_INTEL) ||
+              ((c->vendor == X86_VENDOR_AMD) && (c->family == 0x15)) )
     {
         /*
          * Today all MP CPUs that support C3 share cache.
@@ -1059,8 +1060,7 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
      * is not required while entering C3 type state on
      * P4, Core and beyond CPUs
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL &&
-        (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 14)) )
+    if ( c->vendor == X86_VENDOR_INTEL && c->vfm >= INTEL_CORE_YONAH )
             flags->bm_control = 0;
 }
 
@@ -1416,12 +1416,12 @@ static void amd_cpuidle_init(struct acpi_processor_power *power)
     if ( vendor_override < 0 )
         return;
 
-    switch ( c->x86 )
+    switch ( c->family )
     {
     case 0x1a:
     case 0x19:
     case 0x18:
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_HYGON )
+        if ( boot_cpu_data.vendor != X86_VENDOR_HYGON )
         {
     default:
             vendor_override = -1;
@@ -1648,7 +1648,7 @@ static int cf_check cpu_callback(
         break;
 
     case CPU_ONLINE:
-        if ( (boot_cpu_data.x86_vendor &
+        if ( (boot_cpu_data.vendor &
               (X86_VENDOR_AMD | X86_VENDOR_HYGON)) &&
              processor_powers[cpu] )
             amd_cpuidle_init(processor_powers[cpu]);
xen/arch/x86/acpi/cpufreq/acpi.c +1 -1
index d0ca660db1..de67f1aee2 100644
@@ -454,7 +454,7 @@ static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
     /* Check for APERF/MPERF support in hardware
      * also check for boost support */
-    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
+    if (c->vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
         on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
 
     /*
xen/arch/x86/acpi/cpufreq/cpufreq.c +2 -2
index 5740c0d438..9ef62b3538 100644
@@ -133,7 +133,7 @@ static int __init cf_check cpufreq_driver_init(void)
 
         ret = -ENOENT;
 
-        switch ( boot_cpu_data.x86_vendor )
+        switch ( boot_cpu_data.vendor )
         {
         case X86_VENDOR_INTEL:
             for ( i = 0; i < cpufreq_xen_cnt; i++ )
@@ -252,7 +252,7 @@ __initcall(cpufreq_driver_late_init);
 int cpufreq_cpu_init(unsigned int cpu)
 {
     /* Currently we only handle Intel, AMD and Hygon processor */
-    if ( boot_cpu_data.x86_vendor &
+    if ( boot_cpu_data.vendor &
          (X86_VENDOR_INTEL | X86_VENDOR_AMD | X86_VENDOR_HYGON) )
         return cpufreq_add_cpu(cpu);
 
xen/arch/x86/acpi/cpufreq/powernow.c +2 -2
index beab6cac36..55166eac72 100644
@@ -143,7 +143,7 @@ static void amd_fixup_frequency(struct xen_processor_px *px)
     int index = px->control & 0x00000007;
     const struct cpuinfo_x86 *c = &current_cpu_data;
 
-    if ((c->x86 != 0x10 || c->x86_model >= 10) && c->x86 != 0x11)
+    if ((c->family != 0x10 || c->model >= 10) && c->family != 0x11)
         return;
 
     val = rdmsr(MSR_PSTATE_DEF_BASE + index);
@@ -157,7 +157,7 @@ static void amd_fixup_frequency(struct xen_processor_px *px)
 
     fid = val & 0x3f;
     did = (val >> 6) & 7;
-    if (c->x86 == 0x10)
+    if (c->family == 0x10)
         px->core_frequency = (100 * (fid + 16)) >> did;
     else
         px->core_frequency = (100 * (fid + 8)) >> did;
Signature · 1 line
2.51.1
Acked-by on v1 2/6
#4 lore raw

Re: [PATCH 2/6] x86: Remove x86 prefixed names from acpi code

Quoted 8 lines · Kevin Lampis

struct cpuinfo_x86
.x86 => .family
.x86_vendor => .vendor
.x86_model => .model
.x86_mask => .stepping

No functional change.

Quoted 7 lines

This work is part of making Xen safe for Intel family 18/19.

---
Inside do_get_hw_residencies()
there is an explicit check for c->family != 6
Do we need to add family 18/19 support here?

I think there is more stuff to add there, as the last addition looks to have been quite a while back. But "yes" to the question. However, ...

xen/arch/x86/acpi/cpu_idle.c static void cf_check do_get_hw_residencies(void *arg) · line 183

Quoted 10 lines
xen/arch/x86/acpi/cpu_idle.c +2 -1
@@ -178,10 +178,11 @@ static void cf_check do_get_hw_residencies(void *arg)
     struct cpuinfo_x86 *c = &current_cpu_data;
     struct hw_residencies *hw_res = arg;
 
-    if ( c->x86_vendor != X86_VENDOR_INTEL || c->x86 != 6 )
+    /* XXX Does this need to be extented to include fam 18/19? */
+    if ( c->vendor != X86_VENDOR_INTEL || c->family != 6 )
         return;

... I'd prefer if such a comment could be avoided, ideally by covering the case (in a separate change).

xen/arch/x86/acpi/cpu_idle.c static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag · line 1065

Quoted 9 lines
xen/arch/x86/acpi/cpu_idle.c +1 -2
@@ -1059,8 +1060,7 @@ static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flag
      * is not required while entering C3 type state on
      * P4, Core and beyond CPUs
      */
-    if ( c->x86_vendor == X86_VENDOR_INTEL &&
-        (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 14)) )
+    if ( c->vendor == X86_VENDOR_INTEL && c->vfm >= INTEL_CORE_YONAH )
             flags->bm_control = 0;
 }

Again a check that likely can simply be dropped (in a separate change, possibly together with those other droppings suggested in reply to patch 1)?

With the adjustments:

Jan

#5 lore raw

PATCH 3/6 x86: Remove x86 prefixed names from hvm code

In reply to Kevin Lampis

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.

---
I couldn't find any information about these Intel family 6 processors:
model 0x5d: /* SoFIA 3G Granite/ES2.1 */
model 0x65: /* SoFIA LTE AOSP */
model 0x6e: /* Cougar Mountain */
Should I add them to intel-family.h?

---
 xen/arch/x86/hvm/hvm.c      |   2 +-
 xen/arch/x86/hvm/svm/svm.c  |   6 +-
 xen/arch/x86/hvm/vmx/vmcs.c |   4 +-
 xen/arch/x86/hvm/vmx/vmx.c  | 278 ++++++++++++++++++------------------
 4 files changed, 144 insertions(+), 146 deletions(-)
xen/arch/x86/hvm/hvm.c +1 -1
index 4d37a93c57..6ad52e1197 100644
@@ -3850,7 +3850,7 @@ void hvm_ud_intercept(struct cpu_user_regs *regs)
 {
     struct vcpu *cur = current;
     bool should_emulate =
-        cur->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor;
+        cur->domain->arch.cpuid->x86_vendor != boot_cpu_data.vendor;
     struct hvm_emulate_ctxt ctxt;
 
     hvm_emulate_init_once(&ctxt, opt_hvm_fep ? NULL : is_cross_vendor, regs);
xen/arch/x86/hvm/svm/svm.c +3 -3
index 18ba837738..1320abe392 100644
@@ -590,7 +590,7 @@ static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
     u32 bitmap = vmcb_get_exception_intercepts(vmcb);
 
     if ( opt_hvm_fep ||
-         (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.x86_vendor) )
+         (v->domain->arch.cpuid->x86_vendor != boot_cpu_data.vendor) )
         bitmap |= (1U << X86_EXC_UD);
     else
         bitmap &= ~(1U << X86_EXC_UD);
@@ -1057,7 +1057,7 @@ static void svm_guest_osvw_init(struct domain *d)
      * be conservative here and therefore we tell the guest that erratum 298
      * is present (because we really don't know).
      */
-    if ( osvw_length == 0 && boot_cpu_data.x86 == 0x10 )
+    if ( osvw_length == 0 && boot_cpu_data.family == 0x10 )
         svm->osvw.status |= 1;
 
     spin_unlock(&osvw_lock);
@@ -1791,7 +1791,7 @@ static int cf_check svm_msr_read_intercept(
         if ( !rdmsr_safe(msr, msr_content) )
             break;
 
-        if ( boot_cpu_data.x86 == 0xf )
+        if ( boot_cpu_data.family == 0xf )
         {
             /*
              * Win2k8 x64 reads this MSR on revF chips, where it wasn't
xen/arch/x86/hvm/vmx/vmcs.c +2 -2
index c2e7f9aed3..d3b1730f1d 100644
@@ -26,6 +26,7 @@
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vvmx.h>
 #include <asm/idt.h>
+#include <asm/intel-family.h>
 #include <asm/monitor.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
@@ -2163,8 +2164,7 @@ int __init vmx_vmcs_init(void)
 
     if ( opt_ept_ad < 0 )
         /* Work around Erratum AVR41 on Avoton processors. */
-        opt_ept_ad = !(boot_cpu_data.x86 == 6 &&
-                       boot_cpu_data.x86_model == 0x4d);
+        opt_ept_ad = !(boot_cpu_data.vfm == INTEL_ATOM_SILVERMONT_D);
 
     ret = _vmx_cpu_up(true);
 
xen/arch/x86/hvm/vmx/vmx.c +138 -140

336 lines not on this page · raw message

Signature · 1 line
2.51.1
#6 lore raw

Re: [PATCH 3/6] x86: Remove x86 prefixed names from hvm code

Quoted 10 lines · Kevin Lampis

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.

Quoted 7 lines

---
I couldn't find any information about these Intel family 6 processors:
model 0x5d: /* SoFIA 3G Granite/ES2.1 */
model 0x65: /* SoFIA LTE AOSP */
model 0x6e: /* Cougar Mountain */
Should I add them to intel-family.h?

We should keep that in sync with Linux, I think, so "no" unless you mean to first have respective entries added there.

0x5d is listed in the SDM, so I'd recommend keeping the entries (using IFM() directly for the time being).

0x65 and 0x6e aren't listed in the SDM, so may never really have hit the public. Respective cases can perhaps be dropped, but such dropping would again likely better be done in a separate change.

Quoted 95 lines
xen/arch/x86/hvm/vmx/vmx.c +31 -49
@@ -3073,71 +3077,71 @@ static bool __init has_if_pschange_mc(void)
      * IF_PSCHANGE_MC is only known to affect Intel Family 6 processors at
      * this time.
      */
-    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
-         boot_cpu_data.x86 != 6 )
+    if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.family != 6 )
         return false;
 
-    switch ( boot_cpu_data.x86_model )
+    switch ( boot_cpu_data.vfm )
     {
         /*
          * Core processors since at least Nehalem are vulnerable.
          */
-    case 0x1f: /* Auburndale / Havendale */
-    case 0x1e: /* Nehalem */
-    case 0x1a: /* Nehalem EP */
-    case 0x2e: /* Nehalem EX */
-    case 0x25: /* Westmere */
-    case 0x2c: /* Westmere EP */
-    case 0x2f: /* Westmere EX */
-    case 0x2a: /* SandyBridge */
-    case 0x2d: /* SandyBridge EP/EX */
-    case 0x3a: /* IvyBridge */
-    case 0x3e: /* IvyBridge EP/EX */
-    case 0x3c: /* Haswell */
-    case 0x3f: /* Haswell EX/EP */
-    case 0x45: /* Haswell D */
-    case 0x46: /* Haswell H */
-    case 0x3d: /* Broadwell */
-    case 0x47: /* Broadwell H */
-    case 0x4f: /* Broadwell EP/EX */
-    case 0x56: /* Broadwell D */
-    case 0x4e: /* Skylake M */
-    case 0x5e: /* Skylake D */
-    case 0x55: /* Skylake-X / Cascade Lake */
-    case 0x7d: /* Ice Lake */
-    case 0x7e: /* Ice Lake */
-    case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
-    case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
-    case 0xa5: /* Comet Lake H/S */
-    case 0xa6: /* Comet Lake U */
+    case INTEL_NEHALEM_G:
+    case INTEL_NEHALEM:
+    case INTEL_NEHALEM_EP:
+    case INTEL_NEHALEM_EX:
+    case INTEL_WESTMERE:
+    case INTEL_WESTMERE_EP:
+    case INTEL_WESTMERE_EX:
+    case INTEL_SANDYBRIDGE:
+    case INTEL_SANDYBRIDGE_X:
+    case INTEL_IVYBRIDGE:
+    case INTEL_IVYBRIDGE_X:
+    case INTEL_HASWELL:
+    case INTEL_HASWELL_X:
+    case INTEL_HASWELL_L:
+    case INTEL_HASWELL_G:
+    case INTEL_BROADWELL:
+    case INTEL_BROADWELL_G:
+    case INTEL_BROADWELL_X:
+    case INTEL_BROADWELL_D:
+    case INTEL_SKYLAKE_L:
+    case INTEL_SKYLAKE:
+    case INTEL_SKYLAKE_X:
+    case INTEL_ICELAKE:
+    case INTEL_ICELAKE_L:
+    case INTEL_KABYLAKE_L:
+    case INTEL_KABYLAKE:
+    case INTEL_COMETLAKE:
+    case INTEL_COMETLAKE_L:
         return true;
 
         /*
          * Atom processors are not vulnerable.
          */
-    case 0x1c: /* Pineview */
-    case 0x26: /* Lincroft */
-    case 0x27: /* Penwell */
-    case 0x35: /* Cloverview */
-    case 0x36: /* Cedarview */
-    case 0x37: /* Baytrail / Valleyview (Silvermont) */
-    case 0x4d: /* Avaton / Rangely (Silvermont) */
-    case 0x4c: /* Cherrytrail / Brasswell */
-    case 0x4a: /* Merrifield */
-    case 0x5a: /* Moorefield */
-    case 0x5c: /* Goldmont */
-    case 0x5d: /* SoFIA 3G Granite/ES2.1 */
-    case 0x65: /* SoFIA LTE AOSP */
-    case 0x5f: /* Denverton */
-    case 0x6e: /* Cougar Mountain */
-    case 0x75: /* Lightning Mountain */
-    case 0x7a: /* Gemini Lake */
-    case 0x86: /* Jacobsville */

xen/arch/x86/hvm/vmx/vmx.c static bool __init has_if_pschange_mc(void) · line 3131

Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +10 -0
+    case INTEL_ATOM_BONNELL:
+    case INTEL_ATOM_BONNELL_MID:
+    case INTEL_ATOM_SALTWELL_MID:
+    case INTEL_ATOM_SALTWELL_TABLET:
+    case INTEL_ATOM_SALTWELL:
+    case INTEL_ATOM_SILVERMONT:
+    case INTEL_ATOM_SILVERMONT_D:
+    case INTEL_ATOM_AIRMONT:
+    case INTEL_ATOM_SILVERMONT_MID:
+    case INTEL_ATOM_SILVERMONT_MID2:

Can the Silvermonts please be grouped together?

xen/arch/x86/hvm/vmx/vmx.c static bool __init has_if_pschange_mc(void) · line 3137

Quoted 6 lines
xen/arch/x86/hvm/vmx/vmx.c +6 -0
+    case INTEL_ATOM_GOLDMONT:
+    //case 0x5d: /* SoFIA 3G Granite/ES2.1 */ // XXX ???
+    //case 0x65: /* SoFIA LTE AOSP */         // XXX ???
+    case INTEL_ATOM_GOLDMONT_D:
+    //case 0x6e: /* Cougar Mountain */        // XXX ???
+    case INTEL_ATOM_AIRMONT_NP:

Same for the Airmonts and ...

Review static bool __init has_if_pschange_mc(void) · line 3138

Quoted 1 line
(quoted diff) +1 -0
+    case INTEL_ATOM_GOLDMONT_PLUS:

... the Goldmonts.

Quoted 23 lines
xen/arch/x86/hvm/vmx/vmx.c +3 -13
@@ -3431,23 +3435,20 @@ static void __init lbr_tsx_fixup_check(void)
      * fixed up as well.
      */
     if ( cpu_has_hle || cpu_has_rtm ||
-         boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
-         boot_cpu_data.x86 != 6 )
+         boot_cpu_data.vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.family != 6 )
         return;
 
-    switch ( boot_cpu_data.x86_model )
+    switch ( boot_cpu_data.vfm )
     {
-    case 0x3c: /* HSM182, HSD172 - 4th gen Core */
-    case 0x3f: /* HSE117 - Xeon E5 v3 */
-    case 0x45: /* HSM182 - 4th gen Core */
-    case 0x46: /* HSM182, HSD172 - 4th gen Core (GT3) */
-    case 0x3d: /* BDM127 - 5th gen Core */
-    case 0x47: /* BDD117 - 5th gen Core (GT3)
-                  BDW117 - Xeon E3-1200 v4 */
-    case 0x4f: /* BDF85  - Xeon E5-2600 v4
-                  BDH75  - Core-i7 for LGA2011-v3 Socket
-                  BDX88  - Xeon E7-x800 v4 */

xen/arch/x86/hvm/vmx/vmx.c static void __init lbr_tsx_fixup_check(void) · line 3452

Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +8 -1
-    case 0x56: /* BDE105 - Xeon D-1500 */
+    case INTEL_HASWELL:
+    case INTEL_HASWELL_X:
+    case INTEL_HASWELL_L:
+    case INTEL_HASWELL_G:
+    case INTEL_BROADWELL:
+    case INTEL_BROADWELL_G:
+    case INTEL_BROADWELL_X:
+    case INTEL_BROADWELL_D:
         break;

I think it would be nice for the errata numbers to not be lost.

Quoted 17 lines
xen/arch/x86/hvm/vmx/vmx.c +3 -7
@@ -3476,19 +3477,16 @@ static void __init ler_to_fixup_check(void)
      * that are not equal to bit[47].  Attempting to context switch this value
      * may cause a #GP.  Software should sign extend the MSR.
      */
-    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
-         boot_cpu_data.x86 != 6 )
+    if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.family != 6 )
         return;
 
-    switch ( boot_cpu_data.x86_model )
+    switch ( boot_cpu_data.vfm )
     {
-    case 0x3d: /* BDM131 - 5th gen Core */
-    case 0x47: /* BDD??? - 5th gen Core (H-Processor line)
-                  BDW120 - Xeon E3-1200 v4 */
-    case 0x4f: /* BDF93  - Xeon E5-2600 v4

xen/arch/x86/hvm/vmx/vmx.c static void __init ler_to_fixup_check(void) · line 3492

Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +4 -3
-                  BDH80  - Core-i7 for LGA2011-v3 Socket
-                  BDX93  - Xeon E7-x800 v4 */
-    case 0x56: /* BDE??? - Xeon D-1500 */
+    case INTEL_BROADWELL:
+    case INTEL_BROADWELL_G:
+    case INTEL_BROADWELL_X:
+    case INTEL_BROADWELL_D:
         ler_to_fixup_needed = true;
         break;
     }

Same here then.

Jan

#7 lore raw

Re: [PATCH 3/6] x86: Remove x86 prefixed names from hvm code

Quoted 21 lines · Jan Beulich
Quoted 10 lines · Kevin Lampis

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.

Quoted 7 lines

---
I couldn't find any information about these Intel family 6 processors:
model 0x5d: /* SoFIA 3G Granite/ES2.1 */
model 0x65: /* SoFIA LTE AOSP */
model 0x6e: /* Cougar Mountain */
Should I add them to intel-family.h?

We should keep that in sync with Linux, I think, so "no" unless you mean to first have respective entries added there.

Quoted 6 lines

0x5d is listed in the SDM, so I'd recommend keeping the entries (using IFM() directly for the time being).

0x65 and 0x6e aren't listed in the SDM, so may never really have hit the public. Respective cases can perhaps be dropped, but such dropping would again likely better be done in a separate change.

These are the 5G basestations I mentioned during the x86 meeting.  Linux has declined to take take these models into intel-family.h because they're not general purpose.

I suggest we drop them, including 0x5d.  I can do a separate patch.

Quoted 114 lines
Quoted 96 lines
xen/arch/x86/hvm/vmx/vmx.c +31 -49
@@ -3073,71 +3077,71 @@ static bool __init has_if_pschange_mc(void)
      * IF_PSCHANGE_MC is only known to affect Intel Family 6 processors at
      * this time.
      */
-    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
-         boot_cpu_data.x86 != 6 )
+    if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.family != 6 )
         return false;
 
-    switch ( boot_cpu_data.x86_model )
+    switch ( boot_cpu_data.vfm )
     {
         /*
          * Core processors since at least Nehalem are vulnerable.
          */
-    case 0x1f: /* Auburndale / Havendale */
-    case 0x1e: /* Nehalem */
-    case 0x1a: /* Nehalem EP */
-    case 0x2e: /* Nehalem EX */
-    case 0x25: /* Westmere */
-    case 0x2c: /* Westmere EP */
-    case 0x2f: /* Westmere EX */
-    case 0x2a: /* SandyBridge */
-    case 0x2d: /* SandyBridge EP/EX */
-    case 0x3a: /* IvyBridge */
-    case 0x3e: /* IvyBridge EP/EX */
-    case 0x3c: /* Haswell */
-    case 0x3f: /* Haswell EX/EP */
-    case 0x45: /* Haswell D */
-    case 0x46: /* Haswell H */
-    case 0x3d: /* Broadwell */
-    case 0x47: /* Broadwell H */
-    case 0x4f: /* Broadwell EP/EX */
-    case 0x56: /* Broadwell D */
-    case 0x4e: /* Skylake M */
-    case 0x5e: /* Skylake D */
-    case 0x55: /* Skylake-X / Cascade Lake */
-    case 0x7d: /* Ice Lake */
-    case 0x7e: /* Ice Lake */
-    case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
-    case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
-    case 0xa5: /* Comet Lake H/S */
-    case 0xa6: /* Comet Lake U */
+    case INTEL_NEHALEM_G:
+    case INTEL_NEHALEM:
+    case INTEL_NEHALEM_EP:
+    case INTEL_NEHALEM_EX:
+    case INTEL_WESTMERE:
+    case INTEL_WESTMERE_EP:
+    case INTEL_WESTMERE_EX:
+    case INTEL_SANDYBRIDGE:
+    case INTEL_SANDYBRIDGE_X:
+    case INTEL_IVYBRIDGE:
+    case INTEL_IVYBRIDGE_X:
+    case INTEL_HASWELL:
+    case INTEL_HASWELL_X:
+    case INTEL_HASWELL_L:
+    case INTEL_HASWELL_G:
+    case INTEL_BROADWELL:
+    case INTEL_BROADWELL_G:
+    case INTEL_BROADWELL_X:
+    case INTEL_BROADWELL_D:
+    case INTEL_SKYLAKE_L:
+    case INTEL_SKYLAKE:
+    case INTEL_SKYLAKE_X:
+    case INTEL_ICELAKE:
+    case INTEL_ICELAKE_L:
+    case INTEL_KABYLAKE_L:
+    case INTEL_KABYLAKE:
+    case INTEL_COMETLAKE:
+    case INTEL_COMETLAKE_L:
         return true;
 
         /*
          * Atom processors are not vulnerable.
          */
-    case 0x1c: /* Pineview */
-    case 0x26: /* Lincroft */
-    case 0x27: /* Penwell */
-    case 0x35: /* Cloverview */
-    case 0x36: /* Cedarview */
-    case 0x37: /* Baytrail / Valleyview (Silvermont) */
-    case 0x4d: /* Avaton / Rangely (Silvermont) */
-    case 0x4c: /* Cherrytrail / Brasswell */
-    case 0x4a: /* Merrifield */
-    case 0x5a: /* Moorefield */
-    case 0x5c: /* Goldmont */
-    case 0x5d: /* SoFIA 3G Granite/ES2.1 */
-    case 0x65: /* SoFIA LTE AOSP */
-    case 0x5f: /* Denverton */
-    case 0x6e: /* Cougar Mountain */
-    case 0x75: /* Lightning Mountain */
-    case 0x7a: /* Gemini Lake */
-    case 0x86: /* Jacobsville */

xen/arch/x86/hvm/vmx/vmx.c static bool __init has_if_pschange_mc(void) · line 3131

Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +10 -0
+    case INTEL_ATOM_BONNELL:
+    case INTEL_ATOM_BONNELL_MID:
+    case INTEL_ATOM_SALTWELL_MID:
+    case INTEL_ATOM_SALTWELL_TABLET:
+    case INTEL_ATOM_SALTWELL:
+    case INTEL_ATOM_SILVERMONT:
+    case INTEL_ATOM_SILVERMONT_D:
+    case INTEL_ATOM_AIRMONT:
+    case INTEL_ATOM_SILVERMONT_MID:
+    case INTEL_ATOM_SILVERMONT_MID2:

Can the Silvermonts please be grouped together?

xen/arch/x86/hvm/vmx/vmx.c static bool __init has_if_pschange_mc(void) · line 3137

Quoted 6 lines
xen/arch/x86/hvm/vmx/vmx.c +6 -0
+    case INTEL_ATOM_GOLDMONT:
+    //case 0x5d: /* SoFIA 3G Granite/ES2.1 */ // XXX ???
+    //case 0x65: /* SoFIA LTE AOSP */         // XXX ???
+    case INTEL_ATOM_GOLDMONT_D:
+    //case 0x6e: /* Cougar Mountain */        // XXX ???
+    case INTEL_ATOM_AIRMONT_NP:
Quoted 4 lines

Same for the Airmonts and ...

Review static bool __init has_if_pschange_mc(void) · line 3138

Quoted 1 line
(quoted diff) +1 -0
+    case INTEL_ATOM_GOLDMONT_PLUS:

... the Goldmonts.

We need another sync to intel-family.h.  Christian made a correction or two in this area.  I'll do a patch.

~Andrew

#8 lore raw

Re: [PATCH 3/6] x86: Remove x86 prefixed names from hvm code

Quoted 113 lines · Andrew Cooper
Quoted 113 lines
Quoted 95 lines
xen/arch/x86/hvm/vmx/vmx.c +31 -49
@@ -3073,71 +3077,71 @@ static bool __init has_if_pschange_mc(void)
      * IF_PSCHANGE_MC is only known to affect Intel Family 6 processors at
      * this time.
      */
-    if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
-         boot_cpu_data.x86 != 6 )
+    if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
+         boot_cpu_data.family != 6 )
         return false;
 
-    switch ( boot_cpu_data.x86_model )
+    switch ( boot_cpu_data.vfm )
     {
         /*
          * Core processors since at least Nehalem are vulnerable.
          */
-    case 0x1f: /* Auburndale / Havendale */
-    case 0x1e: /* Nehalem */
-    case 0x1a: /* Nehalem EP */
-    case 0x2e: /* Nehalem EX */
-    case 0x25: /* Westmere */
-    case 0x2c: /* Westmere EP */
-    case 0x2f: /* Westmere EX */
-    case 0x2a: /* SandyBridge */
-    case 0x2d: /* SandyBridge EP/EX */
-    case 0x3a: /* IvyBridge */
-    case 0x3e: /* IvyBridge EP/EX */
-    case 0x3c: /* Haswell */
-    case 0x3f: /* Haswell EX/EP */
-    case 0x45: /* Haswell D */
-    case 0x46: /* Haswell H */
-    case 0x3d: /* Broadwell */
-    case 0x47: /* Broadwell H */
-    case 0x4f: /* Broadwell EP/EX */
-    case 0x56: /* Broadwell D */
-    case 0x4e: /* Skylake M */
-    case 0x5e: /* Skylake D */
-    case 0x55: /* Skylake-X / Cascade Lake */
-    case 0x7d: /* Ice Lake */
-    case 0x7e: /* Ice Lake */
-    case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
-    case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
-    case 0xa5: /* Comet Lake H/S */
-    case 0xa6: /* Comet Lake U */
+    case INTEL_NEHALEM_G:
+    case INTEL_NEHALEM:
+    case INTEL_NEHALEM_EP:
+    case INTEL_NEHALEM_EX:
+    case INTEL_WESTMERE:
+    case INTEL_WESTMERE_EP:
+    case INTEL_WESTMERE_EX:
+    case INTEL_SANDYBRIDGE:
+    case INTEL_SANDYBRIDGE_X:
+    case INTEL_IVYBRIDGE:
+    case INTEL_IVYBRIDGE_X:
+    case INTEL_HASWELL:
+    case INTEL_HASWELL_X:
+    case INTEL_HASWELL_L:
+    case INTEL_HASWELL_G:
+    case INTEL_BROADWELL:
+    case INTEL_BROADWELL_G:
+    case INTEL_BROADWELL_X:
+    case INTEL_BROADWELL_D:
+    case INTEL_SKYLAKE_L:
+    case INTEL_SKYLAKE:
+    case INTEL_SKYLAKE_X:
+    case INTEL_ICELAKE:
+    case INTEL_ICELAKE_L:
+    case INTEL_KABYLAKE_L:
+    case INTEL_KABYLAKE:
+    case INTEL_COMETLAKE:
+    case INTEL_COMETLAKE_L:
         return true;
 
         /*
          * Atom processors are not vulnerable.
          */
-    case 0x1c: /* Pineview */
-    case 0x26: /* Lincroft */
-    case 0x27: /* Penwell */
-    case 0x35: /* Cloverview */
-    case 0x36: /* Cedarview */
-    case 0x37: /* Baytrail / Valleyview (Silvermont) */
-    case 0x4d: /* Avaton / Rangely (Silvermont) */
-    case 0x4c: /* Cherrytrail / Brasswell */
-    case 0x4a: /* Merrifield */
-    case 0x5a: /* Moorefield */
-    case 0x5c: /* Goldmont */
-    case 0x5d: /* SoFIA 3G Granite/ES2.1 */
-    case 0x65: /* SoFIA LTE AOSP */
-    case 0x5f: /* Denverton */
-    case 0x6e: /* Cougar Mountain */
-    case 0x75: /* Lightning Mountain */
-    case 0x7a: /* Gemini Lake */
-    case 0x86: /* Jacobsville */

xen/arch/x86/hvm/vmx/vmx.c static bool __init has_if_pschange_mc(void) · line 3131

Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +10 -0
+    case INTEL_ATOM_BONNELL:
+    case INTEL_ATOM_BONNELL_MID:
+    case INTEL_ATOM_SALTWELL_MID:
+    case INTEL_ATOM_SALTWELL_TABLET:
+    case INTEL_ATOM_SALTWELL:
+    case INTEL_ATOM_SILVERMONT:
+    case INTEL_ATOM_SILVERMONT_D:
+    case INTEL_ATOM_AIRMONT:
+    case INTEL_ATOM_SILVERMONT_MID:
+    case INTEL_ATOM_SILVERMONT_MID2:

Can the Silvermonts please be grouped together?

Quoted 6 lines
xen/arch/x86/hvm/vmx/vmx.c +6 -0
+    case INTEL_ATOM_GOLDMONT:
+    //case 0x5d: /* SoFIA 3G Granite/ES2.1 */ // XXX ???
+    //case 0x65: /* SoFIA LTE AOSP */         // XXX ???
+    case INTEL_ATOM_GOLDMONT_D:
+    //case 0x6e: /* Cougar Mountain */        // XXX ???
+    case INTEL_ATOM_AIRMONT_NP:
Quoted 6 lines
Quoted 4 lines

Same for the Airmonts and ...

Review static bool __init has_if_pschange_mc(void) · line 3138

Quoted 1 line
(quoted diff) +1 -0
+    case INTEL_ATOM_GOLDMONT_PLUS:

... the Goldmonts.

We need another sync to intel-family.h.  Christian made a correction or two in this area.  I'll do a patch.

Scratch this.  It looks like we're already up to date.

~Andrew

#9 lore raw

Re: [PATCH 3/6] x86: Remove x86 prefixed names from hvm code

In reply to Andrew Cooper
Quoted 29 lines · Andrew Cooper
Quoted 21 lines · Jan Beulich
Quoted 10 lines · Kevin Lampis

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.

Quoted 7 lines

---
I couldn't find any information about these Intel family 6 processors:
model 0x5d: /* SoFIA 3G Granite/ES2.1 */
model 0x65: /* SoFIA LTE AOSP */
model 0x6e: /* Cougar Mountain */
Should I add them to intel-family.h?

We should keep that in sync with Linux, I think, so "no" unless you mean to first have respective entries added there.

Quoted 6 lines

0x5d is listed in the SDM, so I'd recommend keeping the entries (using IFM() directly for the time being).

0x65 and 0x6e aren't listed in the SDM, so may never really have hit the public. Respective cases can perhaps be dropped, but such dropping would again likely better be done in a separate change.

Quoted 5 lines

These are the 5G basestations I mentioned during the x86 meeting.  Linux has declined to take take these models into intel-family.h because they're not general purpose.

I suggest we drop them, including 0x5d.  I can do a separate patch.

For 0x5d it's not quite clear what the justification would be. Looking at the SDM, those X3-C3000 don't look any more or less general purpose as C2000 and C1000. I guess I'll learn once you've sent the patch.

Jan

#10 lore raw

PATCH 4/6 x86: Remove x86 prefixed names from x86/cpu/ files

In reply to Kevin Lampis

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.

---
Inside core2_vpmu_init() there is a check for family == 6. Should this be extended to family 18/19?

---
 xen/arch/x86/cpu/centaur.c         | 4 ++--
 xen/arch/x86/cpu/hygon.c           | 4 ++--
 xen/arch/x86/cpu/intel_cacheinfo.c | 6 +++---
 xen/arch/x86/cpu/mtrr/generic.c    | 6 +++---
 xen/arch/x86/cpu/mwait-idle.c      | 4 ++--
 xen/arch/x86/cpu/vpmu.c            | 4 ++--
 xen/arch/x86/cpu/vpmu_amd.c        | 6 +++---
 xen/arch/x86/cpu/vpmu_intel.c      | 6 ++++--
 8 files changed, 21 insertions(+), 19 deletions(-)
xen/arch/x86/cpu/centaur.c +2 -2
index d2e7c8ec99..9123b05dc1 100644
@@ -41,7 +41,7 @@ static void init_c3(struct cpuinfo_x86 *c)
 		}
 	}
 
-	if (c->x86 == 0x6 && c->x86_model >= 0xf) {
+	if (c->family == 0x6 && c->model >= 0xf) {
 		c->x86_cache_alignment = c->x86_clflush_size * 2;
 		__set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
 	}
@@ -52,7 +52,7 @@ static void init_c3(struct cpuinfo_x86 *c)
 
 static void cf_check init_centaur(struct cpuinfo_x86 *c)
 {
-	if (c->x86 == 6)
+	if (c->family == 6)
 		init_c3(c);
 }
 
xen/arch/x86/cpu/hygon.c +2 -2
index b99d83ed4d..7a9fc25d31 100644
@@ -41,12 +41,12 @@ static void cf_check init_hygon(struct cpuinfo_x86 *c)
 
 	/* Probe for NSCB on Zen2 CPUs when not virtualised */
 	if (!cpu_has_hypervisor && !cpu_has_nscb && c == &boot_cpu_data &&
-	    c->x86 == 0x18)
+	    c->family == 0x18)
 		detect_zen2_null_seg_behaviour();
 
 	/*
 	 * TODO: Check heuristic safety with Hygon first
-	if (c->x86 == 0x18)
+	if (c->family == 0x18)
 		amd_init_spectral_chicken();
 	 */
 
xen/arch/x86/cpu/intel_cacheinfo.c +3 -3
index e88faa7545..a81d0764fb 100644
@@ -168,15 +168,15 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
 	 * Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for
 	 * trace cache
 	 */
-	if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1 &&
-	    c->x86_vendor != X86_VENDOR_SHANGHAI)
+	if ((num_cache_leaves == 0 || c->family == 15) && c->cpuid_level > 1 &&
+	    c->vendor != X86_VENDOR_SHANGHAI)
 	{
 		/* supports eax=2  call */
 		unsigned int i, j, n, regs[4];
 		unsigned char *dp = (unsigned char *)regs;
 		int only_trace = 0;
 
-		if (num_cache_leaves != 0 && c->x86 == 15)
+		if (num_cache_leaves != 0 && c->family == 15)
 			only_trace = 1;
 
 		/* Number of times to iterate */
xen/arch/x86/cpu/mtrr/generic.c +3 -3
index c587e9140e..190be7f1b4 100644
@@ -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;
 
 		rdmsrl(MSR_K8_SYSCFG, syscfg);
xen/arch/x86/cpu/mwait-idle.c +2 -2
index 5962ec1db9..6776eeb9ac 100644
@@ -1637,7 +1637,7 @@ static int __init mwait_idle_probe(void)
 		lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
 
 	pr_debug(PREFIX "v" MWAIT_IDLE_VERSION " model %#x\n",
-		 boot_cpu_data.x86_model);
+		 boot_cpu_data.model);
 
 	pr_debug(PREFIX "lapic_timer_reliable_states %#x\n",
 		 lapic_timer_reliable_states);
@@ -1816,7 +1816,7 @@ bool __init mwait_pc10_supported(void)
 {
 	unsigned int ecx, edx, dummy;
 
-	if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+	if (boot_cpu_data.vendor != X86_VENDOR_INTEL ||
 	    !cpu_has_monitor ||
 	    boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
 		return false;
xen/arch/x86/cpu/vpmu.c +2 -2
index c28192ea26..64328bdf3f 100644
@@ -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;
     int ret;
 
     BUILD_BUG_ON(sizeof(struct xen_pmu_intel_ctxt) > XENPMU_CTXT_PAD_SZ);
@@ -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;
     const struct arch_vpmu_ops *ops = NULL;
 
     if ( !opt_vpmu_enabled )
xen/arch/x86/cpu/vpmu_amd.c +3 -3
index d1f6bd5495..943a0f4ebe 100644
@@ -532,7 +532,7 @@ static const struct arch_vpmu_ops *__init common_init(void)
     if ( !num_counters )
     {
         printk(XENLOG_WARNING "VPMU: Unsupported CPU family %#x\n",
-               current_cpu_data.x86);
+               current_cpu_data.family);
         return ERR_PTR(-EINVAL);
     }
 
@@ -557,7 +557,7 @@ static const struct arch_vpmu_ops *__init common_init(void)
 
 const struct arch_vpmu_ops *__init amd_vpmu_init(void)
 {
-    switch ( current_cpu_data.x86 )
+    switch ( current_cpu_data.family )
     {
     case 0x15:
     case 0x17:
@@ -585,7 +585,7 @@ const struct arch_vpmu_ops *__init amd_vpmu_init(void)
 
 const struct arch_vpmu_ops *__init hygon_vpmu_init(void)
 {
-    switch ( current_cpu_data.x86 )
+    switch ( current_cpu_data.family )
     {
     case 0x18:
         num_counters = F15H_NUM_COUNTERS;
xen/arch/x86/cpu/vpmu_intel.c +4 -2
index 1e3b06ef8e..c623554e37 100644
@@ -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 )
     {
         printk(XENLOG_WARNING "VPMU: only family 6 is supported\n");
         return ERR_PTR(-EINVAL);
@@ -958,7 +960,7 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
               sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt;
 
     /* TODO: It's clearly incorrect for this to quirk all Intel Fam6 CPUs. */
-    pmc_quirk = current_cpu_data.x86 == 6;
+    pmc_quirk = current_cpu_data.family == 6;
 
     if ( sizeof(struct xen_pmu_data) + sizeof(uint64_t) * fixed_pmc_cnt +
          sizeof(struct xen_pmu_cntr_pair) * arch_pmc_cnt > PAGE_SIZE )
Signature · 1 line
2.51.1
Acked-by on v1 4/6
#11 lore raw

Re: [PATCH 4/6] x86: Remove x86 prefixed names from x86/cpu/ files

Quoted 6 lines · Kevin Lampis

struct cpuinfo_x86
.x86 => .family
.x86_vendor => .vendor
.x86_model => .model
.x86_mask => .stepping

Quoted 8 lines

No functional change.

This work is part of making Xen safe for Intel family 18/19.

---
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.

xen/arch/x86/cpu/mtrr/generic.c static void __init print_mtrr_state(const char *level) · line 224

Quoted 13 lines
xen/arch/x86/cpu/mtrr/generic.c +3 -3
@@ -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.

xen/arch/x86/cpu/vpmu.c int vpmu_load(struct vcpu *v, bool from_guest) · line 401

Quoted 8 lines
xen/arch/x86/cpu/vpmu.c +1 -1
@@ -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.

xen/arch/x86/cpu/vpmu.c static struct notifier_block cpu_nfb = { · line 818

Quoted 6 lines
xen/arch/x86/cpu/vpmu.c +1 -1
@@ -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.

xen/arch/x86/cpu/vpmu_intel.c const struct arch_vpmu_ops *__init core2_vpmu_init(void) · line 923

Quoted 11 lines
xen/arch/x86/cpu/vpmu_intel.c +3 -1
@@ -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):

Jan

#12 lore raw

PATCH 5/6 x86: Remove x86 prefixed names misc

In reply to Kevin Lampis

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.

---
 xen/arch/x86/alternative.c               |  8 ++++----
 xen/arch/x86/apic.c                      |  2 +-
 xen/arch/x86/cpuid.c                     |  2 +-
 xen/arch/x86/dom0_build.c                |  4 ++--
 xen/arch/x86/domain.c                    | 12 ++++++------
 xen/arch/x86/e820.c                      |  2 +-
 xen/arch/x86/i8259.c                     |  2 +-
 xen/arch/x86/irq.c                       |  4 ++--
 xen/arch/x86/mpparse.c                   |  6 +++---
 xen/arch/x86/msr.c                       |  4 ++--
 xen/arch/x86/nmi.c                       | 12 ++++++------
 xen/arch/x86/platform_hypercall.c        |  8 ++++----
 xen/arch/x86/pv/domain.c                 |  2 +-
 xen/arch/x86/setup.c                     |  6 +++---
 xen/arch/x86/traps-setup.c               |  4 ++--
 xen/arch/x86/tsx.c                       |  4 ++--
 xen/drivers/passthrough/amd/iommu_init.c |  6 +++---
 17 files changed, 44 insertions(+), 44 deletions(-)
xen/arch/x86/alternative.c +4 -4
index 9f844241bc..5ed0c26725 100644
@@ -89,7 +89,7 @@ static bool init_or_livepatch_read_mostly toolchain_nops_are_ideal;
 
 static void __init arch_init_ideal_nops(void)
 {
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_INTEL:
         /*
@@ -97,10 +97,10 @@ static void __init arch_init_ideal_nops(void)
          * actually perform better with the "k8_nops" than with the SDM-
          * recommended NOPs.
          */
-        if ( boot_cpu_data.x86 != 6 )
+        if ( boot_cpu_data.family != 6 )
             break;
 
-        switch ( boot_cpu_data.x86_model )
+        switch ( boot_cpu_data.model )
         {
         case 0x0f ... 0x1b:
         case 0x1d ... 0x25:
@@ -111,7 +111,7 @@ static void __init arch_init_ideal_nops(void)
         break;
 
     case X86_VENDOR_AMD:
-        if ( boot_cpu_data.x86 <= 0xf )
+        if ( boot_cpu_data.family <= 0xf )
             ideal_nops = k8_nops;
         break;
     }
xen/arch/x86/apic.c +1 -1
index fb38be7ec3..d69ef9e16a 100644
@@ -406,7 +406,7 @@ void __init init_bsp_APIC(void)
     value |= APIC_SPIV_APIC_ENABLED;
     
     /* This bit is reserved on P4/Xeon and should be cleared */
-    if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 15))
+    if ((boot_cpu_data.vendor == X86_VENDOR_INTEL) && (boot_cpu_data.family == 15))
         value &= ~APIC_SPIV_FOCUS_DISABLED;
     else
         value |= APIC_SPIV_FOCUS_DISABLED;
xen/arch/x86/cpuid.c +1 -1
index 5decfad8cd..6e9b15c9c3 100644
@@ -437,7 +437,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
 
     case 0xa:
         /* TODO: Rework vPMU control in terms of toolstack choices. */
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
+        if ( boot_cpu_data.vendor != X86_VENDOR_INTEL ||
              !vpmu_available(v) )
             *res = EMPTY_LEAF;
         else
xen/arch/x86/dom0_build.c +2 -2
index 0b467fd4a4..864dd9e53e 100644
@@ -572,10 +572,10 @@ int __init dom0_setup_permissions(struct domain *d)
             rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* HyperTransport range. */
-    if ( boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
+    if ( boot_cpu_data.vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
     {
         mfn = paddr_to_pfn(1UL <<
-                           (boot_cpu_data.x86 < 0x17 ? 40 : paddr_bits));
+                           (boot_cpu_data.family < 0x17 ? 40 : paddr_bits));
         rc |= iomem_deny_access(d, mfn - paddr_to_pfn(3UL << 32), mfn - 1);
     }
 
xen/arch/x86/domain.c +6 -6
index 8eb1509782..b36e113724 100644
@@ -319,7 +319,7 @@ void domain_cpu_policy_changed(struct domain *d)
             if ( cpu_has_htt )
                 edx |= cpufeat_mask(X86_FEATURE_HTT);
 
-            switch ( boot_cpu_data.x86_vendor )
+            switch ( boot_cpu_data.vendor )
             {
             case X86_VENDOR_INTEL:
                 /*
@@ -372,7 +372,7 @@ void domain_cpu_policy_changed(struct domain *d)
         {
             uint64_t mask = cpuidmask_defaults._6c;
 
-            if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
+            if ( boot_cpu_data.vendor == X86_VENDOR_AMD )
                 mask &= (~0ULL << 32) | p->basic.raw[6].c;
 
             d->arch.pv.cpuidmasks->_6c = mask;
@@ -387,7 +387,7 @@ void domain_cpu_policy_changed(struct domain *d)
              * wholesale from the policy, but clamp the features in 7[0].ebx
              * per usual.
              */
-            if ( boot_cpu_data.x86_vendor &
+            if ( boot_cpu_data.vendor &
                  (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
                 mask = (((uint64_t)p->feat.max_subleaf << 32) |
                         ((uint32_t)mask & p->feat._7b0));
@@ -400,7 +400,7 @@ void domain_cpu_policy_changed(struct domain *d)
             uint64_t mask = cpuidmask_defaults.Da1;
             uint32_t eax = p->xstate.Da1;
 
-            if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
+            if ( boot_cpu_data.vendor == X86_VENDOR_INTEL )
                 mask &= (~0ULL << 32) | eax;
 
             d->arch.pv.cpuidmasks->Da1 = mask;
@@ -427,7 +427,7 @@ void domain_cpu_policy_changed(struct domain *d)
             if ( !(p->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
                 edx &= ~CPUID_COMMON_1D_FEATURES;
 
-            switch ( boot_cpu_data.x86_vendor )
+            switch ( boot_cpu_data.vendor )
             {
             case X86_VENDOR_INTEL:
                 mask &= ((uint64_t)edx << 32) | ecx;
@@ -457,7 +457,7 @@ void domain_cpu_policy_changed(struct domain *d)
         cpu_policy_updated(v);
 
         /* If PMU version is zero then the guest doesn't have VPMU */
-        if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+        if ( boot_cpu_data.vendor == X86_VENDOR_INTEL &&
              p->basic.pmu_version == 0 )
             vpmu_destroy(v);
     }
xen/arch/x86/e820.c +1 -1
index ca577c0bde..872208ab37 100644
@@ -426,7 +426,7 @@ static uint64_t __init mtrr_top_of_ram(void)
 
     /* By default we check only Intel systems. */
     if ( e820_mtrr_clip == -1 )
-        e820_mtrr_clip = boot_cpu_data.x86_vendor == X86_VENDOR_INTEL;
+        e820_mtrr_clip = boot_cpu_data.vendor == X86_VENDOR_INTEL;
 
     if ( !e820_mtrr_clip )
         return 0;
xen/arch/x86/i8259.c +1 -1
index 5c7e21a751..d2a08661f8 100644
@@ -419,7 +419,7 @@ void __init init_IRQ(void)
          * the interrupt.
          */
         cpumask_copy(desc->arch.cpu_mask,
-                     (boot_cpu_data.x86_vendor &
+                     (boot_cpu_data.vendor &
                       (X86_VENDOR_AMD | X86_VENDOR_HYGON) ? &cpumask_all
                                                           : cpumask_of(cpu)));
         desc->arch.vector = LEGACY_VECTOR(irq);
xen/arch/x86/irq.c +2 -2
index cc2934bfca..739fc04bd1 100644
@@ -2011,8 +2011,8 @@ void do_IRQ(struct cpu_user_regs *regs)
                      * interrupts have been delivered to CPUs
                      * different than the BSP.
                      */
-                    (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |
-                                                 X86_VENDOR_HYGON))) &&
+                    (boot_cpu_data.vendor & (X86_VENDOR_AMD |
+                                             X86_VENDOR_HYGON))) &&
                    bogus_8259A_irq(vector - FIRST_LEGACY_VECTOR)) )
             {
                 printk("CPU%u: No irq handler for vector %02x (IRQ %d%s)\n",
xen/arch/x86/mpparse.c +3 -3
index c1171f7a3a..1b41aa573f 100644
@@ -511,9 +511,9 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
 	/* Either an integrated APIC or a discrete 82489DX. */
 	processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01;
 	processor.mpc_cpuflag = CPU_ENABLED;
-	processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) |
-				   (boot_cpu_data.x86_model << 4) |
-				   boot_cpu_data.x86_mask;
+	processor.mpc_cpufeature = (boot_cpu_data.family << 8) |
+				   (boot_cpu_data.model << 4) |
+				   boot_cpu_data.stepping;
 	processor.mpc_featureflag =
             boot_cpu_data.x86_capability[FEATURESET_1d];
 	processor.mpc_reserved[0] = 0;
xen/arch/x86/msr.c +2 -2
index ad75a2e108..6a97be59d5 100644
@@ -170,7 +170,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
 
     case MSR_IA32_PLATFORM_ID:
         if ( !(cp->x86_vendor & X86_VENDOR_INTEL) ||
-             !(boot_cpu_data.x86_vendor & X86_VENDOR_INTEL) )
+             !(boot_cpu_data.vendor & X86_VENDOR_INTEL) )
             goto gp_fault;
         rdmsrl(MSR_IA32_PLATFORM_ID, *val);
         break;
@@ -190,7 +190,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
          * the guest.
          */
         if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
-             !(boot_cpu_data.x86_vendor &
+             !(boot_cpu_data.vendor &
                (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
              rdmsr_safe(MSR_AMD_PATCHLEVEL, val) )
             goto gp_fault;
xen/arch/x86/nmi.c +6 -6
index a0c9194ff0..447fac19d3 100644
@@ -216,12 +216,12 @@ void disable_lapic_nmi_watchdog(void)
 {
     if (nmi_active <= 0)
         return;
-    switch (boot_cpu_data.x86_vendor) {
+    switch (boot_cpu_data.vendor) {
     case X86_VENDOR_AMD:
         wrmsrns(MSR_K7_EVNTSEL0, 0);
         break;
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch (boot_cpu_data.family) {
         case 6:
             wrmsrns(MSR_P6_EVNTSEL(0), 0);
             break;
@@ -362,7 +362,7 @@ static void setup_p4_watchdog(void)
         clear_msr_range(0x3F1, 2);
     /* MSR 0x3F0 seems to have a default value of 0xFC00, but current
        docs doesn't fully define it, so leave it alone for now. */
-    if (boot_cpu_data.x86_model >= 0x3) {
+    if (boot_cpu_data.model >= 0x3) {
         /* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */
         clear_msr_range(0x3A0, 26);
         clear_msr_range(0x3BC, 3);
@@ -387,16 +387,16 @@ void setup_apic_nmi_watchdog(void)
     if ( nmi_watchdog == NMI_NONE )
         return;
 
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_AMD:
         setup_k7_watchdog();
         break;
 
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch (boot_cpu_data.family) {
         case 6:
-            setup_p6_watchdog((boot_cpu_data.x86_model < 14) 
+            setup_p6_watchdog((boot_cpu_data.model < 14)
                               ? P6_EVENT_CPU_CLOCKS_NOT_HALTED
                               : CORE_EVENT_CPU_CLOCKS_NOT_HALTED);
             break;
xen/arch/x86/platform_hypercall.c +4 -4
index cd4f0ae5e5..0431f875af 100644
@@ -104,7 +104,7 @@ static bool msr_read_allowed(unsigned int msr)
      * the platform doesn't actually support this MSR.
      */
     case MSR_TEMPERATURE_TARGET:
-        return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+        return boot_cpu_data.vendor == X86_VENDOR_INTEL &&
                host_cpu_policy.basic.digital_temp_sensor;
 
     case MSR_PACKAGE_THERM_STATUS:
@@ -688,9 +688,9 @@ ret_t do_platform_op(
             const struct cpuinfo_x86 *c = &cpu_data[ver->xen_cpuid];
 
             memcpy(ver->vendor_id, c->x86_vendor_id, sizeof(ver->vendor_id));
-            ver->family = c->x86;
-            ver->model = c->x86_model;
-            ver->stepping = c->x86_mask;
+            ver->family = c->family;
+            ver->model = c->model;
+            ver->stepping = c->stepping;
         }
 
         ver->max_present = cpumask_last(&cpu_present_map);
xen/arch/x86/pv/domain.c +1 -1
index d16583a745..0fd05c7059 100644
@@ -174,7 +174,7 @@ static int __init cf_check pge_init(void)
 {
     if ( opt_global_pages == -1 )
         opt_global_pages = !cpu_has_hypervisor ||
-                           !(boot_cpu_data.x86_vendor &
+                           !(boot_cpu_data.vendor &
                              (X86_VENDOR_AMD | X86_VENDOR_HYGON));
 
     return 0;
xen/arch/x86/setup.c +3 -3
index 27c63d1d97..e5f1b4b787 100644
@@ -1407,7 +1407,7 @@ void asmlinkage __init noreturn __start_xen(void)
          * supervisor shadow stacks are now safe to use.
          */
         bool cpu_has_bug_shstk_fracture =
-            boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+            boot_cpu_data.vendor == X86_VENDOR_INTEL &&
             !boot_cpu_has(X86_FEATURE_CET_SSS);
 
         /*
@@ -2038,10 +2038,10 @@ void asmlinkage __init noreturn __start_xen(void)
 
     /* Do not enable SMEP/SMAP in PV shim on AMD and Hygon by default */
     if ( opt_smep == -1 )
-        opt_smep = !pv_shim || !(boot_cpu_data.x86_vendor &
+        opt_smep = !pv_shim || !(boot_cpu_data.vendor &
                                  (X86_VENDOR_AMD | X86_VENDOR_HYGON));
     if ( opt_smap == -1 )
-        opt_smap = !pv_shim || !(boot_cpu_data.x86_vendor &
+        opt_smap = !pv_shim || !(boot_cpu_data.vendor &
                                  (X86_VENDOR_AMD | X86_VENDOR_HYGON));
 
     if ( !opt_smep )
xen/arch/x86/traps-setup.c +2 -2
index d77be8f839..1aff0327dc 100644
@@ -243,10 +243,10 @@ static void __init init_ler(void)
      * Intel Pentium 4 is the only known CPU to not use the architectural MSR
      * indicies.
      */
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_INTEL:
-        if ( boot_cpu_data.x86 == 0xf )
+        if ( boot_cpu_data.family == 0xf )
         {
             msr = MSR_P4_LER_FROM_LIP;
             break;
xen/arch/x86/tsx.c +2 -2
index fe9f0ab4f7..38371487b9 100644
@@ -148,8 +148,8 @@ void tsx_init(void)
             {
                 printk(XENLOG_ERR
                        "FIRMWARE BUG: CPU %02x-%02x-%02x, ucode 0x%08x: RTM_ALWAYS_ABORT vs RTM mismatch\n",
-                       boot_cpu_data.x86, boot_cpu_data.x86_model,
-                       boot_cpu_data.x86_mask, this_cpu(cpu_sig).rev);
+                       boot_cpu_data.family, boot_cpu_data.model,
+                       boot_cpu_data.stepping, this_cpu(cpu_sig).rev);
 
                 setup_clear_cpu_cap(X86_FEATURE_RTM_ALWAYS_ABORT);
                 setup_clear_cpu_cap(X86_FEATURE_TSX_FORCE_ABORT);
xen/drivers/passthrough/amd/iommu_init.c +3 -3
index 00d2c46cbc..d77dd85112 100644
@@ -840,9 +840,9 @@ static void amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
 {
     u32 value;
 
-    if ( (boot_cpu_data.x86 != 0x15) ||
-         (boot_cpu_data.x86_model < 0x10) ||
-         (boot_cpu_data.x86_model > 0x1f) )
+    if ( (boot_cpu_data.family != 0x15) ||
+         (boot_cpu_data.model < 0x10) ||
+         (boot_cpu_data.model > 0x1f) )
         return;
 
     pci_conf_write32(iommu->sbdf, 0xf0, 0x90);
Signature · 1 line
2.51.1
Acked-by on v1 5/6
#13 lore raw

Re: [PATCH 5/6] x86: Remove x86 prefixed names misc

Quoted 7 lines · Kevin Lampis
xen/arch/x86/nmi.c +0 -1
@@ -216,12 +216,12 @@ void disable_lapic_nmi_watchdog(void)
 {
     if (nmi_active <= 0)
         return;
-    switch (boot_cpu_data.x86_vendor) {

xen/arch/x86/nmi.c void disable_lapic_nmi_watchdog(void) · line 227

Quoted 10 lines
xen/arch/x86/nmi.c +2 -1
+    switch (boot_cpu_data.vendor) {
     case X86_VENDOR_AMD:
         wrmsrns(MSR_K7_EVNTSEL0, 0);
         break;
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch (boot_cpu_data.family) {
         case 6:
             wrmsrns(MSR_P6_EVNTSEL(0), 0);
             break;

I think here we would benefit from switching to Xen style at this occasion. Fair parts of the file are already Xen style, and this function would then end up almost correct.

xen/arch/x86/nmi.c static void setup_p4_watchdog(void) · line 368

Quoted 9 lines
xen/arch/x86/nmi.c +1 -1
@@ -362,7 +362,7 @@ static void setup_p4_watchdog(void)
         clear_msr_range(0x3F1, 2);
     /* MSR 0x3F0 seems to have a default value of 0xFC00, but current
        docs doesn't fully define it, so leave it alone for now. */
-    if (boot_cpu_data.x86_model >= 0x3) {
+    if (boot_cpu_data.model >= 0x3) {
         /* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */
         clear_msr_range(0x3A0, 26);
         clear_msr_range(0x3BC, 3);

This may want leaving as is, to match the rest of the function, but ...

Quoted 4 lines
xen/arch/x86/nmi.c +0 -0
@@ -387,16 +387,16 @@ void setup_apic_nmi_watchdog(void)
     if ( nmi_watchdog == NMI_NONE )
         return;
 

xen/arch/x86/nmi.c void setup_apic_nmi_watchdog(void) · line 397

Quoted 10 lines
xen/arch/x86/nmi.c +2 -2
-    switch ( boot_cpu_data.x86_vendor )
+    switch ( boot_cpu_data.vendor )
     {
     case X86_VENDOR_AMD:
         setup_k7_watchdog();
         break;
 
     case X86_VENDOR_INTEL:
-        switch (boot_cpu_data.x86) {
+        switch (boot_cpu_data.family) {

... this (again to match the rest of the function) would want adjusting again. With that (again, happy to make the adjustments while committing):

Jan

#14 lore raw

PATCH 6/6 x86: Remove x86 prefixed names from cpuinfo

In reply to Kevin Lampis

---
With the first patch for intel.c this now compiles.
https://lore.kernel.org/xen-devel/[email protected]/

---
 xen/arch/x86/include/asm/cpufeature.h | 5 -----
 1 file changed, 5 deletions(-)
xen/arch/x86/include/asm/cpufeature.h +0 -5
index dcd223d84f..09b1118cea 100644
@@ -43,19 +43,15 @@
 #ifndef __ASSEMBLER__
 
 struct cpuinfo_x86 {
-    /* TODO: Phase out the x86 prefixed names. */
     union {
         struct {
             union {
-                uint8_t x86_model;
                 uint8_t model;
             };
             union {
-                uint8_t x86;
                 uint8_t family;
             };
             union {
-                uint8_t x86_vendor;
                 uint8_t vendor;
             };
             uint8_t _rsvd;             /* Use of this needs coordinating with VFM_MAKE() */
@@ -63,7 +59,6 @@ struct cpuinfo_x86 {
         uint32_t vfm;                  /* Vendor Family Model */
     };
     union {
-        uint8_t x86_mask;
         uint8_t stepping;
     };
 
Signature · 1 line
2.51.1
#15 lore raw

Re: [PATCH 6/6] x86: Remove x86 prefixed names from cpuinfo

Quoted 23 lines · Kevin Lampis
xen/arch/x86/include/asm/cpufeature.h +0 -4
@@ -43,19 +43,15 @@
 #ifndef __ASSEMBLER__
 
 struct cpuinfo_x86 {
-    /* TODO: Phase out the x86 prefixed names. */
     union {
         struct {
             union {
-                uint8_t x86_model;
                 uint8_t model;
             };
             union {
-                uint8_t x86;
                 uint8_t family;
             };
             union {
-                uint8_t x86_vendor;
                 uint8_t vendor;
             };
             uint8_t _rsvd;             /* Use of this needs coordinating with VFM_MAKE() */

xen/arch/x86/include/asm/cpufeature.h struct cpuinfo_x86 { · line 64

Quoted 7 lines
xen/arch/x86/include/asm/cpufeature.h +0 -1
@@ -63,7 +59,6 @@ struct cpuinfo_x86 {
         uint32_t vfm;                  /* Vendor Family Model */
     };
     union {
-        uint8_t x86_mask;
         uint8_t stepping;
     };
 

But then all the now unnecessary unions also want to go away?

Jan