Re: [PATCH v7 0/5] Add support for debugfs based RAS DES feature in PCIe DW

From: Hrishikesh Deleep
Date: Mon Mar 03 2025 - 04:57:22 EST


>Subject: [PATCH v7 0/5] Add support for debugfs based RAS DES feature in
> PCIe DW
>Date: Fri, 21 Feb 2025 18:45:43 +0530
>Message-Id: <20250221131548.59616-1-shradha.t@xxxxxxxxxxx>
>X-Mailer: git-send-email 2.17.1
>Precedence: bulk
>X-Mailing-List: linux-kernel@xxxxxxxxxxxxxxx
>List-Id: <linux-kernel.vger.kernel.org>
>List-Subscribe: <mailto:linux-kernel+subscribe@xxxxxxxxxxxxxxx>
>List-Unsubscribe: <mailto:linux-kernel+unsubscribe@xxxxxxxxxxxxxxx>
>MIME-Version: 1.0
>Content-Transfer-Encoding: 8bit
>X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJsWRmVeSWpSXmKPExsWy7bCmum7f2p3pBpev8Fhcaf/NbjH9sKLF
> kqYMi2MTVjBbNK2+y2qx4stMdotVC6+xWTT0/Ga12PT4GqvF5V1z2CzOzjvOZnFl6zoWi5Y/
> LSwWd1s6WS2WXr/IZPF3215Gi0Vbv7BbLGx+yWjxf88Odovew7UWLXdMLd7/3MzmIOaxeMUU
> Vo8189YweuycdZfdY8GmUo+WI29ZPTat6mTzuHNtD5vHzoeWHk+uTGfy2Lyk3qNvyypGj8+b
> 5AJ4orJtMlITU1KLFFLzkvNTMvPSbZW8g+Od403NDAx1DS0tzJUU8hJzU22VXHwCdN0yc4C+
> VVIoS8wpBQoFJBYXK+nb2RTll5akKmTkF5fYKqUWpOQUmBToFSfmFpfmpevlpZZYGRoYGJkC
> FSZkZ9w5vYalYLZqxYb7X5gaGB/IdjFyckgImEi83vKXqYuRi0NIYDejxLsX7UwgCSGBT4wS
> u6dkQySA7IMTF7PDdKyZ08QKkdjJKHFn3nso5wujxL2+j2BVbAJaEo1fu5hBbBGBVkaJI8/E
> QIqYBbYxSxxYsQIsISwQJPFjXRsLiM0ioCrx/e98oGYODl4B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Lm2h81j50NLjydXpjN5bF5S79G3ZRWjx+dN
> cgE8UVw2Kak5mWWpRfp2CVwZd06vYSmYrVqx4f4XpgbGB7JdjJwcEgImEmvmNLF2MXJxCAls
> Z5Q4cm4FE0RCUuLzxXVQtrDEyn/P2SGKPjFKnLi3HyzBJqAl0fi1ixkkISLQySix98g7sCpm
> gXPMEjM/tzCCVAkLBEicWbwezGYRUJX4/nc+UBEHB6+AlcSelfYQG+QlVm84wAxi8woISpyc
> +YQFpIRZQF1i/TwhkDAzUEnz1tnMExj5ZyGpmoVQNQtJ1QJG5lWMoqkFxbnpuckFhnrFibnF
> pXnpesn5uZsYwbGpFbSDcdn6v3qHGJk4GA8xSnAwK4nw6pbsSBfiTUmsrEotyo8vKs1JLT7E
> KM3BoiTOq5zTmSIkkJ5YkpqdmlqQWgSTZeLglGpg4pjMtu2b3EL3R9/vnl2nEvFC55TM2YSA
> my6J94qZeTt8782a/COa5zfzt5k3prcfseJ7luLkekH78Adlm03yN7mZkk1XMM56/M3uTPar
> ex8KP295FMh6s2nhnKm/5osxdX5TKq3b61nX9iT1YXNdyKerQsdqYjgT+VaEJK99GX3A6He8
> 1XIWZ2vz9ffnsnQutJ2jtMajR/n7bM0NmbNmena/SZXhnfzD5alN2PFWrd0vK8Je8Blf3/b1
> x9bwBX5/Yl/s/XhNzGKZrer2uvBbUQqvGNOWb17bYhX/xT3W2q3tpEjcHY7SxiIpxtc63+us
> rinukH9y8IUFl3ej4vrW9/u/5z0wPMPHsW9quEntZSWW4oxEQy3mouJEAI4aFoM8AwAA
>X-CMS-MailID: 20250221132011epcas5p4dea1e9ae5c09afaabcd1822f3a7d15c5
>X-Msg-Generator: CA
>Content-Type: text/plain; charset="utf-8"
>X-Sendblock-Type: REQ_APPROVE
>CMS-TYPE: 105P
>DLP-Filter: Pass
>X-CFilter-Loop: Reflected
>X-CMS-RootMailID: 20250221132011epcas5p4dea1e9ae5c09afaabcd1822f3a7d15c5
>References: <CGME20250221132011epcas5p4dea1e9ae5c09afaabcd1822f3a7d15c5@xxxxxxxxxxxxxxxxxxxx>
>
>DesignWare controller provides a vendor specific extended capability
>called RASDES as an IP feature. This extended capability provides
>hardware information like:
> - Debug registers to know the state of the link or controller.
> - Error injection mechanisms to inject various PCIe errors including
> sequence number, CRC
> - Statistical counters to know how many times a particular event
> occurred
>
>However, in Linux we do not have any generic or custom support to be
>able to use this feature in an efficient manner. This is the reason we
>are proposing this framework. Debug and bring up time of high-speed IPs
>are highly dependent on costlier hardware analyzers and this solution
>will in some ways help to reduce the HW analyzer usage.
>
>The debugfs entries can be used to get information about underlying
>hardware and can be shared with user space. Separate debugfs entries has
>been created to cater to all the DES hooks provided by the controller.
>The debugfs entries interacts with the RASDES registers in the required
>sequence and provides the meaningful data to the user. This eases the
>effort to understand and use the register information for debugging.
>
>This series creates a generic debugfs framework for DesignWare PCIe
>controllers where other debug features apart from RASDES can also be
>added as and when required.
>
>v7:
> - Moved the patches to make finding VSEC IDs common from Mani's patchset [1]
> into this series to remove dependancy as discussed
> - Addressed style related change requests from v6
>
>v6: https://lore.kernel.org/all/20250214105007.97582-1-shradha.t@xxxxxxxxxxx/
> - Addressed Niklas's comment to make vsec ID finding similar to perf
> - Minor changes in the driver to make the debugfs file common and
> not specefic to RASDES so that other developers can add debug
> related features to this file.
>
>v5: https://lore.kernel.org/all/20250121111421.35437-1-shradha.t@xxxxxxxxxxx/
> - Addressed Fan's comment to split the patches for easier review
> - Addressed Bjorn's comment to fix vendor specific cap search
> - Addressed style related change requests from v4
> - Added rasdes debugfs init call to common designware files for host
> and EP.
>
>v4: https://lore.kernel.org/lkml/20241206074456.17401-1-shradha.t@xxxxxxxxxxx/
> - Addressed comments from Manivannan, Bjorn and Jonathan
> - Addressed style related change requests from v3
> - Added Documentation under Documentation/ABI/testing and kdoc stype
> comments wherever required for better understanding
> - Enhanced error injection to include all possible error groups
> - Removed debugfs init call from common designware file and left it
> up to individual platform drivers to init/deinit as required.
>
>v3: https://lore.kernel.org/all/20240625093813.112555-1-shradha.t@xxxxxxxxxxx/
> - v2 had suggestions about moving this framework to perf/EDAC instead of a
> controller specific debugfs but after discussions we decided to go ahead
> with the same. Rebased and posted v3 with minor style changes.
>
>v2: https://lore.kernel.org/lkml/20231130115044.53512-1-shradha.t@xxxxxxxxxxx/
> - Addressed comments from Krzysztof Wilczyński, Bjorn Helgaas and
> posted v2 with a changed implementation for a better code design
>
>v1: https://lore.kernel.org/all/20210518174618.42089-1-shradha.t@xxxxxxxxxxx/T/
>
>[1] https://lore.kernel.org/all/20250218-pcie-qcom-ptm-v1-0-16d7e480d73e@xxxxxxxxxx/
>
>Manivannan Sadhasivam (1):
> perf/dwc_pcie: Move common DWC struct definitions to 'pcie-dwc.h'
>
>Shradha Todi (4):
> PCI: dwc: Add helper to find the Vendor Specific Extended Capability
> (VSEC)
> Add debugfs based silicon debug support in DWC
> Add debugfs based error injection support in DWC
> Add debugfs based statistical counter support in DWC
>
> Documentation/ABI/testing/debugfs-dwc-pcie | 144 +++++
> MAINTAINERS | 1 +
> drivers/pci/controller/dwc/Kconfig | 10 +
> drivers/pci/controller/dwc/Makefile | 1 +
> .../controller/dwc/pcie-designware-debugfs.c | 564 ++++++++++++++++++
> .../pci/controller/dwc/pcie-designware-ep.c | 5 +
> .../pci/controller/dwc/pcie-designware-host.c | 6 +
> drivers/pci/controller/dwc/pcie-designware.c | 46 ++
> drivers/pci/controller/dwc/pcie-designware.h | 21 +
> drivers/perf/dwc_pcie_pmu.c | 25 +-
> include/linux/pcie-dwc.h | 36 ++
> 11 files changed, 837 insertions(+), 22 deletions(-)
> create mode 100644 Documentation/ABI/testing/debugfs-dwc-pcie
> create mode 100644 drivers/pci/controller/dwc/pcie-designware-debugfs.c
> create mode 100644 include/linux/pcie-dwc.h
>
>--
>2.17.1
>
>

Thanks for adding the support!

Tested the patch in one of our internal SoC with DesginWare PCIe controller. The patch works fine.

Tested-by: Hrishikesh Deleep <hrishikesh.d@xxxxxxxxxxx>