How to read/write iova(I/O Virtual Address) of PCIE endpoind mode

Hi Nvidia,

I’m testing the endpoint mode of PCIE,
I add the patch of the topic.

The patch work fine and I got the iova of EP side.
But how cauld I read/write the IOVA of PCIE.

wilson@OrinNX-EP:~$ sudo dmesg | grep pci_epf_nv_test
[  522.603944] pci_epf_nv_test pci_epf_nv_test.0: BAR0 RAM IOVA: 0xe0000000

Hi ,
Could anyone help us?

Hi Wilson,

From RP → EP, you can access it via BAR address.
sudo lspci -vvv | grep region gives BAR address, use region 0 address to access the memory allocated on EP.

Hi Wayne,

Yes, I can get Region 0 address is 0x2428000000

RP:~$sudo lspci -vvv -s 0004:01:00.0 | grep Region
	Region 0: Memory at 2428000000 (32-bit, non-prefetchable) [size=64M]
	Region 2: Memory at 2140000000 (64-bit, prefetchable) [size=128K]
	Region 4: Memory at 242c000000 (64-bit, non-prefetchable) [size=4K]
RP:~$ sudo busybox devmem 0x2428000000
0x00000000

But It looks that can’t sync on EP:

EP:~$ sudo busybox devmem 0x2428000000
0xFFFFFFFF

Hi Wilson,

Address 0x2428000000 is valid on RP side only. On EP side, you must access the memory using the virtual address allocated by dma_alloc_coherent().

There is no way to access this memory using command line, please dump the memory in driver itself.

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