[PATCH 01/17] Format CCID controllers after USB hubs

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

 



They can be USB devices.
---
 src/qemu/qemu_command.c                            | 30 +++++++++++++++++++++-
 .../qemuxml2argv-smartcard-controller.args         |  2 +-
 .../qemuxml2argv-smartcard-host-certificates.args  |  2 +-
 .../qemuxml2argv-smartcard-host.args               |  2 +-
 ...emuxml2argv-smartcard-passthrough-spicevmc.args |  2 +-
 .../qemuxml2argv-smartcard-passthrough-tcp.args    |  2 +-
 6 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4a8def1..63b2672 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2773,6 +2773,30 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
 
 
 static int
+qemuBuildCCIDControllerCommandLine(virCommandPtr cmd,
+                                   const virDomainDef *def,
+                                   virQEMUCapsPtr qemuCaps)
+{
+    size_t i;
+
+    for (i = 0; i < def->ncontrollers; i++) {
+        virDomainControllerDefPtr cont = def->controllers[i];
+        char *devstr;
+
+        if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_CCID)
+            continue;
+
+        virCommandAddArg(cmd, "-device");
+        if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps, NULL)))
+            return -1;
+        virCommandAddArg(cmd, devstr);
+        VIR_FREE(devstr);
+    }
+    return 0;
+}
+
+
+static int
 qemuBuildControllerDevCommandLine(virCommandPtr cmd,
                                   const virDomainDef *def,
                                   virQEMUCapsPtr qemuCaps)
@@ -2795,6 +2819,8 @@ 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 added after USB hubs.
          */
         VIR_DOMAIN_CONTROLLER_TYPE_PCI,
         VIR_DOMAIN_CONTROLLER_TYPE_USB,
@@ -2802,7 +2828,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,
     };
 
     for (j = 0; j < ARRAY_CARDINALITY(contOrder); j++) {
@@ -9262,6 +9287,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
     if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0)
         goto error;
 
+    if (qemuBuildCCIDControllerCommandLine(cmd, def, qemuCaps) < 0)
+        goto error;
+
     if (qemuBuildDiskDriveCommandLine(cmd, def, qemuCaps, emitBootindex) < 0)
         goto error;
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.args b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.args
index d3135c2..8cb0968 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-controller.args
@@ -19,7 +19,7 @@ server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline \
 -no-acpi \
 -boot c \
--device usb-ccid,id=ccid0 \
 -usb \
+-device usb-ccid,id=ccid0 \
 -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/qemuxml2argv-smartcard-host-certificates.args b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.args
index 09ef26c..d4a4d31 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host-certificates.args
@@ -19,8 +19,8 @@ server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline \
 -no-acpi \
 -boot c \
--device usb-ccid,id=ccid0 \
 -usb \
+-device usb-ccid,id=ccid0 \
 -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/qemuxml2argv-smartcard-host.args b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.args
index d3135c2..8cb0968 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-host.args
@@ -19,7 +19,7 @@ server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline \
 -no-acpi \
 -boot c \
--device usb-ccid,id=ccid0 \
 -usb \
+-device usb-ccid,id=ccid0 \
 -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/qemuxml2argv-smartcard-passthrough-spicevmc.args b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.args
index b618507..7411f2a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-spicevmc.args
@@ -19,8 +19,8 @@ server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline \
 -no-acpi \
 -boot c \
--device usb-ccid,id=ccid0 \
 -usb \
+-device usb-ccid,id=ccid0 \
 -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/qemuxml2argv-smartcard-passthrough-tcp.args b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.args
index e0fcb49..93bbbc4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smartcard-passthrough-tcp.args
@@ -19,8 +19,8 @@ server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline \
 -no-acpi \
 -boot c \
--device usb-ccid,id=ccid0 \
 -usb \
+-device usb-ccid,id=ccid0 \
 -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
-- 
2.7.3

--
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]