---
 src/conf/domain_conf.c                        |  3 ++-
 src/conf/domain_conf.h                        |  1 +
 src/qemu/qemu_capabilities.c                  |  2 ++
 src/qemu/qemu_capabilities.h                  |  1 +
 src/qemu/qemu_command.c                       | 14 ++++++++++++--
 tests/qemucapabilitiesdata/caps_1.2.2-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.3.1-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.4.2-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.5.3-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.6.0-1.caps  |  1 +
 tests/qemucapabilitiesdata/caps_1.6.50-1.caps |  1 +
 tests/qemuhelptest.c                          |  9 ++++++---
 12 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9c3cd8a..62e9c7a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -458,7 +458,8 @@ VIR_ENUM_IMPL(virDomainSoundModel, 
VIR_DOMAIN_SOUND_MODEL_LAST,
               "pcspk",
               "ac97",
               "ich6",
-              "ich9")
+              "ich9",
+              "usb")

 VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST,
               "virtio",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b988b17..3ddeede 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1166,6 +1166,7 @@ typedef enum {
     VIR_DOMAIN_SOUND_MODEL_AC97,
     VIR_DOMAIN_SOUND_MODEL_ICH6,
     VIR_DOMAIN_SOUND_MODEL_ICH9,
+    VIR_DOMAIN_SOUND_MODEL_USB,

     VIR_DOMAIN_SOUND_MODEL_LAST
 } virDomainSoundModel;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 07306e5..eb2bbfd 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -263,6 +263,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,

               "memory-backend-ram", /* 170 */
               "numa",
+              "usb-audio",
     );


@@ -1481,6 +1482,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "pvpanic", QEMU_CAPS_DEVICE_PANIC },
     { "usb-kbd", QEMU_CAPS_DEVICE_USB_KBD },
     { "memory-backend-ram", QEMU_CAPS_OBJECT_MEMORY_RAM },
+    { "usb-audio", QEMU_CAPS_OBJECT_USB_AUDIO },
 };

 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 4332633..ac65ef3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -211,6 +211,7 @@ typedef enum {
     QEMU_CAPS_CHANGE_BACKING_FILE = 169, /* change name of backing file in 
metadata */
     QEMU_CAPS_OBJECT_MEMORY_RAM  = 170, /* -object memory-backend-ram */
     QEMU_CAPS_NUMA               = 171, /* newer -numa handling with disjoint 
cpu ranges */
+    QEMU_CAPS_OBJECT_USB_AUDIO   = 172, /* usb-audio device support */

     QEMU_CAPS_LAST,                   /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7f9357c..2f0d898 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2090,9 +2090,10 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
     for (i = 0; i < def->nsounds; i++) {
         if (def->sounds[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
             continue;
-        /* Skip ISA sound card, and PCSPK */
+        /* Skip ISA sound card, PCSPK and usb-audio */
         if (def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_SB16 ||
-            def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_PCSPK)
+            def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_PCSPK ||
+            def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_USB)
             continue;

         if (virDomainPCIAddressReserveNextSlot(addrs, &def->sounds[i]->info,
@@ -4693,6 +4694,15 @@ qemuBuildSoundDevStr(virDomainDefPtr def,
     case VIR_DOMAIN_SOUND_MODEL_ICH6:
         model = "intel-hda";
         break;
+    case VIR_DOMAIN_SOUND_MODEL_USB:
+        model = "usb-audio";
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_USB_AUDIO)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("usb-audio controller is not supported "
+                             "by this QEMU binary"));
+            goto error;
+        }
+        break;
     case VIR_DOMAIN_SOUND_MODEL_ICH9:
         model = "ich9-intel-hda";
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ICH9_INTEL_HDA)) {
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps 
b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
index ebbfb82..c8a379a 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps
@@ -115,4 +115,5 @@
     <flag name='enable-fips'/>
     <flag name='usb-kbd'/>
     <flag name='host-pci-multidomain'/>
+    <flag name='usb-audio'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps 
b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
index ab631a2..4b7651e 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps
@@ -128,4 +128,5 @@
     <flag name='kvm-pit-lost-tick-policy'/>
     <flag name='usb-kbd'/>
     <flag name='host-pci-multidomain'/>
+    <flag name='usb-audio'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps 
b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
index e710b60..d146bf9 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps
@@ -129,4 +129,5 @@
     <flag name='kvm-pit-lost-tick-policy'/>
     <flag name='usb-kbd'/>
     <flag name='host-pci-multidomain'/>
+    <flag name='usb-audio'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps 
b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index 36758c8..5fa30aa 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -137,4 +137,5 @@
     <flag name='spiceport'/>
     <flag name='usb-kbd'/>
     <flag name='host-pci-multidomain'/>
+    <flag name='usb-audio'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps 
b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index ca2c236..f364bbf 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -144,4 +144,5 @@
     <flag name='usb-kbd'/>
     <flag name='host-pci-multidomain'/>
     <flag name='msg-timestamp'/>
+    <flag name='usb-audio'/>
   </qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps 
b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index 4b9f693..10ce1b5 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -143,4 +143,5 @@
     <flag name='host-pci-multidomain'/>
     <flag name='msg-timestamp'/>
     <flag name='numa'/>
+    <flag name='usb-audio'/>
   </qemuCaps>
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 105a563..366e36d 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -842,7 +842,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX,
             QEMU_CAPS_VNC_SHARE_POLICY,
             QEMU_CAPS_DEVICE_USB_KBD,
-            QEMU_CAPS_DEVICE_USB_STORAGE);
+            QEMU_CAPS_DEVICE_USB_STORAGE,
+            QEMU_CAPS_OBJECT_USB_AUDIO);
     DO_TEST("qemu-1.2.0", 1002000, 0, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -951,7 +952,8 @@ mymain(void)
             QEMU_CAPS_VNC_SHARE_POLICY,
             QEMU_CAPS_DEVICE_USB_STORAGE,
             QEMU_CAPS_DEVICE_USB_KBD,
-            QEMU_CAPS_USB_STORAGE_REMOVABLE);
+            QEMU_CAPS_USB_STORAGE_REMOVABLE,
+            QEMU_CAPS_OBJECT_USB_AUDIO);
     DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -1065,7 +1067,8 @@ mymain(void)
             QEMU_CAPS_VNC_SHARE_POLICY,
             QEMU_CAPS_DEVICE_USB_STORAGE,
             QEMU_CAPS_DEVICE_USB_KBD,
-            QEMU_CAPS_USB_STORAGE_REMOVABLE);
+            QEMU_CAPS_USB_STORAGE_REMOVABLE,
+            QEMU_CAPS_OBJECT_USB_AUDIO);

     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
2.0.0

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

Reply via email to