All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr_pci: add an extra 'nr_msis' argument to spapr_populate_pci_dt
@ 2018-09-13  5:16 Cédric Le Goater
  2018-09-13  6:05 ` David Gibson
  2018-09-13  6:07 ` Greg Kurz
  0 siblings, 2 replies; 3+ messages in thread
From: Cédric Le Goater @ 2018-09-13  5:16 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel, Greg Kurz, Cédric Le Goater

So that we don't have to call qdev_get_machine() to get the machine
class and the sPAPRIrq backend holding the number of MSIs.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/pci-host/spapr.h | 5 ++---
 hw/ppc/spapr.c              | 2 +-
 hw/ppc/spapr_pci.c          | 9 +++------
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
index 0fae4fc6a4e5..7c66c3872f96 100644
--- a/include/hw/pci-host/spapr.h
+++ b/include/hw/pci-host/spapr.h
@@ -113,9 +113,8 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRPHBState *phb, int pin)
 
 PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index);
 
-int spapr_populate_pci_dt(sPAPRPHBState *phb,
-                          uint32_t xics_phandle,
-                          void *fdt);
+int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
+                          uint32_t nr_msis);
 
 void spapr_pci_rtas_init(void);
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index eba7d60a30a7..98868d893ad8 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1267,7 +1267,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
     }
 
     QLIST_FOREACH(phb, &spapr->phbs, list) {
-        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
+        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt, smc->irq->nr_msis);
         if (ret < 0) {
             error_report("couldn't setup PCI devices in fdt");
             exit(1);
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index bb736177e76c..c2271e6ed462 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -2069,9 +2069,8 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *phb)
 
 }
 
-int spapr_populate_pci_dt(sPAPRPHBState *phb,
-                          uint32_t xics_phandle,
-                          void *fdt)
+int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
+                          uint32_t nr_msis)
 {
     int bus_off, i, j, ret;
     gchar *nodename;
@@ -2121,7 +2120,6 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
     sPAPRTCETable *tcet;
     PCIBus *bus = PCI_HOST_BRIDGE(phb)->bus;
     sPAPRFDT s_fdt;
-    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
 
     /* Start populating the FDT */
     nodename = g_strdup_printf("pci@%" PRIx64, phb->buid);
@@ -2139,8 +2137,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
     _FDT(fdt_setprop(fdt, bus_off, "ranges", &ranges, sizeof_ranges));
     _FDT(fdt_setprop(fdt, bus_off, "reg", &bus_reg, sizeof(bus_reg)));
     _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pci-config-space-type", 0x1));
-    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi",
-                          smc->irq->nr_msis));
+    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", nr_msis));
 
     /* Dynamic DMA window */
     if (phb->ddw_enabled) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_pci: add an extra 'nr_msis' argument to spapr_populate_pci_dt
  2018-09-13  5:16 [Qemu-devel] [PATCH] spapr_pci: add an extra 'nr_msis' argument to spapr_populate_pci_dt Cédric Le Goater
@ 2018-09-13  6:05 ` David Gibson
  2018-09-13  6:07 ` Greg Kurz
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2018-09-13  6:05 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Greg Kurz

