qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] hw/ppc: SysBus simplifications
@ 2023-10-18 13:30 Philippe Mathieu-Daudé
  2023-10-18 13:30 ` [PATCH 1/6] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init() Philippe Mathieu-Daudé
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 13:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc, Philippe Mathieu-Daudé

Hi,

There is no point in exposing an internal MMIO region via
SysBus and directly mapping it in the very same device.

This series replaces a sequence of:
- sysbus_init_mmio()
- sysbus_mmio_map()
by a single call to memory_region_add_subregion().

Philippe Mathieu-Daudé (6):
  hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) ->
    pnv_xscom_init()
  hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init()
  hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region
  hw/ppc/pnv: Do not use SysBus API to map local MMIO region
  hw/intc/spapr_xive: Move sysbus_init_mmio() calls around
  hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region

 include/hw/ppc/pnv_xscom.h |  2 +-
 hw/intc/spapr_xive.c       | 12 ++++++------
 hw/ppc/pnv.c               | 26 +++++---------------------
 hw/ppc/pnv_xscom.c         |  5 ++---
 4 files changed, 14 insertions(+), 31 deletions(-)

-- 
2.41.0



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

* [PATCH 1/6] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init()
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
@ 2023-10-18 13:30 ` Philippe Mathieu-Daudé
  2023-10-19  5:41   ` Thomas Huth
  2023-10-18 13:30 ` [PATCH 2/6] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init() Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 13:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc, Philippe Mathieu-Daudé

pnv_xscom_realize() is not used to *realize* QDev object, rename
it as pnv_xscom_init(). The Error** argument is unused: remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/pnv_xscom.h |  2 +-
 hw/ppc/pnv.c               | 18 +++---------------
 hw/ppc/pnv_xscom.c         |  2 +-
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
index 9bc6463547..41671001da 100644
--- a/include/hw/ppc/pnv_xscom.h
+++ b/include/hw/ppc/pnv_xscom.h
@@ -170,7 +170,7 @@ struct PnvXScomInterfaceClass {
 #define PNV10_XSCOM_PEC_PCI_BASE   0x8010800 /* index goes upwards ... */
 #define PNV10_XSCOM_PEC_PCI_SIZE   0x200
 
-void pnv_xscom_realize(PnvChip *chip, uint64_t size, Error **errp);
+void pnv_xscom_init(PnvChip *chip, uint64_t size);
 int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset,
                  uint64_t xscom_base, uint64_t xscom_size,
                  const char *compat, int compat_size);
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index eb54f93986..456631c9dc 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1249,11 +1249,7 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
     assert(chip8->xics);
 
     /* XSCOM bridge is first */
-    pnv_xscom_realize(chip, PNV_XSCOM_SIZE, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        return;
-    }
+    pnv_xscom_init(chip, PNV_XSCOM_SIZE);
     sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV_XSCOM_BASE(chip));
 
     pcc->parent_realize(dev, &local_err);
@@ -1512,11 +1508,7 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)
     Error *local_err = NULL;
 
     /* XSCOM bridge is first */
-    pnv_xscom_realize(chip, PNV9_XSCOM_SIZE, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        return;
-    }
+    pnv_xscom_init(chip, PNV9_XSCOM_SIZE);
     sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV9_XSCOM_BASE(chip));
 
     pcc->parent_realize(dev, &local_err);
@@ -1727,11 +1719,7 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)
     Error *local_err = NULL;
 
     /* XSCOM bridge is first */
-    pnv_xscom_realize(chip, PNV10_XSCOM_SIZE, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        return;
-    }
+    pnv_xscom_init(chip, PNV10_XSCOM_SIZE);
     sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV10_XSCOM_BASE(chip));
 
     pcc->parent_realize(dev, &local_err);
diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
index d820e05e40..af57b55863 100644
--- a/hw/ppc/pnv_xscom.c
+++ b/hw/ppc/pnv_xscom.c
@@ -221,7 +221,7 @@ const MemoryRegionOps pnv_xscom_ops = {
     .endianness = DEVICE_BIG_ENDIAN,
 };
 
