[PATCH 1/2] PCI: dwc: Add LTSSM tracing support to debugfs

Manivannan Sadhasivam mani at kernel.org
Thu Jan 8 09:05:15 PST 2026


On Thu, Jan 08, 2026 at 12:58:28PM +0800, Shawn Lin wrote:
> 在 2026/01/08 星期四 12:49, Manivannan Sadhasivam 写道:
> > On Thu, Jan 08, 2026 at 09:01:43AM +0800, Shawn Lin wrote:
> > > 在 2026/01/07 星期三 20:41, Manivannan Sadhasivam 写道:
> > > > On Tue, Jan 06, 2026 at 05:18:38PM +0800, Shawn Lin wrote:
> > > > > Some platforms may provide LTSSM trace functionality, recording historical
> > > > > LTSSM state transition information. This is very useful for debugging, such
> > > > > as when certain devices cannot be recognized. Add an ltssm_trace operation
> > > > > node in debugfs for platform which could provide these information to show
> > > > > the LTSSM history.
> > > > > 
> > > > 
> > > > Why don't you implement it as a tracepoint since you want to expose traces?
> > > > 
> > > 
> > > I evaluated this option but didn't choose to do it just as I didn't
> > > want to select CONFIG_TRACING_SUPPORT for dwc driver because of this
> > > cheap function. But I'm fine to implement it as a tracepoint. Just to
> > > make it clear, if a tracepoint is preferred, should I need to create a new
> > > file like pcie-designware-trace?
> > > 
> > 
> > I would prefer that, because that will allow us to add more tracepoints in the
> > future and not muddle pcie-designware.h. General convention is to define
> > trace events in a separate header.
> > 
> 
> I did a quick convention by adding it to the existing
> include/trace/events/pci.h

Is this an existing file? I couldn't see it. But anyway, I think it would be
better to create a separate file for controller drivers. PCI core may end up
having its own tracepoint in the future and mixing both will lead to confusion.

> 
> The TRACE_EVENT is called pcie_ltssm_state_change, making it not just
> for dwc-based but for all possible coming host drivers and the output
> looks like below. Is that the way you expected?
> 
> root at debian:/#echo 1 >
> /sys/kernel/debug/tracing/events/pci/pcie_ltssm_state_change/enable

/sys/kernel/debug/tracing/events/pci_controller/pcie_ltssm_state_transition/enable

> root at debian:/# cat /sys/kernel/debug/tracing/trace
> # tracer: nop
> #
> # entries-in-buffer/entries-written: 572/572   #P:8
> #
> #                                _-----=> irqs-off/BH-disabled
> #                               / _----=> need-resched
> #                              | / _---=> hardirq/softirq
> #                              || / _--=> preempt-depth
> #                              ||| / _-=> migrate-disable
> #                              |||| /     delay
> #           TASK-PID     CPU#  |||||  TIMESTAMP  FUNCTION
> #              | |         |   |||||     |         |
> 
> ...
>      kworker/1:1-109     [001] .....     4.719968: ltssm_state_change: dev:
> a40000000.pcie state: 0x0d rate: 8.0 GT/s PCIe

Can you print the state name using dw_pcie_ltssm_status_string() with:
https://lore.kernel.org/linux-pci/20260107-pci-dwc-suspend-rework-v4-2-9b5f3c72df0a@oss.qualcomm.com/

Also you can remove 'PCIe' at the end.

Rest LGTM, thanks!

- Mani

-- 
மணிவண்ணன் சதாசிவம்



More information about the Linux-rockchip mailing list