I am attempting to configure an FPGA to DMA data via PCIe to memory on the Jetson TX2i.
I have allocated the destination memory using dma_zalloc_coherent. One of the arguments to dma_zalloc_coherent is the dma_handle, which I use to populate the destination address of the DMA descriptors.
Once the DMA is started, I see the following error appear in the dmesg output.
arm-smmu 12000000.iommu: Unhandled context fault: iova=0x00000000, fsynr=0x11, cb=22, sid=17(0x11 - AFI), pgd=0, pmd=0, pte=0
This is eventually followed up by some mc-err messages.
How do I decode the iommu message? Does the iova address tell me something?
Below is a dump of the DMA descriptors. Note that there are 2 descriptors carrying 500kbytes each. The destination address is properly configured for the buffer allocated by dma_zalloc_coherent. The data is generated by an FPGA so I don’t believe the source address needs to be configured. The source address would be configured if I were DMA’ing from the Jetson to the FPGA.
DMA transactions have a source and destination address. In my case, I am interfacing with a Xilinx XDMA module. This module sets up a scatter/gather DMA transaction. For our app, we are moving data from the FPGA to the Jetson. The destination address was set to a buffer allocated using dma_alloc_coherent.
Originally, I was not setting the source address. Since the data was being generated by the FPGA, I didn’t know what to put for the source address. It turns out the Xilinx XDMA module uses the source address to find the next DMA transfer to perform. It is their way to setup a linked list of DMA transfers.
General
This arm-smmu 12000000.iommu: Unhandled context fault: iova=0x00000000 like error thrown when the endpoint (i.e. the FPGA) wants to access (read or write) an un-allocated/un-pinned memory region.
IOVA
IOVA is IO Virtual address, the address which is known by the endpoint. So iova=0x00000000 means that the endpoint configured with a null pointer (more precisely some endpoint’s register is uninitialized.)
OK, which register?
Please try to locate the time of the exception. Separate the dma task.
If the exception is printed after starting, but before sending any data the descriptor list itself contains an unwanted null pointer.
If the exception occurs at the beginning of the dma transaction, the source/destination pointer is null.
If the exception thrown at the end of a descriptor, the writeback address is null.