[PATCH 07/13] qemu: support new pci controller model "pcie-root-port"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is backed by the qemu device ioh3420.
---
 src/qemu/qemu_command.c                              | 20 ++++++++++++++++++++
 .../qemuxml2argv-pcie-root-port.args                 | 10 ++++++++++
 tests/qemuxml2argvtest.c                             |  7 +++++++
 3 files changed, 37 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4952797..01ac690 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1598,6 +1598,12 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
                  */
                 flags = VIR_PCI_CONNECT_TYPE_PCIE;
                 break;
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
+                /* pcie-root-port can only connect to pcie-root, isn't
+                 * hot-pluggable
+                 */
+                flags = VIR_PCI_CONNECT_TYPE_PCIE_ROOT;
+                break;
             default:
                 break;
             }
@@ -2345,6 +2351,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
                  */
                 flags = VIR_PCI_CONNECT_TYPE_PCIE;
                 break;
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
+                /* pcie-root-port can only plug into pcie-root */
+                flags = VIR_PCI_CONNECT_TYPE_PCIE_ROOT;
+                break;
             default:
                 flags = VIR_PCI_CONNECT_HOTPLUGGABLE | VIR_PCI_CONNECT_TYPE_PCI;
                 break;
@@ -4605,6 +4615,16 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
             }
             virBufferAsprintf(&buf, "i82801b11-bridge,id=%s", def->info.alias);
             break;
+        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("The pcie-root-port (ioh3420) controller "
+                                 "is not supported in this QEMU binary"));
+                goto error;
+            }
+            virBufferAsprintf(&buf, "ioh3420,port=%d,chassis=%d,id=%s",
+                              def->idx, def->idx, def->info.alias);
+            break;
         }
         break;
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
new file mode 100644
index 0000000..30bec85
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.args
@@ -0,0 +1,10 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm -S -M q35 -m 2048 -smp 2 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
+-device ioh3420,port=3,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
+-device ioh3420,port=4,chassis=4,id=pci.4,bus=pcie.0,addr=0x3 \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \
+-device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
+-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a90f9a6..999edff 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1461,6 +1461,13 @@ mymain(void)
             QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI,
             QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
+    DO_TEST("pcie-root-port",
+            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+            QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
 
     DO_TEST("hostdev-scsi-lsi", QEMU_CAPS_DRIVE,
             QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE,
-- 
2.1.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]