diff mbox series

[v5,04/16] machine: Add SMP Sockets in CpuTopology

Message ID 158326543822.40452.17598145031344735065.stgit@naples-babu.amd.com (mailing list archive)
State New, archived
Headers show
Series APIC ID fixes for AMD EPYC CPU model | expand

Commit Message

Babu Moger March 3, 2020, 7:57 p.m. UTC
Store the  smp sockets in CpuTopology. The socket information required to
build the apic id in EPYC mode. Right now socket information is not passed
to down when decoding the apic id. Add the socket information here.

Signed-off-by: Babu Moger <babu.moger@amd.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/core/machine.c   |    1 +
 hw/i386/pc.c        |    1 +
 include/hw/boards.h |    2 ++
 vl.c                |    1 +
 4 files changed, 5 insertions(+)

Comments

Igor Mammedov March 9, 2020, 2:17 p.m. UTC | #1
On Tue, 03 Mar 2020 13:57:18 -0600
Babu Moger <babu.moger@amd.com> wrote:

> Store the  smp sockets in CpuTopology. The socket information required to
> build the apic id in EPYC mode. Right now socket information is not passed
> to down when decoding the apic id. Add the socket information here.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/core/machine.c   |    1 +
>  hw/i386/pc.c        |    1 +
>  include/hw/boards.h |    2 ++
>  vl.c                |    1 +

this has been moved to softmmu, so patch needs to rebased against current master

