* [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness
@ 2020-07-07 3:33 Philippe Mathieu-Daudé
2020-07-07 3:36 ` Philippe Mathieu-Daudé
2020-07-07 9:47 ` Paolo Bonzini
0 siblings, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-07 3:33 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé,
Eduardo Habkost, Richard Henderson, Philippe Mathieu-Daudé,
Markus Armbruster, Paolo Bonzini
Since commit 510ef98dca5, qdev_realize() aborts if bus-less device
is realized on a bus. While commits 514db7710b..007d1dbf72 took
care of converting all mainstream uses, QEMU forks weren't. These
forks are usually maintained by hobbyist with interest in following
mainstream development, but with limited time, so usually rebase
from time to time. To avoid them to spend time on debugging and
reading git-log history, display a kind hint about what is wrong.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Since v2:
- scratch __func__ (armbru)
- reword to justify this is not an impossible case (armbru)
---
hw/core/qdev.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 2131c7f951..a16f1270f1 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -392,8 +392,11 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp)
if (bus) {
qdev_set_parent_bus(dev, bus);
- } else {
- assert(!DEVICE_GET_CLASS(dev)->bus_type);
+ } else if (DEVICE_GET_CLASS(dev)->bus_type) {
+ error_setg(errp, "Unexpected bus '%s' for bus-less device '%s'",
+ DEVICE_GET_CLASS(dev)->bus_type,
+ object_get_typename(OBJECT(dev)));
+ return false;
}
object_property_set_bool(OBJECT(dev), true, "realized", &err);
--
2.21.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness
2020-07-07 3:33 [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness Philippe Mathieu-Daudé
@ 2020-07-07 3:36 ` Philippe Mathieu-Daudé
2020-07-07 9:47 ` Paolo Bonzini
1 sibling, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-07 3:36 UTC (permalink / raw)
To: qemu-devel
Cc: Richard Henderson, Paolo Bonzini, Daniel P. Berrangé,
Eduardo Habkost, Markus Armbruster
On 7/7/20 5:33 AM, Philippe Mathieu-Daudé wrote:
> Since commit 510ef98dca5, qdev_realize() aborts if bus-less device
> is realized on a bus. While commits 514db7710b..007d1dbf72 took
> care of converting all mainstream uses, QEMU forks weren't. These
I guess I missed "weren't [converted]".
> forks are usually maintained by hobbyist with interest in following
> mainstream development, but with limited time, so usually rebase
> from time to time. To avoid them to spend time on debugging and
> reading git-log history, display a kind hint about what is wrong.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Since v2:
> - scratch __func__ (armbru)
> - reword to justify this is not an impossible case (armbru)
> ---
> hw/core/qdev.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 2131c7f951..a16f1270f1 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -392,8 +392,11 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp)
>
> if (bus) {
> qdev_set_parent_bus(dev, bus);
> - } else {
> - assert(!DEVICE_GET_CLASS(dev)->bus_type);
> + } else if (DEVICE_GET_CLASS(dev)->bus_type) {
> + error_setg(errp, "Unexpected bus '%s' for bus-less device '%s'",
> + DEVICE_GET_CLASS(dev)->bus_type,
> + object_get_typename(OBJECT(dev)));
> + return false;
> }
>
> object_property_set_bool(OBJECT(dev), true, "realized", &err);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness
2020-07-07 3:33 [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness Philippe Mathieu-Daudé
2020-07-07 3:36 ` Philippe Mathieu-Daudé
@ 2020-07-07 9:47 ` Paolo Bonzini
2020-07-27 17:55 ` Philippe Mathieu-Daudé
1 sibling, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2020-07-07 9:47 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Daniel P. Berrangé,
Richard Henderson, Eduardo Habkost, Markus Armbruster
On 07/07/20 05:33, Philippe Mathieu-Daudé wrote:
> Since commit 510ef98dca5, qdev_realize() aborts if bus-less device
> is realized on a bus. While commits 514db7710b..007d1dbf72 took
> care of converting all mainstream uses, QEMU forks weren't. These
> forks are usually maintained by hobbyist with interest in following
> mainstream development, but with limited time, so usually rebase
> from time to time. To avoid them to spend time on debugging and
> reading git-log history, display a kind hint about what is wrong.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Since v2:
> - scratch __func__ (armbru)
> - reword to justify this is not an impossible case (armbru)
> ---
> hw/core/qdev.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 2131c7f951..a16f1270f1 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -392,8 +392,11 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp)
>
> if (bus) {
> qdev_set_parent_bus(dev, bus);
> - } else {
> - assert(!DEVICE_GET_CLASS(dev)->bus_type);
> + } else if (DEVICE_GET_CLASS(dev)->bus_type) {
> + error_setg(errp, "Unexpected bus '%s' for bus-less device '%s'",
> + DEVICE_GET_CLASS(dev)->bus_type,
> + object_get_typename(OBJECT(dev)));
> + return false;
> }
>
> object_property_set_bool(OBJECT(dev), true, "realized", &err);
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness
2020-07-07 9:47 ` Paolo Bonzini
@ 2020-07-27 17:55 ` Philippe Mathieu-Daudé
2020-07-28 7:46 ` Markus Armbruster
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-27 17:55 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
Cc: Richard Henderson, Daniel P. Berrangé,
Eduardo Habkost, Markus Armbruster
On 7/7/20 11:47 AM, Paolo Bonzini wrote:
> On 07/07/20 05:33, Philippe Mathieu-Daudé wrote:
>> Since commit 510ef98dca5, qdev_realize() aborts if bus-less device
>> is realized on a bus. While commits 514db7710b..007d1dbf72 took
>> care of converting all mainstream uses, QEMU forks weren't. These
>> forks are usually maintained by hobbyist with interest in following
>> mainstream development, but with limited time, so usually rebase
>> from time to time. To avoid them to spend time on debugging and
>> reading git-log history, display a kind hint about what is wrong.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> Since v2:
>> - scratch __func__ (armbru)
>> - reword to justify this is not an impossible case (armbru)
>> ---
>> hw/core/qdev.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>> index 2131c7f951..a16f1270f1 100644
>> --- a/hw/core/qdev.c
>> +++ b/hw/core/qdev.c
>> @@ -392,8 +392,11 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp)
>>
>> if (bus) {
>> qdev_set_parent_bus(dev, bus);
>> - } else {
>> - assert(!DEVICE_GET_CLASS(dev)->bus_type);
>> + } else if (DEVICE_GET_CLASS(dev)->bus_type) {
>> + error_setg(errp, "Unexpected bus '%s' for bus-less device '%s'",
>> + DEVICE_GET_CLASS(dev)->bus_type,
>> + object_get_typename(OBJECT(dev)));
>> + return false;
>> }
>>
>> object_property_set_bool(OBJECT(dev), true, "realized", &err);
>>
>
> Queued, thanks.
Thanks! I haven't see that and sent a v4 with example included &
typo fixed, if possible can you take it instead?
https://patchew.org/QEMU/20200727175112.6820-1-f4bug@amsat.org/
>
> Paolo
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness
2020-07-27 17:55 ` Philippe Mathieu-Daudé
@ 2020-07-28 7:46 ` Markus Armbruster
0 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2020-07-28 7:46 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Daniel P. Berrangé,
Richard Henderson, Philippe Mathieu-Daudé,
Eduardo Habkost, qemu-devel
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> On 7/7/20 11:47 AM, Paolo Bonzini wrote:
>> On 07/07/20 05:33, Philippe Mathieu-Daudé wrote:
>>> Since commit 510ef98dca5, qdev_realize() aborts if bus-less device
>>> is realized on a bus. While commits 514db7710b..007d1dbf72 took
>>> care of converting all mainstream uses, QEMU forks weren't. These
>>> forks are usually maintained by hobbyist with interest in following
>>> mainstream development, but with limited time, so usually rebase
>>> from time to time. To avoid them to spend time on debugging and
>>> reading git-log history, display a kind hint about what is wrong.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>> Since v2:
>>> - scratch __func__ (armbru)
>>> - reword to justify this is not an impossible case (armbru)
>>> ---
>>> hw/core/qdev.c | 7 +++++--
>>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>>> index 2131c7f951..a16f1270f1 100644
>>> --- a/hw/core/qdev.c
>>> +++ b/hw/core/qdev.c
>>> @@ -392,8 +392,11 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp)
>>>
>>> if (bus) {
>>> qdev_set_parent_bus(dev, bus);
>>> - } else {
>>> - assert(!DEVICE_GET_CLASS(dev)->bus_type);
>>> + } else if (DEVICE_GET_CLASS(dev)->bus_type) {
>>> + error_setg(errp, "Unexpected bus '%s' for bus-less device '%s'",
>>> + DEVICE_GET_CLASS(dev)->bus_type,
>>> + object_get_typename(OBJECT(dev)));
>>> + return false;
>>> }
>>>
>>> object_property_set_bool(OBJECT(dev), true, "realized", &err);
>>>
>>
>> Queued, thanks.
>
> Thanks! I haven't see that and sent a v4 with example included &
> typo fixed, if possible can you take it instead?
> https://patchew.org/QEMU/20200727175112.6820-1-f4bug@amsat.org/
Please also consider my objection in reply to v4.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-07-28 7:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 3:33 [PATCH v3] hw/core/qdev: Increase qdev_realize() kindness Philippe Mathieu-Daudé
2020-07-07 3:36 ` Philippe Mathieu-Daudé
2020-07-07 9:47 ` Paolo Bonzini
2020-07-27 17:55 ` Philippe Mathieu-Daudé
2020-07-28 7:46 ` Markus Armbruster
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.