Barrelfish inside qemu with PCIe passthrough

Recent Intel/AMD processors and chipsets support PCIe virtualization. This requires a CPU supporting VT-d/AMD-Vi and a chipset that includes an IOMMU. Linux with KVM support passing a PCIe device to qemu guests transparently. This guide focuses on Intel hardware.

Prerequisites

A computer supporting IOMMU and a processor supporting VT-d are required for this to function. Additionally, a Linux version with KVM and IOMMU support has to be running. Check for IOMMU support using dmesg | grep IOMMU . The output should be similar to the following:

ubuntu@ubuntu:~$ dmesg|grep IOMMU
[    0.000000] Intel-IOMMU: enabled
[    0.000000] Intel-IOMMU: enabled
[    0.401164] dmar: IOMMU 0: reg_base_addr fbffe000 ver 1:0 cap d2078c106f0466 ecap f020de
[    0.416382] dmar: IOMMU 1: reg_base_addr ebffc000 ver 1:0 cap d2078c106f0466 ecap f020de
[    0.436580] IOAPIC id 2 under DRHD base  0xfbffe000 IOMMU 0
[    0.442900] IOAPIC id 0 under DRHD base  0xebffc000 IOMMU 1
[    0.449217] IOAPIC id 1 under DRHD base  0xebffc000 IOMMU 1
[   30.844389] IOMMU 0 0xfbffe000: using Queued invalidation
[   30.850527] IOMMU 1 0xebffc000: using Queued invalidation
[   30.856664] IOMMU: Setting RMRR:
[   30.860391] IOMMU: Setting identity map for device 0000:00:1a.0 [0xbdcf9000 - 0xbdd1dfff]
[   30.869716] IOMMU: Setting identity map for device 0000:00:1d.0 [0xbdcf9000 - 0xbdd1dfff]
[   30.879012] IOMMU: Prepare 0-16MiB unity mapping for LPC
[   30.885068] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]