diff mbox

[RFC,14/16] hw/arm/virt: stash cpu topo info in VirtGuestInfo

Message ID 1465580427-13596-15-git-send-email-drjones@redhat.com
State New
Headers show

Commit Message

Andrew Jones June 10, 2016, 5:40 p.m. UTC
This is a first step to preparing mach-virt for configurable
cpu topology, and is necessary now to prepare to move smbios
code away from using cpu topology globals smp_cores,smp_threads.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 hw/arm/virt.c                    | 6 +++++-
 include/hw/arm/virt-acpi-build.h | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Eduardo Habkost July 14, 2016, 8:43 p.m. UTC | #1
On Fri, Jun 10, 2016 at 07:40:25PM +0200, Andrew Jones wrote:
> This is a first step to preparing mach-virt for configurable
> cpu topology, and is necessary now to prepare to move smbios
> code away from using cpu topology globals smp_cores,smp_threads.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>

I'd rather put a MachineState pointer inside VirtGuestInfo, and
eventually eliminate VirtGuestInfo completely (like we already
did with PCGuestInfo in x86).

> ---
>  hw/arm/virt.c                    | 6 +++++-
>  include/hw/arm/virt-acpi-build.h | 4 ++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 134b6e36623ba..769a49aa5be77 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1281,7 +1281,11 @@ static void machvirt_init(MachineState *machine)
>      create_fw_cfg(vbi, &address_space_memory);
>      rom_set_fw(fw_cfg_find());
>  
> -    guest_info->cpus = vbi->cpus;
> +    guest_info->sockets = machine->sockets;
> +    guest_info->cores   = machine->cores;
> +    guest_info->threads = machine->threads;
> +    guest_info->maxcpus = machine->maxcpus;
> +    guest_info->cpus    = machine->cpus;
>      guest_info->fw_cfg = fw_cfg_find();
>      guest_info->memmap = vbi->memmap;
>      guest_info->irqmap = vbi->irqmap;
> diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
> index d6c5982960403..a34fb04230e66 100644
> --- a/include/hw/arm/virt-acpi-build.h
> +++ b/include/hw/arm/virt-acpi-build.h
> @@ -27,6 +27,10 @@
>  #define ACPI_GICC_ENABLED 1
>  
>  typedef struct VirtGuestInfo {
> +    int sockets;
> +    int cores;
> +    int threads;
> +    int maxcpus;
>      int cpus;
>      FWCfgState *fw_cfg;
>      const MemMapEntry *memmap;
> -- 
> 2.4.11
> 
>
Andrew Jones July 15, 2016, 6:40 a.m. UTC | #2
On Thu, Jul 14, 2016 at 05:43:51PM -0300, Eduardo Habkost wrote:
> On Fri, Jun 10, 2016 at 07:40:25PM +0200, Andrew Jones wrote:
> > This is a first step to preparing mach-virt for configurable
> > cpu topology, and is necessary now to prepare to move smbios
> > code away from using cpu topology globals smp_cores,smp_threads.
> > 
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> 
> I'd rather put a MachineState pointer inside VirtGuestInfo, and
> eventually eliminate VirtGuestInfo completely (like we already
> did with PCGuestInfo in x86).

I'll look at the history of PCGuestInfo's death. It sounds good to me.

> 
> > ---
> >  hw/arm/virt.c                    | 6 +++++-
> >  include/hw/arm/virt-acpi-build.h | 4 ++++
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > index 134b6e36623ba..769a49aa5be77 100644
> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -1281,7 +1281,11 @@ static void machvirt_init(MachineState *machine)
> >      create_fw_cfg(vbi, &address_space_memory);
> >      rom_set_fw(fw_cfg_find());
> >  
> > -    guest_info->cpus = vbi->cpus;
> > +    guest_info->sockets = machine->sockets;
> > +    guest_info->cores   = machine->cores;
> > +    guest_info->threads = machine->threads;
> > +    guest_info->maxcpus = machine->maxcpus;
> > +    guest_info->cpus    = machine->cpus;
> >      guest_info->fw_cfg = fw_cfg_find();
> >      guest_info->memmap = vbi->memmap;
> >      guest_info->irqmap = vbi->irqmap;
> > diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
> > index d6c5982960403..a34fb04230e66 100644
> > --- a/include/hw/arm/virt-acpi-build.h
> > +++ b/include/hw/arm/virt-acpi-build.h
> > @@ -27,6 +27,10 @@
> >  #define ACPI_GICC_ENABLED 1
> >  
> >  typedef struct VirtGuestInfo {
> > +    int sockets;
> > +    int cores;
> > +    int threads;
> > +    int maxcpus;
> >      int cpus;
> >      FWCfgState *fw_cfg;
> >      const MemMapEntry *memmap;
> > -- 
> > 2.4.11
> > 
> > 
> 
> -- 
> Eduardo
>
diff mbox

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 134b6e36623ba..769a49aa5be77 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1281,7 +1281,11 @@  static void machvirt_init(MachineState *machine)
     create_fw_cfg(vbi, &address_space_memory);
     rom_set_fw(fw_cfg_find());
 
-    guest_info->cpus = vbi->cpus;
+    guest_info->sockets = machine->sockets;
+    guest_info->cores   = machine->cores;
+    guest_info->threads = machine->threads;
+    guest_info->maxcpus = machine->maxcpus;
+    guest_info->cpus    = machine->cpus;
     guest_info->fw_cfg = fw_cfg_find();
     guest_info->memmap = vbi->memmap;
     guest_info->irqmap = vbi->irqmap;
diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
index d6c5982960403..a34fb04230e66 100644
--- a/include/hw/arm/virt-acpi-build.h
+++ b/include/hw/arm/virt-acpi-build.h
@@ -27,6 +27,10 @@ 
 #define ACPI_GICC_ENABLED 1
 
 typedef struct VirtGuestInfo {
+    int sockets;
+    int cores;
+    int threads;
+    int maxcpus;
     int cpus;
     FWCfgState *fw_cfg;
     const MemMapEntry *memmap;