From: Markus Armbruster <armbru@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Max Reitz" <mreitz@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: Configuring onboard devices
Date: Thu, 30 Apr 2020 17:20:05 +0200 [thread overview]
Message-ID: <877dxxc862.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <c1fa0770-a07f-e5bc-9db8-6af0576c365f@ilande.co.uk> (Mark Cave-Ayland's message of "Thu, 30 Apr 2020 15:32:31 +0100")
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> writes:
> On 30/04/2020 15:11, Markus Armbruster wrote:
>
>> Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> writes:
>>
>>> On 30/04/2020 11:03, Markus Armbruster wrote:
>>>> Peter Maydell <peter.maydell@linaro.org> writes:
>>>>
>>>>> On Thu, 30 Apr 2020 at 08:09, Markus Armbruster <armbru@redhat.com> wrote:
>>>>>> Our means to configure onboard devices are weak. We sidestepped this
>>>>>> for isa-fdc by taking it off the board, and thus make -device work.
>>>>>
>>>>> This seems to be a general dynamic: the x86 pc machine works
>>>>> via -device options (or is changed so it can work that way);
>>>>> and then people propose dropping/deprecating/etc the config
>>>>> options that work with onboard devices, without providing
>>>>> clear solutions/instructions on how the command line needs
>>>>> to change/etc for the mass of boards which are not the x86
>>>>> pc machine and which do have a lot of onboard devices which
>>>>> can't be handled via -device.
>>>>>
>>>>> So my gut reaction to the "we should deprecate -global"
>>>>> suggestions in this thread was a bit "here we go again"...
>>>>> What works for x86 or even "what is sufficient for libvirt"
>>>>> doesn't necessarily cover all the cases.
>>>>
>>>> Such shortsighted proposals have been made, but don't think it's what
>>>> we're doing here.
>>>>
>>>> You're 100% right in that we do need to configure onboard devices.
>>>> -global is a terrible way to do it, though: it applies to *all* devices
>>>> of a kind. What if the board has more than one? What if the can add
>>>> more?
>>>>
>>>> Taking onboard devices off the board can occasionally sidestep the
>>>> issue. For isa-fdc, we genuinely *wanted* to take the damn thing off,
>>>> because all it did for most users was provide them with VENOM. Not
>>>> needing -global for it anymore was just a nice bonus.
>>>>
>>>> Taking onboard devices off just to reduce the device configuration
>>>> problem to a solved one, namely -device, may be tempting (it was to me),
>>>> but it's too intrusive to be practical at scale.
>>>>
>>>> Adding machine properties that alias onboard device properties is less
>>>> intrusive. The ones I added were still a lot of work.
>>>>
>>>> Configuring onboard devices via machine properties restricts property
>>>> access to the ones we added to the machine. This differs from pluggable
>>>> devices, where users can access all properties.
>>>>
>>>> Any better ideas for letting users configure onboard devices?
>>>
>>> Is it possible to let machine owners add alias properties to the machine object
>>> referencing in-built devices? I could then instantiate my on-board nic in the machine
>>> init() function, and then use object_property_add_alias() to add a "nic0" alias on
>>> the machine that can be used to wire it up to a netdev using the command line.
>>
>> Have a look at hw/arm/virt.c's virt_flash_create(), from commit
>> e0561e60f1 "hw/arm/virt: Support firmware configuration with -blockdev".
>> It adds machine properties "pflash0" and "pflash1" as aliases for the
>> onboard flash memory devices' property "drive".
>>
>> Does this answer your question?
>
> Ah I see now, these aliases are for individual properties rather than objects. What I
> was trying to ask was if it were possible to have something like this:
>
> /machine (SS-5-machine)
> /builtin
> /nic0 -> link to "lance" device
>
> Here nic0 is an alias "published" by the maintainer of the SS-5 machine which is
> configured in the machine init() function using object_property_add_link() or a
> suitable wrapper. Users can then configure these builtin devices from the command
> line using your -machine nic0.netdev=my-netdev-id syntax or similar.
Got it now, thanks!
> Having the default devices under /builtin or other known QOM path would enable
> builtin devices to be easily enumerated programatically and/or from the command line
> as required.
There are three standard containers under /machine/:
* /machine/peripheral/
Devices with a user-specified ID go here, as /machine/peripheral/ID.
User-specified means -device or device_add.
/machine/peripheral/ID is effectively a stable interface. It's just
underdocumented (undocumented?).
To be useful, the stuff below ID/ needed to be stable and documented,
too.
* /machine/peripheral-anon/
Same, but user elected not to give an ID.
/machine/peripheral-anon/device[N], where N counts up from zero in
creation order.
N is obviously not stable, but this is a problem of the user's making.
If you want to refer to a device, give it an ID.
* /machine/unattached/
The orphanage. When a device has no parent when its realized, it gets
put here, as /machine/unattached/device[N], where N counts up from
zero in realization order.
N is obviously not stable, and this time we can't blame the
victim^Wuser. You can search for devices of a certain type.
Sometimes that's good enough.
All the onboard devices are here, and much more. We've fathered a lot
of unloved red-headed children, it seems...
Some of the "much more" is due to sloppy modelling, i.e. neglecting to
set the proper parent.
I figure we could put onboard devices in a nicer place, with nicer
names. Need a convention for the place and the names, then make board
code conform to it.
next prev parent reply other threads:[~2020-04-30 15:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 15:28 Failing property setters + hardwired devices + -global = a bad day Markus Armbruster
2020-04-29 15:39 ` Paolo Bonzini
2020-04-29 16:23 ` Eduardo Habkost
2020-04-29 15:57 ` Daniel P. Berrangé
2020-04-30 7:09 ` Markus Armbruster
2020-04-30 9:27 ` Peter Maydell
2020-04-30 10:03 ` Configuring onboard devices (was: Failing property setters + hardwired devices + -global = a bad day) Markus Armbruster
2020-04-30 10:29 ` Mark Cave-Ayland
2020-04-30 14:11 ` Configuring onboard devices Markus Armbruster
2020-04-30 14:32 ` Mark Cave-Ayland
2020-04-30 15:20 ` Markus Armbruster [this message]
2020-04-30 16:56 ` Mark Cave-Ayland
2020-05-02 5:47 ` Markus Armbruster
2020-05-03 22:13 ` Mark Cave-Ayland
2020-05-04 16:30 ` Eduardo Habkost
2020-04-30 10:34 ` Configuring onboard devices (was: Failing property setters + hardwired devices + -global = a bad day) Daniel P. Berrangé
2020-04-30 10:45 ` Peter Maydell
2020-04-30 10:53 ` Daniel P. Berrangé
2020-04-30 14:38 ` Configuring onboard devices Markus Armbruster
2020-04-30 10:54 ` Configuring onboard devices (was: Failing property setters + hardwired devices + -global = a bad day) Mark Cave-Ayland
2020-04-30 14:27 ` Configuring onboard devices Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877dxxc862.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=jasowang@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.