Dear Colleagues,
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:
PCIE_X8_RC_PF0_PTM_RES_CAP_PTM_RES_LOCAL_LSB_OFF_0
PCIE_X8_RC_PF0_PTM_RES_CAP_PTM_RES_LOCAL_MSB_OFF_0
If I further read (and calculated) correctly, the register addresses for both should be
0x141a0330 (PCIE_X8_RC_PF0_PTM_RES_CAP_PTM_RES_LOCAL_LSB_OFF_0)
0x141a0334 (PCIE_X8_RC_PF0_PTM_RES_CAP_PTM_RES_LOCAL_MSB_OFF_0)
I’m not familiar with such low-level access from within Linux, so any hint would be much appreciated!
Thanks & BR
Daniel
Doesn’t anone have a clue on this? I would be glad to provide additional information or try things out on my Orin - I just need some directions :-).
Hi,
Please check if you can read the registers through devmem2 commands. Certain REGs are protected and may not be read directly.
After installing devmem2 (sudo apt install devmem2
), I can issue the command, but all 0xFF
s 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:~$
Hi,
Actually the reg of these two are
0x3a000330 PCIE_X8_EP_PF0_PTM_REQ_CAP_PTM_REQ_LOCAL_LSB_OFF_0
0x3a000334 PCIE_X8_RC_PF0_PTM_RES_CAP_PTM_RES_LOCAL_MSB_OFF_0
Thanks @WayneWWW
Apparently I did some wrong calculation after looking in the TRM for the base register addresses.
Unfortunately I get the same results with these addresses:
user@ubuntu:~$ sudo devmem2 0x3a000330
/dev/mem opened.
Memory mapped at address 0xffff9e063000.
Value at address 0x3A000330 (0xffff9e063330): 0xFFFFFFFF
user@ubuntu:~$ sudo devmem2 0x3a000334
/dev/mem opened.
Memory mapped at address 0xffffa8dca000.
Bus error
I’m still not sure if the Kenerl option CONFIG_STRICT_DEVMEM has some effect here.
Try to use sudo busybox devmem
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_DEVMEM
not 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.