logoalt Hacker News

Linux kernel framework for PCIe device emulation, in userspace

215 pointsby 71bwyesterday at 7:51 AM76 commentsview on HN

Comments

sedatkyesterday at 8:16 PM

That's pretty much the Linux equivalent of Device Simulation Framework we had for Windows back in 2000's.

In the presentation below, only the USB capabilities of it is discussed, but it was able to simulate PCI devices too.

https://download.microsoft.com/download/5/b/9/5b97017b-e28a-...

tiernanoyesterday at 9:59 AM

Hmmm.... Wondering if this could be eventually used to emulate a PCIe card using another device, like a RaspberryPi or something more powerful... Thinking the idea of a card you could stick in a machine, anything from a 1x to 16x slot, that emulates a network card (you could run VPN or other stuff on the card and offload it from the host) or storage (running something with enough power to run ZFS and a few disks, and show to the host as a single disk, allowing ZFS on devices that would not support it). but this is probably not something easy...

show 9 replies
krupanyesterday at 6:06 PM

So just to be clear, you have to boot up the physical machine with a kernel command-line argument to reserve some RAM for this to work? And the amount of RAM you reserve is for BAR memory? If you wanted multiple PCIem devices (can you do that?) you'd need to reserve RAM for each of them?

show 1 reply
Suracyesterday at 10:13 AM

that is a huge win if you are developing drivers or even real hardware. it allows to iterate on protokols just with the press of a button

show 2 replies
iamoutoftouchyesterday at 6:10 PM

How is that better than emulating the device in QEMU or with something like libvfio-user (which also works on top of QEMU)?

show 1 reply
_lunixyesterday at 10:18 PM

very interesting work! I've been exploring a different idea on the side, using SPDK+libvfio-user [0] to emulate PCIe devices inside QEMU, which doesn't require a kernel module but it's a bit less flexible than this approach.

[0] https://movementarian.org/blog/posts/2025-08-27-vfio-user-cl...

agent013yesterday at 1:39 PM

I've been burned before by driver bugs that only manifested under very specific timing conditions or malformed responses from the device, tnx

show 1 reply
throwaway132448yesterday at 10:21 AM

Tangential question: PCIe is a pretty future-proof technology to learn/invest in, right? As in, it is very unlikely to become obsolete in the next 5-10 years (like USB)?

show 5 replies
petabytyesterday at 5:41 PM

vhci-hcd for USB has been so useful for usb development. Especially for testing usb driver code in CI.

JoshTriplettyesterday at 4:11 PM

Any plans to upstream the kernel-side support?

show 1 reply
brcmthrowawayyesterday at 8:54 PM

How would I do this under macOS?