qemu-devel.nongnu.org archive mirror
 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>
Subject: [Qemu-devel] inconsistency between device traversal in qdev and legacy
Date: Wed, 8 Jun 2011 16:07:26 +0100	[thread overview]
Message-ID: <BANLkTinetbWq7xCVFHvYhL_kwc_-xuY+rg@mail.gmail.com> (raw)

If you have a model with more than one USB bus, and you
create a USB device on the command line without specifying
which bus to plug it into, QEMU will choose a different bus
depending on whether you use the legacy "-usbdevice keyboard"
or the qdev "-device usb-kbd".

This is because the legacy option finds the USB bus with
usb_bus_find(), which searches the 'busses' list, which is
populated by usb_bus_new(), with each new bus added to the
tail of the list. The qdev option looks for the USB bus
with qbus_find_recursive(), which walks the qdev tree.
Since qbus_create_inplace() adds each new child bus to
the front of the parent's child_bus list, this means that
qbus_find_recursive() will encounter the last-added bus
first, whereas usb_bus_find() will get the first-added bus.

I assume this is likely to apply to other bus types as well.

Is there anything we can do to fix this inconsistency [*],
or are we tied to the existing enumeration orders in both
cases for compatibility with users with currently-working
command lines or configurations?

[*] the actual code changes are simple enough, obviously

-- PMM

             reply	other threads:[~2011-06-08 15:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08 15:07 Peter Maydell [this message]
2011-06-08 17:00 ` [Qemu-devel] inconsistency between device traversal in qdev and legacy Gerd Hoffmann
2011-06-08 17:37   ` Andreas Färber
2011-06-08 17:39     ` Peter Maydell
2011-06-08 18:19       ` Rob Landley
2011-06-08 19:06       ` Andreas Färber
2011-06-09 13:59   ` Markus Armbruster
2011-06-09 14:12     ` Gerd Hoffmann
2011-06-09 14:32     ` Peter Maydell

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=BANLkTinetbWq7xCVFHvYhL_kwc_-xuY+rg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=armbru@redhat.com \
    --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 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).