Assigning PCI device to device_pd
Alexander Senier
alex at ...331...
Tue Nov 22 00:54:18 CET 2016
Hi all,
I'm building a toy driver to experiment with the details of Intel integrated graphics. My experiments are based on Genode 16.08 (master) using
NOVA. Getting a capability to the IGD device (0:2:0) from the platform driver works, so does reading/writing PCI config space, mapping BAR0 and
accessing MMIO registers.
Next, I want to test DMA from the IGD device by
1. Allocating DMA memory (via alloc_dma_buffer()) and attaching it to the driver address space
2. Mapping the aperture (BAR2)
3. Pointing the GTT to the physical address of the DMA memory allocated in 1.
4. Writing some data to the DMA memory
5. Reading that data back through the aperture
Unfortunately, I'm stuck with that test. Apparently the IOMMU mappings are not set up correctly and NOVA emits respective IOMMU faults:
[ 0] DMAR:0xffffffff81034040 FRR:0 FR:0x5 BDF:0:2:0 FI:0x041d4000
The BDF is the expected IGD device and the fault address matches the physical address of the allocated DMA memory (and the PTE set up in the GTT).
When instrumenting device_pd, I see that attach_dma_mem() is called for the correct physical address and size. However, assign_device() never
gets called for 0:2:0. The only place I see where assign_device() is used in the code, is in config_write() when writing PCI_CMD_DMA to
PCI_CMD_REG. However, when doing such a config_write() manually in my component, I get an Out_of_metadate exception. How can I assign the PCI
device to my drivers device_pd?
See [1] for example code.
Thanks a lot!
Cheers,
Alex
[1] https://github.com/senier/gpu_kernel/tree/master/src/app/hello_gpu
More information about the users
mailing list