[LINUX] Run Radeon GPU on Windows on QEMU / KVM

GPU passthrough with QEMU / KVM

Recently, due to improvements in GPU performance and software, it has become possible to demonstrate sufficient performance even in Windows under a virtual environment if it is about a general 3D game. However, to do so, you need to touch the GPU directly from the OS in the virtual environment. This technology is called GPU passthrough. Pass-through is possible with both NVIDIA's GeForce series and AMD's Radeon series, but Radeon seems to be easier to do due to various circumstances.

This article is about Radeon 5700XT. This may be true for other products, but it may not be. Use of information is at your own risk.

Basically, [Arch Linux article](https://wiki.archlinux.jp/index.php/OVMF_%E3%81%AB%E3%82%88%E3%82%8B_PCI_%E3%83%91 % E3% 82% B9% E3% 82% B9% E3% 83% AB% E3% 83% BC) It's OK if you follow the street, so please read the article first.

Here are some tips not mentioned in the article.

GPU pass-through tips

Host kernel needs patch

As of this writing (October 2020), a patch is needed for the Linux kernel. This is necessary to bypass the bug that exists in the Radeon series, commonly called the PCIe reset bug. Normally, it sends a reset to the device when the virtual machine is closed, but the Radeon series seems to have a bug that locks to a strange state when receiving this command. In a real machine, the PCIe power is turned off, so this is not a problem, but in the case of a virtual machine, the power is cut off virtually (BACO), so it becomes a problem. To avoid this phenomenon, you need to perform a special procedure to reset the device. Patch for that is provided by volunteers. By applying this patch, you can restart the virtual machine (termination, boot cycle).

Reboot the host after installing the driver

The Radeon driver will prompt you to restart your machine immediately after installation. It also starts a countdown and automatically tries to restart the virtual machine. At this time, reboot the host (probably because you need to reset the hardware). It seems that the driver cannot be installed successfully just by restarting the virtual machine. There are no particular warnings, but once it fails, you will need to reinstall the driver.

Inoperable due to spring driver update

It stopped working well after the driver update around the spring of 2020. The screen output to the display is not performed well, and the display treats it as a no-signal state. There is a possibility of this phenomenon, driver malfunction, etc., so I left it for a while, but there is no sign that it will be fixed even after multiple updates, so I seriously searched for a solution.

As a result of various trials and errors, it seems that it is necessary to deceive the GPU driver. If you were using llbvirt, you had to add something like <vendor_id state =" on "value =" 101 "/> to the / domain / features / hyperv in your machine's XML file. If you are using QEMU as it is, it seems that you need to add a considerable option. Arch Linux Article It seems that almost the same operation as is required. However, <hidden state ='on' /> was not needed.

This allows you to use the GPU as before. In addition, the recording function (Radeon ReLive), which was previously unavailable because the item did not appear in the driver utility, can now be used. There are also things like this ...

The GPU area is solidified with proprietary software, and now it works normally, so I'm satisfied with this place.

Recommended Posts

Run Radeon GPU on Windows on QEMU / KVM
Install Chainer 1.6 (GPU) on Windows 7.
Run Jupyter Notebook on windows
Run FreeBSD on Linux + qemu
Run Tensorflow natively supported on windows
Run SwitchBot on Windows 10 with Bleak
Run XGBoost on Bash on Ubuntu on Windows
Run Yocto on Ubuntu using QEMU.
Run servo with Python on ESP32 (Windows)
Run TensorFlow on a GPU instance on AWS
Run py.test on Windows Anaconda and MinGW
Run matplotlib on a Windows Docker container
Run Linux on ARM architecture with QEMU
Run django applications on Windows + Apache + mod_wsgi + services.
Put MicroPython on Windows to run ESP32 on Python
Python on Windows
Run yolov4 "for the time being" on windows
[Windows] Memo to use Keras on GPU [Tensorflow-GPU]
Run Kali Linux on Windows with GUI (without VirtualBox)
Run Tensorflow from Jupyter Notebook on Bash on Ubuntu on Windows
A memo of installing Chainer 1.5 for GPU on Windows
Building a TensorFlow environment that uses GPU on Windows 10
Run GPU version tensorflow on AWS EC2 Spot Instances
How to run Django on IIS on a Windows server
Pylint on Windows Atom
Linux (WSL) on Windows
Run Django on PythonAnywhere
Run mysqlclient on Lambda
Use pyvenv on Windows
Anaconda on Windows Terminal
Install Anaconda on Windows 10
python basic on windows ②
Install python on windows
Install pycuda on Windows10
Run OpenMVG on Mac
Build TensorFlow on Windows
Try FEniCS on Windows!
Build XGBoost on Windows
Install pygraphviz on Windows 10
Use Ansible on Windows
Try Poerty on Windows
Install Chainer 1.5.0 on Windows
Use QuTiP on Windows
Use pip on Windows