[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Kevin Lampis <kevin.lampis@xxxxxxxxxx>
  • Date: Wed, 4 Mar 2026 19:53:48 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C8uSxdZ9apq9RNkJQVruOhBEhgTE/HpOqrFEHfxII2M=; b=w/WUJ5i4Ivr5Rizdq7JFTQtSN6prGVITq/dgrM0954Ay9AhzMmB6jovP+wb37QRmJn+vpgURuaFws9PATBQdW3QktFuCAxaRakS/TcVW0QQ+usAJMiwxoGHOcYvIQlR/f+rJVnI6Oa2lVZysNVQeRn9Fa1Trr7tJzZayRgb5AT1PpxIP8wmW7RY2bJoo7BzRBCtUMDoqJsAi0Tlu/HO0TbM2W5BJ9FI5PLTLw1TmbmcuP3iFTdb89WY+falxDqKWqtfP6k7VYhzWFqbkJ7zalHjnq3GzTwE8mCH0I7mFMBzlwIqlzH/Af8sX7yMbto+SQWuRKJdLI9xWy4sptklKKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z3wKQwBCJfiwGCPHf/5Hp/Hu6/AGsbeo7DlG4YonOGF9x0Me1HIgNGXL24/MoasdWjjCqUVatJrG/YoLFHwTqRMUmKl+0jxz8n8oJ60S0jIhaA+MPUSlc3EH/sI8Ov0yjgO0kD2uYj7+KmPfJPoav/NqsRxRpMHePhiRGMlZNcMqZPdMXgAJt+1Cvk4fRzw/M1SUsw3blWVog62lsdSAYo5iHWV5kmoeYVDqufxU9jjGj5eas3fHihHIPnM7SaBGKqmgmWJ6yO/lM8wDRrCyCyZJ0KCzAFfD3sRW23OAGtbW00rPPBiclLfK+omQoutxlY8rTsqDgskFpMJV6rjE8Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: jbeulich@xxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Kevin Lampis <kevin.lampis@xxxxxxxxxx>
  • Delivery-date: Wed, 04 Mar 2026 19:53:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 <kevin.lampis@xxxxxxxxxx>
---
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(-)

diff --git a/xen/arch/x86/cpu/centaur.c b/xen/arch/x86/cpu/centaur.c
index d2e7c8ec99..9123b05dc1 100644
--- a/xen/arch/x86/cpu/centaur.c
+++ b/xen/arch/x86/cpu/centaur.c
@@ -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);
 }
 
diff --git a/xen/arch/x86/cpu/hygon.c b/xen/arch/x86/cpu/hygon.c
index b99d83ed4d..7a9fc25d31 100644
--- a/xen/arch/x86/cpu/hygon.c
+++ b/xen/arch/x86/cpu/hygon.c
@@ -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();
         */
 
diff --git a/xen/arch/x86/cpu/intel_cacheinfo.c 
b/xen/arch/x86/cpu/intel_cacheinfo.c
index e88faa7545..a81d0764fb 100644
--- a/xen/arch/x86/cpu/intel_cacheinfo.c
+++ b/xen/arch/x86/cpu/intel_cacheinfo.c
@@ -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 */
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index c587e9140e..190be7f1b4 100644
--- 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;
 
                rdmsrl(MSR_K8_SYSCFG, syscfg);
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 5962ec1db9..6776eeb9ac 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -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;
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index c28192ea26..64328bdf3f 100644
--- 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;
     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 )
diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index d1f6bd5495..943a0f4ebe 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -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;
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 1e3b06ef8e..c623554e37 100644
--- 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 )
     {
         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 )
-- 
2.51.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.