[libvirt] [PATCH 08/11] qemu: format CCID controllers after USB hubs

Ján Tomko jtomko at redhat.com
Wed Jan 16 07:56:13 UTC 2019


Since they go on the USB bus, format them after USB hubs.

https://bugzilla.redhat.com/show_bug.cgi?id=1375402

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/qemu/qemu_command.c                                   | 8 +++++++-
 tests/qemuxml2argvdata/chardev-reconnect.args             | 2 +-
 tests/qemuxml2argvdata/controller-order.args              | 2 +-
 tests/qemuxml2argvdata/name-escape.args                   | 2 +-
 tests/qemuxml2argvdata/smartcard-controller.args          | 2 +-
 .../smartcard-host-certificates-database.args             | 2 +-
 tests/qemuxml2argvdata/smartcard-host-certificates.args   | 2 +-
 tests/qemuxml2argvdata/smartcard-host.args                | 2 +-
 .../qemuxml2argvdata/smartcard-passthrough-spicevmc.args  | 2 +-
 tests/qemuxml2argvdata/smartcard-passthrough-tcp.args     | 2 +-
 tests/qemuxml2argvdata/user-aliases.args                  | 2 +-
 11 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 91c7ec5f7b..7aafe235e2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3197,6 +3197,9 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
          * one. Likewise, we don't do anything for the primary IDE
          * controller on an i440fx machine or primary SATA on q35, but
          * we do add those beyond these two exceptions.
+         *
+         * CCID controllers are formated separately after USB hubs,
+         * because they go on the USB bus.
          */
         VIR_DOMAIN_CONTROLLER_TYPE_PCI,
         VIR_DOMAIN_CONTROLLER_TYPE_USB,
@@ -3204,7 +3207,6 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
         VIR_DOMAIN_CONTROLLER_TYPE_IDE,
         VIR_DOMAIN_CONTROLLER_TYPE_SATA,
         VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL,
-        VIR_DOMAIN_CONTROLLER_TYPE_CCID,
     };
     int ret = -1;
 
@@ -10602,6 +10604,10 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
     if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0)
         goto error;
 
+    if (qemuBuildControllersByTypeCommandLine(cmd, def, qemuCaps,
+                                              VIR_DOMAIN_CONTROLLER_TYPE_CCID) < 0)
+        goto error;
+
     if (qemuBuildDisksCommandLine(cmd, def, qemuCaps) < 0)
         goto error;
 
diff --git a/tests/qemuxml2argvdata/chardev-reconnect.args b/tests/qemuxml2argvdata/chardev-reconnect.args
index e88e083291..baff469c7b 100644
--- a/tests/qemuxml2argvdata/chardev-reconnect.args
+++ b/tests/qemuxml2argvdata/chardev-reconnect.args
@@ -22,8 +22,8 @@ server,nowait \
 -no-acpi \
 -device virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa \
 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x3 \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -chardev socket,id=charsmartcard0,path=/tmp/channel/asdf,reconnect=20 \
 -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \
 -chardev socket,id=charchannel0,host=localhost,port=1234,reconnect=10 \
diff --git a/tests/qemuxml2argvdata/controller-order.args b/tests/qemuxml2argvdata/controller-order.args
index 2477cd2e1c..6bb4942223 100644
--- a/tests/qemuxml2argvdata/controller-order.args
+++ b/tests/qemuxml2argvdata/controller-order.args
@@ -21,8 +21,8 @@ nowait \
 -boot menu=off \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 \
--device usb-ccid,id=ccid0,bus=usb.0,port=1.1 \
 -device usb-hub,id=hub0,bus=usb.0,port=1 \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1.1 \
 -drive file=/tmp/fdr.img,format=raw,if=none,id=drive-virtio-disk0,cache=none,\
 aio=native \
 -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,\
diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvdata/name-escape.args
index 58f284014c..d314ed409a 100644
--- a/tests/qemuxml2argvdata/name-escape.args
+++ b/tests/qemuxml2argvdata/name-escape.args
@@ -22,8 +22,8 @@ bar=2/monitor.sock,server,nowait \
 -no-shutdown \
 -no-acpi \
 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -drive file=/dev/HostVG/QEMUGuest1,format=qcow2,if=none,id=drive-ide0-0-0,\
 cache=none,throttling.bps-total=5000,throttling.iops-total=6000,\
 throttling.bps-total-max=10000,throttling.iops-total-max=11000,\
diff --git a/tests/qemuxml2argvdata/smartcard-controller.args b/tests/qemuxml2argvdata/smartcard-controller.args
index 1a654cb4e1..4c5286dd87 100644
--- a/tests/qemuxml2argvdata/smartcard-controller.args
+++ b/tests/qemuxml2argvdata/smartcard-controller.args
@@ -20,7 +20,7 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -device ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ccid0.0 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/smartcard-host-certificates-database.args b/tests/qemuxml2argvdata/smartcard-host-certificates-database.args
index 17fb50699a..1056f52cfa 100644
--- a/tests/qemuxml2argvdata/smartcard-host-certificates-database.args
+++ b/tests/qemuxml2argvdata/smartcard-host-certificates-database.args
@@ -20,8 +20,8 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -device ccid-card-emulated,backend=certificates,cert1=cert1,cert2=cert2,\
 cert3=cert3,db=/tmp/foo,id=smartcard0,bus=ccid0.0 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/smartcard-host-certificates.args b/tests/qemuxml2argvdata/smartcard-host-certificates.args
index 489299a475..6bfb56b94b 100644
--- a/tests/qemuxml2argvdata/smartcard-host-certificates.args
+++ b/tests/qemuxml2argvdata/smartcard-host-certificates.args
@@ -20,8 +20,8 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -device ccid-card-emulated,backend=certificates,cert1=cert1,cert2=cert2,\
 cert3=cert3,db=/etc/pki/nssdb,id=smartcard0,bus=ccid0.0 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/smartcard-host.args b/tests/qemuxml2argvdata/smartcard-host.args
index 1a654cb4e1..4c5286dd87 100644
--- a/tests/qemuxml2argvdata/smartcard-host.args
+++ b/tests/qemuxml2argvdata/smartcard-host.args
@@ -20,7 +20,7 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -device ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ccid0.0 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args b/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args
index 8784a3ffaa..9fbc86bce7 100644
--- a/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args
+++ b/tests/qemuxml2argvdata/smartcard-passthrough-spicevmc.args
@@ -20,8 +20,8 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -chardev spicevmc,id=charsmartcard0,name=smartcard \
 -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/smartcard-passthrough-tcp.args b/tests/qemuxml2argvdata/smartcard-passthrough-tcp.args
index e55126c206..12c03ad4b6 100644
--- a/tests/qemuxml2argvdata/smartcard-passthrough-tcp.args
+++ b/tests/qemuxml2argvdata/smartcard-passthrough-tcp.args
@@ -20,8 +20,8 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -no-acpi \
--device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -usb \
+-device usb-ccid,id=ccid0,bus=usb.0,port=1 \
 -chardev socket,id=charsmartcard0,host=127.0.0.1,port=2001,server,nowait \
 -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/user-aliases.args b/tests/qemuxml2argvdata/user-aliases.args
index 089a7d8d4b..7fd3b4a6e1 100644
--- a/tests/qemuxml2argvdata/user-aliases.args
+++ b/tests/qemuxml2argvdata/user-aliases.args
@@ -35,9 +35,9 @@ server,nowait \
 -global PIIX4_PM.disable_s3=0 \
 -global PIIX4_PM.disable_s4=0 \
 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x8 \
+-usb \
 -device usb-ccid,id=ua-myCCID,bus=ua-SomeWeirdController.0,port=1 \
 -device usb-ccid,id=ua-myCCID2,bus=ua-SomeWeirdController.0,port=2 \
--usb \
 -drive file=/var/lib/libvirt/images/fd.img,format=raw,if=none,\
 id=drive-ua-myDisk1,cache=none \
 -drive file=/var/lib/libvirt/images/gentoo.qcow2,format=qcow2,if=none,\
-- 
2.20.1




More information about the libvir-list mailing list