Normally when you access a VFIO device as a normal user, you would get a permission denied, like so:
(qemu) qemu-system-x86_64: -device vfio-pci,sysfsdev=/sys/bus/pci/devices/0000:00:02.0/fff6f017-3417-4ad3-b05e-17ae3e1a4615,display=on,x-igd-opregion=on,romfile=vbios_gvt_uefi.rom: vfio error: fff6f017-3417-4ad3-b05e-17ae3e1a4615: failed to open /dev/vfio/17: Permission denied
I was wondering if there is a way to the mdev GVT-g device without needing to be root.
Edit: To be clear, this is for plain qemu, not libvirt. I am able to get it working fine for libvirt.
Edit2: Here are the commands if you want to look at it.
MY_OPTIONS="+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check"
qemu-system-x86_64 -enable-kvm -m 3072 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS\
-machine pc-q35-2.11 \
-smp 4,cores=2 \
-usb -device usb-kbd -device usb-tablet \
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
-drive if=pflash,format=raw,readonly,file='OVMF_CODE.fd' \
-drive if=pflash,format=raw,file='OVMF_VARS-1024x768.fd' \
-smbios type=2 \
-device ide-drive,bus=ide.2,drive=Clover \
-drive id=Clover,if=none,snapshot=on,format=qcow2,file='/home/user/Documents/Virtual Machine/shared/harddrives/MacOS/uefi_mojave_clover.qcow2' \
-device ide-drive,bus=ide.1,drive=MacHDD \
-drive id=MacHDD,if=none,file='/home/user/Documents/Virtual Machine/shared/harddrives/MacOS/uefi-mojave.qcow2',format=qcow2 \
-vga none \
-device vfio-pci,sysfsdev='/sys/bus/pci/devices/0000:00:02.0/fff6f017-3417-4ad3-b05e-17ae3e1a4615',display=on,x-igd-opregion=on,romfile='vbios_gvt_uefi.rom' \
-monitor stdio