-void pnv_xscom_realize(PnvChip *chip, uint64_t size, Error **errp)
+void pnv_xscom_init(PnvChip *chip, uint64_t size)
 {
     SysBusDevice *sbd = SYS_BUS_DEVICE(chip);
     char *name;
-- 
2.41.0



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

* [PATCH 2/6] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init()
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
  2023-10-18 13:30 ` [PATCH 1/6] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init() Philippe Mathieu-Daudé
@ 2023-10-18 13:30 ` Philippe Mathieu-Daudé
  2023-10-19  5:42   ` Thomas Huth
  2023-10-18 13:30 ` [PATCH 3/6] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 13:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc, Philippe Mathieu-Daudé

In order to make the next commit trivial, move sysbus_init_mmio()
calls just before the corresponding sysbus_mmio_map() calls.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/pnv_xscom.h | 2 +-
 hw/ppc/pnv.c               | 9 +++------
 hw/ppc/pnv_xscom.c         | 3 ++-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
index 41671001da..35b19610f7 100644
--- a/include/hw/ppc/pnv_xscom.h
+++ b/include/hw/ppc/pnv_xscom.h
@@ -170,7 +170,7 @@ struct PnvXScomInterfaceClass {
 #define PNV10_XSCOM_PEC_PCI_BASE   0x8010800 /* index goes upwards ... */
 #define PNV10_XSCOM_PEC_PCI_SIZE   0x200
 
-void pnv_xscom_init(PnvChip *chip, uint64_t size);
+void pnv_xscom_init(PnvChip *chip, uint64_t size, hwaddr addr);
 int pnv_dt_xscom(PnvChip *chip, void *fdt, int root_offset,
                  uint64_t xscom_base, uint64_t xscom_size,
                  const char *compat, int compat_size);
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 456631c9dc..10158f7684 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1249,8 +1249,7 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
     assert(chip8->xics);
 
     /* XSCOM bridge is first */
-    pnv_xscom_init(chip, PNV_XSCOM_SIZE);
-    sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV_XSCOM_BASE(chip));
+    pnv_xscom_init(chip, PNV_XSCOM_SIZE, PNV_XSCOM_BASE(chip));
 
     pcc->parent_realize(dev, &local_err);
     if (local_err) {
@@ -1508,8 +1507,7 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)
     Error *local_err = NULL;
 
     /* XSCOM bridge is first */
-    pnv_xscom_init(chip, PNV9_XSCOM_SIZE);
-    sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV9_XSCOM_BASE(chip));
+    pnv_xscom_init(chip, PNV9_XSCOM_SIZE, PNV9_XSCOM_BASE(chip));
 
     pcc->parent_realize(dev, &local_err);
     if (local_err) {
@@ -1719,8 +1717,7 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)
     Error *local_err = NULL;
 
     /* XSCOM bridge is first */
