From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Thomas Huth" <thuth@redhat.com>,
"Michael Tokarev" <mjt@tls.msk.ru>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [PATCH 2/3] hw/qdev: Introduce BusClass::is_full() handler
Date: Tue, 7 Jul 2026 10:40:49 +0200 [thread overview]
Message-ID: <20260707084050.32137-3-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260707084050.32137-1-philmd@oss.qualcomm.com>
Allow BusClass implementation to have their own is_full() handler.
Use it in qbus_is_full().
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/core/qdev.h | 5 +++++
system/qdev-monitor.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h
index e1476223411..c1c17bd6f2b 100644
--- a/include/hw/core/qdev.h
+++ b/include/hw/core/qdev.h
@@ -345,6 +345,11 @@ struct BusClass {
*/
bool (*check_address)(BusState *bus, DeviceState *dev, Error **errp);
+ /*
+ * Return whether more devices can be plugged into @bus.
+ */
+ bool (*is_full)(const BusState *bus);
+
BusRealize realize;
BusUnrealize unrealize;
diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 00fed791cce..496850bd8ed 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -454,6 +454,9 @@ static inline bool qbus_is_full(BusState *bus)
return true;
}
bus_class = BUS_GET_CLASS(bus);
+ if (bus_class->is_full && bus_class->is_full(bus)) {
+ return true;
+ }
return bus_class->max_dev && bus->num_children >= bus_class->max_dev;
}
--
2.53.0
next prev parent reply other threads:[~2026-07-07 8:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 8:40 [PATCH 0/3] hw/pci: Consider reserved slots mask when checking PCI bus is full Philippe Mathieu-Daudé
2026-07-07 8:40 ` [PATCH 1/3] hw/pci: Have various pci_bus*() methods take a const PCIBus argument Philippe Mathieu-Daudé
2026-07-07 9:11 ` Thomas Huth
2026-07-07 8:40 ` Philippe Mathieu-Daudé [this message]
2026-07-07 8:40 ` [PATCH 3/3] hw/pci: Consider reserved slots mask when checking PCI bus is full Philippe Mathieu-Daudé
2026-07-07 10:20 ` Michael S. Tsirkin
2026-07-07 12:53 ` Philippe Mathieu-Daudé
2026-07-07 13:43 ` Michael S. Tsirkin
2026-07-07 22:05 ` [PATCH 0/3] " Mark Cave-Ayland
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=20260707084050.32137-3-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=atar4qemu@gmail.com \
--cc=berrange@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mjt@tls.msk.ru \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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.