[-- Attachment #1: Type: text/plain, Size: 3426 bytes --]

On Thu, Sep 13, 2018 at 07:16:05AM +0200, Cédric Le Goater wrote:
> So that we don't have to call qdev_get_machine() to get the machine
> class and the sPAPRIrq backend holding the number of MSIs.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Applied, thanks.

> ---
>  include/hw/pci-host/spapr.h | 5 ++---
>  hw/ppc/spapr.c              | 2 +-
>  hw/ppc/spapr_pci.c          | 9 +++------
>  3 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
> index 0fae4fc6a4e5..7c66c3872f96 100644
> --- a/include/hw/pci-host/spapr.h
> +++ b/include/hw/pci-host/spapr.h
> @@ -113,9 +113,8 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRPHBState *phb, int pin)
>  
>  PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index);
>  
> -int spapr_populate_pci_dt(sPAPRPHBState *phb,
> -                          uint32_t xics_phandle,
> -                          void *fdt);
> +int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
> +                          uint32_t nr_msis);
>  
>  void spapr_pci_rtas_init(void);
>  
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index eba7d60a30a7..98868d893ad8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1267,7 +1267,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
>      }
>  
>      QLIST_FOREACH(phb, &spapr->phbs, list) {
> -        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
> +        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt, smc->irq->nr_msis);
>          if (ret < 0) {
>              error_report("couldn't setup PCI devices in fdt");
>              exit(1);
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index bb736177e76c..c2271e6ed462 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -2069,9 +2069,8 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *phb)
>  
>  }
>  
> -int spapr_populate_pci_dt(sPAPRPHBState *phb,
> -                          uint32_t xics_phandle,
> -                          void *fdt)
> +int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
> +                          uint32_t nr_msis)
>  {
>      int bus_off, i, j, ret;
>      gchar *nodename;
> @@ -2121,7 +2120,6 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
>      sPAPRTCETable *tcet;
>      PCIBus *bus = PCI_HOST_BRIDGE(phb)->bus;
>      sPAPRFDT s_fdt;
> -    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
>  
>      /* Start populating the FDT */
>      nodename = g_strdup_printf("pci@%" PRIx64, phb->buid);
> @@ -2139,8 +2137,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
>      _FDT(fdt_setprop(fdt, bus_off, "ranges", &ranges, sizeof_ranges));
>      _FDT(fdt_setprop(fdt, bus_off, "reg", &bus_reg, sizeof(bus_reg)));
>      _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pci-config-space-type", 0x1));
> -    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi",
> -                          smc->irq->nr_msis));
> +    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", nr_msis));
>  
>      /* Dynamic DMA window */
>      if (phb->ddw_enabled) {

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr_pci: add an extra 'nr_msis' argument to spapr_populate_pci_dt
  2018-09-13  5:16 [Qemu-devel] [PATCH] spapr_pci: add an extra 'nr_msis' argument to spapr_populate_pci_dt Cédric Le Goater
  2018-09-13  6:05 ` David Gibson
@ 2018-09-13  6:07 ` Greg Kurz
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kurz @ 2018-09-13  6:07 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: David Gibson, qemu-ppc, qemu-devel

On Thu, 13 Sep 2018 07:16:05 +0200
Cédric Le Goater <clg@kaod.org> wrote:

> So that we don't have to call qdev_get_machine() to get the machine
> class and the sPAPRIrq backend holding the number of MSIs.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  include/hw/pci-host/spapr.h | 5 ++---
>  hw/ppc/spapr.c              | 2 +-
>  hw/ppc/spapr_pci.c          | 9 +++------
>  3 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
> index 0fae4fc6a4e5..7c66c3872f96 100644
> --- a/include/hw/pci-host/spapr.h
> +++ b/include/hw/pci-host/spapr.h
> @@ -113,9 +113,8 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRPHBState *phb, int pin)
>  
>  PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index);
>  
> -int spapr_populate_pci_dt(sPAPRPHBState *phb,
> -                          uint32_t xics_phandle,
> -                          void *fdt);
> +int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
> +                          uint32_t nr_msis);
>  
>  void spapr_pci_rtas_init(void);
>  
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index eba7d60a30a7..98868d893ad8 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1267,7 +1267,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
>      }
>  
>      QLIST_FOREACH(phb, &spapr->phbs, list) {
> -        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
> +        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt, smc->irq->nr_msis);
>          if (ret < 0) {
>              error_report("couldn't setup PCI devices in fdt");
>              exit(1);
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index bb736177e76c..c2271e6ed462 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -2069,9 +2069,8 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *phb)
>  
>  }
>  
> -int spapr_populate_pci_dt(sPAPRPHBState *phb,
> -                          uint32_t xics_phandle,
> -                          void *fdt)
> +int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
> +                          uint32_t nr_msis)
>  {
>      int bus_off, i, j, ret;
>      gchar *nodename;
> @@ -2121,7 +2120,6 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
>      sPAPRTCETable *tcet;
>      PCIBus *bus = PCI_HOST_BRIDGE(phb)->bus;
>      sPAPRFDT s_fdt;
> -    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
>  
>      /* Start populating the FDT */
>      nodename = g_strdup_printf("pci@%" PRIx64, phb->buid);
> @@ -2139,8 +2137,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
>      _FDT(fdt_setprop(fdt, bus_off, "ranges", &ranges, sizeof_ranges));
>      _FDT(fdt_setprop(fdt, bus_off, "reg", &bus_reg, sizeof(bus_reg)));
>      _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pci-config-space-type", 0x1));
> -    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi",
> -                          smc->irq->nr_msis));
> +    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", nr_msis));
>  
>      /* Dynamic DMA window */
>      if (phb->ddw_enabled) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-13  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13  5:16 [Qemu-devel] [PATCH] spapr_pci: add an extra 'nr_msis' argument to spapr_populate_pci_dt Cédric Le Goater
2018-09-13  6:05 ` David Gibson
2018-09-13  6:07 ` Greg Kurz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.