[PATCH 4/6] hw/pci-host/astro: Use proper region names

Helge Deller posted 6 patches 2 weeks, 6 days ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>
[PATCH 4/6] hw/pci-host/astro: Use proper region names
Posted by Helge Deller 2 weeks, 6 days ago
From: Helge Deller <deller@gmx.de>

All 64-bit hppa machines have at least 4 Elroy PCI busses in the system.
Make sure to use proper names in the qemu device tree, e.g. "elroy0" or
"elroy2-pci-mmio", to be able to distinguish between the various chips.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 hw/pci-host/astro.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/pci-host/astro.c b/hw/pci-host/astro.c
index 626aa9ce22..2c97d400bf 100644
--- a/hw/pci-host/astro.c
+++ b/hw/pci-host/astro.c
@@ -433,7 +433,7 @@ static void elroy_pcihost_realize(DeviceState *dev, Error **errp)
 
     /* Elroy config access from CPU.  */
     memory_region_init_io(&s->this_mem, obj, &elroy_chip_ops,
-                          s, "elroy", 0x2000);
+                          s, dev->id, 0x2000);
 
     /* Elroy PCI config. */
     memory_region_init_io(&phb->conf_mem, obj,
@@ -448,7 +448,9 @@ static void elroy_pcihost_realize(DeviceState *dev, Error **errp)
                                 &phb->data_mem);
 
     /* Elroy PCI bus memory.  */
-    memory_region_init(&s->pci_mmio, obj, "pci-mmio", UINT64_MAX);
+    g_autofree char *elroy_mmio_name;
+    elroy_mmio_name = g_strdup_printf("%s-pci-mmio", dev->id);
+    memory_region_init(&s->pci_mmio, obj, elroy_mmio_name, UINT64_MAX);
     memory_region_init_io(&s->pci_io, obj, &unassigned_io_ops, obj,
                             "pci-isa-mmio",
                             ((uint32_t) IOS_DIST_BASE_SIZE) / ROPES_PER_IOC);
-- 
2.53.0
Re: [PATCH 4/6] hw/pci-host/astro: Use proper region names
Posted by Philippe Mathieu-Daudé 2 weeks, 5 days ago
On 17/3/26 20:51, Helge Deller wrote:
> From: Helge Deller <deller@gmx.de>
> 
> All 64-bit hppa machines have at least 4 Elroy PCI busses in the system.
> Make sure to use proper names in the qemu device tree, e.g. "elroy0" or
> "elroy2-pci-mmio", to be able to distinguish between the various chips.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
>   hw/pci-host/astro.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/pci-host/astro.c b/hw/pci-host/astro.c
> index 626aa9ce22..2c97d400bf 100644
> --- a/hw/pci-host/astro.c
> +++ b/hw/pci-host/astro.c
> @@ -433,7 +433,7 @@ static void elroy_pcihost_realize(DeviceState *dev, Error **errp)
>   
>       /* Elroy config access from CPU.  */
>       memory_region_init_io(&s->this_mem, obj, &elroy_chip_ops,
> -                          s, "elroy", 0x2000);
> +                          s, dev->id, 0x2000);
>   
>       /* Elroy PCI config. */
>       memory_region_init_io(&phb->conf_mem, obj,
> @@ -448,7 +448,9 @@ static void elroy_pcihost_realize(DeviceState *dev, Error **errp)
>                                   &phb->data_mem);
>   
>       /* Elroy PCI bus memory.  */
> -    memory_region_init(&s->pci_mmio, obj, "pci-mmio", UINT64_MAX);
> +    g_autofree char *elroy_mmio_name;

Please move to function prologue:

     g_autofree char *elroy_mmio_name = NULL;

With that:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +    elroy_mmio_name = g_strdup_printf("%s-pci-mmio", dev->id);
> +    memory_region_init(&s->pci_mmio, obj, elroy_mmio_name, UINT64_MAX);
>       memory_region_init_io(&s->pci_io, obj, &unassigned_io_ops, obj,
>                               "pci-isa-mmio",
>                               ((uint32_t) IOS_DIST_BASE_SIZE) / ROPES_PER_IOC);