homelab-notes/proxmox1/gpu-passthrough-notes.md
ilia e6ab067641
All checks were successful
CI / skip-ci-check (push) Successful in 1m15s
CI / markdown-lint (push) Successful in 1m18s
CI / yaml-validate (push) Successful in 1m18s
Add gpu, qbit and vikunja notes (#2)
Reviewed-on: #2
2025-12-30 23:12:38 -05:00

147 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GPU Passthrough (VFIO) Notes
Host/guest checklist for GPU passthrough (or virtual GPU) when building Debian VMs in Proxmox / virt-manager style setups.
---
## Host: Pick GPU and enable passthrough
List GPUs on the host:
```bash
lspci | egrep -i 'vga|3d|display'
```
Note the PCI ID of the card you want to pass, e.g. `0000:01:00.0`.
On the host, enable IOMMU and passthrough (Proxmox/virt-manager style):
- Add appropriate kernel params (example Intel):
```text
intel_iommu=on iommu=pt
```
- Reboot and verify:
```bash
dmesg | egrep -i 'iommu|dmar'
```
Bind the GPU to `vfio` (or equivalent passthrough driver) on the host so the VM can own it exclusively.
---
## Host: Create the VM with a VGA/GPU device
Create a new VM (Proxmox or virt-manager):
- **Firmware**: UEFI/OVMF if possible
- **Machine type**: Q35/modern
- **CPU**: host-passthrough (or similar)
Add GPU to the VM:
- Add PCI device: select your GPU (and its audio function if present)
- For a purely virtual GPU instead (no passthrough), pick Virtio GPU or QXL as the display adapter
Add display channel:
- If you want a normal graphical console, use SPICE (virt-manager) or Proxmoxs standard console display
- Add a Channel (spice) device for clipboard/resize when using SPICE
---
## Guest: Verify what GPU the VM sees
Inside the guest OS (your Debian VM):
```bash
lspci | egrep -i 'vga|3d|display'
lsmod | egrep 'nvidia|amdgpu|radeon|virtio_gpu'
```
Interpretation:
- `NVIDIA Corporation ...` → real NVIDIA passthrough
- `Advanced Micro Devices, Inc. [AMD/ATI] ...` → AMD passthrough
- `Red Hat, Inc. Virtio GPU` or `QXL` → virtual GPU only
---
## Guest: Install and test drivers
### If NVIDIA passthrough
Install driver and tools:
```bash
sudo apt update
sudo apt install nvidia-driver-535 nvidia-smi
```
(Adjust version to what Debian suggests.)
Test:
```bash
nvidia-smi
watch -n 1 nvidia-smi
```
The watch line must be `watch -n 1 nvidia-smi`.
Quick 3D check:
```bash
sudo apt install mesa-utils
glxgears
```
GPU utilization should rise in `nvidia-smi` while `glxgears` runs.
### If AMD passthrough
Inspect and ensure `amdgpu` is used:
```bash
sudo lshw -c video
lsmod | grep amdgpu
```
Install tools:
```bash
sudo apt install mesa-utils
# optionally:
sudo apt install amdgpu-tools # or ROCm SMI tools if available
```
Monitor:
```bash
watch -n 1 sudo amd-smi
```
(Or the ROCm SMI CLI in your distro.)
### If only Virtio/QXL is present
- You have a virtual GPU, not the physical one.
- You can still use `glxgears` and basic acceleration, but host GPU usage is not controlled directly from inside this VM.
- To use the physical card, change the VM to PCI passthrough as above.
---
## Guest: Console and SPICE/GUI behavior
- With SPICE display and the spice channel present, dynamic resolution and clipboard should work once guest tools are installed.
- If a graphical display manager (e.g. LightDM) misbehaves, you can force a TTY-only boot:
```bash
sudo systemctl set-default multi-user.target
sudo systemctl disable --now lightdm.service
```
This gives you a reliable text console, and you can work purely over SSH for GPU workloads.