From bc76fb17caf756582784cf9a0fbae2a0956ec3c5 Mon Sep 17 00:00:00 2001 Message-Id: From: Laine Stump Date: Fri, 27 Sep 2013 05:19:43 -0600 Subject: [PATCH] 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. (cherry picked from commit b83d26f6c434f80c71a2a7a0823b1ec16b798ca3) Conflicts: src/qemu/qemu_capabilities.c src/qemu/qemu_capabilities.h There were a few other capabilities added upstream that haven't yet been added to the RHEL7 branch; these caused a mismatch in the capabilities enum. Signed-off-by: Jiri Denemark --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 6 ++++-- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 16 ++++++++++++++-- tests/qemuxml2argvdata/qemuxml2argv-sound-device.args | 7 ++++++- tests/qemuxml2argvdata/qemuxml2argv-sound-device.xml | 5 +++++ tests/qemuxml2argvtest.c | 3 ++- 9 files changed, 36 insertions(+), 6 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index dfcd61c..838f657 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2896,6 +2896,7 @@ pcspk ac97 ich6 + ich9 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c391eae..bca2151 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -455,7 +455,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", @@ -8397,7 +8398,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 b9e9600..5d2cb83 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1237,6 +1237,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 47cc07a..9b1d9f5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -235,6 +235,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "vnc-share-policy", /* 150 */ "device-del-event", "dmi-to-pci-bridge", + "ich9-intel-hda", ); struct _virQEMUCaps { @@ -1383,6 +1384,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { { "vfio-pci", QEMU_CAPS_DEVICE_VFIO_PCI }, { "scsi-generic", QEMU_CAPS_DEVICE_SCSI_GENERIC }, { "i82801b11-bridge", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE }, + { "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 074e55d..c992dcb 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -191,6 +191,7 @@ enum virQEMUCapsFlags { QEMU_CAPS_VNC_SHARE_POLICY = 150, /* set display sharing policy */ QEMU_CAPS_DEVICE_DEL_EVENT = 151, /* DEVICE_DELETED event */ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE = 152, /* -device i82801b11-bridge */ + QEMU_CAPS_DEVICE_ICH9_INTEL_HDA = 153, /* -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 8b03470..2de7678 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1758,6 +1758,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; @@ -5142,6 +5143,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); @@ -8866,7 +8876,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++) { @@ -8912,7 +8923,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 7c5f05c..997e458 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-sound-device.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-sound-device.args @@ -8,4 +8,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 7bf9ff9..8ce718e 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 aa43145..23ea2ee 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -841,7 +841,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); -- 1.8.3.2