Repolode
cakehonolulu

cakehonolulu/pciem

A Linux kernel framework that lets you build virtual PCIe devices in userspace and test host drivers against them without real hardware.

Stars
375
Forks
19
Open issues
0
Last commit
20 days ago

What is it?

PCIem creates synthetic PCIe devices that the host Linux kernel sees as legitimate PCI devices. Unlike approaches that expose emulated hardware to a guest VM through QEMU or vfio-user, the device appears directly on the host's PCIe bus, so a real kernel driver can bind to it and run on the same machine.

The device logic is written in userspace and communicates with the kernel framework through the /dev/pciem device file. The framework provides BAR creation with MMIO access tracing, legacy, MSI and MSI-X interrupt injection, a PCI capability framework, and IOMMU-aware DMA between the kernel and the userspace device. Peer-to-peer DMA is available as a preliminary feature with whitelist-based access control.

The project targets Linux 6.6 and later, built with gcc-12, on amd64, i386, aarch64 and riscv. Example devices include a Bochs BGA display card, an NVMe controller, an Intel HDA audio card and an E1000 network card.

Key features

  • 01Creates PCI BARs that userspace can monitor for MMIO reads and writes.
  • 02Injects legacy, MSI and MSI-X interrupts into the host.
  • 03Provides a PCI capability framework for device configuration.
  • 04Performs IOMMU-aware DMA between the kernel and a userspace device.
  • 05Runs entirely in userspace, exposing the device through /dev/pciem.

Use cases

  • Developing and testing PCIe device drivers without physical hardware.
  • Prototyping a new PCI device model and checking how a real kernel driver behaves with it.
  • Experimenting with NVMe, audio, network or display drivers against emulated devices.

Things to know

  • Requires Linux kernel 6.6 or newer and gcc-12 to build.
  • Peer-to-peer DMA support is preliminary.
  • The kernel components are GPLv2, a copyleft license.

Topics

FAQ

What is pciem?
A Linux kernel framework that lets you build virtual PCIe devices in userspace and test host drivers against them without real hardware. PCIem creates synthetic PCIe devices that the host Linux kernel sees as legitimate PCI devices. Unlike approaches that expose emulated hardware to a guest VM through QEMU or vfio-user, the device appears directly on the host's PCIe bus, so a real kernel driver can bind to it and run on the same machine.
Is pciem free to use? What license does it have?
pciem is open source under the GPL-2.0 license. Check the license terms before using it in commercial products.
Is pciem still maintained?
Actively maintained. The last commit to pciem was on Sep 30, 2026.
What can I use pciem for?
Developing and testing PCIe device drivers without physical hardware. Prototyping a new PCI device model and checking how a real kernel driver behaves with it. Experimenting with NVMe, audio, network or display drivers against emulated devices.
Where can I get pciem?
The source code and installation instructions are on GitHub: https://github.com/cakehonolulu/pciem

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects