xavier pcie endpoint problem

I am use PCIe to communicate between two Xaviers now, but I have some problem.
According to document 《NVIDIA Jetson AGX Xavier PCIe Endpoint Software for L4T》, I set the endpoint xavier as follows:

cd /sys/kernel/config/pci_ep/
mkdir functions/pci_epf_nv_test/func1
echo 0x10de > functions/pci_epf_nv_test/func1/vendorid
echo 0x0001 > functions/pci_epf_nv_test/func1/deviceid
ln -s functions/pci_epf_nv_test/func1 controllers/141a0000.pcie_ep/
echo 1 > controllers/141a0000.pcie_ep/start

But in my system, I have no 141a0000.pcie_ep folder in /sys/kernel/config/pci_ep/controllers.

I have configured the kernel code, the kernel log as follows:

tegra-pcie-dw-ep 141a0000.pcie_ep: EP BAR DMA addr = 0XFFF00000

another pcie, lspci as as follows:

0005:01:00.0 Memory controller: NVIDIA Corporation Device 1ad4 (rev a1)

can you help me?

Thanks

Did you flash the system which you would like to operate in PCIe endpoint mode with the correct ODM data? i.e. setting 12th bit in ODM data to ‘1’ to operate PCIe in endpoint mode.

Hi, vidyas:

Thank you for your reply.

My operation is as follows:

  1. Download “L4T source” and “L4T Jetson Driver Package” from https://developer.nvidia.com/embedded/downloads, It version is 32.1.
  2. unzip the package
  3. modified the file sources/kernel/kernel-4.9/arch/arm64/config/tegra_defconfig, and add a config CONFIG_PCIE_TEGRA_DW_EP=y
  4. build the kernel according to the document “L4T Document” chapter “Kernel Customization”
  5. modified the file Linux_for_Tegra/p2972-0000.conf.common, set the ODMDATA=0x9190000 to ODMDATA=0x9191000.
  6. download the rootfs system from https://developer.nvidia.com/embedded/downloads, and unzip it to Linux_for_Tegra/rootfs
  7. Execution script “apply_binaries.sh” at folder Linux_for_Tegra
  8. sudo ./flash.sh jetson-xavier mmcblk0p1

I create the fun1 under /sys/kernel/config/pci_ep/functions/pci_epf_nv_test/, the vendorid and deviceid will be appeared, but the /sys/kernel/config/pci_ep/controllers if null, no foler 141a0000.pcie_ep under controllers.

If I am not config CONFIG_PCIE_TEGRA_DW_EP=y, The /sys/kernel/config/pci_ep/functions/pci_epf_nv_test/141a0000.pcie_ep will be appeared. But the kernel log will be error about endpoint as follows:

tegra-pcie-dw 141a0000.pcie_ep: invalid max-speed (err=-22), set to Gen-1

If I am set CONFIG_PCIE_TEGRA_DW_EP=y, the kernel log show

tegra-pcie-dw-ep 141a0000.pcie_ep: EP BAR DMA addr = 0XFFF00000.

Can you tell me what should we do and why?

Hi,
Please don’t change any kernel config.
After downloading the package, flash the one that you want to operate in RootPort mode with default ODM data and the one you want to operate as endpoint with ODM data modified to have ‘1’ set in 12th bit.
After booting the EP system, execute the following commands as sudo

cd /sys/kernel/config/pci_ep/
mkdir functions/pci_epf_nv_test/func1
echo 0x1AD5 > functions/pci_epf_nv_test/func1/deviceid
echo 16 > functions/pci_epf_nv_test/func1/msi_interrupts
ln -s functions/pci_epf_nv_test/func1 controllers/141a0000.pcie_ep/
echo 1 > controllers/141a0000.pcie_ep/start

and then boot RP system and you should be able to see EP system getting enumerated in RP system. This is a verified procedure and it should just work.

I create the fun1 under /sys/kernel/config/pci_ep/functions/pci_epf_nv_test/, the vendorid and deviceid will be appeared, but the /sys/kernel/config/pci_ep/controllers if null, no foler 141a0000.pcie_ep under controllers.

I have the same questions,can you tell me how to solve this problem?