Created
February 11, 2021 16:18
-
-
Save MakiseKurisu/1e16ef1448d66a56f3f9f07740010d35 to your computer and use it in GitHub Desktop.
Thinkpad W540 GPU passthrough
This file contains hidden or 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
# Reference guides: | |
# https://pve.proxmox.com/wiki/PCI(e)_Passthrough | |
# https://elijahliedtke.medium.com/home-lab-guides-proxmox-6-pci-e-passthrough-with-nvidia-43ccfb9424de | |
# https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Buster | |
# Based on fresh Debian Buster install | |
# Remember to turn on SVM in BIOS and disable CSM | |
# Disable closing lid event | |
sed -i "s/#HandleLidSwitch=suspend/HandleLidSwitch=ignore/" /etc/systemd/logind.conf | |
sed -i "s/#HandleLidSwitchExternalPower=suspend/HandleLidSwitchExternalPower=ignore/" /etc/systemd/logind.conf | |
sed -i "s/#HandleLidSwitchDocked=ignore/HandleLidSwitchDocked=ignore/" /etc/systemd/logind.conf | |
# Add your ip to hosts, see https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Buster | |
sed -i "s/127.0.1.1/192.168.1.90/" /etc/hosts | |
# Add Proxmox repository | |
echo "deb [arch=amd64] http://download.proxmox.com/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list | |
wget http://download.proxmox.com/debian/proxmox-ve-release-6.x.gpg -O /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg | |
chmod +r /etc/apt/trusted.gpg.d/proxmox-ve-release-6.x.gpg | |
# Update system | |
apt update | |
apt full-upgrade -y | |
# Install Proxmox packages, check some interactive questions' response in https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Buster | |
apt install proxmox-ve postfix open-iscsi -y | |
# Remove stock Debian kernel | |
apt remove linux-image-amd64 'linux-image-4.19*' -y | |
# Remove Proxmox Enterprise repository | |
rm /etc/apt/sources.list.d/pve-enterprise.list | |
# Load vfio-pci early | |
cat << EOF >> /etc/modules | |
vfio | |
vfio_iommu_type1 | |
vfio_pci | |
vfio_virqfd | |
EOF | |
# Bind vfio-pci via device ID | |
echo "options vfio-pci ids=10de:11fc,10de:0e0b" >> /etc/modprobe.d/vfio.conf | |
# Enable IOMMU | |
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt"/' /etc/default/grub | |
update-grub | |
# Blacklist display driver | |
cat << EOF >> /etc/modprobe.d/vfio-blacklist.conf | |
blacklist nouveau | |
blacklist nvidia | |
EOF | |
update-initramfs -u -k all | |
# Create bridge | |
sed -i "s/dhcp/manual/" /etc/network/interfaces | |
cat << EOF >> /etc/network/interfaces | |
auto vmbr0 | |
iface vmbr0 inet static | |
address 192.168.1.90/24 | |
gateway 192.168.1.254 | |
bridge-ports enp0s25 | |
bridge-stp off | |
bridge-fd 0 | |
EOF | |
cat << EOF >> /etc/pve/qemu-server/100.conf | |
agent: 1 | |
balloon: 0 | |
bios: ovmf | |
boot: order=scsi0;ide2;net0 | |
cores: 8 | |
efidisk0: local:100/vm-100-disk-1.qcow2,size=128K | |
hostpci0: 01:00,pcie=1 | |
ide0: local:iso/virtio-win.iso,media=cdrom,size=489986K | |
ide2: local:iso/Win10_20H2_v2_English_x64.iso,media=cdrom | |
machine: q35 | |
memory: 8192 | |
name: Quadro | |
net0: virtio=46:B2:5E:5E:79:66,bridge=vmbr0,firewall=1,queues=8 | |
numa: 0 | |
ostype: win10 | |
scsi0: local:100/vm-100-disk-0.qcow2,backup=0,discard=on,iothread=1,size=64G,ssd=1 | |
scsihw: virtio-scsi-single | |
smbios1: uuid=5f2a8822-0e55-4d37-8e18-3a35e0f42d31 | |
sockets: 1 | |
vmgenid: 3d719a56-955f-498e-b815-38be98f7756b | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment