diff mbox series

[3/6] spapr: Pass sPAPR machine state down to spapr_pci_switch_vga()

Message ID 20201209170052.1431440-4-groug@kaod.org (mailing list archive)
State New, archived
Headers show
Series spapr: Drop some users of qdev_get_machine() | expand

Commit Message

Greg Kurz Dec. 9, 2020, 5 p.m. UTC
This allows to drop a user of qdev_get_machine().

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 include/hw/ppc/spapr.h | 2 +-
 hw/ppc/spapr_hcall.c   | 7 ++++---
 hw/ppc/spapr_pci.c     | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

David Gibson Dec. 10, 2020, 3:28 a.m. UTC | #1
On Wed, Dec 09, 2020 at 06:00:49PM +0100, Greg Kurz wrote:
> This allows to drop a user of qdev_get_machine().
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>

Applied to ppc-for-6.0.

> ---
>  include/hw/ppc/spapr.h | 2 +-
>  hw/ppc/spapr_hcall.c   | 7 ++++---
>  hw/ppc/spapr_pci.c     | 3 +--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index b7ced9faebf5..e0f10f252c08 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -834,7 +834,7 @@ int spapr_dma_dt(void *fdt, int node_off, const char *propname,
>                   uint32_t liobn, uint64_t window, uint32_t size);
>  int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
>                        SpaprTceTable *tcet);
> -void spapr_pci_switch_vga(bool big_endian);
> +void spapr_pci_switch_vga(SpaprMachineState *spapr, bool big_endian);
>  void spapr_hotplug_req_add_by_index(SpaprDrc *drc);
>  void spapr_hotplug_req_remove_by_index(SpaprDrc *drc);
>  void spapr_hotplug_req_add_by_count(SpaprDrcType drc_type,
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 1d8e8e6a888f..c0ea0bd5794b 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1351,6 +1351,7 @@ static target_ulong h_logical_dcbf(PowerPCCPU *cpu, SpaprMachineState *spapr,
>  }
>  
>  static target_ulong h_set_mode_resource_le(PowerPCCPU *cpu,
> +                                           SpaprMachineState *spapr,
>                                             target_ulong mflags,
>                                             target_ulong value1,
>                                             target_ulong value2)
> @@ -1365,12 +1366,12 @@ static target_ulong h_set_mode_resource_le(PowerPCCPU *cpu,
>      switch (mflags) {
>      case H_SET_MODE_ENDIAN_BIG:
>          spapr_set_all_lpcrs(0, LPCR_ILE);
> -        spapr_pci_switch_vga(true);
> +        spapr_pci_switch_vga(spapr, true);
>          return H_SUCCESS;
>  
>      case H_SET_MODE_ENDIAN_LITTLE:
>          spapr_set_all_lpcrs(LPCR_ILE, LPCR_ILE);
> -        spapr_pci_switch_vga(false);
> +        spapr_pci_switch_vga(spapr, false);
>          return H_SUCCESS;
>      }
>  
> @@ -1411,7 +1412,7 @@ static target_ulong h_set_mode(PowerPCCPU *cpu, SpaprMachineState *spapr,
>  
>      switch (resource) {
>      case H_SET_MODE_RESOURCE_LE:
> -        ret = h_set_mode_resource_le(cpu, args[0], args[2], args[3]);
> +        ret = h_set_mode_resource_le(cpu, spapr, args[0], args[2], args[3]);
>          break;
>      case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
>          ret = h_set_mode_resource_addr_trans_mode(cpu, args[0],
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index 2d9b88b93122..149bf4c21d22 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -2490,9 +2490,8 @@ static int spapr_switch_one_vga(DeviceState *dev, void *opaque)
>      return 0;
>  }
>  
> -void spapr_pci_switch_vga(bool big_endian)
> +void spapr_pci_switch_vga(SpaprMachineState *spapr, bool big_endian)
>  {
> -    SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
>      SpaprPhbState *sphb;
>  
>      /*
diff mbox series

Patch

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index b7ced9faebf5..e0f10f252c08 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -834,7 +834,7 @@  int spapr_dma_dt(void *fdt, int node_off, const char *propname,
                  uint32_t liobn, uint64_t window, uint32_t size);
 int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
                       SpaprTceTable *tcet);
-void spapr_pci_switch_vga(bool big_endian);
+void spapr_pci_switch_vga(SpaprMachineState *spapr, bool big_endian);
 void spapr_hotplug_req_add_by_index(SpaprDrc *drc);
 void spapr_hotplug_req_remove_by_index(SpaprDrc *drc);
 void spapr_hotplug_req_add_by_count(SpaprDrcType drc_type,
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 1d8e8e6a888f..c0ea0bd5794b 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1351,6 +1351,7 @@  static target_ulong h_logical_dcbf(PowerPCCPU *cpu, SpaprMachineState *spapr,
 }
 
 static target_ulong h_set_mode_resource_le(PowerPCCPU *cpu,
+                                           SpaprMachineState *spapr,
                                            target_ulong mflags,
                                            target_ulong value1,
                                            target_ulong value2)
@@ -1365,12 +1366,12 @@  static target_ulong h_set_mode_resource_le(PowerPCCPU *cpu,
     switch (mflags) {
     case H_SET_MODE_ENDIAN_BIG:
         spapr_set_all_lpcrs(0, LPCR_ILE);
-        spapr_pci_switch_vga(true);
+        spapr_pci_switch_vga(spapr, true);
         return H_SUCCESS;
 
     case H_SET_MODE_ENDIAN_LITTLE:
         spapr_set_all_lpcrs(LPCR_ILE, LPCR_ILE);
-        spapr_pci_switch_vga(false);
+        spapr_pci_switch_vga(spapr, false);
         return H_SUCCESS;
     }
 
@@ -1411,7 +1412,7 @@  static target_ulong h_set_mode(PowerPCCPU *cpu, SpaprMachineState *spapr,
 
     switch (resource) {
     case H_SET_MODE_RESOURCE_LE:
-        ret = h_set_mode_resource_le(cpu, args[0], args[2], args[3]);
+        ret = h_set_mode_resource_le(cpu, spapr, args[0], args[2], args[3]);
         break;
     case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
         ret = h_set_mode_resource_addr_trans_mode(cpu, args[0],
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 2d9b88b93122..149bf4c21d22 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -2490,9 +2490,8 @@  static int spapr_switch_one_vga(DeviceState *dev, void *opaque)
     return 0;
 }
 
-void spapr_pci_switch_vga(bool big_endian)
+void spapr_pci_switch_vga(SpaprMachineState *spapr, bool big_endian)
 {
-    SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
     SpaprPhbState *sphb;
 
     /*