Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH v2 0/3] PCI: Add PTM sysfs support
@ 2025-03-24 10:04 Manivannan Sadhasivam via B4 Relay
  2025-03-24 10:04 ` [PATCH v2 1/3] PCI: Add sysfs support for exposing PTM context Manivannan Sadhasivam via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2025-03-24 10:04 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Bjorn Helgaas, Jingoo Han
  Cc: linux-pci, linux-kernel, linux-arm-msm, Manivannan Sadhasivam

Hi,

This series adds sysfs support to expose the PTM context available in the
capable PCIe controllers. Support for enabling PTM in the requester/responder is
already available in drivers/pci/pcie/ptm.c and this series expands that file to
add sysfs support for the PTM context info.

The controller drivers are expected to call pcie_ptm_create_sysfs() with
'pcie_ptm_ops' callbacks populated to create the sysfs entries and call
pcie_ptm_destroy_sysfs() to destroy them.

Patch 1 adds the necessary code in the drivers/pci/pcie/ptm.c to expose PTM
context over sysfs and patch 2 adds PTM support in the DWC drivers (host and
endpoint). Finally, patch 3 masks the PTM_UPDATING interrupt in the pcie-qcom-ep
driver to avoid processing the interrupt for each PTM context update.

Testing
=======

This series is tested on Qcom SA8775p Ride Mx platform where one SA8775p acts as
RC and another as EP with following instructions:

RC
--

$ echo 1 > /sys/devices/platform/1c10000.pcie/ptm/context_valid

EP
--

$ echo auto > /sys/devices/platform/1c10000.pcie-ep/ptm/context_update

$ cat /sys/devices/platform/1c10000.pcie-ep/ptm/local_clock
159612570424

$ cat /sys/devices/platform/1c10000.pcie-ep/ptm/master_clock
159609466232

$ cat /sys/devices/platform/1c10000.pcie-ep/ptm/t1
159609466112

$ cat /sys/devices/platform/1c10000.pcie-ep/ptm/t4
159609466518

NOTE: To make use of the PTM feature, the host PCIe client driver has to call
'pci_enable_ptm()' API during probe. This series was tested with enabling PTM in
the MHI host driver with a local change (which will be upstreamed later).
Technically, PTM could also be enabled in the pci_endpoint_test driver, but I
didn't add the change as I'm not sure we'd want to add random PCIe features in
the test driver without corresponding code in pci-epf-test driver.

Changes in v2:

* Dropped the VSEC changes that got merged
* Moved the PTM sysfs code from drivers/pci/controller/dwc to
  drivers/pci/pcie/ptm to make it generic so that other controller drivers could
  also benefit from it.
* Rebased on top of pci/controller/dwc

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Manivannan Sadhasivam (3):
      PCI: Add sysfs support for exposing PTM context
      PCI: dwc: Add sysfs support for PTM context
      PCI: qcom-ep: Mask PTM_UPDATING interrupt

 Documentation/ABI/testing/sysfs-platform-pcie-ptm  |  70 ++++++
 MAINTAINERS                                        |   1 +
 drivers/pci/controller/dwc/Makefile                |   2 +-
 drivers/pci/controller/dwc/pcie-designware-ep.c    |   3 +
 drivers/pci/controller/dwc/pcie-designware-host.c  |   3 +
 drivers/pci/controller/dwc/pcie-designware-sysfs.c | 254 +++++++++++++++++++
 drivers/pci/controller/dwc/pcie-designware.c       |   6 +
 drivers/pci/controller/dwc/pcie-designware.h       |  21 ++
 drivers/pci/controller/dwc/pcie-qcom-ep.c          |   8 +
 drivers/pci/pcie/ptm.c                             | 268 +++++++++++++++++++++
 include/linux/pci.h                                |  35 +++
 include/linux/pcie-dwc.h                           |   8 +
 12 files changed, 678 insertions(+), 1 deletion(-)
---
base-commit: 1f5a69f1b3132054d8d82b8d7546d0af6a2ed4f6
change-id: 20250324-pcie-ptm-e75b9b2ffcfb

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-04-07 16:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-24 10:04 [PATCH v2 0/3] PCI: Add PTM sysfs support Manivannan Sadhasivam via B4 Relay
2025-03-24 10:04 ` [PATCH v2 1/3] PCI: Add sysfs support for exposing PTM context Manivannan Sadhasivam via B4 Relay
2025-03-24 13:01   ` Ilpo Järvinen
2025-04-07  7:36     ` Manivannan Sadhasivam
2025-03-24 16:28   ` Bjorn Helgaas
2025-04-07  7:44     ` Manivannan Sadhasivam
2025-04-07 16:53       ` Bjorn Helgaas
2025-03-26 21:18   ` kernel test robot
2025-03-24 10:04 ` [PATCH v2 2/3] PCI: dwc: Add sysfs support for " Manivannan Sadhasivam via B4 Relay
2025-03-24 14:06   ` kernel test robot
2025-03-26 21:42   ` kernel test robot
2025-03-24 10:04 ` [PATCH v2 3/3] PCI: qcom-ep: Mask PTM_UPDATING interrupt Manivannan Sadhasivam via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox