diff mbox

[09/11] hw/arm/virt-acpi-build: don't save VirtGuestInfo on AcpiBuildState

Message ID 20161213214522.25548-10-drjones@redhat.com
State New
Headers show

Commit Message

Andrew Jones Dec. 13, 2016, 9:45 p.m. UTC
We can get to VirtMachineState without the need for saving a pointer
on AcpiBuildState. This is the mach-virt equivalent to "acpi: Don't save
PcGuestInfo on AcpiBuildState"

Signed-off-by: Andrew Jones <drjones@redhat.com>

---
 hw/arm/virt-acpi-build.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
2.9.3

Comments

Igor Mammedov Dec. 15, 2016, 3:08 p.m. UTC | #1
On Tue, 13 Dec 2016 22:45:20 +0100
Andrew Jones <drjones@redhat.com> wrote:

> We can get to VirtMachineState without the need for saving a pointer

> on AcpiBuildState. This is the mach-virt equivalent to "acpi: Don't save

> PcGuestInfo on AcpiBuildState"

> 

> Signed-off-by: Andrew Jones <drjones@redhat.com>

> ---

>  hw/arm/virt-acpi-build.c | 7 +++----

>  1 file changed, 3 insertions(+), 4 deletions(-)

> 

> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c

> index 7a1efd0dc538..137781646bec 100644

> --- a/hw/arm/virt-acpi-build.c

> +++ b/hw/arm/virt-acpi-build.c

> @@ -706,7 +706,6 @@ struct AcpiBuildState {

>      MemoryRegion *linker_mr;

>      /* Is table patched? */

>      bool patched;

> -    VirtGuestInfo *guest_info;

>  } AcpiBuildState;

>  

>  static

> @@ -779,6 +778,8 @@ static void acpi_ram_update(MemoryRegion *mr, GArray *data)

>  

>  static void virt_acpi_build_update(void *build_opaque)

>  {

> +    MachineState *machine = MACHINE(qdev_get_machine());

> +    VirtMachineState *vms = VIRT_MACHINE(machine);

>      AcpiBuildState *build_state = build_opaque;

>      AcpiBuildTables tables;

>  

> @@ -790,8 +791,7 @@ static void virt_acpi_build_update(void *build_opaque)

>  

>      acpi_build_tables_init(&tables);

>  

> -    virt_acpi_build(container_of(build_state->guest_info,

> -                                 VirtMachineState, acpi_guest_info), &tables);

> +    virt_acpi_build(vms, &tables);


virt_acpi_build(VIRT_MACHINE(qdev_get_machine()), &tables);

or even better do it inside of virt_acpi_build(&tables);


>  

>      acpi_ram_update(build_state->table_mr, tables.table_data);

>      acpi_ram_update(build_state->rsdp_mr, tables.rsdp);

> @@ -841,7 +841,6 @@ void virt_acpi_setup(VirtMachineState *vms)

>      }

>  

>      build_state = g_malloc0(sizeof *build_state);

> -    build_state->guest_info = guest_info;

>  

>      acpi_build_tables_init(&tables);

>      virt_acpi_build(vms, &tables);
Andrew Jones Dec. 15, 2016, 4:25 p.m. UTC | #2
On Thu, Dec 15, 2016 at 04:08:22PM +0100, Igor Mammedov wrote:
> On Tue, 13 Dec 2016 22:45:20 +0100

> Andrew Jones <drjones@redhat.com> wrote:

> 

> > We can get to VirtMachineState without the need for saving a pointer

> > on AcpiBuildState. This is the mach-virt equivalent to "acpi: Don't save

> > PcGuestInfo on AcpiBuildState"

> > 

> > Signed-off-by: Andrew Jones <drjones@redhat.com>

> > ---

> >  hw/arm/virt-acpi-build.c | 7 +++----

> >  1 file changed, 3 insertions(+), 4 deletions(-)

> > 

> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c

> > index 7a1efd0dc538..137781646bec 100644

> > --- a/hw/arm/virt-acpi-build.c

> > +++ b/hw/arm/virt-acpi-build.c

> > @@ -706,7 +706,6 @@ struct AcpiBuildState {

> >      MemoryRegion *linker_mr;

> >      /* Is table patched? */

> >      bool patched;

> > -    VirtGuestInfo *guest_info;

> >  } AcpiBuildState;

> >  

> >  static

> > @@ -779,6 +778,8 @@ static void acpi_ram_update(MemoryRegion *mr, GArray *data)

> >  

> >  static void virt_acpi_build_update(void *build_opaque)

> >  {

> > +    MachineState *machine = MACHINE(qdev_get_machine());

> > +    VirtMachineState *vms = VIRT_MACHINE(machine);

> >      AcpiBuildState *build_state = build_opaque;

> >      AcpiBuildTables tables;

> >  

> > @@ -790,8 +791,7 @@ static void virt_acpi_build_update(void *build_opaque)

> >  

> >      acpi_build_tables_init(&tables);

> >  

> > -    virt_acpi_build(container_of(build_state->guest_info,

> > -                                 VirtMachineState, acpi_guest_info), &tables);

> > +    virt_acpi_build(vms, &tables);

> 

> virt_acpi_build(VIRT_MACHINE(qdev_get_machine()), &tables);

> 

> or even better do it inside of virt_acpi_build(&tables);


Sounds good.

Thanks,
drew

> 

> 

> >  

> >      acpi_ram_update(build_state->table_mr, tables.table_data);

> >      acpi_ram_update(build_state->rsdp_mr, tables.rsdp);

> > @@ -841,7 +841,6 @@ void virt_acpi_setup(VirtMachineState *vms)

> >      }

> >  

> >      build_state = g_malloc0(sizeof *build_state);

> > -    build_state->guest_info = guest_info;

> >  

> >      acpi_build_tables_init(&tables);

> >      virt_acpi_build(vms, &tables);

>
diff mbox

Patch

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 7a1efd0dc538..137781646bec 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -706,7 +706,6 @@  struct AcpiBuildState {
     MemoryRegion *linker_mr;
     /* Is table patched? */
     bool patched;
-    VirtGuestInfo *guest_info;
 } AcpiBuildState;
 
 static
@@ -779,6 +778,8 @@  static void acpi_ram_update(MemoryRegion *mr, GArray *data)
 
 static void virt_acpi_build_update(void *build_opaque)
 {
+    MachineState *machine = MACHINE(qdev_get_machine());
+    VirtMachineState *vms = VIRT_MACHINE(machine);
     AcpiBuildState *build_state = build_opaque;
     AcpiBuildTables tables;
 
@@ -790,8 +791,7 @@  static void virt_acpi_build_update(void *build_opaque)
 
     acpi_build_tables_init(&tables);
 
-    virt_acpi_build(container_of(build_state->guest_info,
-                                 VirtMachineState, acpi_guest_info), &tables);
+    virt_acpi_build(vms, &tables);
 
     acpi_ram_update(build_state->table_mr, tables.table_data);
     acpi_ram_update(build_state->rsdp_mr, tables.rsdp);
@@ -841,7 +841,6 @@  void virt_acpi_setup(VirtMachineState *vms)
     }
 
     build_state = g_malloc0(sizeof *build_state);
-    build_state->guest_info = guest_info;
 
     acpi_build_tables_init(&tables);
     virt_acpi_build(vms, &tables);