Hi,
Currently we are having a setup like one jetson xavier acts as RC and another jetson xavior acts as Endpoint.
In that, I want to try the dma test code provided in the nvidia/drivers/pci/dwc/pcie-tegra.c.
I understood from the code we can test the dma engine using the debugfs from userspace
But when i try to enable CONFIG_PCIE_TEGRA_DW_DMA_TEST thru make menuconfig command, i couldn’t found CONFIG_PCIE_TEGRA_DW_DMA_TEST options.
Hi ,
I have added a macro directly to source file itself. Now debugfs files available related to dma in /sys/kernel/debug/pcie-5 directory.
I tried to test the dma by writing 0xc0000000(This is the address printed when memory allocated using dma_alloc_coherent) as src address, 0x1f40000000(This is the address mapped for bar0) as dst address , channel number as 0 and size as 0x100.
I tried in polling method by adding dma-poll in device tree.
after performing write operation by opening write file, i checked the dmesg log, it printed DMA write passed.
But when i checked the data from userspace using devmem application, the data present in location 0x1f40000000 and 0xc0000000 are different.
Regarding the data not being equal, the source address here i.e. 0xC0000000 is an IOVA address and NOT the physical address ¶. The input argument to devmem should always be a PA and hence the data at 0xC0000000 PA would not be equal to the data at 0xC0000000 IOVA address (for which the physical address equivalent would be at a different place, certainly not at 0xC0000000 PA).
It is for this reason that the below code is added to use the CPU-VA for comparison purposes (FWIW, dma_alloc_coherent() gives returns two addresses pointing to the same location viz. CPU-VA to be used by the CPU and IOVA to be used by the PCIe controller)
/* compare copied data */
if (!memcmp(pcie->cpu_virt_addr, dst_cpu_virt, pcie->size))
dev_info(pcie->dev, "DMA-Write test PASSED\n");
else
dev_info(pcie->dev, "DMA-Write test FAILED\n");