* [PATCH] xen: Fix xen-legacy-backend qdev types
@ 2020-06-24 12:19 Jason Andryuk
2020-06-24 12:30 ` Paul Durrant
0 siblings, 1 reply; 4+ messages in thread
From: Jason Andryuk @ 2020-06-24 12:19 UTC (permalink / raw)
To: Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel
Cc: qemu-devel, Jason Andryuk
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.
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
hw/xen/xen-legacy-backend.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c
index 2335ee2e65..c5c75c0064 100644
--- a/hw/xen/xen-legacy-backend.c
+++ b/hw/xen/xen-legacy-backend.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] xen: Fix xen-legacy-backend qdev types
2020-06-24 12:19 [PATCH] xen: Fix xen-legacy-backend qdev types Jason Andryuk
@ 2020-06-24 12:30 ` Paul Durrant
2020-06-24 12:52 ` Jason Andryuk
0 siblings, 1 reply; 4+ messages in thread
From: Paul Durrant @ 2020-06-24 12:30 UTC (permalink / raw)
To: 'Jason Andryuk', 'Stefano Stabellini',
'Anthony Perard',
xen-devel
Cc: qemu-devel
> -----Original Message-----
> From: Jason Andryuk <jandryuk@gmail.com>
> Sent: 24 June 2020 13:20
> To: Stefano Stabellini <sstabellini@kernel.org>; Anthony Perard <anthony.perard@citrix.com>; Paul
> Durrant <paul@xen.org>; xen-devel@lists.xenproject.org
> Cc: Jason Andryuk <jandryuk@gmail.com>; qemu-devel@nongnu.org
> Subject: [PATCH] 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.
>
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Clearly we raced. This patch and my patch #1 are identical so I'm happy to give my ack to this.
Paul
> ---
> hw/xen/xen-legacy-backend.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c
> index 2335ee2e65..c5c75c0064 100644
> --- a/hw/xen/xen-legacy-backend.c
> +++ b/hw/xen/xen-legacy-backend.c
> @@ -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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xen: Fix xen-legacy-backend qdev types
2020-06-24 12:30 ` Paul Durrant
@ 2020-06-24 12:52 ` Jason Andryuk
2020-06-30 13:59 ` Anthony PERARD
0 siblings, 1 reply; 4+ messages in thread
From: Jason Andryuk @ 2020-06-24 12:52 UTC (permalink / raw)
To: Paul Durrant; +Cc: Anthony Perard, xen-devel, Stefano Stabellini, QEMU
On Wed, Jun 24, 2020 at 8:30 AM Paul Durrant <xadimgnik@gmail.com> wrote:
>
> > -----Original Message-----
> > From: Jason Andryuk <jandryuk@gmail.com>
> > Sent: 24 June 2020 13:20
> > To: Stefano Stabellini <sstabellini@kernel.org>; Anthony Perard <anthony.perard@citrix.com>; Paul
> > Durrant <paul@xen.org>; xen-devel@lists.xenproject.org
> > Cc: Jason Andryuk <jandryuk@gmail.com>; qemu-devel@nongnu.org
> > Subject: [PATCH] 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.
> >
> > Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xen: Fix xen-legacy-backend qdev types
2020-06-24 12:52 ` Jason Andryuk
@ 2020-06-30 13:59 ` Anthony PERARD
0 siblings, 0 replies; 4+ messages in thread
From: Anthony PERARD @ 2020-06-30 13:59 UTC (permalink / raw)
To: Jason Andryuk; +Cc: xen-devel, Stefano Stabellini, QEMU, Paul Durrant
On Wed, Jun 24, 2020 at 08:52:44AM -0400, Jason Andryuk wrote:
> On Wed, Jun 24, 2020 at 8:30 AM Paul Durrant <xadimgnik@gmail.com> wrote:
> >
> > > -----Original Message-----
> > > From: Jason Andryuk <jandryuk@gmail.com>
> > > Sent: 24 June 2020 13:20
> > > To: Stefano Stabellini <sstabellini@kernel.org>; Anthony Perard <anthony.perard@citrix.com>; Paul
> > > Durrant <paul@xen.org>; xen-devel@lists.xenproject.org
> > > Cc: Jason Andryuk <jandryuk@gmail.com>; qemu-devel@nongnu.org
> > > Subject: [PATCH] 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.
> > >
> > > Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
> >
> > 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:
Fixes: 81cb05732efb ("qdev: Assert devices are plugged into a bus that can take them")
Thanks,
--
Anthony PERARD
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-30 13:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 12:19 [PATCH] xen: Fix xen-legacy-backend qdev types Jason Andryuk
2020-06-24 12:30 ` Paul Durrant
2020-06-24 12:52 ` Jason Andryuk
2020-06-30 13:59 ` Anthony PERARD
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).