--- Notes: Version 3: - rebased after recent additions Version 2: - added docs docs/formatdomain.html.in | 5 +++-- 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 ++++++--- 13 files changed, 33 insertions(+), 8 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index e5b1adb..409a76e 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4981,9 +4981,10 @@ qemu-kvm -net nic,model=? /dev/null The <code>sound</code> element has one mandatory attribute, <code>model</code>, which specifies what real sound device is emulated. Valid values are specific to the underlying hypervisor, though typical - choices are 'es1370', 'sb16', 'ac97', and 'ich6' + choices are 'es1370', 'sb16', 'ac97', 'ich6' and 'usb'. (<span class="since"> - 'ac97' only since 0.6.0, 'ich6' only since 0.8.8</span>) + 'ac97' only since 0.6.0, 'ich6' only since 0.8.8, + 'usb' only since 1.2.7</span>) </dd> </dl> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c25c74b..e4c6218 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 bffc0a5..ff7d640 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1177,6 +1177,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 f69c4d0..360cc67 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -264,6 +264,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "memory-backend-ram", /* 170 */ "numa", "memory-backend-file", + "usb-audio", ); @@ -1483,6 +1484,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "usb-kbd", QEMU_CAPS_DEVICE_USB_KBD }, { "memory-backend-ram", QEMU_CAPS_OBJECT_MEMORY_RAM }, { "memory-backend-file", QEMU_CAPS_OBJECT_MEMORY_FILE }, + { "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 e80a377..6342f81 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -212,6 +212,7 @@ typedef enum { QEMU_CAPS_OBJECT_MEMORY_RAM = 170, /* -object memory-backend-ram */ QEMU_CAPS_NUMA = 171, /* newer -numa handling with disjoint cpu ranges */ QEMU_CAPS_OBJECT_MEMORY_FILE = 172, /* -object memory-backend-file */ + QEMU_CAPS_OBJECT_USB_AUDIO = 173, /* 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 4e074e5..eb3f392 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, @@ -4687,6 +4688,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.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list