xen: Fix xen-legacy-backend qdev types
PATCH 1/1 xen: Fix xen-legacy-backend qdev types
xen-sysdev is a TYPE_SYS_BUS_DEVICE. bus_type should not be changed so that it can plug into the System bus. Otherwise this assert triggers:
qemu-system-i386: hw/core/qdev.c:102: qdev_set_parent_bus: Assertion `dc->bus_type && object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
TYPE_XENBACKEND attaches to TYPE_XENSYSBUS, so its class_init needs to be set accordingly to attach the qdev. Otherwise the following assert triggers:
qemu-system-i386: hw/core/qdev.c:102: qdev_set_parent_bus: Assertion `dc->bus_type && object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
TYPE_XENBACKEND is not a subclass of XEN_XENSYSDEV, so it's parent is just TYPE_DEVICE. Change that.
--- hw/xen/xen-legacy-backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/xen/xen-legacy-backend.c +2 -2
@@ -789,11 +789,12 @@ static void xendev_class_init(ObjectClass *klass, void *data)set_bit (DEVICE_CATEGORY_MISC , dc->categories);/* xen-backend devices can be plugged/unplugged dynamically */ dc->user_creatable = true; + dc->bus_type =TYPE_XENSYSBUS ; }static const TypeInfo xendev_type_info = { .name =TYPE_XENBACKEND , - .parent =TYPE_XENSYSDEV , + .parent =TYPE_DEVICE , .class_init = xendev_class_init, .instance_size =sizeof (struct XenLegacyDevice ), };
@@ -824,7 +825,6 @@ static void xen_sysdev_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);device_class_set_props (dc, xen_sysdev_properties); - dc->bus_type =TYPE_XENSYSBUS ; }static const TypeInfo xensysdev_info = {
Signature · 1 line
2.25.1
Quoted 21 lines
-----Original Message-----
From: Jason Andryuk <[email protected]>
Sent: 24 June 2020 13:20
To: Stefano Stabellini <[email protected]>; Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; [email protected]
Cc: Jason Andryuk <[email protected]>; [email protected]
Subject: [PATCH] xen: Fix xen-legacy-backend qdev typesxen-sysdev is a
TYPE_SYS_BUS_DEVICE.bus_typeshould not be changed so that it can plug into the System bus. Otherwise this assert triggers:
qemu-system-i386:hw/core/qdev.c:102:qdev_set_parent_bus: Assertion `dc->bus_type &&object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
TYPE_XENBACKENDattaches toTYPE_XENSYSBUS, so itsclass_initneeds to be set accordingly to attach the qdev. Otherwise the following assert triggers:
qemu-system-i386:hw/core/qdev.c:102:qdev_set_parent_bus: Assertion `dc->bus_type &&object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
Quoted 4 lines
TYPE_XENBACKENDis not a subclass ofXEN_XENSYSDEV, so it's parent is justTYPE_DEVICE. Change that.Signed-off-by Jason Andryuk <[email protected]>
Clearly we raced. This patch and my patch #1 are identical so I'm happy to give my ack to this.
Paul
Quoted 32 lines
--- hw/xen/xen-legacy-backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/xen/xen-legacy-backend.c +2
-3@@ -789,11 +789,12 @@ static void xendev_class_init(ObjectClass *klass, void *data)set_bit (DEVICE_CATEGORY_MISC , dc->categories);/* xen-backend devices can be plugged/unplugged dynamically */ dc->user_creatable = true; + dc->bus_type =TYPE_XENSYSBUS ; }static const TypeInfo xendev_type_info = { .name =TYPE_XENBACKEND , - .parent =TYPE_XENSYSDEV , + .parent =TYPE_DEVICE , .class_init = xendev_class_init, .instance_size =sizeof (struct XenLegacyDevice ), };@@ -824,7 +825,6 @@ static void xen_sysdev_class_init(ObjectClass *klass, void *data)DeviceClass *dc =DEVICE_CLASS (klass);device_class_set_props (dc, xen_sysdev_properties); - dc->bus_type =TYPE_XENSYSBUS ; }static const TypeInfo xensysdev_info = { --2.25.1
Quoted 22 lines · Paul Durrant
Quoted 22 lines
-----Original Message-----
From: Jason Andryuk <[email protected]>
Sent: 24 June 2020 13:20
To: Stefano Stabellini <[email protected]>; Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; [email protected]
Cc: Jason Andryuk <[email protected]>; [email protected]
Subject: [PATCH] xen: Fix xen-legacy-backend qdev typesxen-sysdev is a
TYPE_SYS_BUS_DEVICE.bus_typeshould not be changed so that it can plug into the System bus. Otherwise this assert triggers:
qemu-system-i386:hw/core/qdev.c:102:qdev_set_parent_bus: Assertion `dc->bus_type &&object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
TYPE_XENBACKENDattaches toTYPE_XENSYSBUS, so itsclass_initneeds to be set accordingly to attach the qdev. Otherwise the following assert triggers:
qemu-system-i386:hw/core/qdev.c:102:qdev_set_parent_bus: Assertion `dc->bus_type &&object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
Quoted 6 lines
Quoted 4 lines
TYPE_XENBACKENDis not a subclass ofXEN_XENSYSDEV, so it's parent is justTYPE_DEVICE. Change that.Signed-off-by Jason Andryuk <[email protected]>Clearly we raced. This patch and my patch #1 are identical so I'm happy to give my ack to this.
Yeah, looks like you beat me by a hair :)
Either way it gets fixed is fine by me.
Thanks,
Jason
Quoted 26 lines · Jason Andryuk
Quoted 25 lines · Paul Durrant
Quoted 25 lines
-----Original Message-----
From: Jason Andryuk <[email protected]>
Sent: 24 June 2020 13:20
To: Stefano Stabellini <[email protected]>; Anthony Perard <[email protected]>; Paul Durrant <[email protected]>; [email protected]
Cc: Jason Andryuk <[email protected]>; [email protected]
Subject: [PATCH] xen: Fix xen-legacy-backend qdev typesxen-sysdev is a
TYPE_SYS_BUS_DEVICE.bus_typeshould not be changed so that it can plug into the System bus. Otherwise this assert triggers:
qemu-system-i386:hw/core/qdev.c:102:qdev_set_parent_bus: Assertion `dc->bus_type &&object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
TYPE_XENBACKENDattaches toTYPE_XENSYSBUS, so itsclass_initneeds to be set accordingly to attach the qdev. Otherwise the following assert triggers:
qemu-system-i386:hw/core/qdev.c:102:qdev_set_parent_bus: Assertion `dc->bus_type &&object_dynamic_cast(OBJECT(bus), dc->bus_type)' failed.
TYPE_XENBACKENDis not a subclass ofXEN_XENSYSDEV, so it's parent is justTYPE_DEVICE. Change that.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Jason Andryuk <[email protected]>Clearly we raced. This patch and my patch #1 are identical so I'm happy to give my ack to this.
Yeah, looks like you beat me by a hair :)
Either way it gets fixed is fine by me.
Since there's a choice to make, I think I'll take this patch, but I will add:
Thanks,
Signature · 1 line
Anthony PERARD