* [DISCUSSION] How to set properties of non-pluggable devices?
@ 2020-12-02 18:52 Doug Evans
2020-12-02 19:59 ` BALATON Zoltan via
2020-12-03 8:37 ` Gerd Hoffmann
0 siblings, 2 replies; 3+ messages in thread
From: Doug Evans @ 2020-12-02 18:52 UTC (permalink / raw)
To: QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]
Hi.
Suppose I want to set a property of a non-pluggable device that cannot be
set after the device has been realized (e.g., I can't use qmp to set the
property after QEMU has started).
Being non-pluggable means I can't use "-device foo,bar=baz" on the command
line.
[But I can use "-device foo,help" to list its properties :-) (if I also
specify -M bar) ]
How do people do this?
The device is part of a "machine" (board really), so I could add the
property to the machine to be passed on to the device when it's realized
(at least I think I can), but that doesn't feel right: The machine has lots
of devices -> it feels cleaner to associate the property with the device
and not the machine (lest the machine over time collect a myriad of random
properties to pass on to its devices). Things get a little complicated
because the machine can have multiple copies of a device: specifying the
device's name is insufficient.
The device has an object path: /machine/foo/bar/device[0]. There's also
/.../device[1].
IWBN to be able to do something along the lines of:
-device-property /device/path[,PROP1=VALUE1,...]
copying the syntax used for "-object".
It's perhaps even nicer if this could be accomplished with -device:
avoiding further confusion on what -device can and can't be used for (e.g.,
can I use -device-property to set a property that could also be set with
-device?).
If what I'm asking for is reasonable and isn't doable today (I'm certainly
willing to believe I'm missing something), I'm happy to work on the patch
(with some guidance as to what would be acceptable).
One thought that comes to mind is to use -object, store the properties
there, and have the machine collect them from there when realizing its
devices. Or is that an abuse of -object ?
[-- Attachment #2: Type: text/html, Size: 2463 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [DISCUSSION] How to set properties of non-pluggable devices?
2020-12-02 18:52 [DISCUSSION] How to set properties of non-pluggable devices? Doug Evans
@ 2020-12-02 19:59 ` BALATON Zoltan via
2020-12-03 8:37 ` Gerd Hoffmann
1 sibling, 0 replies; 3+ messages in thread
From: BALATON Zoltan via @ 2020-12-02 19:59 UTC (permalink / raw)
To: Doug Evans; +Cc: QEMU Developers
Hello,
On Wed, 2 Dec 2020, Doug Evans wrote:
> Hi.
>
> Suppose I want to set a property of a non-pluggable device that cannot be
> set after the device has been realized (e.g., I can't use qmp to set the
> property after QEMU has started).
> Being non-pluggable means I can't use "-device foo,bar=baz" on the command
> line.
> [But I can use "-device foo,help" to list its properties :-) (if I also
> specify -M bar) ]
>
> How do people do this?
I don't know but there's a -global option than may be what you need but I
never know how to use it. You may be able to find examples in the doc dir
or hopefully someone who knows it better will correct me.
Hope this helps or sorry if this is not the right answer.
Regards,
BALATON Zoltan
> The device is part of a "machine" (board really), so I could add the
> property to the machine to be passed on to the device when it's realized
> (at least I think I can), but that doesn't feel right: The machine has lots
> of devices -> it feels cleaner to associate the property with the device
> and not the machine (lest the machine over time collect a myriad of random
> properties to pass on to its devices). Things get a little complicated
> because the machine can have multiple copies of a device: specifying the
> device's name is insufficient.
>
> The device has an object path: /machine/foo/bar/device[0]. There's also
> /.../device[1].
> IWBN to be able to do something along the lines of:
> -device-property /device/path[,PROP1=VALUE1,...]
> copying the syntax used for "-object".
>
> It's perhaps even nicer if this could be accomplished with -device:
> avoiding further confusion on what -device can and can't be used for (e.g.,
> can I use -device-property to set a property that could also be set with
> -device?).
>
> If what I'm asking for is reasonable and isn't doable today (I'm certainly
> willing to believe I'm missing something), I'm happy to work on the patch
> (with some guidance as to what would be acceptable).
>
> One thought that comes to mind is to use -object, store the properties
> there, and have the machine collect them from there when realizing its
> devices. Or is that an abuse of -object ?
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [DISCUSSION] How to set properties of non-pluggable devices?
2020-12-02 18:52 [DISCUSSION] How to set properties of non-pluggable devices? Doug Evans
2020-12-02 19:59 ` BALATON Zoltan via
@ 2020-12-03 8:37 ` Gerd Hoffmann
1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2020-12-03 8:37 UTC (permalink / raw)
To: Doug Evans; +Cc: QEMU Developers
Hi,
> Being non-pluggable means I can't use "-device foo,bar=baz" on the command
> line.
> [But I can use "-device foo,help" to list its properties :-) (if I also
> specify -M bar) ]
>
> How do people do this?
There is -global. This sets properties for all instances of a given
device. If there is only one instance of your built-in device you can
use that to set the properties. A bit hackish, but works and has been
the only way to do it for a long time.
These days we typically add an alias to the machine type, examples are
pflash{0,1} and pcspk-audiodev for the pc machine type which configure
the builtin flash and pc speaker devices.
take care,
Gerd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-03 8:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-02 18:52 [DISCUSSION] How to set properties of non-pluggable devices? Doug Evans
2020-12-02 19:59 ` BALATON Zoltan via
2020-12-03 8:37 ` Gerd Hoffmann
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).