Qemu/kvm trying to use OpenGL (in VMM) with integrated GPU -> black screen in VM

Questions about virtualization software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
Limifo
Level 1
Level 1
Posts: 3
Joined: Fri Feb 09, 2024 11:13 am

Qemu/kvm trying to use OpenGL (in VMM) with integrated GPU -> black screen in VM

Post by Limifo »

Hi, I installed Qemu today and try to get improved graphics inside my VM.

I have an installed GTX 960 at PCIe and a i7-2600k which has an integrated GPU. (and 16 GB RAM, Gigabyte Z68X-UD3H-B3 Mainboard)
The integrated GPU I don't use for my host system (Mint 21.3) and would like to use it inside my Linux Mint 21.3 VM which I generated inside Virtual Machine Manager (VMM).

Inside VMM at the Display Spice section I can activate OpenGL and select the integrated intel GPU.
(listen type: none, Type: Spice server)

This only works if I also activate Virtio with 3d acceleration inside the video section.

I also changed my grub to:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt"
But if I start the VM I just get a black screen.

It looks like something is not working:

Code: Select all

$ dmesg | grep -i -e DMAR -e IOMMU
[    0.000000] Command line: BOOT_IMAGE=/@/boot/vmlinuz-5.15.0-94-generic root=UUID=..... ro rootflags=subvol=@ intel_iommu=on iommu=pt
[    0.043134] Kernel command line: BOOT_IMAGE=/@/boot/vmlinuz-5.15.0-94-generic root=UUID=.. ro rootflags=subvol=@ intel_iommu=on iommu=pt
[    0.043193] DMAR: IOMMU enabled
[    0.205106] iommu: Default domain type: Passthrough (set via kernel command line)

But if I run this script it returns nothing:

Code: Select all

for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
    echo "IOMMU Group ${g##*/}:"
    for d in $g/devices/*; do
        echo -e "\t$(lspci -nns ${d##*/})"
    done;
done;

IOMMU Group .:
As far as I read this is no real passthrough but it should work (just not that good).
Do I need to change something else?

---------------------------------------------------
For real passthrough I tried the grub settings (shown here):

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt pcie_acs_override=downstream,multifunction initcall_blacklist=sysfb_init video=simplefb:off video=vesafb:off video=efifb:off video=vesa:off disable_vga=1 vfio_iommu_type1.allow_unsafe_interrupts=1 kvm.ignore_msrs=1 modprobe.blacklist=radeon,nouveau,nvidia,nvidiafb,nvidia-gpu,snd_hda_intel,snd_hda_codec_hdmi,i915"
Updated grub and edited

Code: Select all

nano /etc/modules
# Modules required for PCI passthrough
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
And updated initramfs

Code: Select all

update-initramfs -u -k all
After reboot I was unable to select my integrated GPU inside VMM.
So this didn't work either.
I also had no sound at my host system. Can just passthrough the GPU and keep my (onboard) sound?
Potential solutions for both options are welcome.

---------------------------------------------

What else do I need to change?
Most guides I found are only for discrete GPU's
This problem with black screen was also posted on other sides but without a working solution.
powerhouse
Level 6
Level 6
Posts: 1144
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: Qemu/kvm trying to use OpenGL (in VMM) with integrated GPU -> black screen in VM

Post by powerhouse »

You have to first make sure that IOMMU is set up correctly. It's not enough to enable it in grub via intel_iommu=on, but you have to turn it on in the BIOS. On Intel CPUs it is usually called VT-d, but it may also appear as IOMMU. Go into your BIOS settings and look for virtualization, IOMMU or VT-d. Turn all the virtualization features on. Most/all(?) motherboard manufacturers disable IOMMU / VT-d by default.

If that doesn't help or if it was turned on already, check which BIOS firmware release you are running. You will find all about IOMMU in my post here: https://www.heiko-sieger.info/iommu-gro ... -consider/.

There is no point in continuing if you haven't got any IOMMU groups. Good luck!
Subjects of interest: Linux, vfio passthrough virtualization, photography
See my blog on virtualization, including tutorials: https://www.heiko-sieger.info/category/ ... alization/
Post Reply

Return to “Virtual Machines”