Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

single-gpu-passthrough

БесплатноБез исполняемых скриптовНе проверен

Comprehensive skill for the author's single-GPU passthrough setup: Fedora 44 bootc atomic host with Intel i5-12400F, NVIDIA RTX 2060 12GB (TU106), QEMU…

mina-atef-00от mina-atef-00401 установка в других каталогах

Об этом скилле

Single GPU Passthrough — the author's Setup

System Overview

Component Detail
Host OS Fedora 44 (bootc atomic — ostree-based, immutable root)
Kernel 7.0.12-201.fc44.x86_64
CPU Intel i5-12400F (12th Gen Alder Lake, 6C/12T)
GPU NVIDIA RTX 2060 12GB (TU106) — PCI 01:00.0 + HDMI Audio 01:00.1
NVIDIA Driver 610.43.02
Display greetd → dms-greeter → niri (Wayland compositor)
QEMU 10.2.2
libvirt 12.0.0 (modular daemons)
VM Name win10
Boot UEFI (OVMF)
Storage NVMe 238GB (boot), HDD 1.8TB (data: niabc NTFS / niaext ext4)

Hardware Topology

IOMMU Groups

The GPU and its HDMI audio controller share a clean IOMMU group (Group 12):

  • pci_0000_01_00_0 — GPU (vendor 0x10de, product 0x1f03, class 0x030000)
  • pci_0000_01_00_1 — HDMI Audio (vendor 0x10de, product 0x10f9, class 0x040300)

Both devices must be passed together as they share IOMMU Group 12. They connect via PCI bridge at 0000:00:01.0.

Other Devices

  • 03:00.0 — Realtek RTL8111H Gigabit Ethernet
  • 04:00.0 — MAXIO NVMe SSD Controller

Kernel Configuration

Kernel Cmdline (bootc/ostree)

Kernel parameters are set via rpm-ostree kargs (NOT /etc/default/grub — bootc is immutable):

sudo rpm-ostree kargs \
  --append='intel_iommu=on' \
  --append='iommu=pt' \
  --append='rd.driver.blacklist=nouveau' \
  --append='modprobe.blacklist=nouveau' \
  --append='nvidia-drm.modeset=1'

Current cmdline (from /proc/cmdline):

intel_iommu=on iommu=pt rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1

IMPORTANT — bootc atomic context: On a bootc/ostree system:

  • /etc is writable (persists across updates)
  • /usr is immutable (resets on each deployment update)
  • Kernel params are applied via rpm-ostree kargs — add/remove requires a reboot
  • To add: sudo rpm-ostree kargs --append='new_param=value'
  • To remove: sudo rpm-ostree kargs --delete='old_param=value'
  • To replace: sudo rpm-ostree kargs --replace='old=value' --replace-to='new=value'
  • To view: rpm-ostree kargs

modprobe.d /etc Configs

/etc/modprobe.d/ is writable on bootc. The following reside there:

  • nvidia.conf (performance profile): NVreg_RegistryDwords, NVreg_EnableGpuFirmware, NVreg_DynamicPowerManagement, nvidia-drm modeset=1
  • vhost.conf: max_mem_regions=509

VFIO modules are not loaded at boot — they are loaded dynamically by the hook scripts on VM prepare.

IOMMU Verification Commands

# Check IOMMU is enabled
dmesg | grep -i iommu
cat /proc/cmdline | grep -o 'intel_iommu\|iommu'

# Check IOMMU groups
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
  echo "IOMMU Group $(basename $g):"
  for d in $g/devices/*; do
    echo -n "  $(basename $d): "
    lspci -nns "$(basename $d)" 2>/dev/null || echo "unknown"
  done
done

# Via virsh
virsh nodedev-list --cap pci
virsh nodedev-dumpxml pci_0000_01_00_0  # GPU
virsh nodedev-dumpxml pci_0000_01_00_1  # HDMI Audio

Hook Architecture

Overview

The passthrough uses libvirt qemu hooks — scripts that fire on VM lifecycle events. Three scripts form the system:

  1. /etc/libvirt/hooks/qemu — dispatcher: called by libvirt on VM prepare/release
  2. ~/.local/sbin/vfio-startup — detaches GPU from host, called on VM prepare
  3. ~/.local/sbin/vfio-teardown — reattaches GPU to host, called on VM release
  4. [email protected] — systemd inhibit sleep while VM runs

File Locations (Deployed)

Script Deployed To Purpose
qemu hook /etc/libvirt/hooks/qemu Dispatches startup/teardown per VM name
vfio-startup ~/.local/sbin/vfio-startup Prepare phase: detach GPU
vfio-teardown ~/.local/sbin/vfio-teardown Release phase: reattach GPU
inhibit service /etc/systemd/system/[email protected] Prevents sleep while VM active

NOTE: The repo's install_hooks.sh installs to /usr/local/bin/ but The author modified the qemu hook to call ~/.local/sbin/ instead. Always check which paths are active before modifying.

Script Sources

The source repo is at ~/projects/single-gpu-passthrough/ but the deployed scripts have been customized — they differ from the repo versions significantly.

Libvirt Hook Lifecycle

The qemu hook receives 4 positional arguments:

/etc/libvirt/hooks/qemu <vm_name> <operation> <sub-operation> <extra>
Phase When Called Operation Sub-Op
Prepare Before libvirt resource labeling, before guest start prepare begin
Start After labeling, before QEMU starts start begin
Started After QEMU process started started begin
Stopped Before libvirt restores labels stopped end
Release After l
Полный SKILL.md на ClawHub

Установить single-gpu-passthrough в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл single-gpu-passthrough?

Comprehensive skill for the author's single-GPU passthrough setup: Fedora 44 bootc atomic host with Intel i5-12400F, NVIDIA RTX 2060 12GB (TU106), QEMU 10.2.2, libvirt 12.0.0, Wayland (niri on greetd). Covers hook scripts, kernel config, libvirt domain XML, virsh operations, and troubleshooting for single-GPU VFIO passthrough to a Win10 VM.

Как установить скилл single-gpu-passthrough?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл single-gpu-passthrough запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить single-gpu-passthrough с