Fedora 34 + NVIDIA driver + Secure Boot + VFIO issue

I’m running Fedora 34. on an Asus Zephyrus G15 laptop which has NVIDIA 3070 dGPU and AMD iGPU. Using NVIDIA driver from RPM Fusion package. Have Secure Boot enabled. Got it working successfully, confirmed by being able to switch graphics mode using asusctl, which allows commmand-line settings of “Integrated”, “NVIDIA”, “Hybrid” and even “vfio”. If SecureBoot wasn’t working, there would be a message at boot time about NVIDIA module missing, falling back to Nouveau, and the asusctl graphics switching would hang at a blank screen upon switching modes.

With that said, when I make the necessary changes to enable VFIO, to pass through the NVIDIA 3070 dGPU, upon reboot I get that NVIDIA module missing, falling back to Nouveau again, and the asusctl graphics switching hangs at a blank screen upon switching modes.

All I do to enable VFIO on Fedora 34 are:

  1. modify /etc/sysconfig/grub, with:

GRUB_CMDLINE_LINUX=“rd.luks.uuid=luks- rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 amd_iommu=pt amd_iommu=on rd.driver.pre=vfio-pci”

  1. create /etc/dracut.conf.d/vfio.conf with contents:

add_drivers+=" vfio vfio_iommu_type1 vfio_pci vfio_virqfd "

  1. create /etc/modprobe.d/vfio.conf with contents:

options vfio-pci ids=10de:249d,10de:228b

  1. Then “grub2-mkconfig -o /etc/grub2-efi.cfg” and “dracut -vf” and reboot.

I see other people’s VFIO configs and they are more involved, with hooks with pre and post processes and so on.

What do I need to do in order to get Secure Boot working again and get rid of the NVIDIA module missing falling back to Nouveau message WITH vfio enabled?

I only would use the NVIDIA dGPU on Linux host for Davinci Resolve (video editing), and it would otherwise be used for GPU passthrough to Win10 VM for gaming and other things. I could try to exclusively use the dGPU in VM, and try to run Resolve in Win10 VM and see how it performs. If I do that, I may have to pass through an SSD drive for faster disk performance perhaps.

But even if I were to do that, how would I get rid of the NVIDIA module missing falling back to Nouveau message?

Thanks in advance!