* Re: [Qemu-devel] [PATCH 4/4] vl: add -late-object to create QOM objects after machine init
[not found] ` <1340664222-25098-5-git-send-email-aliguori@us.ibm.com>
@ 2012-07-02 12:32 ` Paolo Bonzini
2012-07-02 12:35 ` Andreas Färber
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2012-07-02 12:32 UTC (permalink / raw)
To: Anthony Liguori
Cc: Kevin Wolf, Stefan Hajnoczi, qemu-devel, Markus Armbruster,
Amit Shah, Andreas Faerber
Il 26/06/2012 00:43, Anthony Liguori ha scritto:
> In order to create qdev objects via -late-object, we almost always have to
> specify the parent_bus which is usually created during machine init. Until we
> properly support two stage init, introduce a -late-object option that allows for
> creation of objects post-machine init.
This is only needed for -device, no? So we can avoid introducing it and
just use -device.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 2/4] qdev: add realized property and make adding child bus implied by realize
[not found] ` <1340664222-25098-3-git-send-email-aliguori@us.ibm.com>
@ 2012-07-02 12:32 ` Paolo Bonzini
0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-07-02 12:32 UTC (permalink / raw)
To: Anthony Liguori
Cc: Kevin Wolf, Stefan Hajnoczi, qemu-devel, Markus Armbruster,
Amit Shah, Andreas Faerber
Why does this lack recursive realization?
(I'm not top posting, I'm replying to the commit message. :))
Paolo
Il 26/06/2012 00:43, Anthony Liguori ha scritto:
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
> hw/qdev.c | 36 +++++++++++++++++++++++++++++++++++-
> 1 files changed, 35 insertions(+), 1 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index a6c4c02..d305128 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -101,7 +101,6 @@ static void bus_add_child(BusState *bus, DeviceState *child)
> void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
> {
> dev->parent_bus = bus;
> - bus_add_child(bus, dev);
> }
>
> /* Create a new device. This only initializes the device state structure
> @@ -157,6 +156,10 @@ int qdev_init(DeviceState *dev)
>
> assert(dev->state == DEV_STATE_CREATED);
>
> + if (dev->parent_bus) {
> + bus_add_child(dev->parent_bus, dev);
> + }
> +
> rc = dc->init(dev);
> if (rc < 0) {
> object_unparent(OBJECT(dev));
> @@ -663,6 +666,33 @@ void qdev_property_add_static(DeviceState *dev, Property *prop,
> assert_no_error(local_err);
> }
>
> +static bool qdev_prop_get_realized(Object *obj, Error **errp)
> +{
> + DeviceState *dev = DEVICE(obj);
> +
> + return (dev->state == DEV_STATE_INITIALIZED);
> +}
> +
> +static void qdev_prop_set_realized(Object *obj, bool value, Error **errp)
> +{
> + DeviceState *dev = DEVICE(obj);
> + bool realized = (dev->state == DEV_STATE_INITIALIZED);
> +
> + if (realized == value) {
> + return;
> + }
> +
> + if (realized && !value) {
> + error_set(errp, QERR_PERMISSION_DENIED);
> + return;
> + }
> +
> + if (qdev_init(dev) < 0) {
> + error_set(errp, QERR_DEVICE_INIT_FAILED, "");
> + return;
> + }
> +}
> +
> static void device_initfn(Object *obj)
> {
> DeviceState *dev = DEVICE(obj);
> @@ -687,6 +717,10 @@ static void device_initfn(Object *obj)
> } while (class != object_class_by_name(TYPE_DEVICE));
> qdev_prop_set_globals(dev);
>
> + object_property_add_bool(obj, "realized",
> + qdev_prop_get_realized, qdev_prop_set_realized,
> + NULL);
> +
> object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS,
> (Object **)&dev->parent_bus, NULL);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] vl: add -late-object to create QOM objects after machine init
2012-07-02 12:32 ` [Qemu-devel] [PATCH 4/4] vl: add -late-object to create QOM objects after machine init Paolo Bonzini
@ 2012-07-02 12:35 ` Andreas Färber
2012-09-18 23:07 ` Anthony Liguori
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Färber @ 2012-07-02 12:35 UTC (permalink / raw)
To: Anthony Liguori
Cc: Kevin Wolf, Stefan Hajnoczi, qemu-devel, Markus Armbruster,
Amit Shah, Paolo Bonzini
Am 02.07.2012 14:32, schrieb Paolo Bonzini:
> Il 26/06/2012 00:43, Anthony Liguori ha scritto:
>> In order to create qdev objects via -late-object, we almost always have to
>> specify the parent_bus which is usually created during machine init. Until we
>> properly support two stage init, introduce a -late-object option that allows for
>> creation of objects post-machine init.
>
> This is only needed for -device, no? So we can avoid introducing it and
> just use -device.
+1, was thinking along the same lines...
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] vl: add -late-object to create QOM objects after machine init
2012-07-02 12:35 ` Andreas Färber
@ 2012-09-18 23:07 ` Anthony Liguori
2012-09-19 7:27 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2012-09-18 23:07 UTC (permalink / raw)
To: Andreas Färber
Cc: Kevin Wolf, Stefan Hajnoczi, qemu-devel, Markus Armbruster,
Amit Shah, Paolo Bonzini
Andreas Färber <afaerber@suse.de> writes:
> Am 02.07.2012 14:32, schrieb Paolo Bonzini:
>> Il 26/06/2012 00:43, Anthony Liguori ha scritto:
>>> In order to create qdev objects via -late-object, we almost always have to
>>> specify the parent_bus which is usually created during machine init. Until we
>>> properly support two stage init, introduce a -late-object option that allows for
>>> creation of objects post-machine init.
>>
>> This is only needed for -device, no? So we can avoid introducing it and
>> just use -device.
>
> +1, was thinking along the same lines...
Sorry for such a delayed response...
The semantics of how -device is different in that it implies realize.
Regards,
Anthony Liguori
>
> Andreas
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] vl: add -late-object to create QOM objects after machine init
2012-09-18 23:07 ` Anthony Liguori
@ 2012-09-19 7:27 ` Paolo Bonzini
0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-09-19 7:27 UTC (permalink / raw)
To: Anthony Liguori
Cc: Kevin Wolf, Stefan Hajnoczi, Markus Armbruster, qemu-devel,
Amit Shah, Andreas Färber
Il 19/09/2012 01:07, Anthony Liguori ha scritto:
>>>> In order to create qdev objects via -late-object, we almost always have to
>>>> >>> specify the parent_bus which is usually created during machine init. Until we
>>>> >>> properly support two stage init, introduce a -late-object option that allows for
>>>> >>> creation of objects post-machine init.
>>> >>
>>> >> This is only needed for -device, no? So we can avoid introducing it and
>>> >> just use -device.
>> >
>> > +1, was thinking along the same lines...
> Sorry for such a delayed response...
>
> The semantics of how -device is different in that it implies realize.
Yes, all I'm saying is, I don't see a need for -late-object since it is
only needed for devices and we have a separate method to create them.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-19 7:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1340664222-25098-1-git-send-email-aliguori@us.ibm.com>
[not found] ` <1340664222-25098-5-git-send-email-aliguori@us.ibm.com>
2012-07-02 12:32 ` [Qemu-devel] [PATCH 4/4] vl: add -late-object to create QOM objects after machine init Paolo Bonzini
2012-07-02 12:35 ` Andreas Färber
2012-09-18 23:07 ` Anthony Liguori
2012-09-19 7:27 ` Paolo Bonzini
[not found] ` <1340664222-25098-3-git-send-email-aliguori@us.ibm.com>
2012-07-02 12:32 ` [Qemu-devel] [PATCH 2/4] qdev: add realized property and make adding child bus implied by realize Paolo Bonzini
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).