TL;DR: Is there a way/API in Linux to access PCIe PTM timestamp registers PCIE_X8_RC_PF0_PTM_RES_CAP_PTM_RES_LOCAL_LSB_OFF_0 and PCIE_X8_RC_PF0_PTM_RES_CAP_PTM_RES_LOCAL_MSB_OFF_0?
I’m having a PTM-capable Ethernet Switch attached to the x16 PCIe Slot on my NVIDIA Orin Development Kit. The Linux Kernel driver of that Ethernet Switch needs to access the PTM time of the Root Complex (= NVIDIA Orin) to do some calculations.
If I read the TRM right, the two relevant registers for me should be:
After installing devmem2 (sudo apt install devmem2), I can issue the command, but all 0xFFs seem wrong and the other address is not accessible at all.
I have CONFIG_STRICT_DEVMEM=y in my running Kernel config. Should I try with a kernel with CONFIG_STRICT_DEVMEM not set instead?
user@ubuntu:~$ sudo devmem2 0x141a0330
/dev/mem opened.
Memory mapped at address 0xffff9a8cc000.
Value at address 0x141A0330 (0xffff9a8cc330): 0xFFFFFFFF
user@ubuntu:~$ sudo devmem2 0x141a0334
/dev/mem opened.
Memory mapped at address 0xffff85781000.
Bus error
user@ubuntu:~$
busybox was not available on my Orin yet, so I had to also install it (sudo apt install busybox) first.
After I now also compiled and started a Kernel with CONFIG_STRICT_DEVMEMnot set, the results are as follows:
user@ubuntu:~$ sudo busybox devmem 0x3a000330
0x00000000
user@ubuntu:~$ sudo busybox devmem 0x3a000334
0x00000000
user@ubuntu:~$ sudo devmem2 0x3a000330
/dev/mem opened.
Memory mapped at address 0xffff83d36000.
Value at address 0x3A000330 (0xffff83d36330): 0xFFFFFFFF
user@ubuntu:~$ sudo devmem2 0x3a000334
/dev/mem opened.
Memory mapped at address 0xffffb80d9000.
Bus error
user@ubuntu:~$
I do have a PTM-capable end-point attached to the PCIe connector and PTM is running as far as I understand.
I would have expected the register to show different (actual timestamp) values which change on every read.