vendor-reset

1
2
3
4
5
6
7
apt-get install pve-headers-$(uname -r) git dkms build-essential
git clone https://github.com/gnif/vendor-reset.git
cd vendor-reset
dkms install .
echo "vendor-reset" >> /etc/modules
update-initramfs -u
shutdown -r now

vendor_reset_hook

1
2
3
vim /etc/systemd/system/gpu-vendor-reset-method.service
systemctl enable gpu-vendor-reset-method
systemctl start gpu-vendor-reset-method
1
2
3
4
5
6
7
8
9
[Unit]
Description=Set the AMD GPU reset method to 'device_specific'
After=multi-user.target

[Service]
ExecStart=/usr/bin/bash -c '/usr/sbin/modprobe vendor-reset && /usr/bin/echo device_specific > /sys/bus/pci/devices/0000:07:00.0/reset_method'

[Install]
WantedBy=multi-user.target

options

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash

modprobe vfio-pci
dev="0000:07:00.0"

vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo 'device_specific' > /sys/bus/pci/devices/$dev/reset_method
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
echo 'device_specific' > /sys/bus/pci/devices/$dev/reset_method

XRSec has the right to modify and interpret this article. If you want to reprint or disseminate this article, you must ensure the integrity of this article, including all contents such as copyright notice. Without the permission of the author, the content of this article shall not be modified or increased or decreased arbitrarily, and it shall not be used for commercial purposes in any way