From: Laine Stump Date: Tue, 24 Sep 2013 14:17:38 +0000 (-0400) Subject: qemu: support ich9-intel-hda audio device X-Git-Tag: v1.1.3-rc1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b83d26f6c434f80c71a2a7a0823b1ec16b798ca3;p=thirdparty%2Flibvirt.git qemu: support ich9-intel-hda audio device This resolves one of the issues in: https://bugzilla.redhat.com/show_bug.cgi?id=1003983 This device is identical to qemu's "intel-hda" device (known as "ich6" in libvirt), but has a different PCI device ID (which matches the ID of the hda audio built into the ich9 chipset, of course). It's not supported in earlier versions of qemu, so it requires a capability bit. --- diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fb6a26c3bc..5c5301d8af 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2947,6 +2947,7 @@ pcspk ac97 ich6 + ich9 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 240f318936..4110127f92 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -462,7 +462,8 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST, "es1370", "pcspk", "ac97", - "ich6") + "ich6", + "ich9") VIR_ENUM_IMPL(virDomainMemDump, VIR_DOMAIN_MEM_DUMP_LAST, "default", @@ -8451,7 +8452,8 @@ virDomainSoundDefParseXML(const xmlNodePtr node, goto error; } - if (def->model == VIR_DOMAIN_SOUND_MODEL_ICH6) { + if (def->model == VIR_DOMAIN_SOUND_MODEL_ICH6 || + def->model == VIR_DOMAIN_SOUND_MODEL_ICH9) { int ncodecs; xmlNodePtr *codecNodes = NULL; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5c33e080c6..f20a91687e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1253,6 +1253,7 @@ enum virDomainSoundModel { VIR_DOMAIN_SOUND_MODEL_PCSPK, VIR_DOMAIN_SOUND_MODEL_AC97, VIR_DOMAIN_SOUND_MODEL_ICH6, + VIR_DOMAIN_SOUND_MODEL_ICH9, VIR_DOMAIN_SOUND_MODEL_LAST }; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d830e2ab2f..dc8f0be02b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -241,6 +241,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "usb-storage", /* 155 */ "usb-storage.removable", "virtio-mmio", + "ich9-intel-hda", ); struct _virQEMUCaps { @@ -1391,6 +1392,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "i82801b11-bridge", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE }, { "usb-storage", QEMU_CAPS_DEVICE_USB_STORAGE }, { "virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO }, + { "ich9-intel-hda", QEMU_CAPS_DEVICE_ICH9_INTEL_HDA }, }; static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index f3c8fa86bf..f8dc728c83 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -196,6 +196,7 @@ enum virQEMUCapsFlags { QEMU_CAPS_DEVICE_USB_STORAGE = 155, /* -device usb-storage */ QEMU_CAPS_USB_STORAGE_REMOVABLE = 156, /* usb-storage.removable */ QEMU_CAPS_DEVICE_VIRTIO_MMIO = 157, /* -device virtio-mmio */ + QEMU_CAPS_DEVICE_ICH9_INTEL_HDA = 158, /* -device ich9-intel-hda */ QEMU_CAPS_LAST, /* this must always be the last item */ }; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3156cff97f..c8a5c8b555 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1800,6 +1800,7 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, case VIR_DOMAIN_DEVICE_SOUND: switch (device->data.sound->model) { case VIR_DOMAIN_SOUND_MODEL_ICH6: + case VIR_DOMAIN_SOUND_MODEL_ICH9: flags = (QEMU_PCI_CONNECT_TYPE_PCI | QEMU_PCI_CONNECT_TYPE_EITHER_IF_CONFIG); break; @@ -5280,6 +5281,15 @@ qemuBuildSoundDevStr(virDomainDefPtr def, case VIR_DOMAIN_SOUND_MODEL_ICH6: model = "intel-hda"; break; + case VIR_DOMAIN_SOUND_MODEL_ICH9: + model = "ich9-intel-hda"; + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ICH9_INTEL_HDA)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("The ich9-intel-hda audio controller " + "is not supported in this QEMU binary")); + goto error; + } + break; } virBufferAsprintf(&buf, "%s,id=%s", model, sound->info.alias); @@ -9065,7 +9075,8 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, str); - if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) { + if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 || + sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) { char *codecstr = NULL; for (j = 0; j < sound->ncodecs; j++) { @@ -9111,7 +9122,8 @@ qemuBuildCommandLine(virConnectPtr conn, goto error; } - if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) { + if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6 || + sound->model == VIR_DOMAIN_SOUND_MODEL_ICH9) { VIR_FREE(modstr); virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("this QEMU binary lacks hda support")); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-device.args b/tests/qemuxml2argvdata/qemuxml2argv-sound-device.args index d358453532..1511389d8f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-sound-device.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-device.args @@ -9,4 +9,9 @@ id=sound4-codec0,bus=sound4.0,cad=0 \ -device intel-hda,id=sound5,bus=pci.0,addr=0x6 \ -device hda-micro,id=sound5-codec0,bus=sound5.0,cad=0 \ -device hda-duplex,id=sound5-codec1,bus=sound5.0,cad=1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 +-device ich9-intel-hda,id=sound6,bus=pci.0,addr=0x7 -device hda-duplex,\ +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 virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-sound-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-sound-device.xml index 7bf9ff9217..8ce718e98a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-sound-device.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-device.xml @@ -31,6 +31,11 @@ + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ec4a6e5777..0b808a4a39 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -855,7 +855,8 @@ mymain(void) DO_TEST("sound", NONE); DO_TEST("sound-device", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, - QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO); + QEMU_CAPS_HDA_DUPLEX, QEMU_CAPS_HDA_MICRO, + QEMU_CAPS_DEVICE_ICH9_INTEL_HDA); DO_TEST("fs9p", QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_FSDEV, QEMU_CAPS_FSDEV_WRITEOUT);