On Tue, Jan 11, 2011 at 11:46:14AM +0100, Gerd Hoffmann wrote:
On 01/10/11 18:19, Cole Robinson wrote:
>In QEMU, the card itself is a PCI device, but it requires
>-device hda-output in order to actually get sound to the host. AIUI this
>is just HDA configuration and does not require stable addressing, so
>is not presently represented in the XML.
It isn't that simple. There are actually multiple devices involved.
Each audio codec (yes, there can be multiple of these, up to 15) is
connected via HDA Link to the pci controller. Each audio codec has
a codec address (HDA bus property: cad=[0..14]).
So you can specify "-device intel-hda -device hda-duplex -device
hda-output" and the guest has multiple audio devices. Win7 even
handles this correctly, whereas alsa uses only the first codec it
finds (lowest codec address). Not that this buys you much today,
qemu mixes all channels together before sending them off to the
hosts sound system, i.e. you don't see a stream per sound card in
pulseaudio. That might change in the future though.
So 'intel-hda' should really be considered as a controller,
and hda-output' & 'hda-duplex' are the things to be treated
as devices in the guest config.
This suggests a setup more like the one we did for virtio-serial
where we'd invent a new address type for codecs, and have XML
looking something like
<controller type='hda' model='ich6'>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x0a' function='0x0'/>
</controller>
<sound model='hda-output'>
<address type='hda' codec='0'/>
</sound>
<sound model='hda-duplex'>
<address type='hda' codec='1'/>
</sound>
Are there any technical model names for 'hda-output' 'hda-duplex'
we need to be aware of (as we potentially have ich6, ich7, 8, 9,
etc for intel-hda in the future)
We also might see more hda codecs in the future. Maybe to pass
through digital audio interfaces from the host? Not investigated
yet in detail though.
The HDA Links are even hot-pluggable (new audio codec can be linked
up when putting the laptop into the docking station for example),
although the qemu emulation doesn't support that today.
Hotplug is another good reason for us to treat the 'hda-output'
and 'hda-duplex' objects as the <sound> device in libvirt XML,
because then we can add/remove them via virDomainAttachDevice
which we couldn't otherwise do
Regards,
Daniel