
A Linux framework to enable userspace-defined "Virtual" PCIe card shims to enable in-host PCIe card driver development.
PCIem is a framework that creates virtual PCIe devices in the Linux kernel by leveraging a few novel techniques to populate synthetic cards as legitimate PCI devices to the host OS.
To brief what PCIem is: a framework for (Albeit not limited to) developing and testing PCIe device drivers without requiring actual hardware on the host.
PCIem and libfvio-user are two different solutions for different needs, there may be confusion when comparing both so herein the differences (See figure 1 for more).
The main one is that libvfio-user usually relies on a client (That implements the vfio-user protocol), usually QEMU (Through KVM, using VM exits) to expose the emulated PCIe device to the guest. You write your vfio server (With a callback mechanism usually) which then interacts with the client.
What PCIem does instead is, expose the device directly on the host; no KVM, no guests, no virtual machines, nothing. The device appears on the host's PCIe bus as if it was physically connected.
| Feature | PCIem | libfvio-user |
|---|---|---|
| Connection | Device file (/dev/pciem) | UNIX Sockets (vfio-user protocol) |
| Target driver runs on | Host | Guest OS |
| Emulated device runs on | Userspace | Userspace |
| Device accesses | Direct (Within host) | Virtualized (Guest to Host) |
Figure 1: Comparison between frameworks
graph LR
subgraph Kernel ["Host Linux Kernel"]
direction TB
RealDriver["Real PCIe Driver"]
subgraph Framework ["PCIem Framework"]
direction TB
Config["PCI Config Space"]
BARs["BARs"]
IRQ["Interrupts"]
DMA["DMA / IOMMU"]
end
end
Interface(("/dev/pciem"))
subgraph User ["Linux Userspace"]
direction TB
Shim["Device Emulation"]
end
Framework <==> Interface
Interface <==> Shim
6.6gcc-12amd64/i386, aarch64, riscvaarch64 note: Tested w/Raspberry Pi 4b, device-tree (No ACPI)
riscv note: Tested w/VisionFive 2 (Device-tree) and Muse Pi Pro (Device-tree and ACPI)
| Distribution | |||
|---|---|---|---|
| Ubuntu Latest | - | - | |
| Ubuntu 24.04 LTS | |||
| Debian Stable | - | - | |
| Fedora Latest | - | - | |
| openSUSE Tumbleweed | - | - |
A Bochs BGA-compatible (bochs-drm) card that can be driven by userspace utilities such as Weston; uses SDL3.
https://github.com/user-attachments/assets/d2f7abe4-aef4-4d3a-a30b-ab7ec793faed
NVME controller with 1GB of storage attached to. User can freely format, mount, create and remove files from the memory.
https://github.com/user-attachments/assets/29ce370a-7317-4fd4-9d1d-c3e868e1083d
ICH6-compatible emulation model that can play samples in conjunction with pipewire.
NOTE: Slight audio crackling only heard on recording, works fine otherwise
https://github.com/user-attachments/assets/7264a18c-6fcb-46c4-acde-9531b0be7ff6