[vfio-users] No hdmi audio on AMD R7 370 w/ libvirt

Muted Bytes mutedbytes at gmail.com
Thu Dec 1 08:41:10 UTC 2016


On Thu, Dec 1, 2016 at 12:08 AM, Brian Chow
<brianchow at digitaldescent.net> wrote:
> I was using ioh3420 because that was the only way I could ever get GPU
> passthrough to work, I was using 440fx instead of Q35, so it didn't have
> pcie, just pci (If there was another way, I either didn't know about it, it
> couldn't get it work).  With libvirt I didn't need to specify anything, the
> GPU passthrough is working just fine, it's strictly audio that isn't
> working.
>
> Here's the domxml-to-native. There 01 addresses are video/audio, the 05
> address is a USB controller.
>
> ------
> LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
> QEMU_AUDIO_DRV=none
> /usr/bin/qemu-system-x86_64 -name guest=starscream,debug-threads=on \
> -object
> secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-starscream/master-key.aes
> \
> -machine pc-i440fx-2.4,accel=kvm,usb=off,dump-guest-core=off \
> -cpu host,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,kvm=off \
> -drive
> file=/usr/share/OVMF/OVMF-pure-efi.fd,if=pflash,format=raw,unit=0,readonly=on
> \
> -drive
> file=/var/lib/libvirt/qemu/nvram/starscream_VARS.fd,if=pflash,format=raw,unit=1
> \
> -m 7630 \
> -mem-prealloc \
> -mem-path /dev/hugepages/libvirt/qemu \
> -realtime mlock=off \
> -smp 2,maxcpus=4,sockets=1,cores=2,threads=2 \
> -uuid d18b5dce-5bdf-4db7-87b6-e0c6b2479b0f \
> -display none \
> -no-user-config \
> -nodefaults \
> -chardev
> socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain--1-starscream/monitor.sock,server,nowait
> \
> -mon chardev=charmonitor,id=monitor,mode=control \
> -rtc base=2016-11-28T00:08:22 \
> -no-shutdown \
> -boot menu=on,strict=on \
> -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
> -device ahci,id=sata0,bus=pci.0,addr=0x6 \
> -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x2 \
> -drive
> file=/dev/zvol/htpc/vm/starscream1,format=raw,if=none,id=drive-virtio-disk0
> \
> -device
> virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
> -drive
> file=/dev/zvol/htpc/vm/starscream2,format=raw,if=none,id=drive-virtio-disk1
> \
> -device
> virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1
> \
> -drive if=none,id=drive-ide0-0-0,readonly=on \
> -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
> -drive if=none,id=drive-ide0-0-1,readonly=on \
> -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
> -netdev tap,fd=26,id=hostnet0 \
> -device
> virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:f7:64:f4,bus=pci.0,addr=0x4
> \
> -chardev pty,id=charconsole0 \
> -device virtconsole,chardev=charconsole0,id=console0 \
> -device
> vfio-pci,host=01:00.0,id=hostdev0,bus=pci.0,multifunction=on,addr=0x8,rombar=1
> \
> -device
> vfio-pci,host=01:00.1,id=hostdev1,bus=pci.0,multifunction=on,addr=0x9,rombar=1
> \
> -device vfio-pci,host=05:00.0,id=hostdev2,bus=pci.0,addr=0xa \
> -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
> -msg timestamp=on
> ---------
>
>
> On Wed, Nov 30, 2016 at 11:58 PM, Muted Bytes <mutedbytes at gmail.com> wrote:
>>
>> On Wed, Nov 30, 2016 at 11:43 AM, Brian Chow
>> <brianchow at digitaldescent.net> wrote:
>> > Resending as I forgot to reply-all/include the mailing list.  The below
>> > suggestions didn't work, unfortunately.  Does anyone have any other
>> > ideas?
>> > ---
>> >
>> >
>> >
>> > On Sun, Nov 27, 2016 at 11:02 AM, Muted Bytes <mutedbytes at gmail.com>
>> > wrote:
>> >>
>> >> On Sun, Nov 27, 2016 at 1:38 AM, Brian Chow
>> >> <brianchow at digitaldescent.net> wrote:
>> >> > I converted my Win10 VM over to a full libvirt VM, removing qemu
>> >> > command
>> >> > line args from the XML, and I no longer have functioning HDMI audio.
>> >> > The
>> >> > device shows up in device manager as OK, and it detects my monitor as
>> >> > the
>> >> > speakers, which is also correct, but no audio plays, when and when I
>> >> > attempt
>> >> > to to configure the speakers/test the audio, I get a message that the
>> >> > test
>> >> > tone cannot be played.  Does anyone know what I need to tweak to get
>> >> > it
>> >> > working again?  I moved off the qemu command args style because a
>> >> > system/libvirt/qemu update a while ago changed how the permissions
>> >> > were
>> >> > working and that broke passthrough for me.  I also saw Alex recommend
>> >> > not
>> >> > using qemu command args a while back.  Video passthrough IS working.
>> >> >
>> >> > Thanks in advance!
>> >> >
>> >> > My XML is as follows:
>> >> >
>> >> > <domain type='kvm' id='3'>  <name>starscream</name>
>> >> > <uuid>d18b5dce-5bdf-4db7-87b6-e0c6b2479b0f</uuid>  <memory
>> >> > unit='KiB'>7813120</memory>  <currentMemory
>> >> > unit='KiB'>7812500</currentMemory>  <memoryBacking>    <hugepages/>
>> >> > </memoryBacking>  <vcpu placement='static' current='2'>4</vcpu>
>> >> > <cputune>
>> >> > <vcpupin vcpu='0' cpuset='2'/>    <vcpupin vcpu='1' cpuset='3'/>
>> >> > <vcpupin
>> >> > vcpu='2' cpuset='6'/>    <vcpupin vcpu='3' cpuset='7'/>  </cputune>
>> >> > <resource>    <partition>/machine</partition>  </resource>  <os>
>> >> > <type
>> >> > arch='x86_64' machine='pc-i440fx-2.4'>hvm</type>    <loader
>> >> > readonly='yes'
>> >> > type='pflash'>/usr/share/OVMF/OVMF-pure-efi.fd</loader>    <nvram
>> >> >
>> >> >
>> >> > template='/kvm/starscream/OVMF-starscream.fd'>/var/lib/libvirt/qemu/nvram/starscream_VARS.fd</nvram>
>> >> > <bootmenu enable='yes'/>  </os>  <features>    <acpi/>    <hyperv>
>> >> > <relaxed state='on'/>      <vapic state='on'/>      <spinlocks
>> >> > state='on'
>> >> > retries='8191'/>    </hyperv>    <kvm>      <hidden state='on'/>
>> >> > </kvm>
>> >> > </features>  <cpu mode='host-passthrough'>    <topology sockets='1'
>> >> > cores='2' threads='2'/>  </cpu>  <clock offset='variable'
>> >> > adjustment='-28801' basis='utc'>    <timer name='hypervclock'
>> >> > present='yes'/>  </clock>  <on_poweroff>destroy</on_poweroff>
>> >> > <on_reboot>restart</on_reboot>  <on_crash>destroy</on_crash>
>> >> > <devices>
>> >> > <emulator>/usr/bin/qemu-system-x86_64</emulator>    <disk
>> >> > type='block'
>> >> > device='disk'>      <driver name='qemu' type='raw'/>      <source
>> >> > dev='/dev/zvol/htpc/vm/starscream1'/>      <backingStore/>
>> >> > <target
>> >> > dev='vda' bus='virtio'/>      <boot order='1'/>      <alias
>> >> > name='virtio-disk0'/>      <address type='pci' domain='0x0000'
>> >> > bus='0x00'
>> >> > slot='0x07' function='0x0'/>    </disk>    <disk type='block'
>> >> > device='disk'>
>> >> > <driver name='qemu' type='raw'/>      <source
>> >> > dev='/dev/zvol/htpc/vm/starscream2'/>      <backingStore/>
>> >> > <target
>> >> > dev='vdb' bus='virtio'/>      <alias name='virtio-disk1'/>
>> >> > <address
>> >> > type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
>> >> > </disk>    <disk type='file' device='cdrom'>      <driver name='qemu'
>> >> > type='raw'/>      <backingStore/>      <target dev='hda' bus='ide'/>
>> >> > <readonly/>      <alias name='ide0-0-0'/>      <address type='drive'
>> >> > controller='0' bus='0' target='0' unit='0'/>    </disk>    <disk
>> >> > type='file'
>> >> > device='cdrom'>      <driver name='qemu' type='raw'/>
>> >> > <backingStore/>
>> >> > <target dev='hdb' bus='ide'/>      <readonly/>      <alias
>> >> > name='ide0-0-1'/>
>> >> > <address type='drive' controller='0' bus='0' target='0' unit='1'/>
>> >> > </disk>    <controller type='usb' index='0' model='piix3-uhci'>
>> >> > <alias
>> >> > name='usb'/>      <address type='pci' domain='0x0000' bus='0x00'
>> >> > slot='0x01'
>> >> > function='0x2'/>    </controller>    <controller type='pci' index='0'
>> >> > model='pci-root'>      <alias name='pci.0'/>    </controller>
>> >> > <controller
>> >> > type='ide' index='0'>      <alias name='ide'/>      <address
>> >> > type='pci'
>> >> > domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
>> >> > </controller>
>> >> > <controller type='virtio-serial' index='0'>      <alias
>> >> > name='virtio-serial0'/>      <address type='pci' domain='0x0000'
>> >> > bus='0x00'
>> >> > slot='0x02' function='0x0'/>    </controller>    <controller
>> >> > type='sata'
>> >> > index='0'>      <alias name='sata0'/>      <address type='pci'
>> >> > domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
>> >> > </controller>
>> >> > <interface type='bridge'>      <mac address='52:54:00:f7:64:f4'/>
>> >> > <source bridge='br0'/>      <target dev='vnet0'/>      <model
>> >> > type='virtio'/>      <alias name='net0'/>      <address type='pci'
>> >> > domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
>> >> > </interface>
>> >> > <console type='pty' tty='/dev/pts/2'>      <source
>> >> > path='/dev/pts/2'/>
>> >> > <target type='virtio' port='0'/>      <alias name='console0'/>
>> >> > </console>
>> >> > <input type='mouse' bus='ps2'>      <alias name='input0'/>
>> >> > </input>
>> >> > <input type='keyboard' bus='ps2'>      <alias name='input1'/>
>> >> > </input>
>> >> > <hostdev mode='subsystem' type='pci' managed='yes'>      <driver
>> >> > name='vfio'/>      <source>        <address domain='0x0000'
>> >> > bus='0x01'
>> >> > slot='0x00' function='0x0'/>      </source>      <alias
>> >> > name='hostdev0'/>
>> >> > <rom bar='on'/>      <address type='pci' domain='0x0000' bus='0x00'
>> >> > slot='0x08' function='0x0' multifunction='on'/>    </hostdev>
>> >> > <hostdev
>> >> > mode='subsystem' type='pci' managed='yes'>      <driver name='vfio'/>
>> >> > <source>        <address domain='0x0000' bus='0x01' slot='0x00'
>> >> > function='0x1'/>      </source>      <alias name='hostdev1'/>
>> >> > <rom
>> >> > bar='on'/>      <address type='pci' domain='0x0000' bus='0x00'
>> >> > slot='0x09'
>> >> > function='0x0' multifunction='on'/>    </hostdev>    <hostdev
>> >> > mode='subsystem' type='pci' managed='yes'>      <driver name='vfio'/>
>> >> > <source>        <address domain='0x0000' bus='0x05' slot='0x00'
>> >> > function='0x0'/>      </source>      <alias name='hostdev2'/>
>> >> > <address
>> >> > type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
>> >> > </hostdev>    <memballoon model='virtio'>      <alias
>> >> > name='balloon0'/>
>> >> > <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
>> >> > function='0x0'/>
>> >> > </memballoon>  </devices>  <seclabel type='none' model='none'/>
>> >> > <seclabel
>> >> > type='dynamic' model='dac' relabel='yes'>    <label>+1000:+78</label>
>> >> > <imagelabel>+1000:+78</imagelabel>  </seclabel></domain>
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > vfio-users mailing list
>> >> > vfio-users at redhat.com
>> >> > https://www.redhat.com/mailman/listinfo/vfio-users
>> >> >
>> >>
>> >> >I'm assuming this is the relevant gpu stuff, with gpu at 0000:01:00.0
>> >> >and hdmi audio at 0000:01:00.1:
>> >> >
>> >> ><hostdev mode='subsystem' type='pci' managed='yes'>
>> >> >  <driver name='vfio'/>
>> >> >  <source>
>> >> >    <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
>> >> >  </source>
>> >> >  <alias name='hostdev0'/>
>> >> >  <rom bar='on'/>
>> >> >  <address type='pci' domain='0x0000' bus='0x00' slot='0x08'
>> >> >function='0x0' multifunction='on'/>
>> >> ></hostdev>
>> >> ><hostdev mode='subsystem' type='pci' managed='yes'>
>> >> > <driver name='vfio'/>
>> >> >  <source>
>> >> >    <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
>> >> >  </source>
>> >> >  <alias name='hostdev1'/>
>> >> >  <rom bar='on'/>
>> >> >  <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
>> >> >function='0x0' multifunction='on'/>
>> >> ></hostdev>
>> >> >
>> >> >On host, audio is defined as additional function in same slot, so I
>> >> >usually assign to guest in the same way, so that yours would be at
>> >> >slot='0x08' function='0x1', but not sure if this really matters or if
>> >> >this is what your problem is. multifunction='on' would also be removed
>> >> >for function 1.
>> >>
>> >> >You might also try virsh's domxml-to-native command to see the
>> >> >generated qemu command + args to see if anything funny is happening in
>> >> >the actual vm launch (audio related stuff etc).
>> >
>> >
>> > -----
>> > Yes, sorry, that is the relevant GPU part of the XML.  I tried removing
>> > the
>> > multifunction attribute on the secondary function (hdmi audio) and that
>> > didn't change anything.  I also tried changing the slot/function as you
>> > mentioned.  The device re-enumerated and appears the same as before inn
>> > device manager -- it does show up correctly.  Unfortunately, the same
>> > end
>> > result of no audio, and windows saying it couldn't play the test sound.
>> >
>> > I'm including what was in my old start script for comparison -- the
>> > 01:00.[0,1] device is the GPU., 05:00 is a usb controller:
>> >
>> > qemu-system-x86_64 \
>> >         -name starscream \
>> >         -enable-kvm \
>> >         -m 8192 \
>> >         -cpu host,kvm=off \
>> >         -smp 4,sockets=1,cores=4,threads=1 \
>> >         -drive
>> > if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF-pure-efi.fd \
>> >         -drive
>> > if=pflash,format=raw,file=/kvm/starscream/OVMF-starscream.fd
>> > \
>> >         -drive file=/kvm/starscream/starscream.img,if=virtio,format=raw
>> > \
>> >         -drive file="",format=raw,id=optical1,if=none -device
>> > ide-cd,bus=ide.1,drive=optical1 \
>> >         -net nic,macaddr=52:54:00:f7:64:f4,model=virtio \
>> >         -net bridge,br=br0 \
>> >         -device
>> > ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
>> > \
>> >         -device
>> > vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,
>> > \
>> >         -device
>> > vfio-pci,host=01:00.1,bus=root.1,addr=00.1,multifunction=on
>> > \
>> >         -device vfio-pci,host=05:00.0 \
>> >         -vga none \
>> >         -boot menu=on \
>> >         -nographic
>> >
>>
>> In your qemu script, you defined an ioh3420 root-port device which the
>> gpu/audio device attaches to. I don't think this is reflected in your
>> libvirt xml, where it would normally be a "pcie-root-port" model. I'm
>> not sure what the actual resulting configuration is from your xml,
>> could you maybe dump the "domxml-to-native" output from virsh?
>
>

I apologize, realized I didn't respond to the thread again. Even if
you don't need to specify anything, the virsh result is different from
your qemu script, where your gpu and other devices are being attached
directly to the pci.0 root bus where previously you had the ioh
root-port in between them. Other than that, the only thing different I
notice is that rombar=1 is being passed to both gpu and audio
function. I wonder if this might have any effect.




More information about the vfio-users mailing list