All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
@ 2018-07-17 14:55 Thomas Huth
  2018-07-17 17:37 ` Edgar E. Iglesias
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2018-07-17 14:55 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel; +Cc: Alistair Francis

Valgrind complains:

echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
 "'arguments':{'typename':'xlnx,zynqmp-pmu-soc'}}" \
 "{'execute': 'human-monitor-command', " \
 "'arguments': {'command-line': 'info qtree'}}" | \
 valgrind -q microblazeel-softmmu/qemu-system-microblazeel -M none,accel=qtest -qmp stdio
[...]
==13605== Invalid read of size 8
==13605==    at 0x2AC69A: qdev_print (qdev-monitor.c:686)
==13605==    by 0x2AC69A: qbus_print (qdev-monitor.c:719)
==13605==    by 0x2591E8: handle_hmp_command (monitor.c:3446)

Use the new object_initialize_child() and sysbus_init_child_obj() to
fix the issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/microblaze/xlnx-zynqmp-pmu.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c
index 999a565..57dc1cc 100644
--- a/hw/microblaze/xlnx-zynqmp-pmu.c
+++ b/hw/microblaze/xlnx-zynqmp-pmu.c
@@ -62,13 +62,11 @@ static void xlnx_zynqmp_pmu_soc_init(Object *obj)
 {
     XlnxZynqMPPMUSoCState *s = XLNX_ZYNQMP_PMU_SOC(obj);
 
-    object_initialize(&s->cpu, sizeof(s->cpu),
-                      TYPE_MICROBLAZE_CPU);
-    object_property_add_child(obj, "pmu-cpu", OBJECT(&s->cpu),
-                              &error_abort);
+    object_initialize_child(obj, "pmu-cpu", &s->cpu, sizeof(s->cpu),
+                            TYPE_MICROBLAZE_CPU, &error_abort, NULL);
 
-    object_initialize(&s->intc, sizeof(s->intc), TYPE_XLNX_PMU_IO_INTC);
-    qdev_set_parent_bus(DEVICE(&s->intc), sysbus_get_default());
+    sysbus_init_child_obj(obj, "intc", &s->intc, sizeof(s->intc),
+                          TYPE_XLNX_PMU_IO_INTC);
 }
 
 static void xlnx_zynqmp_pmu_soc_realize(DeviceState *dev, Error **errp)
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
  2018-07-17 14:55 [Qemu-devel] [PATCH] hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc' Thomas Huth
@ 2018-07-17 17:37 ` Edgar E. Iglesias
  2018-07-17 19:41   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Edgar E. Iglesias @ 2018-07-17 17:37 UTC (permalink / raw)
  To: Thomas Huth, Peter Maydell; +Cc: qemu-devel, Alistair Francis

On Tue, Jul 17, 2018 at 04:55:43PM +0200, Thomas Huth wrote:
> Valgrind complains:
> 
> echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
>  "'arguments':{'typename':'xlnx,zynqmp-pmu-soc'}}" \
>  "{'execute': 'human-monitor-command', " \
>  "'arguments': {'command-line': 'info qtree'}}" | \
>  valgrind -q microblazeel-softmmu/qemu-system-microblazeel -M none,accel=qtest -qmp stdio
> [...]
> ==13605== Invalid read of size 8
> ==13605==    at 0x2AC69A: qdev_print (qdev-monitor.c:686)
> ==13605==    by 0x2AC69A: qbus_print (qdev-monitor.c:719)
> ==13605==    by 0x2591E8: handle_hmp_command (monitor.c:3446)
> 
> Use the new object_initialize_child() and sysbus_init_child_obj() to
> fix the issue.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>


Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

Peter, could you pick this up for 3.0? Or do you want a pull request?

Cheers,
Edgar


> ---
>  hw/microblaze/xlnx-zynqmp-pmu.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c
> index 999a565..57dc1cc 100644
> --- a/hw/microblaze/xlnx-zynqmp-pmu.c
> +++ b/hw/microblaze/xlnx-zynqmp-pmu.c
> @@ -62,13 +62,11 @@ static void xlnx_zynqmp_pmu_soc_init(Object *obj)
>  {
>      XlnxZynqMPPMUSoCState *s = XLNX_ZYNQMP_PMU_SOC(obj);
>  
> -    object_initialize(&s->cpu, sizeof(s->cpu),
> -                      TYPE_MICROBLAZE_CPU);
> -    object_property_add_child(obj, "pmu-cpu", OBJECT(&s->cpu),
> -                              &error_abort);
> +    object_initialize_child(obj, "pmu-cpu", &s->cpu, sizeof(s->cpu),
> +                            TYPE_MICROBLAZE_CPU, &error_abort, NULL);
>  
> -    object_initialize(&s->intc, sizeof(s->intc), TYPE_XLNX_PMU_IO_INTC);
> -    qdev_set_parent_bus(DEVICE(&s->intc), sysbus_get_default());
> +    sysbus_init_child_obj(obj, "intc", &s->intc, sizeof(s->intc),
> +                          TYPE_XLNX_PMU_IO_INTC);
>  }
>  
>  static void xlnx_zynqmp_pmu_soc_realize(DeviceState *dev, Error **errp)
> -- 
> 1.8.3.1
> 

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

* Re: [Qemu-devel] [PATCH] hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
  2018-07-17 17:37 ` Edgar E. Iglesias
@ 2018-07-17 19:41   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-07-17 19:41 UTC (permalink / raw)
  To: Edgar E. Iglesias; +Cc: Thomas Huth, QEMU Developers, Alistair Francis

On 17 July 2018 at 18:37, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> On Tue, Jul 17, 2018 at 04:55:43PM +0200, Thomas Huth wrote:
>> Valgrind complains:
>>
>> echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
>>  "'arguments':{'typename':'xlnx,zynqmp-pmu-soc'}}" \
>>  "{'execute': 'human-monitor-command', " \
>>  "'arguments': {'command-line': 'info qtree'}}" | \
>>  valgrind -q microblazeel-softmmu/qemu-system-microblazeel -M none,accel=qtest -qmp stdio
>> [...]
>> ==13605== Invalid read of size 8
>> ==13605==    at 0x2AC69A: qdev_print (qdev-monitor.c:686)
>> ==13605==    by 0x2AC69A: qbus_print (qdev-monitor.c:719)
>> ==13605==    by 0x2591E8: handle_hmp_command (monitor.c:3446)
>>
>> Use the new object_initialize_child() and sysbus_init_child_obj() to
>> fix the issue.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>
>
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
>
> Peter, could you pick this up for 3.0? Or do you want a pull request?

It's missed rc1 but I'll put it in via target-arm.next for rc2.

thanks
-- PMM

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

end of thread, other threads:[~2018-07-17 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 14:55 [Qemu-devel] [PATCH] hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc' Thomas Huth
2018-07-17 17:37 ` Edgar E. Iglesias
2018-07-17 19:41   ` Peter Maydell

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.