All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vl: Add opts to device opts list when using JSON syntax for -device
@ 2021-12-20  8:45 MkfsSion
  2021-12-21  8:25 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: MkfsSion @ 2021-12-20  8:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, MkfsSion

When using JSON syntax for -device, -set option can not find device
specified in JSON by id field. The following commandline is an example:

$ qemu-system-x86_64 -device '{"id":"foo"}' -set device.foo.bar=1
qemu-system-x86_64: -set device.foo.bar=1: there is no device "foo" defined

The patch adds device opts to device opts list when a device opts get
parsed.

Signed-off-by: MkfsSion <mkfssion@mkfssion.com>
---
 softmmu/vl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 620a1f1367..0dd5acbc1a 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3400,6 +3400,8 @@ void qemu_init(int argc, char **argv, char **envp)
                     loc_save(&opt->loc);
                     assert(opt->opts != NULL);
                     QTAILQ_INSERT_TAIL(&device_opts, opt, next);
+                    qemu_opts_from_qdict(qemu_find_opts_err("device", &error_fatal),
+                                         opt->opts, &error_fatal);
                 } else {
                     if (!qemu_opts_parse_noisily(qemu_find_opts("device"),
                                                  optarg, true)) {
-- 
2.34.1



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

* Re: [PATCH] vl: Add opts to device opts list when using JSON syntax for -device
  2021-12-20  8:45 [PATCH] vl: Add opts to device opts list when using JSON syntax for -device MkfsSion
@ 2021-12-21  8:25 ` Philippe Mathieu-Daudé
  2021-12-21 10:09   ` MkfsSion
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-21  8:25 UTC (permalink / raw)
  To: MkfsSion, qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster

Cc'ing Markus.

On 12/20/21 09:45, MkfsSion wrote:
> When using JSON syntax for -device, -set option can not find device
> specified in JSON by id field. The following commandline is an example:
> 
> $ qemu-system-x86_64 -device '{"id":"foo"}' -set device.foo.bar=1
> qemu-system-x86_64: -set device.foo.bar=1: there is no device "foo" defined
> 
> The patch adds device opts to device opts list when a device opts get
> parsed.
> 
> Signed-off-by: MkfsSion <mkfssion@mkfssion.com>

BTW per:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#patch-emails-must-include-a-signed-off-by-line
"Please use your real name to sign a patch (not an alias or acronym)."

> ---
>  softmmu/vl.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 620a1f1367..0dd5acbc1a 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -3400,6 +3400,8 @@ void qemu_init(int argc, char **argv, char **envp)
>                      loc_save(&opt->loc);
>                      assert(opt->opts != NULL);
>                      QTAILQ_INSERT_TAIL(&device_opts, opt, next);
> +                    qemu_opts_from_qdict(qemu_find_opts_err("device", &error_fatal),
> +                                         opt->opts, &error_fatal);
>                  } else {
>                      if (!qemu_opts_parse_noisily(qemu_find_opts("device"),
>                                                   optarg, true)) {



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

* Re: [PATCH] vl: Add opts to device opts list when using JSON syntax for -device
  2021-12-21  8:25 ` Philippe Mathieu-Daudé
@ 2021-12-21 10:09   ` MkfsSion
  0 siblings, 0 replies; 3+ messages in thread
From: MkfsSion @ 2021-12-21 10:09 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster

Sorry, the patch is not well tested and it causes duplicate devices creation. I have send another patch to the mailing list to fix the issue.

On 2021/12/21 16:25, Philippe Mathieu-Daudé wrote:
> Cc'ing Markus.
> 
> On 12/20/21 09:45, MkfsSion wrote:
>> When using JSON syntax for -device, -set option can not find device
>> specified in JSON by id field. The following commandline is an example:
>>
>> $ qemu-system-x86_64 -device '{"id":"foo"}' -set device.foo.bar=1
>> qemu-system-x86_64: -set device.foo.bar=1: there is no device "foo" defined
>>
>> The patch adds device opts to device opts list when a device opts get
>> parsed.
>>
>> Signed-off-by: MkfsSion <mkfssion@mkfssion.com>
> 
> BTW per:
> https://www.qemu.org/docs/master/devel/submitting-a-patch.html#patch-emails-must-include-a-signed-off-by-line
> "Please use your real name to sign a patch (not an alias or acronym)."
The issue has been fixed in new patch.
> 
>> ---
>>  softmmu/vl.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/softmmu/vl.c b/softmmu/vl.c
>> index 620a1f1367..0dd5acbc1a 100644
>> --- a/softmmu/vl.c
>> +++ b/softmmu/vl.c
>> @@ -3400,6 +3400,8 @@ void qemu_init(int argc, char **argv, char **envp)
>>                      loc_save(&opt->loc);
>>                      assert(opt->opts != NULL);
>>                      QTAILQ_INSERT_TAIL(&device_opts, opt, next);
>> +                    qemu_opts_from_qdict(qemu_find_opts_err("device", &error_fatal),
>> +                                         opt->opts, &error_fatal);
>>                  } else {
>>                      if (!qemu_opts_parse_noisily(qemu_find_opts("device"),
>>                                                   optarg, true)) {
> 


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

end of thread, other threads:[~2021-12-21 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20  8:45 [PATCH] vl: Add opts to device opts list when using JSON syntax for -device MkfsSion
2021-12-21  8:25 ` Philippe Mathieu-Daudé
2021-12-21 10:09   ` MkfsSion

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.