qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 9/9] hw/misc/empty_slot: Pass the slot name as a


From: Artyom Tarasenko
Subject: Re: [Qemu-devel] [PATCH 9/9] hw/misc/empty_slot: Pass the slot name as argument
Date: Tue, 25 Jun 2019 09:03:53 +0200

On Tue, Jun 25, 2019 at 12:01 AM Philippe Mathieu-Daudé <address@hidden> wrote:
>
> Use the slot name to have more meaningful tracing logs.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>

Reviewed-by: Artyom Tarasenko <address@hidden>

> ---
>  include/hw/misc/empty_slot.h | 3 ++-
>  hw/mips/mips_malta.c         | 2 +-
>  hw/misc/empty_slot.c         | 6 ++++--
>  hw/sparc/sun4m.c             | 9 ++++++---
>  4 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/include/hw/misc/empty_slot.h b/include/hw/misc/empty_slot.h
> index 46483f24c3..d0cd989d2d 100644
> --- a/include/hw/misc/empty_slot.h
> +++ b/include/hw/misc/empty_slot.h
> @@ -14,6 +14,7 @@
>
>  /**
>   * empty_slot_init: create and map a RAZ/WI device
> + * @name: name of the device for debug logging
>   * @base: base address of the device's MMIO region
>   * @size: size of the device's MMIO region
>   *
> @@ -27,6 +28,6 @@
>   * use it to cover a large region and then map other devices on top of it
>   * if necessary.
>   */
> -void empty_slot_init(hwaddr addr, uint64_t slot_size);
> +void empty_slot_init(const char *name, hwaddr addr, uint64_t slot_size);
>
>  #endif
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 7008be2e5b..51db5212be 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1212,7 +1212,7 @@ void mips_malta_init(MachineState *machine)
>      /* The whole address space decoded by the GT-64120A doesn't generate
>         exception when accessing invalid memory. Create an empty slot to
>         emulate this feature. */
> -    empty_slot_init(0, 0x20000000);
> +    empty_slot_init("gt64120-ad", 0x00000000, 0x20000000);
>
>      qdev_init_nofail(dev);
>
> diff --git a/hw/misc/empty_slot.c b/hw/misc/empty_slot.c
> index b810655554..396f9dd06a 100644
> --- a/hw/misc/empty_slot.c
> +++ b/hw/misc/empty_slot.c
> @@ -52,12 +52,13 @@ static const MemoryRegionOps empty_slot_ops = {
>      .endianness = DEVICE_NATIVE_ENDIAN,
>  };
>
> -void empty_slot_init(hwaddr addr, uint64_t slot_size)
> +void empty_slot_init(const char *name, hwaddr addr, uint64_t slot_size)
>  {
>      DeviceState *dev;
>
>      dev = qdev_create(NULL, TYPE_EMPTY_SLOT);
>
> +    qdev_prop_set_string(dev, "name", name);
>      qdev_prop_set_uint64(dev, "size", slot_size);
>      qdev_init_nofail(dev);
>
> @@ -77,7 +78,8 @@ static void empty_slot_realize(DeviceState *dev, Error 
> **errp)
>          return;
>      }
>      if (s->name == NULL) {
> -        s->name = g_strdup("empty-slot");
> +        error_setg(errp, "property 'name' not specified");
> +        return;
>      }
>
>      memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s,
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index d55753d5cb..b17be3ddb8 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -819,7 +819,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
>                                           machine->ram_size);
>      memory_region_add_subregion(get_system_memory(), 0x00000000, &ram);
>      /* models without ECC don't trap when missing ram is accessed */
> -    empty_slot_init(0x00000000, hwdef->max_mem);
> +    empty_slot_init("dram", 0x00000000, hwdef->max_mem);
>
>      /* init CPUs */
>      for(i = 0; i < smp_cpus; i++) {
> @@ -859,7 +859,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
>             Software shouldn't use aliased addresses, neither should it crash
>             when does. Using empty_slot instead of aliasing can help with
>             debugging such accesses */
> -        empty_slot_init(hwdef->iommu_pad_base,hwdef->iommu_pad_len);
> +        empty_slot_init("iommu.alias",
> +                        hwdef->iommu_pad_base, hwdef->iommu_pad_len);
>      }
>
>      sparc32_dma_init(hwdef->dma_base,
> @@ -908,7 +909,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
>      for (i = 0; i < MAX_VSIMMS; i++) {
>          /* vsimm registers probed by OBP */
>          if (hwdef->vsimm[i].reg_base) {
> -            empty_slot_init(hwdef->vsimm[i].reg_base, 0x2000);
> +            char *name = g_strdup_printf("vsimm[%d]", i);
> +            empty_slot_init(name, hwdef->vsimm[i].reg_base, 0x2000);
> +            g_free(name);
>          }
>      }
>
> --
> 2.19.1
>


-- 
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]