Data transfer from EP using EP DMA

I’m having two Jetson Xavier boards, one is RC and another is for EP.

I’m trying initiate data transfer from EP to RC. It works fine without DMA. But when i try to transfer the data using DMA, it is not working.
Below are the steps i followed for DMA,

For the source address: I have reserved 256MB of data starting from location 0x470000000. In the driver i have ioremapped it.
Since i cannot use virtual address for DMA , i have used dma_map_single() (for 0x96000 bytes) to get the dma address and this is used as source address.

For the destination address: Similar like without DMA method, I have used pci_epc_mem_alloc_addr() and pci_epc_map_addr(). But with one change i.e here i have used the phys_addr(passed as arg to pci_epc_map_addr()) as destination address.

Am i doing anything wrong? why is it not working in DMA ?

Based on the description, I believe you are trying to do DMA write with source being the EP system’s local memory and destination being the RP system’s local memory and the errors are observed in the RP system. Is that a correct understanding?
If so, I think the issue is that the destination should be a DMA’able address and in this case, the physical address is given directly. Since SMMU is enabled for the controller, it throws errors when a non DMA’able address access takes place from the PCIe IP.

@vidyas I’m not observing any errors at RC. I dont know whether EP issued tlp properly or not.

@vidyas Should i have convert the destination PCIe space address to iova address?
The physical address which i referred is PCIe space address not DDR address.

I have even tried converting PCIe space physical address to iova address but at that time I’m getting errors at RC side.

Hi @vidyas ,
Is there any update on this?
It seems like problem with source address. Am i doing correctly? i.e reserving memory in device tree, then in driver ioremap to get virtual address and dma_map_single with that virtual address inorder to get iova address?

Hi dasanfreedom,
Would you please upload your code let us have a review ?
Or you can refer to nvidia/drivers/pci/endpoint/functions/pci-epf-tegra-vnet.c which transfer skb by PCIe DMA
static netdev_tx_t tvnet_ep_start_xmit(struct sk_buff *skb,
struct net_device *ndev)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.