XML used for the device:
<interface type='hostdev' managed='yes'>
<driver name='vfio'/>
<mac address='52:54:00:c3:0e:32'/>
<source>
<address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x2'/>
</source>
</interface>
$ virsh detach-device focal-pttest VF-pass-through.xml
error: Failed to detach device from VF-pass-through.xml
error: internal error: End of file from qemu monitor
Logs:
1. Guest dmesg (doesn't exist as it dies immediately).
I got VFs enabled now, attach works fine as well.
But I can confirm that detach breaks it.
XML used for the device: '52:54: 00:c3:0e: 32'/>
<interface type='hostdev' managed='yes'>
<driver name='vfio'/>
<mac address=
<source>
<address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x2'/>
</source>
</interface>
$ virsh detach-device focal-pttest VF-pass-through.xml
error: Failed to detach device from VF-pass-through.xml
error: internal error: End of file from qemu monitor
Logs:
1. Guest dmesg (doesn't exist as it dies immediately).
2. qemu log:
2020-03-18 11:02:18.221+0000: shutting down, reason=crashed
This one is interesting, Host dmesg: x86_64[ 55d37b008000+ 529000]
[ 5819.223023] CPU 0/KVM[2763]: segfault at 0 ip 000055d37b4b245d sp 00007f2f5fffe188 error 6 in qemu-system-
[ 5819.223030] Code: 08 48 89 50 10 48 89 37 48 89 7e 10 c3 f3 0f 1e fa 48 8b 47 08 48 8b 57 10 48 85 c0 74 0c 48 89 50 10 48 8b 57 10 48 8b 47 08 <48> 89 02 c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 f3 0f 1e
Afterwards I see the device come back to the host, but the segfault is the reason it died.