Created
November 26, 2022 14:51
-
-
Save phhusson/4bf5a5bcc910c3d1a372b1fb19e71daf to your computer and use it in GitHub Desktop.
phh's GPU passthrough setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
systemctl stop nvidia-persistenced.service | |
echo 0000:23:00.0 > /sys/bus/pci/devices/0000:23:00.0/driver/unbind | |
echo 0000:23:00.1 > /sys/bus/pci/devices/0000:23:00.1/driver/unbind | |
modprobe macvtap | |
ip link add link enp39s0 name eth0.3 type macvtap mode bridge | |
ip link set eth0.3 up | |
modprobe vfio-pci ids=10de:2484,10de:228b | |
#swtpm socket --ctrl type=unixio,path=swtpm-kvm0 --tpmstate dir=$PWD/tpm --tpm2 --log level=20 | |
# As root, not simply prefix with sudo, because <> | |
##kvm -vnc :0 -drive file=hdd -m 8192 -cpu 'host' -chardev socket,id=chrtpm,path=swtpm-kvm0 -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 -smp 8 -bios /usr/share/ovmf/OVMF.fd -usb -device usb-tablet -device vfio-pci,host=0000:23:00.0,multifunction=on -device vfio-pci,host=0000:23:00.1 -net nic,model=e1000,macaddr=$(cat /sys/class/net/eth0.3/address) -net tap,fd=31 31<>/dev/tap$(cat /sys/class/net/eth0.3/ifindex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment