diff mbox series

[v1,1/5] cpu: introduce die, the new cpu toppolgy emulation level

Message ID 1547468699-17633-2-git-send-email-like.xu@linux.intel.com
State New
Headers show
Series Introduce cpu die topology and enable CPUID.1F for i386 | expand

Commit Message

Like Xu Jan. 14, 2019, 12:24 p.m. UTC
Following codes on smp_cores, the smp_dies/nr_dies/die-id is added to
machine and CPUState. In addition to enable_cpuid_0xb, enable_cpuid_0x1f
is introduced to track wether host is a new MCP macine or just ignored.
The number for die level_type on Intel is 5 while core type keeps 2.

Signed-off-by: Like Xu <like.xu@linux.intel.com>
---
 cpus.c                | 1 +
 include/qom/cpu.h     | 1 +
 include/sysemu/cpus.h | 1 +
 qapi/misc.json        | 1 +
 target/i386/cpu.h     | 5 +++++
 5 files changed, 9 insertions(+)

Comments

Eric Blake Jan. 14, 2019, 8:08 p.m. UTC | #1
On 1/14/19 6:24 AM, Like Xu wrote:
> Following codes on smp_cores, the smp_dies/nr_dies/die-id is added to
> machine and CPUState. In addition to enable_cpuid_0xb, enable_cpuid_0x1f
> is introduced to track wether host is a new MCP macine or just ignored.

s/wether/whether/, s/macine/machine/

> The number for die level_type on Intel is 5 while core type keeps 2.
> 
> Signed-off-by: Like Xu <like.xu@linux.intel.com>
> ---
>  cpus.c                | 1 +
>  include/qom/cpu.h     | 1 +
>  include/sysemu/cpus.h | 1 +
>  qapi/misc.json        | 1 +
>  target/i386/cpu.h     | 5 +++++
>  5 files changed, 9 insertions(+)
> 

> +++ b/qapi/misc.json
> @@ -3229,6 +3229,7 @@
>  { 'struct': 'CpuInstanceProperties',
>    'data': { '*node-id': 'int',
>              '*socket-id': 'int',
> +            '*die-id': 'int',

Missing documentation of the new field, including a '(since 4.0)' tag.

>              '*core-id': 'int',
>              '*thread-id': 'int'
>    }
Xu, Like Jan. 15, 2019, 1:34 a.m. UTC | #2
> -----Original Message-----
> From: Eric Blake [mailto:eblake@redhat.com]
> Sent: Tuesday, January 15, 2019 4:08 AM
> To: Like Xu <like.xu@linux.intel.com>; qemu-devel@nongnu.org
> Cc: drjones@redhat.com; Peter Crosthwaite
> <crosthwaite.peter@gmail.com>; Eduardo Habkost <ehabkost@redhat.com>;
> Michael S. Tsirkin <mst@redhat.com>; Xu, Like <like.xu@intel.com>;
> Marcelo Tosatti <mtosatti@redhat.com>; Paolo Bonzini
> <pbonzini@redhat.com>; imammedo@redhat.com; Richard Henderson
> <rth@twiddle.net>
> Subject: Re: [Qemu-devel] [PATCH v1 1/5] cpu: introduce die, the new cpu
> toppolgy emulation level
> 
> On 1/14/19 6:24 AM, Like Xu wrote:
> > Following codes on smp_cores, the smp_dies/nr_dies/die-id is added to
> > machine and CPUState. In addition to enable_cpuid_0xb,
> enable_cpuid_0x1f
> > is introduced to track wether host is a new MCP macine or just ignored.
> 
> s/wether/whether/, s/macine/machine/
[Xu, Like] Sorry for typos and inconvenience.
> 
> > The number for die level_type on Intel is 5 while core type keeps 2.
> >
> > Signed-off-by: Like Xu <like.xu@linux.intel.com>
> > ---
> >  cpus.c                | 1 +
> >  include/qom/cpu.h     | 1 +
> >  include/sysemu/cpus.h | 1 +
> >  qapi/misc.json        | 1 +
> >  target/i386/cpu.h     | 5 +++++
> >  5 files changed, 9 insertions(+)
> >
> 
> > +++ b/qapi/misc.json
> > @@ -3229,6 +3229,7 @@
> >  { 'struct': 'CpuInstanceProperties',
> >    'data': { '*node-id': 'int',
> >              '*socket-id': 'int',
> > +            '*die-id': 'int',
> 
> Missing documentation of the new field, including a '(since 4.0)' tag.
[Xu, Like] Let me add more docs in next version and thanks.
> 
> >              '*core-id': 'int',
> >              '*thread-id': 'int'
> >    }
> 
> 
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org
diff mbox series

Patch

diff --git a/cpus.c b/cpus.c
index b09b702..503558d 100644
--- a/cpus.c
+++ b/cpus.c
@@ -2066,6 +2066,7 @@  static void qemu_dummy_start_vcpu(CPUState *cpu)
 
 void qemu_init_vcpu(CPUState *cpu)
 {
+    cpu->nr_dies = smp_dies;
     cpu->nr_cores = smp_cores;
     cpu->nr_threads = smp_threads;
     cpu->stopped = true;
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 16bbed1..ee53862 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -332,6 +332,7 @@  struct CPUState {
     DeviceState parent_obj;
     /*< public >*/
 
+    int nr_dies;
     int nr_cores;
     int nr_threads;
 
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 731756d..4243c8f 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -34,6 +34,7 @@  void qtest_clock_warp(int64_t dest);
 #ifndef CONFIG_USER_ONLY
 /* vl.c */
 /* *-user doesn't have configurable SMP topology */
+extern int smp_dies;
 extern int smp_cores;
 extern int smp_threads;
 #endif
diff --git a/qapi/misc.json b/qapi/misc.json
index 24d20a8..a01a9fe 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -3229,6 +3229,7 @@ 
 { 'struct': 'CpuInstanceProperties',
   'data': { '*node-id': 'int',
             '*socket-id': 'int',
+            '*die-id': 'int',
             '*core-id': 'int',
             '*thread-id': 'int'
   }
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index ef41a03..aa2ee8a 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -732,6 +732,7 @@  typedef uint32_t FeatureWordArray[FEATURE_WORDS];
 #define CPUID_TOPOLOGY_LEVEL_INVALID  (0U << 8)
 #define CPUID_TOPOLOGY_LEVEL_SMT      (1U << 8)
 #define CPUID_TOPOLOGY_LEVEL_CORE     (2U << 8)
+#define CPUID_TOPOLOGY_LEVEL_DIE      (5U << 8)
 
 /* MSR Feature Bits */
 #define MSR_ARCH_CAP_RDCL_NO    (1U << 0)
@@ -1450,6 +1451,9 @@  struct X86CPU {
     /* Compatibility bits for old machine types: */
     bool enable_cpuid_0xb;
 
+    /* Compatibility bits for new machine types: */
+    bool enable_cpuid_0x1f;
+
     /* Enable auto level-increase for all CPUID leaves */
     bool full_cpuid_auto_level;
 
@@ -1475,6 +1479,7 @@  struct X86CPU {
 
     int32_t node_id; /* NUMA node this CPU belongs to */
     int32_t socket_id;
+    int32_t die_id;
     int32_t core_id;
     int32_t thread_id;