mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
conf: Add USB sound card support and implement it for qemu
This commit is contained in:
parent
2e194e5bcc
commit
e260a0e60a
@ -5031,9 +5031,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>
|
||||
|
||||
|
@ -3168,6 +3168,7 @@
|
||||
<value>ac97</value>
|
||||
<value>ich6</value>
|
||||
<value>ich9</value>
|
||||
<value>usb</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<interleave>
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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[] = {
|
||||
|
@ -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;
|
||||
|
@ -2086,9 +2086,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,
|
||||
@ -4683,6 +4684,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)) {
|
||||
|
@ -115,4 +115,5 @@
|
||||
<flag name='enable-fips'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
<flag name='usb-audio'/>
|
||||
</qemuCaps>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -137,4 +137,5 @@
|
||||
<flag name='spiceport'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
<flag name='usb-audio'/>
|
||||
</qemuCaps>
|
||||
|
@ -144,4 +144,5 @@
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
<flag name='msg-timestamp'/>
|
||||
<flag name='usb-audio'/>
|
||||
</qemuCaps>
|
||||
|
@ -143,4 +143,5 @@
|
||||
<flag name='host-pci-multidomain'/>
|
||||
<flag name='msg-timestamp'/>
|
||||
<flag name='numa'/>
|
||||
<flag name='usb-audio'/>
|
||||
</qemuCaps>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -14,4 +14,5 @@ id=sound6-codec0,bus=sound6.0,cad=0 \
|
||||
-device ich9-intel-hda,id=sound7,bus=pci.0,addr=0x8 \
|
||||
-device hda-micro,id=sound7-codec0,bus=sound7.0,cad=0 \
|
||||
-device hda-duplex,id=sound7-codec1,bus=sound7.0,cad=1 \
|
||||
-device usb-audio,id=sound8 \
|
||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9
|
||||
|
@ -36,6 +36,7 @@
|
||||
<codec type='micro'/>
|
||||
<codec type='duplex'/>
|
||||
</sound>
|
||||
<sound model='usb'/>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -1136,7 +1136,8 @@ mymain(void)
|
||||
DO_TEST("sound-device",
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
|
||||
QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO,
|
||||
QEMU_CAPS_DEVICE_ICH9_INTEL_HDA);
|
||||
QEMU_CAPS_DEVICE_ICH9_INTEL_HDA,
|
||||
QEMU_CAPS_OBJECT_USB_AUDIO);
|
||||
DO_TEST("fs9p",
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV,
|
||||
QEMU_CAPS_FSDEV_WRITEOUT);
|
||||
|
Loading…
Reference in New Issue
Block a user