Get the latest tech news
Learning about PCI-e: Driver and DMA
Creating a simple driver for a simple PCI-e device (in QEMU)
The probe function (which is only called if the device/vendor IDs match), needs to return 0 if it takes ownership of the device. Bus mastering is a feature which allows devices to directly manipulate system memory without involving the CPU. We now have a 'framebuffer' that can receive write(2) from userspace, and will forward the data as-is to a PCI-e device using DMA; we can cheat a little bit to pretend we have a working GPU, by hooking the card's buffer to QEMU's console output:
Or read this on Hacker News