-    pnv_xscom_init(chip, PNV10_XSCOM_SIZE);
-    sysbus_mmio_map(SYS_BUS_DEVICE(chip), 0, PNV10_XSCOM_BASE(chip));
+    pnv_xscom_init(chip, PNV10_XSCOM_SIZE, PNV10_XSCOM_BASE(chip));
 
     pcc->parent_realize(dev, &local_err);
     if (local_err) {
diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
index af57b55863..cf892c9fe8 100644
--- a/hw/ppc/pnv_xscom.c
+++ b/hw/ppc/pnv_xscom.c
@@ -221,7 +221,7 @@ const MemoryRegionOps pnv_xscom_ops = {
     .endianness = DEVICE_BIG_ENDIAN,
 };
 
-void pnv_xscom_init(PnvChip *chip, uint64_t size)
+void pnv_xscom_init(PnvChip *chip, uint64_t size, hwaddr addr)
 {
     SysBusDevice *sbd = SYS_BUS_DEVICE(chip);
     char *name;
@@ -230,6 +230,7 @@ void pnv_xscom_init(PnvChip *chip, uint64_t size)
     memory_region_init_io(&chip->xscom_mmio, OBJECT(chip), &pnv_xscom_ops,
                           chip, name, size);
     sysbus_init_mmio(sbd, &chip->xscom_mmio);
+    sysbus_mmio_map(sbd, 0, addr);
 
     memory_region_init(&chip->xscom, OBJECT(chip), name, size);
     address_space_init(&chip->xscom_as, &chip->xscom, name);
-- 
2.41.0



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

* [PATCH 3/6] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
  2023-10-18 13:30 ` [PATCH 1/6] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init() Philippe Mathieu-Daudé
  2023-10-18 13:30 ` [PATCH 2/6] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init() Philippe Mathieu-Daudé
@ 2023-10-18 13:30 ` Philippe Mathieu-Daudé
  2023-10-19  5:43   ` Thomas Huth
  2023-10-18 13:30 ` [PATCH 4/6] hw/ppc/pnv: " Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 13:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc, Philippe Mathieu-Daudé

There is no point in exposing an internal MMIO region via
SysBus and directly mapping it in the very same device.

Just map it without using the SysBus API.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/pnv_xscom.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
index cf892c9fe8..805b1d0c87 100644
--- a/hw/ppc/pnv_xscom.c
+++ b/hw/ppc/pnv_xscom.c
@@ -223,14 +223,12 @@ const MemoryRegionOps pnv_xscom_ops = {
 
 void pnv_xscom_init(PnvChip *chip, uint64_t size, hwaddr addr)
 {
-    SysBusDevice *sbd = SYS_BUS_DEVICE(chip);
     char *name;
 
     name = g_strdup_printf("xscom-%x", chip->chip_id);
     memory_region_init_io(&chip->xscom_mmio, OBJECT(chip), &pnv_xscom_ops,
                           chip, name, size);
-    sysbus_init_mmio(sbd, &chip->xscom_mmio);
-    sysbus_mmio_map(sbd, 0, addr);
+    memory_region_add_subregion(get_system_memory(), addr, &chip->xscom_mmio);
 
     memory_region_init(&chip->xscom, OBJECT(chip), name, size);
     address_space_init(&chip->xscom_as, &chip->xscom, name);
-- 
2.41.0



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

* [PATCH 4/6] hw/ppc/pnv: Do not use SysBus API to map local MMIO region
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2023-10-18 13:30 ` [PATCH 3/6] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
@ 2023-10-18 13:30 ` Philippe Mathieu-Daudé
  2023-10-19  5:44   ` Thomas Huth
  2023-10-18 13:30 ` [PATCH 5/6] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 13:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc, Philippe Mathieu-Daudé

There is no point in exposing an internal MMIO region via
SysBus and directly mapping it in the very same device.

Just map it without using the SysBus API.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/pnv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 10158f7684..c0e34fffbc 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1217,10 +1217,9 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
 
     name = g_strdup_printf("icp-%x", chip->chip_id);
     memory_region_init(&chip8->icp_mmio, OBJECT(chip), name, PNV_ICP_SIZE);
-    sysbus_init_mmio(SYS_BUS_DEVICE(chip), &chip8->icp_mmio);
     g_free(name);
-
-    sysbus_mmio_map(SYS_BUS_DEVICE(chip), 1, PNV_ICP_BASE(chip));
+    memory_region_add_subregion(get_system_memory(), PNV_ICP_BASE(chip),
+                                &chip8->icp_mmio);
 
     /* Map the ICP registers for each thread */
     for (i = 0; i < chip->nr_cores; i++) {
-- 
2.41.0



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

* [PATCH 5/6] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2023-10-18 13:30 ` [PATCH 4/6] hw/ppc/pnv: " Philippe Mathieu-Daudé
@ 2023-10-18 13:30 ` Philippe Mathieu-Daudé
  2023-10-19  5:45   ` Thomas Huth
  2023-10-18 13:30 ` [PATCH 6/6] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 13:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc, Philippe Mathieu-Daudé

In order to make the next commit trivial, move sysbus_init_mmio()
calls just before the corresponding sysbus_mmio_map() calls.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/spapr_xive.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index 7f701d414b..12057ffe5b 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -316,7 +316,6 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp)
     if (!qdev_realize(DEVICE(xsrc), NULL, errp)) {
         return;
     }
-    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xsrc->esb_mmio);
 
     /*
      * Initialize the END ESB source
@@ -328,7 +327,6 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp)
     if (!qdev_realize(DEVICE(end_xsrc), NULL, errp)) {
         return;
     }
-    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio);
 
     /* Set the mapping address of the END ESB pages after the source ESBs */
     xive->end_base = xive->vc_base + xive_source_esb_len(xsrc);
@@ -347,14 +345,16 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp)
     /* TIMA initialization */
     memory_region_init_io(&xive->tm_mmio, OBJECT(xive), &spapr_xive_tm_ops,
                           xive, "xive.tima", 4ull << TM_SHIFT);
-    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xive->tm_mmio);
 
     /*
      * Map all regions. These will be enabled or disabled at reset and
      * can also be overridden by KVM memory regions if active
      */
+    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xsrc->esb_mmio);
     sysbus_mmio_map(SYS_BUS_DEVICE(xive), 0, xive->vc_base);
+    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio);
     sysbus_mmio_map(SYS_BUS_DEVICE(xive), 1, xive->end_base);
+    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xive->tm_mmio);
     sysbus_mmio_map(SYS_BUS_DEVICE(xive), 2, xive->tm_base);
 }
 
-- 
2.41.0



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

* [PATCH 6/6] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2023-10-18 13:30 ` [PATCH 5/6] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around Philippe Mathieu-Daudé
@ 2023-10-18 13:30 ` Philippe Mathieu-Daudé
  2023-10-19  5:46   ` Thomas Huth
  2023-10-18 18:28 ` [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 13:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc, Philippe Mathieu-Daudé

There is no point in exposing an internal MMIO region via
SysBus and directly mapping it in the very same device.

Just map it without using the SysBus API.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/spapr_xive.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index 12057ffe5b..199c261b07 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -350,12 +350,12 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp)
      * Map all regions. These will be enabled or disabled at reset and
      * can also be overridden by KVM memory regions if active
      */
-    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xsrc->esb_mmio);
-    sysbus_mmio_map(SYS_BUS_DEVICE(xive), 0, xive->vc_base);
-    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio);
-    sysbus_mmio_map(SYS_BUS_DEVICE(xive), 1, xive->end_base);
-    sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xive->tm_mmio);
-    sysbus_mmio_map(SYS_BUS_DEVICE(xive), 2, xive->tm_base);
+    memory_region_add_subregion(get_system_memory(), xive->vc_base,
+                                &xsrc->esb_mmio);
+    memory_region_add_subregion(get_system_memory(), xive->end_base,
+                                &end_xsrc->esb_mmio);
+    memory_region_add_subregion(get_system_memory(), xive->tm_base,
+                                &xive->tm_mmio);
 }
 
 static int spapr_xive_get_eas(XiveRouter *xrtr, uint8_t eas_blk,
-- 
2.41.0



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

* Re: [PATCH 0/6] hw/ppc: SysBus simplifications
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2023-10-18 13:30 ` [PATCH 6/6] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
@ 2023-10-18 18:28 ` Philippe Mathieu-Daudé
  2023-10-18 23:52 ` Richard Henderson
  2023-10-19  8:28 ` LIU Zhiwei
  8 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-18 18:28 UTC (permalink / raw)
  To: qemu-devel, Thomas Huth
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 18/10/23 15:30, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> There is no point in exposing an internal MMIO region via
> SysBus and directly mapping it in the very same device.
> 
> This series replaces a sequence of:
> - sysbus_init_mmio()
> - sysbus_mmio_map()
> by a single call to memory_region_add_subregion().
> 
> Philippe Mathieu-Daudé (6):
>    hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) ->
>      pnv_xscom_init()
>    hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init()
>    hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region
>    hw/ppc/pnv: Do not use SysBus API to map local MMIO region
>    hw/intc/spapr_xive: Move sysbus_init_mmio() calls around
>    hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region

Cc'ing Thomas :)


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

* Re: [PATCH 0/6] hw/ppc: SysBus simplifications
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2023-10-18 18:28 ` [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
@ 2023-10-18 23:52 ` Richard Henderson
  2023-10-19  8:28 ` LIU Zhiwei
  8 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2023-10-18 23:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 10/18/23 06:30, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> There is no point in exposing an internal MMIO region via
> SysBus and directly mapping it in the very same device.
> 
> This series replaces a sequence of:
> - sysbus_init_mmio()
> - sysbus_mmio_map()
> by a single call to memory_region_add_subregion().
> 
> Philippe Mathieu-Daudé (6):
>    hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) ->
>      pnv_xscom_init()
>    hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init()
>    hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region
>    hw/ppc/pnv: Do not use SysBus API to map local MMIO region
>    hw/intc/spapr_xive: Move sysbus_init_mmio() calls around
>    hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region
> 
>   include/hw/ppc/pnv_xscom.h |  2 +-
>   hw/intc/spapr_xive.c       | 12 ++++++------
>   hw/ppc/pnv.c               | 26 +++++---------------------
>   hw/ppc/pnv_xscom.c         |  5 ++---
>   4 files changed, 14 insertions(+), 31 deletions(-)
> 

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 1/6] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init()
  2023-10-18 13:30 ` [PATCH 1/6] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init() Philippe Mathieu-Daudé
@ 2023-10-19  5:41   ` Thomas Huth
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2023-10-19  5:41 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 18/10/2023 15.30, Philippe Mathieu-Daudé wrote:
> pnv_xscom_realize() is not used to *realize* QDev object, rename
> it as pnv_xscom_init(). The Error** argument is unused: remove it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/ppc/pnv_xscom.h |  2 +-
>   hw/ppc/pnv.c               | 18 +++---------------
>   hw/ppc/pnv_xscom.c         |  2 +-
>   3 files changed, 5 insertions(+), 17 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>




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

* Re: [PATCH 2/6] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init()
  2023-10-18 13:30 ` [PATCH 2/6] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init() Philippe Mathieu-Daudé
@ 2023-10-19  5:42   ` Thomas Huth
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2023-10-19  5:42 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 18/10/2023 15.30, Philippe Mathieu-Daudé wrote:
> In order to make the next commit trivial, move sysbus_init_mmio()
> calls just before the corresponding sysbus_mmio_map() calls.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/ppc/pnv_xscom.h | 2 +-
>   hw/ppc/pnv.c               | 9 +++------
>   hw/ppc/pnv_xscom.c         | 3 ++-
>   3 files changed, 6 insertions(+), 8 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>




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

* Re: [PATCH 3/6] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region
  2023-10-18 13:30 ` [PATCH 3/6] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
@ 2023-10-19  5:43   ` Thomas Huth
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2023-10-19  5:43 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 18/10/2023 15.30, Philippe Mathieu-Daudé wrote:
> There is no point in exposing an internal MMIO region via
> SysBus and directly mapping it in the very same device.
> 
> Just map it without using the SysBus API.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/ppc/pnv_xscom.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>




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

* Re: [PATCH 4/6] hw/ppc/pnv: Do not use SysBus API to map local MMIO region
  2023-10-18 13:30 ` [PATCH 4/6] hw/ppc/pnv: " Philippe Mathieu-Daudé
@ 2023-10-19  5:44   ` Thomas Huth
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2023-10-19  5:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 18/10/2023 15.30, Philippe Mathieu-Daudé wrote:
> There is no point in exposing an internal MMIO region via
> SysBus and directly mapping it in the very same device.
> 
> Just map it without using the SysBus API.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/ppc/pnv.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>




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

* Re: [PATCH 5/6] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around
  2023-10-18 13:30 ` [PATCH 5/6] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around Philippe Mathieu-Daudé
@ 2023-10-19  5:45   ` Thomas Huth
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2023-10-19  5:45 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 18/10/2023 15.30, Philippe Mathieu-Daudé wrote:
> In order to make the next commit trivial, move sysbus_init_mmio()
> calls just before the corresponding sysbus_mmio_map() calls.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/intc/spapr_xive.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH 6/6] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region
  2023-10-18 13:30 ` [PATCH 6/6] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
@ 2023-10-19  5:46   ` Thomas Huth
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Huth @ 2023-10-19  5:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc

