aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2025-01-16 18:00:55 +0900
committerMichael S. Tsirkin <mst@redhat.com>2025-02-20 18:23:19 -0500
commitd966250e93c1194c0a4c775e08a8e23f2ef66cf8 (patch)
treeedd5eb5f8ac274bca548a60a2b240ae716044aaf
parentb77a2778d9bbefc6119331ce3083d85d69d7a0c1 (diff)
downloadqemu-d966250e93c1194c0a4c775e08a8e23f2ef66cf8.zip
qemu-d966250e93c1194c0a4c775e08a8e23f2ef66cf8.tar.gz
qemu-d966250e93c1194c0a4c775e08a8e23f2ef66cf8.tar.bz2
s390x/pci: Allow plugging SR-IOV devices
The guest cannot use VFs due to the lack of multifunction support but can use PFs. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-Id: <20250116-reuse-v20-4-7cb370606368@daynix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/s390x/s390-pci-bus.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 8c5eb69..c396d55 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -974,7 +974,14 @@ static void s390_pcihost_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
PCIDevice *pdev = PCI_DEVICE(dev);
- if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) {
+ /*
+ * Multifunction is not supported due to the lack of CLP. However,
+ * do not check for multifunction capability for SR-IOV devices because
+ * SR-IOV devices automatically add the multifunction capability whether
+ * the user intends to use the functions other than the PF.
+ */
+ if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION &&
+ !pdev->exp.sriov_cap) {
error_setg(errp, "multifunction not supported in s390");
return;
}