On 9/3/21 5:14 PM, Peter Maydell wrote:
By default, QEMU will allow devices to be plugged into a bus up to
the bus class's device count limit.  If the user creates a device on
the command line or via the monitor and doesn't explicitly specify
the bus to plug it in, QEMU will plug it into the first non-full bus
that it finds.

This is fine in most cases, but some machines have multiple buses of
a given type, some of which are dedicated to on-board devices and
some of which have an externally exposed connector for user-pluggable
devices. One example is I2C buses.

Provide a new function qbus_mark_full() so that a machine model can
mark this kind of "internal only" bus as 'full' after it has created
all the devices that should be plugged into that bus. The "find a
non-full bus" algorithm will then skip the internal-only bus when
looking for a place to plug in user-created devices.

Signed-off-by: Peter Maydell<[email protected]>
---
  include/hw/qdev-core.h | 24 ++++++++++++++++++++++++
  softmmu/qdev-monitor.c |  7 ++++++-
  2 files changed, 30 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <[email protected]>

r~

Reply via email to