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

[PATCH 5/6] x86: use standard C types in struct cpuinfo_x86


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 9 Feb 2023 11:42:59 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=gJVJeI3VEzCV6YzhKqBfgIWU3kFqNTq9u2bZ49rhjQk=; b=NtN72dCwfen2oRhnSjBrLirE4DEQduXdLtDAanyolrc/xudQ3nnuJcLxw6ag40mcAbcr+foW4xvdbGqOPygeoexQLgB7GGMB+KYemQcs9HjGO1WG9W4OinmqahX1qEXcEQo2oxr5qaR0cY6Qnwx5SvFkj1C76XcTSif2lHfHiJZguGXzImXCwR4bsbHVGzzpncXxEGFSiIUZOu2d2IGWb1trA87YRkTLmli9qzmtgv/52Ty5thk30ImmocJeD1U493aWta/1cIEvSwiM//KsU1gdq9+SN2OG88CjOJQV/lwFOVogy6WFjRkBNqY+1GPpnaO15FK3By+sUlI7PC7IIg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oGVQX2k2/gZbC2/zFX7PsMzUPIQZHjCjEv0pkHxb5+suyv6EqKeT0picWHB9B2heVw4ijaecjG2VVuflcRDhaD2p1ZFz4SkGEe6e6NeDxprXoPnDx6IPVJjXTPg/O+dr7KHrPXCOkCVwTAl85zxY8dNqMj9457mOCsTjZJJLp1worygIz8ebrpeaSh86ilVjDBo3Ypbmq3RKoEtM6s1bVVZbuPGKW5HkeWa1N+TbLlWt/Zt1NrSRDLFTgCxrxUqQPYPVd8nCVLRet/2DOyP+IC+KxD6wOW8nPLd32YZRGm+PVxINrMWgs8aoj8HF4IyrD1EygOpT6zz4cnK+ZraFSQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Feb 2023 10:43:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Consolidate this to use exclusively standard types, and change oprofile
code (apparently trying to mirror those types) at the same time. Where
sensible actually drop local variables.

No functional change intended.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Much like x86_capability[] already doesn't use a fixed width type, most
if not all of the other fields touched here probably also shouldn't. I
wasn't sure though whether switching might be controversial for some of
them ...

--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -119,24 +119,24 @@ struct x86_cpu_id {
 };
 
 struct cpuinfo_x86 {
-    __u8 x86;            /* CPU family */
-    __u8 x86_vendor;     /* CPU vendor */
-    __u8 x86_model;
-    __u8 x86_mask;
+    uint8_t x86;            /* CPU family */
+    uint8_t x86_vendor;     /* CPU vendor */
+    uint8_t x86_model;
+    uint8_t x86_mask;
     int  cpuid_level;    /* Maximum supported CPUID level, -1=no CPUID */
-    __u32 extended_cpuid_level; /* Maximum supported CPUID extended level */
+    uint32_t extended_cpuid_level; /* Maximum supported CPUID extended level */
     unsigned int x86_capability[NCAPINTS];
     char x86_vendor_id[16];
     char x86_model_id[64];
     int  x86_cache_size; /* in KB - valid for CPUS which support this call  */
     int  x86_cache_alignment;    /* In bytes */
-    __u32 x86_max_cores; /* cpuid returned max cores value */
-    __u32 booted_cores;  /* number of cores as seen by OS */
-    __u32 x86_num_siblings; /* cpuid logical cpus per chip value */
-    __u32 apicid;
-    __u32 phys_proc_id;    /* package ID of each logical CPU */
-    __u32 cpu_core_id;     /* core ID of each logical CPU*/
-    __u32 compute_unit_id; /* AMD compute unit ID of each logical CPU */
+    uint32_t x86_max_cores;   /* cpuid returned max cores value */
+    uint32_t booted_cores;    /* number of cores as seen by OS */
+    uint32_t x86_num_siblings; /* cpuid logical cpus per chip value */
+    uint32_t apicid;
+    uint32_t phys_proc_id;    /* package ID of each logical CPU */
+    uint32_t cpu_core_id;     /* core ID of each logical CPU */
+    uint32_t compute_unit_id; /* AMD compute unit ID of each logical CPU */
     unsigned short x86_clflush_size;
 } __cacheline_aligned;
 
--- a/xen/arch/x86/oprofile/nmi_int.c
+++ b/xen/arch/x86/oprofile/nmi_int.c
@@ -311,11 +311,11 @@ void nmi_stop(void)
 
 static int __init p4_init(char ** cpu_type)
 {
-       __u8 cpu_model = current_cpu_data.x86_model;
+       unsigned int cpu_model = current_cpu_data.x86_model;
 
        if ((cpu_model > 6) || (cpu_model == 5)) {
                printk("xenoprof: Initialization failed. "
-                      "Intel processor model %d for pentium 4 family is not "
+                      "Intel processor model %u for pentium 4 family is not "
                       "supported\n", cpu_model);
                return 0;
        }
@@ -355,12 +355,10 @@ custom_param("cpu_type", force_cpu_type)
 
 static int __init ppro_init(char ** cpu_type)
 {
-       __u8 cpu_model = current_cpu_data.x86_model;
-
        if (force_arch_perfmon && cpu_has_arch_perfmon)
                return 0;
 
-       switch (cpu_model) {
+       switch (current_cpu_data.x86_model) {
        case 14:
                *cpu_type = "i386/core";
                break;
@@ -390,9 +388,8 @@ static int __init arch_perfmon_init(char
 
 static int __init cf_check nmi_init(void)
 {
-       __u8 vendor = current_cpu_data.x86_vendor;
-       __u8 family = current_cpu_data.x86;
-       __u8 _model = current_cpu_data.x86_model;
+       unsigned int vendor = current_cpu_data.x86_vendor;
+       unsigned int family = current_cpu_data.x86;
 
        if (!cpu_has_apic) {
                printk("xenoprof: Initialization failed. No APIC\n");
@@ -406,7 +403,7 @@ static int __init cf_check nmi_init(void
                        switch (family) {
                        default:
                                printk("xenoprof: Initialization failed. "
-                                      "AMD processor family %d is not "
+                                      "AMD processor family %u is not "
                                       "supported\n", family);
                                return -ENODEV;
                        case 0xf:
@@ -458,15 +455,15 @@ static int __init cf_check nmi_init(void
                        }
                        if (!cpu_type && !arch_perfmon_init(&cpu_type)) {
                                printk("xenoprof: Initialization failed. "
-                                      "Intel processor family %d model %d "
-                                      "is not supported\n", family, _model);
+                                      "Intel processor family %u model %d is 
not supported\n",
+                                      family, current_cpu_data.x86_model);
                                return -ENODEV;
                        }
                        break;
 
                default:
                        printk("xenoprof: Initialization failed. "
-                              "Unsupported processor. Unknown vendor %d\n",
+                              "Unsupported processor. Unknown vendor %u\n",
                                vendor);
                        return -ENODEV;
        }




 


Rackspace

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