I have managed to get VFIO working by creating a service of boot-service-type 
which overrides the GPU driver with vfio-pci and binds the GPU to VFIO:

>(simple-service 'vfio-override boot-service-type
>    '(and (call-with-output-file 
>"/sys/bus/pci/devices/0000:04:00.0/driver_override"
>      (lambda (p)
>       (display "vfio-pci" p)))
>     (call-with-output-file "/sys/bus/pci/drivers/vfio-pci/new_id"
>      (lambda (p)
>       (display "1002 665f" p)))
>  )
>)

Sorry for the hard-coded IDs, you should replace them with your own. You might 
need to unbind the GPU's audio card from its driver as well, after you're fully 
booted. QEMU will refuse to pass-through the GPU if the audio card is in the 
same IOMMU group and not using vfio-pci.

In my case, the service runs early enough in the boot process where amdgpu has 
not initialized the GPU yet. There might be a better way to accomplish this, 
I'm still new to Guix and Scheme.

Thanks,
Nikola



Reply via email to