From 744a0e2d0e6c9a2909b4005c085665e4236ad879 Mon Sep 17 00:00:00 2001 From: Yumi Yukimura Date: Tue, 14 Jan 2025 22:52:44 +0800 Subject: [PATCH] wiki: libvirt-qemu: Add "GPU passthrough" section Change-Id: I24d1dfea23472af05e4a74898fa91eed921831c1 --- pages/libvirt-qemu.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pages/libvirt-qemu.md b/pages/libvirt-qemu.md index e88628b08..72484ab65 100644 --- a/pages/libvirt-qemu.md +++ b/pages/libvirt-qemu.md @@ -331,6 +331,34 @@ Here's how to use fastbootd over Ethernet: fastboot -s tcp: [fastboot command...] ``` +### GPU passthrough (for `virtio_x86_64` target) + +The `virtio_x86_64` target supports displaying directly on a monitor connected to a real GPU using GPU passthrough, in normal boot mode (non-recovery), since LineageOS 22.1. + +Currently, only Intel GPUs (iGPU or dGPU) are supported. + +{% include alerts/note.html content="Neither the display color issue nor the video playback issue will likely occur on Intel GPUs." %} + +{% include alerts/warning.html content="There is no guarantee that every GPU models will work fine without any problem. Initial testing used IntelĀ® HD Graphics 4600. If you have fixes for any GPU, feel free to submit!" %} + +#### Additional build dependencies required for Intel Broadwell and later GPUs + +* Install the package `python3-ply`. +* Provide Intel OpenCL C compiler executable at `prebuilts/intel-clc/intel_clc`. + +#### Add GPU to the virtual machine + +1. Enable VT-d (Intel) or IOMMU (AMD) in BIOS settings on the host PC. +2. Stop any driver from using the GPU on the host OS. +3. Probe `vfio-pci` kernel module with `ids` parameter containing PCI ID(s) of the GPU on the host OS. +4. Add PCI device of the GPU to the virtual machine at PCI bus `0x00` slot `0x1e`. + +#### Start the virtual machine with GPU passthrough + +When on the boot menu, enter `Advanced options (virtio_x86_64 specific)` submenu, and select the option that corresponds to the GPU and/or your usecase. + +If something that's related with graphics doesn't work in GPU passthrough mode, you could firstly try booting in SELinux Permissive mode by selecting `Settings` > `SELinux` > `Permissive` on boot menu before booting. + ### Install flashable ZIPs in recovery mode Currently, there are two ways to do so: