VFIO는 “Virtual Function I/O”의 약자로, 리눅스 커널에 들어있는 장치 패스스루용 프레임워크/드라이버 체계라고 보면 됩니다.
VFIO의 의미/역할
- 의미: VFIO는 사용자 공간(userspace) 프로그램이나 VM(QEMU/KVM 같은)이 직접 PCI 장치(GPU, NIC, NVMe 등)에 접근할 수 있게 해주는 커널 서브시스템이에요.
- 목적: 이걸 이용하면 게스트가 가상 에뮬레이션 장치 대신 호스트의 실제 하드웨어를 거의 네이티브 성능으로 쓰도록 만드는 것이 가능해집니다 (GPU passthrough 등).
Passthrough에서 VFIO가 하는 일
Ubuntu + KVM에서 GPU 같은 걸 passthrough 할 때 흔히 보이는 vfio-pci가 핵심인데, 흐름은 대략 이렇습니다.
- IOMMU(VT-d / AMD-Vi)를 켜서 장치의 DMA를 격리할 수 있게 함.
- 원래 장치를 잡고 있던 호스트 드라이버(nvidia, nouveau, ixgbe 등)에서 장치를 떼어냄(unbind).
- 그 장치를
vfio-pci드라이버에 바인딩해서, 이제부터는 VFIO가 그 장치를 “잡고” 있게 함. - QEMU/libvirt가 VFIO를 통해 그 장치를 특정 VM에 붙여주고, VM 안의 드라이버가 직접 그 물리 장치를 사용.
즉, VFIO = 유저/VM이 커널을 거치지 않고도 안전하게 물리 장치에 직접 접근하도록 IOMMU 기반 격리 + API를 제공하는 커널 프레임워크,vfio-pci는 그 중에서 PCI 장치를 VM에 패스스루할 때 쓰는 드라이버라고 이해하면 됩니다.
출처
[Ubuntu 18.04/20.04] Virtual Machine with Passthrough - marco https://marcokhan.tistory.com/251
[Ubuntu 22.04.3 Server LTS] QEMU/KVM passthrough & 중첩 ... https://junyharang.tistory.com/495
[가상화] PCI Pass-through와 VFIO - Computing - 티스토리 https://computing-jhson.tistory.com/92
How to Configure PCI Passthrough for VMs on Ubuntu - OneUptime https://oneuptime.com/blog/post/2026-03-02-configure-pci-passthrough-vms-ubuntu/view
VFIO, Passthrough - 아는 개발자 https://selfish-developer.com/entry/VFIO-Passthrough
VFIO-PCI Passthrough https://itpe.jackerlab.com/entry/VFIO-PCI-Passthrough
다시 한번 시작하는 우분투 서버 깔고 그 위에서 GPU 하나로 게스트 OS에 Passthrough 하고 나서 KVM의 메모리를 조작해서 윈도우를 마음대로 주무르기 까지의 웹로깅 https://blog.naver.com/makdan/221570452022
VFIO & mdev (디바이스 패스스루) https://minzkn.com/linuxkernel/pages/vfio-mdev.html
VFIO가 뭐임? https://www.reddit.com/r/VFIO/comments/12nfck3/what_is_vfio/
GPU PCIe Passthrough 를 통해 VM에 GPU 할당하여 사용하기 (1) https://itpractice.tistory.com/7
설정예제
Ubuntu를 돌리는 NAS에서 VFIO passthrough 설정은 대략 아래 7단계로 정리할 수 있어요.
(예: GPU / NVMe / NIC 등 PCI 장치를 KVM VM에 직접 할당하는 경우)
1. 하드웨어/BIOS 설정
- CPU: Intel이면 VT‑d, AMD이면 **AMD‑Vi(IOMMU)**를 BIOS에서
Enabled. - 메인보드: BIOS에서 IOMMU / “PCI‑SATA/PCI‑NVMe Passthrough” 계열 옵션 켜기.
이후 리부팅 후 아래로 IOMMU 활성 여부 확인:
dmesg | grep -i "IOMMU\|DMAR\|AMD-Vi"IOMMU enabled / AMD-Vi enabled 같은 메시지가 나오면 준비 완료.
2. GRUB에 IOMMU + VFIO 옵션 추가
sudo nano /etc/default/grub- Intel:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on iommu=pt" - AMD:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=on iommu=pt"
저장 후 업데이트:
sudo update-grub && sudo reboot3. 장치가 속한 IOMMU group 확인
해당 GPU/NVMe/NIC가 어떤 группа에 속해 있는지 확인:
sudo lspci -nn원하는 장치를 찾고, 예를 들어 01:00.0 VGA [10de:2206] 라면:
# 해당 장치의 IOMMU 그룹 확인
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
[ -e "$d" ] && echo "IOMMU Group $n:" $(ls -l "$d")
done | grep "01:00"장치가 가능한 한 혼자 a group에 속해 있는 것이 이상적입니다 (ACS 문제가 적음).
4. VFIO 드라이버 설치 및 모듈 로드
필요한 모듈들을 /etc/modules에 등록:
sudo nano /etc/modules아래 줄을 추가:
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd데비안/우분투 계열은 initramfs에 모듈 정보도 포함하도록:
sudo nano /etc/initramfs-tools/modules같은 모듈들을 한 줄씩 추가한 뒤:
sudo update-initramfs -u5. passthrough 장치를 vfio‑pci로 고정 바인딩
lspci -nn으로 나온 PCI ID를 이용해 vfio-pci에 강제 바인딩시킵니다.
예: GPU VGA 10de:2206 + HDMI Audio 10de:1aef
sudo nano /etc/modprobe.d/vfio.conf내용:
options vfio-pci ids=10de:2206,10de:1aef- NVIDIA 등 기존 GPU 드라이버를 먼저 vfio보다 늦게(또는 아예) 로드하지 않게 하려면:
softdep nvidia pre: vfio-pci또는
blacklist nouveau
blacklist nvidia이후 initramfs 재생성:
sudo update-initramfs -u
sudo reboot6. 부팅 후 vfio‑pci 바인딩 확인
재부팅 후:
lspci -k -s 01:00.0 # VGA
lspci -k -s 01:00.1 # HDMI AudioOutput 예:
Kernel driver in use: vfio-pci이렇게 되어 있으면 해당 장치가 vfio-pci에게 잡혀서 VM에 pass-through 가능 상태입니다.
7. KVM / libvirt에서 VM에 장치 할당
virt-manager 또는 virsh edit로 VM 구성 파일을 열고, 예를 들어:
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</source>
</hostdev>또는 virt-manager GUI에서Add Hardware → PCI Host Device → 앞에서 확인한 GPU 장치를 선택.
- 고급:
OVMF이미지를 사용해 UEFI로 VM 부팅 (Windows 게스트용).
정리 (NAS용 요약)
- NAS Ubuntu + KVM이면:
- BIOS에서 IOMMU/VT‑d/AMD‑Vi 켜기 →
- GRUB에
iommu=on계열 부팅 파라미터 추가 → vfio/vfio-pci모듈 initramfs에 포함 →- passthrough 장치를
vfio-pci가 항상 잡도록ids=+ blacklist 설정 → - KVM VM에 그 PCI 장치를 hostdev로 붙이면 끝.
출처
[Ubuntu 18.04/20.04] Virtual Machine with Passthrough - marco https://marcokhan.tistory.com/251
How to Configure GPU Passthrough in KVM on Ubuntu https://oneuptime.com/blog/post/2026-03-02-how-to-configure-gpu-passthrough-in-kvm-on-ubuntu/view
[Ubuntu 22.04.3 Server LTS] QEMU/KVM passthrough & 중첩 ... https://junyharang.tistory.com/495
GPU PCIe Passthrough 를 통해 VM에 GPU 할당하여 사용하기 (1) https://itpractice.tistory.com/7
Host Setup for Qemu KVM GPU Passthrough with VFIO on ... https://www.cloudrift.ai/blog/host-setup-for-qemu-kvm-gpu-passthrough-with-vfio-on-linux
다시 한번 시작하는 우분투 서버 깔고 그 위에서 GPU 하나로 게스트 OS에 Passthrough 하고 나서 KVM의 메모리를 조작해서 윈도우를 마음대로 주무르기 까지의 웹로깅 https://blog.naver.com/makdan/221570452022
GPU-Passthrough-On-Ubuntu-22.04.2-for-Beginners https://github.com/Andrew-Willms/GPU-Passthrough-On-Ubuntu-22.04.2-for-Beginners
Virtual gaming machine with PCI passthrough on Ubuntu 20.04 https://mathiashueber.com/pci-passthrough-ubuntu-2004-virtual-machine/
NVIDIA GPU Passthrough with Ubuntu Server 24.4 on new ... https://www.reddit.com/r/VFIO/comments/1kwztit/nvidia_gpu_passthrough_with_ubuntu_server_244_on/
Up to Date Guide on enabling setting up VFIO on Ubuntu host (22.04) https://www.reddit.com/r/VFIO/comments/186quw4/up_to_date_guide_on_enabling_setting_up_vfio_on/
iGPU passthrough 상세예시
iGPU passthrough는 **CPU에 내장된 GPU(인텔 iGPU, AMD APU iGPU 등)**를 VM에 직접 할당해서,
- 호스트는 디스플레이 없이 headless로 쓰고,
- VM에서만 화면/그래픽을 사용하는 방식이다.
Ubuntu + KVM 기준으로 정리하면 아래 단계를 참고
1. 지원 여부 먼저 확인
Intel iGPU:
- Broadwell(5세대) 이후 일부 칩셋은
dmesg에서Disabling IOMMU for graphics때문에 VFIO passthrough이 안 되는 버전도 있어서,
i915 + VFIO 전체 장치 통째 passthrough은 세대/커널에 따라 불가능한 경우가 많음. - 그 대신 GVT‑g(또는 GVT‑d) 같은 가상화 기술로 “iGPU 일부를 VM에 나눠 쓰는” 방식이 더 현실적인 경우가 많음.
- Broadwell(5세대) 이후 일부 칩셋은
AMD iGPU(AMD APU):
- APU 내 그래픽을 vfio‑pci로 통째 passthrough해서 Windows VM에 쓰는 케이스가 존재하고,
vfio-pci.ids=로 iGPU PCI ID를 잡아서 VM에 hostdev로 붙이는 방식으로 구현 가능.
- APU 내 그래픽을 vfio‑pci로 통째 passthrough해서 Windows VM에 쓰는 케이스가 존재하고,
2. 기본 VFIO + IOMMU 설정 (Ubuntu NAS 기준)
BIOS에서 VT‑d(=Intel IOMMU) 또는 AMD‑Vi와 IOMMU를 활성화.
GRUB에 옵션 추가:
- Intel APU:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on iommu=pt" - AMD APU:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=on iommu=pt" - 적용:
sudo update-grub && sudo reboot
- Intel APU:
vfio모듈 initramfs에 포함:sudo nano /etc/modules아래를 추가:
vfio vfio_iommu_type1 vfio_pci vfio_virqfd그 다음:
sudo update-initramfs -u
3. iGPU 장치 vfio‑pci로 고정 바인딩
iGPU PCI ID 찾기:
lspci -nn | grep -i "VGA\|Display"예: Intel iGPU가
00:02.0 VGA [8086:5912]이면 ID는8086:5912.vfio‑pci ids에 iGPU 등록:
sudo nano /etc/modprobe.d/vfio.conf# Intel iGPU 예시 options vfio-pci ids=8086:5912 # AMD APU iGPU 예시(실제 ID로 교체) # options vfio-pci ids=1002:7340기존 그래픽 드라이버를 vfio보다 못 쓰게 하기 (Intel):
echo "softdep i915 pre: vfio-pci" | sudo tee -a /etc/modprobe.d/vfio.conf또는
echo "blacklist i915" | sudo tee -a /etc/modprobe.d/blacklist.confinitramfs 재생성 후 재부팅:
sudo update-initramfs -u sudo reboot부팅 후 확인:
lspci -k -s 00:02.0아래처럼 나오면 성공:
Kernel driver in use: vfio-pci
4. KVM VM에 iGPU 할당
virt-manager또는virsh edit에서 VM 열고:<hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </source> </hostdev>VM는 **OVMF(UEFI)**로 부팅하는 것이 좋다.
- Windows 게스트의 경우, iGPU/AMD APU iGPU는 UEFI에서 드라이버를 더 잘 인식.
5. Intel iGPU 주의사항 (특별히)
- 5세대(Broadwell) 이후 iGPU:
- 최신 커널에서
Disabling IOMMU for graphics on this chipset때문에 전체 iGPU를 vfio로 빼는 통째 passthrough이 안 되는 경우가 많음. - 이런 경우는
- GVT‑g로 iGPU를 “가상 GPU”로 쪼개서 여러 VM에 나눠 쓰거나,
- 또는 별도 dGPU를 VM에 passthrough하고 iGPU는 호스트 GUI용으로 쓰는 구조를 권장.
- 최신 커널에서
정리 (Ubuntu NAS에서 iGPU passthrough 체크포인트)
- Intel iGPU:
- VFIO 통째 passthrough은 세대/커널에 따라 막힘 → GVT‑g 또는 dGPU passthrough + iGPU 호스트용을 고려.
- AMD APU iGPU:
vfio-pci.ids=로 iGPU PCI ID를 vfio‑pci에 고정 → KVM VM에 PCI hostdev로 붙이면 비교적 직관적.
출처
Use GPU passthrough with Intel integrated graphics to ... https://worthdoingbadly.com/gpupassthrough/
What's the best way to passthrough an Intel integrated GPU? https://www.reddit.com/r/VFIO/comments/y6blh8/whats_the_best_way_to_passthrough_an_intel/
Intel iGPU passthrough with GVT-d on Ubuntu, Manjaro, ... https://www.youtube.com/watch?v=Tt4kHYO1S8U
clunkiersalt817/amdGPU-Passthrough: iGPU for ubuntu ... https://github.com/clunkiersalt817/amdGPU-Passthrough
Single GPU Passthrough in Ubuntu AMD CPU/GPU https://www.youtube.com/watch?v=eTX10QlFJ6c
QEMU GPU Passthrough - Tutorials https://discourse.ubuntu.com/t/qemu-gpu-passthrough/54509
[Ubuntu 18.04/20.04] Virtual Machine with Passthrough - marco https://marcokhan.tistory.com/251
AMD GPU Passthrough Windows VM passes through but ... https://www.reddit.com/r/VFIO/comments/1amegvz/amd_gpu_passthrough_windows_vm_passes_through_but/
How to Configure GPU Passthrough in KVM on Ubuntu https://oneuptime.com/blog/post/2026-03-02-how-to-configure-gpu-passthrough-in-kvm-on-ubuntu/view
stop intel igpu from using VFIO and make it use original ... https://forum.proxmox.com/threads/stop-intel-igpu-from-using-vfio-and-make-it-use-original-host-i915-driver-i-e-revert-passthrough.126692/
댓글
댓글 쓰기