A Linux kernel framework for synthetic PCIe device emulation entirely in userspace.
What is PCIem?
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 developing and testing PCIe device drivers without requiring actual hardware.
Architecture
┌──────────────────────────────────────────┐ ┌──────────────────────────────────────────────────┐ │ │ │ │ │ ┌─────────►Host Linux Kernel │ │ Linux Userspace │ │ │ │ │ │ │ │ │ │ │ │ │ ┌────────────────────────────┐ │ │ ┌────────────────────────────────────────┐ │ │ │ │ PCIem Framework ◄──────┼────────────►/dev/pciem◄───────────┼────► Userspace PCI shim │ │ │ │ │ │ │ │ │ │ │ │ │ │ - PCI Config Space │ │ │ │ - Emulates PCIe device logic │ │ │ │ │ │ │ │ │ │ │ │ │ │ - BAR Mappings │ │ │ └────────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ │◄───┤ - INT/MSI/MSI-X Interrupts │ │ │ │ │ │ │ │ │ └──────────────────────────────────────────────────┘ │ │ │ - DMA (With/without IOMMU) │ │ Userspace │ │ │ │ │ │ │ │ - P2P DMA │ │ │ │ │ │ │ │ │ └────────────────────────────┘ │ │ │ │ │ │ │ │ │ PCIe driver is unaware of PCIem │ │ │ │ │ │ │ │ │ ┌──────────────────────────────────┐ │ │ │ │ Real PCIe Driver │ │ │ │ │ │ │ │ └─┤ - Untouched logic from production│ │ │ │ │ │ │ └──────────────────────────────────┘ │ │ │ └──────────────────────────────────────────┘ Kernel Space
Current Features
BAR Support : Register and manage BARs programmatically
: Register and manage BARs programmatically Watchpoints : Event-driven architecture using CPU watchpoints for access detection
: Event-driven architecture using CPU watchpoints for access detection Legacy IRQ/MSI/MSI-X Support : Full interrupt support with dynamic triggering
... continue reading