Xlinix DMA PCIe driver crashes

We’re using a Xilinx FPGA Development Board, the AC701, to stream data over the PCIe interface on the TX2 carrier board into the TX2.
On the TX2 we have this DMA driver running:

https://www.xilinx.com/support/answers/65444.html

On a Desktop Pc, this driver works stable.

On the TX2 the driver crashes after a couple of reads with this ERROR:

“Unable to handle kernel NULL pointer dereference at virtual address 00000004”

Feb  2 12:24:15 tegra-ubuntu kernel: [  616.619378] transfer_create():transfer_create()
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.623935] transfer_create():mapped_pages=1.
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.628332] transfer_create():sgl = 0xffffffc1a04a5280.
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.633608] transfer_create():hwnents=1.
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.637574] transfer_create():sg_page(&sgl[0])=0xffffffbdc82ed780.
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.643774] transfer_create():sg_dma_address(&sgl[0])=0x0000000080000000.
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.650603] transfer_create():sg_dma_len(&sgl[0])=0x00000008.
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.656386] xdma_desc_alloc():FAIL desc_virt():
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.661015] transfer_create():transfer_create():
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.665968] transfer_create():transfer->desc_bus = 0xffffffffffffffff.
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.672560] transfer_build():SGLE    0: addr=0x0000000080000000 length=0x00000008
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.680094] transfer_build():DESC    0: cont_addr=0x80000000 cont_len=0x00000008 ep_addr=0x0
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.688611] Unable to handle kernel NULL pointer dereference at virtual address 00000004
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.696716] pgd = ffffffc18c3a9000
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.700174] [00000004] *pgd=000000022838c003, *pud=000000022838c003, *pmd=0000000000000000
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.708534] Internal error: Oops: 96000046 [#1] PREEMPT SMP
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.714096] Modules linked in: xdma(O) fuse bcmdhd pci_tegra bluedroid_pm
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.720947] CPU: 2 PID: 2624 Comm: dmatest Tainted: G           O    4.4.38-tegra #1
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.728675] Hardware name: quill (DT)
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.732331] task: ffffffc1d0b16400 ti: ffffffc18c6fc000 task.ti: ffffffc18c6fc000
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.739869] PC is at transfer_create.isra.17+0x2e8/0x878 [xdma]
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.745833] LR is at transfer_create.isra.17+0x74c/0x878 [xdma]
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.751740] pc : [<ffffffbffcf74f20>] lr : [<ffffffbffcf75384>] pstate: 80000045
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.759122] sp : ffffffc18c6ffc20
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.762429] x29: ffffffc18c6ffc20 x28: 0000000000000000 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.767753] x27: ffffffc1a04a5380 x26: 0000000080000000 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.773075] x25: 0000000080000000 x24: 0000000000000000 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.778398] x23: 0000000000000001 x22: 0000000000000000 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.783720] x21: ffffffbffcf80888 x20: 0000000000000000 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.789041] x19: 0000000000000008 x18: 0000000000000a03 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.794362] x17: 0000007fb7ad1930 x16: ffffffc0001c5044 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.799684] x15: 00000000f5257d14 x14: 2030303030303030 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.805007] x13: 3878303d72646461 x12: 5f746e6f63203a30 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.810331] x11: 0000000000008221 x10: 00000000000008a0 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.815655] x9 : ffffffc18c6ff930 x8 : ffffffc1d0b16d00 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.820977] x7 : 0000000000000318 x6 : 0000000000000000 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.826300] x5 : 0000000000000000 x4 : ffffffc1d0b16d08 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.831622] x3 : ffffffc1a82fd3cc x2 : ffffffc1ebf7cb28 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.836945] x1 : 0000000000000000 x0 : 0000000000000000 
Feb  2 12:24:15 tegra-ubuntu kernel: [  616.842267]

After a driver debug, we found this position in the code that should be responsible for it:

desc_virt = (struct xdma_desc *)pci_alloc_consistent(dev, number * sizeof(struct xdma_desc), desc_bus_p);

When i look to the forum, i see a lot of people who have posted similar problems with pci_alloc_consistent.
But there are no solutions. I can not find something about SMMU in the device tree file… (L4T 28.1)

Please help me! I have no idea how to solve this.

Being discussed and supported at https://devtalk.nvidia.com/default/topic/1029631/jetson-tx2/pcie-2-0-on-tx2-not-meeting-specifications-/post/5238382/#5238382