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', and 'ac97'
- (<span class="since">'ac97' only since 0.6.0</span>)
+ choices are 'es1370', 'sb16', 'ac97', and 'ich6'
+ (<span class="since">
+ 'ac97' only since 0.6.0, 'ich6' only since 0.8.8</span>)
</dd>
</dl>
goto error;
}
- /* Hack for 2 wierdly unusal devices name in QEMU */
+ /* Hack for weirdly unusual devices name in QEMU */
if (STREQ(model, "es1370"))
model = "ES1370";
else if (STREQ(model, "ac97"))
model = "AC97";
+ else if (STREQ(model, "ich6"))
+ model = "intel-hda";
virBufferVSprintf(&buf, "%s", model);
virBufferVSprintf(&buf, ",id=%s", sound->info.alias);
return NULL;
}
+static char *
+qemuBuildSoundCodecStr(virDomainSoundDefPtr sound,
+ const char *codec)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ int cad = 0;
+
+ virBufferVSprintf(&buf, "%s", codec);
+ virBufferVSprintf(&buf, ",id=%s-codec%d", sound->info.alias, cad);
+ virBufferVSprintf(&buf, ",bus=%s.0", sound->info.alias);
+ virBufferVSprintf(&buf, ",cad=%d", cad);
+
+ if (virBufferError(&buf)) {
+ virReportOOMError();
+ goto error;
+ }
+
+ return virBufferContentAndReset(&buf);
+
+error:
+ virBufferFreeAndReset(&buf);
+ return NULL;
+}
static char *
qemuBuildVideoDevStr(virDomainVideoDefPtr video)
virCommandAddArgList(cmd, "-soundhw", "pcspk", NULL);
} else {
virCommandAddArg(cmd, "-device");
-
if (!(str = qemuBuildSoundDevStr(sound)))
goto error;
virCommandAddArg(cmd, str);
+
+ if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) {
+ char *codecstr = NULL;
+ if (!(qemuCmdFlags & QEMUD_CMD_FLAG_HDA_DUPLEX)) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("this QEMU binary lacks hda support"));
+ goto error;
+ }
+
+ virCommandAddArg(cmd, "-device");
+ if (!(codecstr = qemuBuildSoundCodecStr(sound,
+ "hda-duplex"))) {
+ goto error;
+ }
+
+ virCommandAddArg(cmd, codecstr);
+ VIR_FREE(codecstr);
+ }
+
VIR_FREE(str);
}
}
"%s", _("invalid sound model"));
goto error;
}
+
+ if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("this QEMU binary lacks hda support"));
+ goto error;
+ }
+
strncat(modstr, model, size);
size -= strlen(model);
if (i < (def->nsounds - 1))
type = VIR_DOMAIN_SOUND_MODEL_ES1370;
} else if (STRPREFIX(start, "ac97")) {
type = VIR_DOMAIN_SOUND_MODEL_AC97;
+ } else if (STRPREFIX(start, "hda")) {
+ type = VIR_DOMAIN_SOUND_MODEL_ICH6;
}
if (type != -1) {
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -soundhw pcspk -device ES1370,id=sound1,bus=pci.0,addr=0x2 -device sb16,id=sound2 -device AC97,id=sound3,bus=pci.0,addr=0x3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -soundhw pcspk -device ES1370,id=sound1,bus=pci.0,addr=0x2 -device sb16,id=sound2 -device AC97,id=sound3,bus=pci.0,addr=0x3 -device intel-hda,id=sound4,bus=pci.0,addr=0x4 -device hda-duplex,id=sound4-codec0,bus=sound4.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5