All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: "Markus Armbruster" <armbru@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: ensuring a machine's buses have unique names
Date: Thu, 12 Aug 2021 12:05:36 +0100	[thread overview]
Message-ID: <CAFEAcA8Q2XEANtKfk_Ak2GgeM8b_=kf_qduLztCuL=E_k36FWg@mail.gmail.com> (raw)

What's the right way to ensure that when a machine has multiple
buses of the same type (eg multiple i2c controllers, multiple
sd card controllers) they all get assigned unique names so that
the user can use '-device ...,bus=some-name' to put a device on a
specific bus?

For instance in hw/arm/xlnx-zynqmp.c, the SoC object creates
a set of alias properties on the SoC for the sd-bus buses that
its 4 SD card controllers create. The alias properties are named
"sd-bus%d" so they are unique. This works, but it's kind of error-prone
because you need each machine model to remember to create these
aliases when necessary.

mps3-an524 is an example of a machine that fails to do this
for its i2c buses, and therefore the user can't usefully
tell QEMU which bus to plug a command-line created i2c bus into.

Ideally we should make buses get unique names by default
and also assert() at startup that there aren't any duplicated
names, I think.

Side note: is there a way to mark a bus as "do not consider
this when plugging devices where the user did not specify
the bus themselves" ? Some of the i2c buses on that machine
are purely internal to the board (eg there's one that has
the touchscreen controller hanging off it and nothing else),
and some are "this i2c bus is connected to the expansion port",
so ideally if no bus is specified we would want to prefer
the expansion-port i2c bus, not the ones that are internal-only.

thanks
-- PMM


             reply	other threads:[~2021-08-12 11:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 11:05 Peter Maydell [this message]
2021-08-26 13:00 ` ensuring a machine's buses have unique names Peter Maydell
2021-08-26 14:08 ` Markus Armbruster
2021-09-14 15:25   ` Peter Maydell
2021-09-15  4:28     ` Markus Armbruster
2021-09-21 13:20       ` Peter Maydell
2021-09-21 15:48         ` BALATON Zoltan
2021-09-22  4:37           ` Markus Armbruster
2021-09-22  9:58             ` BALATON Zoltan
2021-09-22 13:07               ` Markus Armbruster
2021-09-22  7:02         ` Markus Armbruster
2021-09-22  8:14           ` Cédric Le Goater
2021-09-22  4:46     ` 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='CAFEAcA8Q2XEANtKfk_Ak2GgeM8b_=kf_qduLztCuL=E_k36FWg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=armbru@redhat.com \
    --cc=f4bug@amsat.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.