On 18/10/2023 15.30, Philippe Mathieu-Daudé wrote:
> There is no point in exposing an internal MMIO region via
> SysBus and directly mapping it in the very same device.
> 
> Just map it without using the SysBus API.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/intc/spapr_xive.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>




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

* Re: [PATCH 0/6] hw/ppc: SysBus simplifications
  2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2023-10-18 23:52 ` Richard Henderson
@ 2023-10-19  8:28 ` LIU Zhiwei
  8 siblings, 0 replies; 16+ messages in thread
From: LIU Zhiwei @ 2023-10-19  8:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: David Gibson, Frédéric Barrat, Cédric Le Goater,
	Harsh Prateek Bora, Nicholas Piggin, Daniel Henrique Barboza,
	qemu-ppc


On 2023/10/18 21:30, Philippe Mathieu-Daudé wrote:
> Hi,
>
> There is no point in exposing an internal MMIO region via
> SysBus and directly mapping it in the very same device.
>
> This series replaces a sequence of:
> - sysbus_init_mmio()
> - sysbus_mmio_map()
> by a single call to memory_region_add_subregion().

Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>

Zhiwei

>
> Philippe Mathieu-Daudé (6):
>    hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) ->
>      pnv_xscom_init()
>    hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init()
>    hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region
>    hw/ppc/pnv: Do not use SysBus API to map local MMIO region
>    hw/intc/spapr_xive: Move sysbus_init_mmio() calls around
>    hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region
>
>   include/hw/ppc/pnv_xscom.h |  2 +-
>   hw/intc/spapr_xive.c       | 12 ++++++------
>   hw/ppc/pnv.c               | 26 +++++---------------------
>   hw/ppc/pnv_xscom.c         |  5 ++---
>   4 files changed, 14 insertions(+), 31 deletions(-)
>


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

end of thread, other threads:[~2023-10-19  8:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18 13:30 [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
2023-10-18 13:30 ` [PATCH 1/6] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init() Philippe Mathieu-Daudé
2023-10-19  5:41   ` Thomas Huth
2023-10-18 13:30 ` [PATCH 2/6] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init() Philippe Mathieu-Daudé
2023-10-19  5:42   ` Thomas Huth
2023-10-18 13:30 ` [PATCH 3/6] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19  5:43   ` Thomas Huth
2023-10-18 13:30 ` [PATCH 4/6] hw/ppc/pnv: " Philippe Mathieu-Daudé
2023-10-19  5:44   ` Thomas Huth
2023-10-18 13:30 ` [PATCH 5/6] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around Philippe Mathieu-Daudé
2023-10-19  5:45   ` Thomas Huth
2023-10-18 13:30 ` [PATCH 6/6] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19  5:46   ` Thomas Huth
2023-10-18 18:28 ` [PATCH 0/6] hw/ppc: SysBus simplifications Philippe Mathieu-Daudé
2023-10-18 23:52 ` Richard Henderson
2023-10-19  8:28 ` LIU Zhiwei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).