>  4 files changed, 5 insertions(+)
> 
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index d8e30e4895..2582ce94f6 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -728,6 +728,7 @@ static void smp_parse(MachineState *ms, QemuOpts *opts)
>          ms->smp.cpus = cpus;
>          ms->smp.cores = cores;
>          ms->smp.threads = threads;
> +        ms->smp.sockets = sockets;
>      }
>  
>      if (ms->smp.cpus > 1) {
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index ef23ae2af5..68bf08f285 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -780,6 +780,7 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts)
>          ms->smp.cpus = cpus;
>          ms->smp.cores = cores;
>          ms->smp.threads = threads;
> +        ms->smp.sockets = sockets;
>          x86ms->smp_dies = dies;
>      }
>  
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb1b43d5b9..320dd14e02 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -252,12 +252,14 @@ typedef struct DeviceMemoryState {
>   * @cpus: the number of present logical processors on the machine
>   * @cores: the number of cores in one package
>   * @threads: the number of threads in one core
> + * @sockets: the number of sockets on the machine
>   * @max_cpus: the maximum number of logical processors on the machine
>   */
>  typedef struct CpuTopology {
>      unsigned int cpus;
>      unsigned int cores;
>      unsigned int threads;
> +    unsigned int sockets;
>      unsigned int max_cpus;
>  } CpuTopology;
>  
> diff --git a/vl.c b/vl.c
> index 7dcb0879c4..f77b1285c6 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3949,6 +3949,7 @@ int main(int argc, char **argv, char **envp)
>      current_machine->smp.max_cpus = machine_class->default_cpus;
>      current_machine->smp.cores = 1;
>      current_machine->smp.threads = 1;
> +    current_machine->smp.sockets = 1;
>  
>      machine_class->smp_parse(current_machine,
>          qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
>
Babu Moger March 9, 2020, 6:01 p.m. UTC | #2
On 3/9/20 9:17 AM, Igor Mammedov wrote:
> On Tue, 03 Mar 2020 13:57:18 -0600
> Babu Moger <babu.moger@amd.com> wrote:
> 
>> Store the  smp sockets in CpuTopology. The socket information required to
>> build the apic id in EPYC mode. Right now socket information is not passed
>> to down when decoding the apic id. Add the socket information here.
>>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
>> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
>> ---
>>  hw/core/machine.c   |    1 +
>>  hw/i386/pc.c        |    1 +
>>  include/hw/boards.h |    2 ++
>>  vl.c                |    1 +
> 
> this has been moved to softmmu, so patch needs to rebased against current master

Sure. Will do.

> 
>>  4 files changed, 5 insertions(+)
>>
>> diff --git a/hw/core/machine.c b/hw/core/machine.c
>> index d8e30e4895..2582ce94f6 100644
>> --- a/hw/core/machine.c
>> +++ b/hw/core/machine.c
>> @@ -728,6 +728,7 @@ static void smp_parse(MachineState *ms, QemuOpts *opts)
>>          ms->smp.cpus = cpus;
>>          ms->smp.cores = cores;
>>          ms->smp.threads = threads;
>> +        ms->smp.sockets = sockets;
>>      }
>>  
>>      if (ms->smp.cpus > 1) {
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index ef23ae2af5..68bf08f285 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -780,6 +780,7 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts)
>>          ms->smp.cpus = cpus;
>>          ms->smp.cores = cores;
>>          ms->smp.threads = threads;
>> +        ms->smp.sockets = sockets;
>>          x86ms->smp_dies = dies;
>>      }
>>  
>> diff --git a/include/hw/boards.h b/include/hw/boards.h
>> index fb1b43d5b9..320dd14e02 100644
>> --- a/include/hw/boards.h
>> +++ b/include/hw/boards.h
>> @@ -252,12 +252,14 @@ typedef struct DeviceMemoryState {
>>   * @cpus: the number of present logical processors on the machine
>>   * @cores: the number of cores in one package
>>   * @threads: the number of threads in one core
>> + * @sockets: the number of sockets on the machine
>>   * @max_cpus: the maximum number of logical processors on the machine
>>   */
>>  typedef struct CpuTopology {
>>      unsigned int cpus;
>>      unsigned int cores;
>>      unsigned int threads;
>> +    unsigned int sockets;
>>      unsigned int max_cpus;
>>  } CpuTopology;
>>  
>> diff --git a/vl.c b/vl.c
>> index 7dcb0879c4..f77b1285c6 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -3949,6 +3949,7 @@ int main(int argc, char **argv, char **envp)
>>      current_machine->smp.max_cpus = machine_class->default_cpus;
>>      current_machine->smp.cores = 1;
>>      current_machine->smp.threads = 1;
>> +    current_machine->smp.sockets = 1;
>>  
>>      machine_class->smp_parse(current_machine,
>>          qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
>>
>
diff mbox series

Patch

diff --git a/hw/core/machine.c b/hw/core/machine.c
index d8e30e4895..2582ce94f6 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -728,6 +728,7 @@  static void smp_parse(MachineState *ms, QemuOpts *opts)
         ms->smp.cpus = cpus;
         ms->smp.cores = cores;
         ms->smp.threads = threads;
+        ms->smp.sockets = sockets;
     }
 
     if (ms->smp.cpus > 1) {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index ef23ae2af5..68bf08f285 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -780,6 +780,7 @@  void pc_smp_parse(MachineState *ms, QemuOpts *opts)
         ms->smp.cpus = cpus;
         ms->smp.cores = cores;
         ms->smp.threads = threads;
+        ms->smp.sockets = sockets;
         x86ms->smp_dies = dies;
     }
 
diff --git a/include/hw/boards.h b/include/hw/boards.h
index fb1b43d5b9..320dd14e02 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -252,12 +252,14 @@  typedef struct DeviceMemoryState {
  * @cpus: the number of present logical processors on the machine
  * @cores: the number of cores in one package
  * @threads: the number of threads in one core
+ * @sockets: the number of sockets on the machine
  * @max_cpus: the maximum number of logical processors on the machine
  */
 typedef struct CpuTopology {
     unsigned int cpus;
     unsigned int cores;
     unsigned int threads;
+    unsigned int sockets;
     unsigned int max_cpus;
 } CpuTopology;
 
diff --git a/vl.c b/vl.c
index 7dcb0879c4..f77b1285c6 100644
--- a/vl.c
+++ b/vl.c
@@ -3949,6 +3949,7 @@  int main(int argc, char **argv, char **envp)
     current_machine->smp.max_cpus = machine_class->default_cpus;
     current_machine->smp.cores = 1;
     current_machine->smp.threads = 1;
+    current_machine->smp.sockets = 1;
 
     machine_class->smp_parse(current_machine,
         qemu_opts_find(qemu_find_opts("smp-opts"), NULL));