Add support for debugfs based RAS DES feature in PCIe DW
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): CGME20250221132011epcas5p4dea1e9ae5c09afaabcd1822f3a7d15c5@epcas5p4.samsung.com
v7 cover Add support for debugfs based RAS DES feature in PCIe DW
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/[email protected]/
- 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/[email protected]/
- 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/[email protected]/
- 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/[email protected]/
- 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/[email protected]/
- 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/[email protected]/T/
[1] https://lore.kernel.org/all/[email protected]/
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
Signature · 1 line
2.17.1
PATCH v7 1/5 perf/dwc_pcie: Move common DWC struct definitions to 'pcie-dwc.h'
From: Manivannan Sadhasivam <[email protected]>
Since these are common to all Desginware PCIe IPs, move them to a new header 'pcie-dwc.h', so that other drivers like debugfs, perf and sysfs could make use of them.
--- MAINTAINERS | 1 + drivers/perf/dwc_pcie_pmu.c | 25 +++---------------------- include/linux/pcie-dwc.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 include/linux/pcie-dwc.h
MAINTAINERS +1 -0
@@ -18167,6 +18167,7 @@ S: Maintained F: Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml F: Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml F: drivers/pci/controller/dwc/*designware* +F: include/linux/pcie-dwc.h PCI DRIVER FOR TI DRA7XX/J721E M: Vignesh Raghavendra <[email protected]>
drivers/perf/dwc_pcie_pmu.c +3 -22
@@ -13,6 +13,7 @@#include <linux/errno.h> #include <linux/kernel.h> #include <linux/list.h> +#include <linux/pcie-dwc.h> #include <linux/perf_event.h> #include <linux/pci.h> #include <linux/platform_device.h>
@@ -99,26 +100,6 @@ struct dwc_pcie_dev_info {struct list_head dev_node; }; -struct dwc_pcie_pmu_vsec_id { -u16 vendor_id; -u16 vsec_id; -u8 vsec_rev; -}; - -/* -* VSEC IDs are allocated by the vendor, so a given ID may mean different -* things to different vendors. See PCIe r6.0, sec 7.9.5.2. -*/ -static const struct dwc_pcie_pmu_vsec_id dwc_pcie_pmu_vsec_ids[] = { - { .vendor_id =PCI_VENDOR_ID_ALIBABA , - .vsec_id =0x02 , .vsec_rev =0x4 }, - { .vendor_id =PCI_VENDOR_ID_AMPERE , - .vsec_id =0x02 , .vsec_rev =0x4 }, - { .vendor_id =PCI_VENDOR_ID_QCOM , - .vsec_id =0x02 , .vsec_rev =0x4 }, - {}/* terminator */ -}; -static ssize_t cpumask_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -529,14 +510,14 @@ static void dwc_pcie_unregister_pmu(void *data)static u16 dwc_pcie_des_cap (struct pci_dev *pdev) { -const struct dwc_pcie_pmu_vsec_id *vid; +const struct dwc_pcie_vsec_id *vid;u16 vsec;u32 val;if (!pci_is_pcie (pdev) || !(pci_pcie_type (pdev) ==PCI_EXP_TYPE_ROOT_PORT ))return 0 ; -for (vid = dwc_pcie_pmu_vsec_ids; vid->vendor_id; vid++) { +for (vid = dwc_pcie_rasdes_vsec_ids; vid->vendor_id; vid++) { vsec =pci_find_vsec_capability (pdev, vid->vendor_id, vid->vsec_id);if (vsec) {
include/linux/pcie-dwc.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2021-2023 Alibaba Inc. +* +* Copyright 2025 Linaro Ltd. +* Author: Manivannan Sadhasivam <[email protected]> +*/ + +#ifndef LINUX_PCIE_DWC_H +#define LINUX_PCIE_DWC_H + +#include <linux/pci_ids.h> + +struct dwc_pcie_vsec_id { +u16 vendor_id; +u16 vsec_id; +u8 vsec_rev; +}; + +/* +* VSEC IDs are allocated by the vendor, so a given ID may mean different +* things to different vendors. See PCIe r6.0, sec 7.9.5.2. +*/ +static const struct dwc_pcie_vsec_id dwc_pcie_rasdes_vsec_ids[] = { + { .vendor_id =PCI_VENDOR_ID_ALIBABA , + .vsec_id =0x02 , .vsec_rev =0x4 }, + { .vendor_id =PCI_VENDOR_ID_AMPERE , + .vsec_id =0x02 , .vsec_rev =0x4 }, + { .vendor_id =PCI_VENDOR_ID_QCOM , + .vsec_id =0x02 , .vsec_rev =0x4 }, + {}/* terminator */ +}; + +#endif /* LINUX_PCIE_DWC_H */
Signature · 1 line
2.17.1
Re: [PATCH v7 1/5] perf/dwc_pcie: Move common DWC struct definitions to 'pcie-dwc.h'
Hello,
Quoted 6 lines
Since these are common to all Desginware PCIe IPs, move them to a new header '
pcie-dwc.h', so that other drivers like debugfs, perf and sysfs could make use of them.Signed-off-by Manivannan Sadhasivam <[email protected]>Signed-off-by Shradha Todi <[email protected]>
We are still missing feedback from the perf maintainers.
Especially, as I would like to take this patch via the PCI tree, if there is no objection.
Thank you, Niklas, for pointing this out. Appreciated.
Krzysztof
Re: [PATCH v7 1/5] perf/dwc_pcie: Move common DWC struct definitions to 'pcie-dwc.h'
In reply to Shradha TodiQuoted 113 lines · Shradha Todi
From: Manivannan Sadhasivam <[email protected]>
Since these are common to all Desginware PCIe IPs, move them to a new header '
pcie-dwc.h', so that other drivers like debugfs, perf and sysfs could make use of them.Signed-off-by Manivannan Sadhasivam <[email protected]>Signed-off-by Shradha Todi <[email protected]>--- MAINTAINERS | 1 + drivers/perf/dwc_pcie_pmu.c | 25 +++---------------------- include/linux/pcie-dwc.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 22 deletions(-)create mode 100644
include/linux/pcie-dwc.hMAINTAINERS +1
-0@@ -18167,6 +18167,7 @@ S: Maintained F: Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml F: Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml F: drivers/pci/controller/dwc/*designware* +F: include/linux/pcie-dwc.h PCI DRIVER FOR TI DRA7XX/J721E M: Vignesh Raghavendra <[email protected]>drivers/perf/dwc_pcie_pmu.c +3
-22@@ -13,6 +13,7 @@#include <linux/errno.h> #include <linux/kernel.h> #include <linux/list.h> +#include <linux/pcie-dwc.h> #include <linux/perf_event.h> #include <linux/pci.h> #include <linux/platform_device.h> @@ -99,26 +100,6 @@ struct dwc_pcie_dev_info {struct list_head dev_node; }; -struct dwc_pcie_pmu_vsec_id { -u16 vendor_id; -u16 vsec_id; -u8 vsec_rev; -}; - -/* -* VSEC IDs are allocated by the vendor, so a given ID may mean different -* things to different vendors. See PCIe r6.0, sec 7.9.5.2. -*/ -static const struct dwc_pcie_pmu_vsec_id dwc_pcie_pmu_vsec_ids[] = { - { .vendor_id =PCI_VENDOR_ID_ALIBABA , - .vsec_id =0x02 , .vsec_rev =0x4 }, - { .vendor_id =PCI_VENDOR_ID_AMPERE , - .vsec_id =0x02 , .vsec_rev =0x4 }, - { .vendor_id =PCI_VENDOR_ID_QCOM , - .vsec_id =0x02 , .vsec_rev =0x4 }, - {}/* terminator */ -}; -static ssize_t cpumask_show (struct device *dev,struct device_attribute *attr,char *buf)@@ -529,14 +510,14 @@ static void dwc_pcie_unregister_pmu(void *data)static u16 dwc_pcie_des_cap (struct pci_dev *pdev) { -const struct dwc_pcie_pmu_vsec_id *vid; +const struct dwc_pcie_vsec_id *vid;u16 vsec;u32 val;if (!pci_is_pcie (pdev) || !(pci_pcie_type (pdev) ==PCI_EXP_TYPE_ROOT_PORT ))return 0 ; -for (vid = dwc_pcie_pmu_vsec_ids; vid->vendor_id; vid++) { +for (vid = dwc_pcie_rasdes_vsec_ids; vid->vendor_id; vid++) { vsec =pci_find_vsec_capability (pdev, vid->vendor_id, vid->vsec_id);if (vsec) {include/linux/pcie-dwc.h new file +24
-0@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2021-2023 Alibaba Inc. +* +* Copyright 2025 Linaro Ltd. +* Author: Manivannan Sadhasivam <[email protected]> +*/ + +#ifndef LINUX_PCIE_DWC_H +#define LINUX_PCIE_DWC_H + +#include <linux/pci_ids.h> + +struct dwc_pcie_vsec_id { +u16 vendor_id; +u16 vsec_id; +u8 vsec_rev; +}; + +/* +* VSEC IDs are allocated by the vendor, so a given ID may mean different +* things to different vendors. See PCIe r6.0, sec 7.9.5.2. +*/ +static const struct dwc_pcie_vsec_id dwc_pcie_rasdes_vsec_ids[] = {
include/linux/pcie-dwc.h line 34
Quoted 10 lines
include/linux/pcie-dwc.h new file +10
-0+ { .vendor_id = PCI_VENDOR_ID_ALIBABA, + .vsec_id = 0x02, .vsec_rev = 0x4 }, + { .vendor_id = PCI_VENDOR_ID_AMPERE, + .vsec_id = 0x02, .vsec_rev = 0x4 }, + { .vendor_id = PCI_VENDOR_ID_QCOM, + .vsec_id = 0x02, .vsec_rev = 0x4 }, + {}/* terminator */ +}; + +#endif /* LINUX_PCIE_DWC_H */
LGTM. Thanks.
Shuai
Re: [PATCH v7 1/5] perf/dwc_pcie: Move common DWC struct definitions to 'pcie-dwc.h'
Hello,
Quoted 3 lines
Quoted 3 lines
Since these are common to all Desginware PCIe IPs, move them to a new header '
pcie-dwc.h', so that other drivers like debugfs, perf and sysfs could make use of them.
[...]
Quoted 3 lines
LGTM. Thanks.
Reviewed-by Shuai Xue <[email protected]>
Thank you!
Krzysztof
Re: [PATCH v7 1/5] perf/dwc_pcie: Move common DWC struct definitions to 'pcie-dwc.h'
In reply to Shradha TodiQuoted 8 lines · Shradha Todi
From: Manivannan Sadhasivam <[email protected]>
Since these are common to all Desginware PCIe IPs, move them to a new header '
pcie-dwc.h', so that other drivers like debugfs, perf and sysfs could make use of them.Signed-off-by Manivannan Sadhasivam <[email protected]>Signed-off-by Shradha Todi <[email protected]>
Quoted 118 lines
--- MAINTAINERS | 1 + drivers/perf/dwc_pcie_pmu.c | 25 +++---------------------- include/linux/pcie-dwc.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 include/linux/pcie-dwc.hMAINTAINERS +1
-0@@ -18167,6 +18167,7 @@ S: Maintained F: Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml F: Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml F: drivers/pci/controller/dwc/*designware* +F: include/linux/pcie-dwc.h PCI DRIVER FOR TI DRA7XX/J721E M: Vignesh Raghavendra <[email protected]>drivers/perf/dwc_pcie_pmu.c +3
-22@@ -13,6 +13,7 @@#include <linux/errno.h> #include <linux/kernel.h> #include <linux/list.h> +#include <linux/pcie-dwc.h> #include <linux/perf_event.h> #include <linux/pci.h> #include <linux/platform_device.h> @@ -99,26 +100,6 @@ struct dwc_pcie_dev_info {struct list_head dev_node; }; -struct dwc_pcie_pmu_vsec_id { -u16 vendor_id; -u16 vsec_id; -u8 vsec_rev; -}; - -/* -* VSEC IDs are allocated by the vendor, so a given ID may mean different -* things to different vendors. See PCIe r6.0, sec 7.9.5.2. -*/ -static const struct dwc_pcie_pmu_vsec_id dwc_pcie_pmu_vsec_ids[] = { - { .vendor_id =PCI_VENDOR_ID_ALIBABA , - .vsec_id =0x02 , .vsec_rev =0x4 }, - { .vendor_id =PCI_VENDOR_ID_AMPERE , - .vsec_id =0x02 , .vsec_rev =0x4 }, - { .vendor_id =PCI_VENDOR_ID_QCOM , - .vsec_id =0x02 , .vsec_rev =0x4 }, - {}/* terminator */ -}; -static ssize_t cpumask_show (struct device *dev,struct device_attribute *attr,char *buf)@@ -529,14 +510,14 @@ static void dwc_pcie_unregister_pmu(void *data)static u16 dwc_pcie_des_cap (struct pci_dev *pdev) { -const struct dwc_pcie_pmu_vsec_id *vid; +const struct dwc_pcie_vsec_id *vid;u16 vsec;u32 val;if (!pci_is_pcie (pdev) || !(pci_pcie_type (pdev) ==PCI_EXP_TYPE_ROOT_PORT ))return 0 ; -for (vid = dwc_pcie_pmu_vsec_ids; vid->vendor_id; vid++) { +for (vid = dwc_pcie_rasdes_vsec_ids; vid->vendor_id; vid++) { vsec =pci_find_vsec_capability (pdev, vid->vendor_id, vid->vsec_id);if (vsec) {include/linux/pcie-dwc.h new file +34
-0@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2021-2023 Alibaba Inc. +* +* Copyright 2025 Linaro Ltd. +* Author: Manivannan Sadhasivam <[email protected]> +*/ + +#ifndef LINUX_PCIE_DWC_H +#define LINUX_PCIE_DWC_H + +#include <linux/pci_ids.h> + +struct dwc_pcie_vsec_id { +u16 vendor_id; +u16 vsec_id; +u8 vsec_rev; +}; + +/* +* VSEC IDs are allocated by the vendor, so a given ID may mean different +* things to different vendors. See PCIe r6.0, sec 7.9.5.2. +*/ +static const struct dwc_pcie_vsec_id dwc_pcie_rasdes_vsec_ids[] = { + { .vendor_id =PCI_VENDOR_ID_ALIBABA , + .vsec_id =0x02 , .vsec_rev =0x4 }, + { .vendor_id =PCI_VENDOR_ID_AMPERE , + .vsec_id =0x02 , .vsec_rev =0x4 }, + { .vendor_id =PCI_VENDOR_ID_QCOM , + .vsec_id =0x02 , .vsec_rev =0x4 }, + {}/* terminator */ +}; + +#endif /* LINUX_PCIE_DWC_H */ Signature · 1 line
2.17.1
PATCH v7 2/5 PCI: dwc: Add helper to find the Vendor Specific Extended Capability (VSEC)
In reply to Shradha Todidw_pcie_find_vsec_capability() is used by upcoming DWC APIs to find the VSEC capabilities like PTM, RAS etc.
--- drivers/pci/controller/dwc/pcie-designware.c | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/pci/controller/dwc/pcie-designware.c +40 -0
@@ -16,6 +16,7 @@#include <linux/gpio/consumer.h> #include <linux/ioport.h> #include <linux/of.h> +#include <linux/pcie-dwc.h> #include <linux/platform_device.h> #include <linux/sizes.h> #include <linux/types.h>
@@ -283,6 +284,45 @@ u16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap) }EXPORT_SYMBOL_GPL (dw_pcie_find_ext_capability); +static u16 __dw_pcie_find_vsec_capability (struct dw_pcie *pci,u16 vendor_id, +u16 vsec_id) +{ +u16 vsec =0 ; +u32 header; + +if (vendor_id !=dw_pcie_readw_dbi (pci,PCI_VENDOR_ID )) +return 0 ; + +while ((vsec =dw_pcie_find_next_ext_capability (pci, vsec, +PCI_EXT_CAP_ID_VNDR ))) { + header =dw_pcie_readl_dbi (pci, vsec +PCI_VNDR_HEADER ); +if (PCI_VNDR_HEADER_ID (header) == vsec_id) +return vsec; + } + +return 0 ; +} + +static u16 dw_pcie_find_vsec_capability (struct dw_pcie *pci, +const struct dwc_pcie_vsec_id *vsec_ids) +{ +const struct dwc_pcie_vsec_id *vid; +u16 vsec; +u32 header; + +for (vid = vsec_ids; vid->vendor_id; vid++) { + vsec =__dw_pcie_find_vsec_capability (pci, vid->vendor_id, + vid->vsec_id); +if (vsec) { + header =dw_pcie_readl_dbi (pci, vsec +PCI_VNDR_HEADER ); +if (PCI_VNDR_HEADER_REV (header) == vid->vsec_rev) +return vsec; + } + } + +return 0 ; +} +int dw_pcie_read (void __iomem *addr,int size,u32 *val) {if (!IS_ALIGNED ((uintptr_t )addr, size)) {
Signature · 1 line
2.17.1
Re: [PATCH v7 2/5] PCI: dwc: Add helper to find the Vendor Specific Extended Capability (VSEC)
Quoted 1 line · Shradha Todi
dw_pcie_find_vsec_capability()is used by upcoming DWC APIs to find the
How are about "Add dw_pcie_find_ext_capability(), which will be used by ..."
Other than that,
Quoted 70 lines
VSEC capabilities like PTM, RAS etc.
Co-developed-by Manivannan Sadhasivam <[email protected]>Signed-off-by Manivannan Sadhasivam <[email protected]>Signed-off-by Shradha Todi <[email protected]>--- drivers/pci/controller/dwc/pcie-designware.c | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+)drivers/pci/controller/dwc/pcie-designware.c +40
-0@@ -16,6 +16,7 @@#include <linux/gpio/consumer.h> #include <linux/ioport.h> #include <linux/of.h> +#include <linux/pcie-dwc.h> #include <linux/platform_device.h> #include <linux/sizes.h> #include <linux/types.h> @@ -283,6 +284,45 @@ u16 dw_pcie_find_ext_capability(struct dw_pcie *pci, u8 cap) }EXPORT_SYMBOL_GPL (dw_pcie_find_ext_capability); +static u16 __dw_pcie_find_vsec_capability (struct dw_pcie *pci,u16 vendor_id, +u16 vsec_id) +{ +u16 vsec =0 ; +u32 header; + +if (vendor_id !=dw_pcie_readw_dbi (pci,PCI_VENDOR_ID )) +return 0 ; + +while ((vsec =dw_pcie_find_next_ext_capability (pci, vsec, +PCI_EXT_CAP_ID_VNDR ))) { + header =dw_pcie_readl_dbi (pci, vsec +PCI_VNDR_HEADER ); +if (PCI_VNDR_HEADER_ID (header) == vsec_id) +return vsec; + } + +return 0 ; +} + +static u16 dw_pcie_find_vsec_capability (struct dw_pcie *pci, +const struct dwc_pcie_vsec_id *vsec_ids) +{ +const struct dwc_pcie_vsec_id *vid; +u16 vsec; +u32 header; + +for (vid = vsec_ids; vid->vendor_id; vid++) { + vsec =__dw_pcie_find_vsec_capability (pci, vid->vendor_id, + vid->vsec_id); +if (vsec) { + header =dw_pcie_readl_dbi (pci, vsec +PCI_VNDR_HEADER ); +if (PCI_VNDR_HEADER_REV (header) == vid->vsec_rev) +return vsec; + } + } + +return 0 ; +} +int dw_pcie_read (void __iomem *addr,int size,u32 *val) {if (!IS_ALIGNED ((uintptr_t )addr, size)) {Signature · 1 line
2.17.1
PATCH v7 3/5 Add debugfs based silicon debug support in DWC
In reply to Shradha TodiAdd support to provide silicon debug interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
--- Documentation/ABI/testing/debugfs-dwc-pcie | 13 ++ drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + .../controller/dwc/pcie-designware-debugfs.c | 176 ++++++++++++++++++ .../pci/controller/dwc/pcie-designware-ep.c | 5 + .../pci/controller/dwc/pcie-designware-host.c | 6 + drivers/pci/controller/dwc/pcie-designware.c | 6 + drivers/pci/controller/dwc/pcie-designware.h | 21 +++ include/linux/pcie-dwc.h | 2 + 9 files changed, 240 insertions(+) create mode 100644 Documentation/ABI/testing/debugfs-dwc-pcie create mode 100644 drivers/pci/controller/dwc/pcie-designware-debugfs.c
Documentation/ABI/testing/debugfs-dwc-pcie new file +13 -0
@@ -0,0 +1,13 @@ +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_debug/lane_detect +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RW) Write the lane number to be checked for detection. Read + will return whether PHY indicates receiver detection on the + selected lane. The default selected lane is Lane0. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_debug/rx_valid +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RW) Write the lane number to be checked as valid or invalid. Read + will return the status of PIPE RXVALID signal of the selected lane. + The default selected lane is Lane0.
drivers/pci/controller/dwc/Kconfig +10 -0
@@ -6,6 +6,16 @@ menu "DesignWare-based PCIe controllers" config PCIE_DW bool +config PCIE_DW_DEBUGFS + default y + depends on DEBUG_FS + depends on PCIE_DW_HOST || PCIE_DW_EP + bool "DWC PCIe debugfs entries" + help + Enables debugfs entries for the DW PCIe Controller. These entries + provide all debug features related to DW controller including the RAS + DES features to help in debug, error injection and statistical counters. + config PCIE_DW_HOST bool select PCIE_DW
drivers/pci/controller/dwc/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCIE_DW_DEBUGFS) += pcie-designware-debugfs.o obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +176 -0
176 lines not on this page · raw message
drivers/pci/controller/dwc/pcie-designware-ep.c +5 -0
@@ -814,6 +814,7 @@ void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep) {struct dw_pcie *pci =to_dw_pcie_from_ep (ep); +dwc_pcie_debugfs_deinit (pci);dw_pcie_edma_remove (pci); }EXPORT_SYMBOL_GPL (dw_pcie_ep_cleanup);
@@ -989,6 +990,10 @@ int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep)dw_pcie_ep_init_non_sticky_registers (pci); + ret =dwc_pcie_debugfs_init (pci); +if (ret) + goto err_remove_edma; +return 0 ; err_remove_edma:
drivers/pci/controller/dwc/pcie-designware-host.c +6 -0
@@ -548,6 +548,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (pp->ops->post_init) pp->ops->post_init (pp); + ret =dwc_pcie_debugfs_init (pci); +if (ret) + goto err_stop_link; +return 0 ; err_stop_link:
@@ -572,6 +576,8 @@ void dw_pcie_host_deinit(struct dw_pcie_rp *pp) {struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +dwc_pcie_debugfs_deinit (pci); +pci_stop_root_bus (pp->bridge->bus);pci_remove_root_bus (pp->bridge->bus);
drivers/pci/controller/dwc/pcie-designware.c +6 -0
@@ -323,6 +323,12 @@ static u16 dw_pcie_find_vsec_capability(struct dw_pcie *pci,return 0 ; } +u16 dw_pcie_find_rasdes_capability (struct dw_pcie *pci) +{ +return dw_pcie_find_vsec_capability (pci, dwc_pcie_rasdes_vsec_ids); +} +EXPORT_SYMBOL_GPL (dw_pcie_find_rasdes_capability); +int dw_pcie_read (void __iomem *addr,int size,u32 *val) {if (!IS_ALIGNED ((uintptr_t )addr, size)) {
drivers/pci/controller/dwc/pcie-designware.h +21 -0
@@ -437,6 +437,11 @@ struct dw_pcie_ops {void (*stop_link)(struct dw_pcie *pcie); }; +struct debugfs_info { +struct dentry *debug_dir; +void *rasdes_info; +}; +struct dw_pcie {struct device *dev;void __iomem *dbi_base;
@@ -465,6 +470,7 @@ struct dw_pcie {struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS ];struct gpio_desc *pe_rst;bool suspended; +struct debugfs_info *debugfs; };#define to_dw_pcie_from_pp (port) container_of((port), struct dw_pcie, pp)
@@ -478,6 +484,7 @@ void dw_pcie_version_detect(struct dw_pcie *pci);u8 dw_pcie_find_capability (struct dw_pcie *pci,u8 cap);u16 dw_pcie_find_ext_capability (struct dw_pcie *pci,u8 cap); +u16 dw_pcie_find_rasdes_capability (struct dw_pcie *pci);int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val);
@@ -806,4 +813,18 @@ dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)return NULL ; }#endif + +#ifdef CONFIG_PCIE_DW_DEBUGFS +int dwc_pcie_debugfs_init (struct dw_pcie *pci); +void dwc_pcie_debugfs_deinit (struct dw_pcie *pci); +#else +static inline int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +return 0 ; +} +static inline void dwc_pcie_debugfs_deinit (struct dw_pcie *pci) +{ +} +#endif +#endif /* _PCIE_DESIGNWARE_H */
include/linux/pcie-dwc.h +2 -0
@@ -28,6 +28,8 @@ static const struct dwc_pcie_vsec_id dwc_pcie_rasdes_vsec_ids[] = { .vsec_id = 0x02, .vsec_rev = 0x4 }, { .vendor_id = PCI_VENDOR_ID_QCOM, .vsec_id = 0x02, .vsec_rev = 0x4 }, + { .vendor_id = PCI_VENDOR_ID_SAMSUNG, + .vsec_id = 0x02, .vsec_rev = 0x4 }, {}/* terminator */ };
Signature · 1 line
2.17.1
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 5 lines · Shradha Todi
Add support to provide silicon debug interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
Signed-off-by Shradha Todi <[email protected]>
- Mani
Quoted 378 lines
--- Documentation/ABI/testing/debugfs-dwc-pcie | 13 ++ drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + .../controller/dwc/pcie-designware-debugfs.c | 176 ++++++++++++++++++ .../pci/controller/dwc/pcie-designware-ep.c | 5 + .../pci/controller/dwc/pcie-designware-host.c | 6 + drivers/pci/controller/dwc/pcie-designware.c | 6 + drivers/pci/controller/dwc/pcie-designware.h | 21 +++ include/linux/pcie-dwc.h | 2 + 9 files changed, 240 insertions(+) create mode 100644 Documentation/ABI/testing/debugfs-dwc-pcie create mode 100644 drivers/pci/controller/dwc/pcie-designware-debugfs.cDocumentation/ABI/testing/debugfs-dwc-pcie new file +13
-0@@ -0,0 +1,13 @@ +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_debug/lane_detect +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RW) Write the lane number to be checked for detection. Read + will return whether PHY indicates receiver detection on the + selected lane. The default selected lane is Lane0. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_debug/rx_valid +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RW) Write the lane number to be checked as valid or invalid. Read + will return the status of PIPE RXVALID signal of the selected lane. + The default selected lane is Lane0.drivers/pci/controller/dwc/Kconfig +10
-0@@ -6,6 +6,16 @@ menu "DesignWare-based PCIe controllers" config PCIE_DW bool +config PCIE_DW_DEBUGFS + default y + depends on DEBUG_FS + depends on PCIE_DW_HOST || PCIE_DW_EP + bool "DWC PCIe debugfs entries" + help + Enables debugfs entries for the DW PCIe Controller. These entries + provide all debug features related to DW controller including the RAS + DES features to help in debug, error injection and statistical counters. + config PCIE_DW_HOST bool select PCIE_DWdrivers/pci/controller/dwc/Makefile +1
-0@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCIE_DW_DEBUGFS) += pcie-designware-debugfs.o obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.odrivers/pci/controller/dwc/pcie-designware-debugfs.c new file +176
-0@@ -0,0 +1,176 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Synopsys DesignWare PCIe controller debugfs driver +* +* Copyright (C) 2025 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* +* Author: Shradha Todi <[email protected]> +*/ + +#include <linux/debugfs.h> + +#include "pcie-designware.h" + +#define SD_STATUS_L1LANE_REG 0xb0 +#define PIPE_RXVALID BIT(18) +#define PIPE_DETECT_LANE BIT(17) +#define LANE_SELECT GENMASK(3, 0) + +#define DWC_DEBUGFS_BUF_MAX 128 + +/** +* struct dwc_pcie_rasdes_info - Stores controller common information +* @ras_cap_offset: RAS DES vendor specific extended capability offset +* @reg_event_lock: Mutex used for RASDES shadow event registers +* +* Any parameter constant to all files of the debugfs hierarchy for a single controller +* will be stored in this struct. It is allocated and assigned to controller specific +* struct dw_pcie during initialization. +*/ +struct dwc_pcie_rasdes_info { +u32 ras_cap_offset; +struct mutex reg_event_lock; +}; + +static ssize_t lane_detect_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dw_pcie *pci = file->private_data; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +SD_STATUS_L1LANE_REG ); + val =FIELD_GET (PIPE_DETECT_LANE , val); +if (val) + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Lane Detected\n" ); +else + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Lane Undetected\n" ); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +} + +static ssize_t lane_detect_write (struct file *file,const char __user *buf, +size_t count,loff_t *ppos) +{ +struct dw_pcie *pci = file->private_data; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +u32 lane, val; + + val =kstrtou32_from_user (buf, count,0 , &lane); +if (val) +return val; + + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +SD_STATUS_L1LANE_REG ); + val &= ~(LANE_SELECT ); + val |=FIELD_PREP (LANE_SELECT , lane); +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +SD_STATUS_L1LANE_REG , val); + +return count; +} + +static ssize_t rx_valid_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dw_pcie *pci = file->private_data; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +SD_STATUS_L1LANE_REG ); + val =FIELD_GET (PIPE_RXVALID , val); +if (val) + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"RX Valid\n" ); +else + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"RX Invalid\n" ); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +} + +static ssize_t rx_valid_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) +{ +return lane_detect_write (file, buf, count, ppos); +} + +#define dwc_debugfs_create (name) \ +debugfs_create_file(#name, 0644, rasdes_debug, pci, \ + &dbg_ ## name ## _fops) + +#define DWC_DEBUGFS_FOPS (name) \ +static const struct file_operations dbg_ ## name ## _fops = { \ + .open = simple_open, \ + .read = name ## _read, \ + .write = name ## _write \ +} + +DWC_DEBUGFS_FOPS (lane_detect); +DWC_DEBUGFS_FOPS (rx_valid); + +static void dwc_pcie_rasdes_debugfs_deinit (struct dw_pcie *pci) +{ +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; + +mutex_destroy (&rinfo->reg_event_lock); +} + +static int dwc_pcie_rasdes_debugfs_init (struct dw_pcie *pci,struct dentry *dir) +{ +struct dentry *rasdes_debug; +struct dwc_pcie_rasdes_info *rasdes_info; +struct device *dev = pci->dev; +int ras_cap; + + ras_cap =dw_pcie_find_rasdes_capability (pci); +if (!ras_cap) { +dev_dbg (dev,"no RASDES capability available\n" ); +return -ENODEV ; + } + + rasdes_info =devm_kzalloc (dev,sizeof (*rasdes_info),GFP_KERNEL ); +if (!rasdes_info) +return -ENOMEM ; + +/* Create subdirectories for Debug, Error injection, Statistics */ + rasdes_debug =debugfs_create_dir ("rasdes_debug" , dir); + +mutex_init (&rasdes_info->reg_event_lock); + rasdes_info->ras_cap_offset = ras_cap; + pci->debugfs->rasdes_info = rasdes_info; + +/* Create debugfs files for Debug subdirectory */ +dwc_debugfs_create (lane_detect); +dwc_debugfs_create (rx_valid); + +return 0 ; +} + +void dwc_pcie_debugfs_deinit (struct dw_pcie *pci) +{ +dwc_pcie_rasdes_debugfs_deinit (pci); +debugfs_remove_recursive (pci->debugfs->debug_dir); +} + +int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ; + + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" ); + +return 0 ; +}drivers/pci/controller/dwc/pcie-designware-ep.c +5
-0@@ -814,6 +814,7 @@ void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep) {struct dw_pcie *pci =to_dw_pcie_from_ep (ep); +dwc_pcie_debugfs_deinit (pci);dw_pcie_edma_remove (pci); }EXPORT_SYMBOL_GPL (dw_pcie_ep_cleanup);@@ -989,6 +990,10 @@ int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep)dw_pcie_ep_init_non_sticky_registers (pci); + ret =dwc_pcie_debugfs_init (pci); +if (ret) + goto err_remove_edma; +return 0 ; err_remove_edma:drivers/pci/controller/dwc/pcie-designware-host.c +6
-0@@ -548,6 +548,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (pp->ops->post_init) pp->ops->post_init (pp); + ret =dwc_pcie_debugfs_init (pci); +if (ret) + goto err_stop_link; +return 0 ; err_stop_link:@@ -572,6 +576,8 @@ void dw_pcie_host_deinit(struct dw_pcie_rp *pp) {struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +dwc_pcie_debugfs_deinit (pci); +pci_stop_root_bus (pp->bridge->bus);pci_remove_root_bus (pp->bridge->bus);drivers/pci/controller/dwc/pcie-designware.c +6
-0@@ -323,6 +323,12 @@ static u16 dw_pcie_find_vsec_capability(struct dw_pcie *pci,return 0 ; } +u16 dw_pcie_find_rasdes_capability (struct dw_pcie *pci) +{ +return dw_pcie_find_vsec_capability (pci, dwc_pcie_rasdes_vsec_ids); +} +EXPORT_SYMBOL_GPL (dw_pcie_find_rasdes_capability); +int dw_pcie_read (void __iomem *addr,int size,u32 *val) {if (!IS_ALIGNED ((uintptr_t )addr, size)) {drivers/pci/controller/dwc/pcie-designware.h +21
-0@@ -437,6 +437,11 @@ struct dw_pcie_ops {void (*stop_link)(struct dw_pcie *pcie); }; +struct debugfs_info { +struct dentry *debug_dir; +void *rasdes_info; +}; +struct dw_pcie {struct device *dev;void __iomem *dbi_base;@@ -465,6 +470,7 @@ struct dw_pcie {struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS ];struct gpio_desc *pe_rst;bool suspended; +struct debugfs_info *debugfs; };#define to_dw_pcie_from_pp (port) container_of((port), struct dw_pcie, pp)@@ -478,6 +484,7 @@ void dw_pcie_version_detect(struct dw_pcie *pci);u8 dw_pcie_find_capability (struct dw_pcie *pci,u8 cap);u16 dw_pcie_find_ext_capability (struct dw_pcie *pci,u8 cap); +u16 dw_pcie_find_rasdes_capability (struct dw_pcie *pci);int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val);@@ -806,4 +813,18 @@ dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)return NULL ; }#endif + +#ifdef CONFIG_PCIE_DW_DEBUGFS +int dwc_pcie_debugfs_init (struct dw_pcie *pci); +void dwc_pcie_debugfs_deinit (struct dw_pcie *pci); +#else +static inline int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +return 0 ; +} +static inline void dwc_pcie_debugfs_deinit (struct dw_pcie *pci) +{ +} +#endif +#endif /* _PCIE_DESIGNWARE_H */ include/linux/pcie-dwc.h +2
-0@@ -28,6 +28,8 @@ static const struct dwc_pcie_vsec_id dwc_pcie_rasdes_vsec_ids[] = { .vsec_id = 0x02, .vsec_rev = 0x4 }, { .vendor_id = PCI_VENDOR_ID_QCOM, .vsec_id = 0x02, .vsec_rev = 0x4 }, + { .vendor_id = PCI_VENDOR_ID_SAMSUNG, + .vsec_id = 0x02, .vsec_rev = 0x4 }, {}/* terminator */ };Signature · 1 line
2.17.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
In reply to Shradha TodiQuoted 5 lines · Shradha Todi
Add support to provide silicon debug interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
Signed-off-by Shradha Todi <[email protected]>
One comment inline.
Quoted 14 lines
--- Documentation/ABI/testing/debugfs-dwc-pcie | 13 ++ drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + .../controller/dwc/pcie-designware-debugfs.c | 176 ++++++++++++++++++ .../pci/controller/dwc/pcie-designware-ep.c | 5 + .../pci/controller/dwc/pcie-designware-host.c | 6 + drivers/pci/controller/dwc/pcie-designware.c | 6 + drivers/pci/controller/dwc/pcie-designware.h | 21 +++ include/linux/pcie-dwc.h | 2 + 9 files changed, 240 insertions(+) create mode 100644 Documentation/ABI/testing/debugfs-dwc-pcie create mode 100644 drivers/pci/controller/dwc/pcie-designware-debugfs.c
...
Quoted 55 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +55
-0+ +static void dwc_pcie_rasdes_debugfs_deinit (struct dw_pcie *pci) +{ +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; + +mutex_destroy (&rinfo->reg_event_lock); +} + +static int dwc_pcie_rasdes_debugfs_init (struct dw_pcie *pci,struct dentry *dir) +{ +struct dentry *rasdes_debug; +struct dwc_pcie_rasdes_info *rasdes_info; +struct device *dev = pci->dev; +int ras_cap; + + ras_cap =dw_pcie_find_rasdes_capability (pci); +if (!ras_cap) { +dev_dbg (dev,"no RASDES capability available\n" ); +return -ENODEV ; + } + + rasdes_info =devm_kzalloc (dev,sizeof (*rasdes_info),GFP_KERNEL ); +if (!rasdes_info) +return -ENOMEM ; + +/* Create subdirectories for Debug, Error injection, Statistics */ + rasdes_debug =debugfs_create_dir ("rasdes_debug" , dir); + +mutex_init (&rasdes_info->reg_event_lock); + rasdes_info->ras_cap_offset = ras_cap; + pci->debugfs->rasdes_info = rasdes_info; + +/* Create debugfs files for Debug subdirectory */ +dwc_debugfs_create (lane_detect); +dwc_debugfs_create (rx_valid); + +return 0 ; +} + +void dwc_pcie_debugfs_deinit (struct dw_pcie *pci) +{ +dwc_pcie_rasdes_debugfs_deinit (pci); +debugfs_remove_recursive (pci->debugfs->debug_dir); +} + +int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev));
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 10 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +10
-0+ dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ; + + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );
What will happen if ret != 0? still return 0?
Fan
Quoted 134 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +3
-0+ +return 0 ; +}drivers/pci/controller/dwc/pcie-designware-ep.c +5
-0@@ -814,6 +814,7 @@ void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep) {struct dw_pcie *pci =to_dw_pcie_from_ep (ep); +dwc_pcie_debugfs_deinit (pci);dw_pcie_edma_remove (pci); }EXPORT_SYMBOL_GPL (dw_pcie_ep_cleanup);@@ -989,6 +990,10 @@ int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep)dw_pcie_ep_init_non_sticky_registers (pci); + ret =dwc_pcie_debugfs_init (pci); +if (ret) + goto err_remove_edma; +return 0 ; err_remove_edma:drivers/pci/controller/dwc/pcie-designware-host.c +6
-0@@ -548,6 +548,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (pp->ops->post_init) pp->ops->post_init (pp); + ret =dwc_pcie_debugfs_init (pci); +if (ret) + goto err_stop_link; +return 0 ; err_stop_link:@@ -572,6 +576,8 @@ void dw_pcie_host_deinit(struct dw_pcie_rp *pp) {struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +dwc_pcie_debugfs_deinit (pci); +pci_stop_root_bus (pp->bridge->bus);pci_remove_root_bus (pp->bridge->bus);drivers/pci/controller/dwc/pcie-designware.c +6
-0@@ -323,6 +323,12 @@ static u16 dw_pcie_find_vsec_capability(struct dw_pcie *pci,return 0 ; } +u16 dw_pcie_find_rasdes_capability (struct dw_pcie *pci) +{ +return dw_pcie_find_vsec_capability (pci, dwc_pcie_rasdes_vsec_ids); +} +EXPORT_SYMBOL_GPL (dw_pcie_find_rasdes_capability); +int dw_pcie_read (void __iomem *addr,int size,u32 *val) {if (!IS_ALIGNED ((uintptr_t )addr, size)) {drivers/pci/controller/dwc/pcie-designware.h +21
-0@@ -437,6 +437,11 @@ struct dw_pcie_ops {void (*stop_link)(struct dw_pcie *pcie); }; +struct debugfs_info { +struct dentry *debug_dir; +void *rasdes_info; +}; +struct dw_pcie {struct device *dev;void __iomem *dbi_base;@@ -465,6 +470,7 @@ struct dw_pcie {struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS ];struct gpio_desc *pe_rst;bool suspended; +struct debugfs_info *debugfs; };#define to_dw_pcie_from_pp (port) container_of((port), struct dw_pcie, pp)@@ -478,6 +484,7 @@ void dw_pcie_version_detect(struct dw_pcie *pci);u8 dw_pcie_find_capability (struct dw_pcie *pci,u8 cap);u16 dw_pcie_find_ext_capability (struct dw_pcie *pci,u8 cap); +u16 dw_pcie_find_rasdes_capability (struct dw_pcie *pci);int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val);@@ -806,4 +813,18 @@ dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)return NULL ; }#endif + +#ifdef CONFIG_PCIE_DW_DEBUGFS +int dwc_pcie_debugfs_init (struct dw_pcie *pci); +void dwc_pcie_debugfs_deinit (struct dw_pcie *pci); +#else +static inline int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +return 0 ; +} +static inline void dwc_pcie_debugfs_deinit (struct dw_pcie *pci) +{ +} +#endif +#endif /* _PCIE_DESIGNWARE_H */ include/linux/pcie-dwc.h +2
-0@@ -28,6 +28,8 @@ static const struct dwc_pcie_vsec_id dwc_pcie_rasdes_vsec_ids[] = { .vsec_id = 0x02, .vsec_rev = 0x4 }, { .vendor_id = PCI_VENDOR_ID_QCOM, .vsec_id = 0x02, .vsec_rev = 0x4 }, + { .vendor_id = PCI_VENDOR_ID_SAMSUNG, + .vsec_id = 0x02, .vsec_rev = 0x4 }, {}/* terminator */ };Signature · 1 line
2.17.1
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Hello,
[...]
Quoted 14 lines
Quoted 14 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +14
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
Given that callers of dwc_pcie_debugfs_init() check for errors, this probably should correctly bubble up any failure coming from dwc_pcie_rasdes_debugfs_init().
I made updates to the code directly on the current branch, have a look:
Let me know if this is OK with you.
Good catch, thank you!
Krzysztof
Fan Ni
Reviewed-byRe: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 30 lines · Krzysztof Wilczyński
Hello,
[...]
Quoted 14 lines
Quoted 14 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +14
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
Given that callers of
dwc_pcie_debugfs_init()check for errors, this probably should correctly bubble up any failure coming fromdwc_pcie_rasdes_debugfs_init().
Quoted 5 lines
I made updates to the code directly on the current branch, have a look:
Let me know if this is OK with you.
It looks good to me.
Feel free to add,
Fan
Quoted 4 lines
Good catch, thank you!
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Hello,
[...]
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
What will happen if ret != 0? still return 0?
Given that callers of
dwc_pcie_debugfs_init()check for errors, this probably should correctly bubble up any failure coming fromdwc_pcie_rasdes_debugfs_init().I made updates to the code directly on the current branch, have a look:
Quoted 8 lines
Quoted 3 lines
Let me know if this is OK with you.
It looks good to me.
Feel free to add,
Reviewed-by Fan Ni <[email protected]>
Will do. Thank you.
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
In reply to Krzysztof WilczyńskiHi Krzysztof,
This patch is now commit 1ff54f4cbaed9ec6 ("PCI: dwc: Add debugfs based Silicon Debug support for DWC") in pci/next (next-20250304).
Quoted 15 lines · Krzysztof Wilczyński
[...]
Quoted 14 lines
Quoted 14 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +14
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;
Quoted 8 lines
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
And that is exactly what happens on Gray Hawk Single with R-Car
V4M: dw_pcie_find_rasdes_capability() returns NULL, causing dwc_pcie_rasdes_debugfs_init() to return -ENODEV.
Quoted 1 line
Given that callers of
dwc_pcie_debugfs_init()check for errors,
Debugfs issues should never be propagated upstream!
Quoted 4 lines
this probably should correctly bubble up any failure coming from
dwc_pcie_rasdes_debugfs_init().I made updates to the code directly on the current branch, have a look:
So while applying, you changed this like:
ret = dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
- dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+ dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }
return 0;
Hence this is now a fatal error, causing the probe to fail. Unfortunately something fails during cleanup:
pcie-rcar-gen4 e65d0000.pcie: failed to initialize RAS DES debugfs ------------[ cut here ]------------
WARNING: CPU: 3 PID: 36 at kernel/irq/irqdomain.c:393
irq_domain_remove+0xa8/0xb0
CPU: 3 UID: 0 PID: 36 Comm: kworker/u16:1 Not tainted
6.14.0-rc1-arm64-renesas-00134-g12c8c1363538 #2884
Hardware name: Renesas Gray Hawk Single board based on r8a779h0 (DT)
Workqueue: async async_run_entry_fn
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : irq_domain_remove+0xa8/0xb0
lr : irq_domain_remove+0x2c/0xb0
sp : ffff8000819b3b10
x29: ffff8000819b3b10 x28: 0000000000000000 x27: 0000000000000000
x26: ffff00044011d800 x25: ffff80008053294c x24: ffff000441740400
x23: ffff0004413a30f0 x22: ffff0004413a3130 x21: ffff0004413a3130
x20: ffff8000815c0ec8 x19: ffff0004415f8240 x18: 00000000ffffffff
x17: 6775626564205345 x16: 0000000000000020 x15: ffff8000819b37b0
x14: 0000000000000004 x13: ffff8000813e9dd8 x12: 0000000000000000
x11: ffff0004404b6448 x10: ffff800080e85400 x9 : 1fffe00088334301
x8 : 0000000000000001 x7 : ffff0004419a1800 x6 : ffff0004419a1808
x5 : ffff000441349030 x4 : fffffffffffffdc1 x3 : 0000000000000000
x2 : ffff0004403e0000 x1 : 0000000000000000 x0 : ffff00044134f630
Call trace:
irq_domain_remove+0xa8/0xb0 (P)
dw_pcie_host_init+0x394/0x710
rcar_gen4_pcie_probe+0x104/0x2f8
platform_probe+0x64/0xbc
really_probe+0xb8/0x294
__driver_probe_device+0x74/0x124
driver_probe_device+0x3c/0x158
__device_attach_driver+0xd4/0x154
bus_for_each_drv+0x84/0xe0
__device_attach_async_helper+0xac/0xd0
async_run_entry_fn+0x30/0xd8
process_one_work+0x144/0x280
worker_thread+0x2c4/0x3cc
kthread+0x128/0x1e0
ret_from_fork+0x10/0x20
---[ end trace 0000000000000000 ]---Worse, the PCI bus is still registered, so running "lspci" causes an Oops:
Unable to handle kernel NULL pointer dereference at virtual
address 0000000000000004
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000483b53000
[0000000000000004] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
CPU: 3 UID: 0 PID: 707 Comm: lspci Tainted: G W
6.14.0-rc1-arm64-renesas-00134-g12c8c1363538 #2884
Tainted: [W]=WARN
Hardware name: Renesas Gray Hawk Single board based on r8a779h0 (DT)
pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : pci_generic_config_read+0x34/0xac
lr : pci_generic_config_read+0x20/0xac
sp : ffff8000825cbbf0
x29: ffff8000825cbbf0 x28: ffff0004491c4b84 x27: 0000000000000004
x26: 000000000000000f x25: ffff0004491c4b80 x24: 0000000000000040
x23: 0000000000000040 x22: ffff8000825cbc64 x21: ffff8000816fb4f8
x20: ffff8000825cbc14 x19: 0000000000000004 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : 0000000000000000 x7 : ffff000442c653c0 x6 : ffff8000805163d0
x5 : ffff8000804f3334 x4 : ffff8000825cbc14 x3 : ffff800080531990
x2 : 0000000000000004 x1 : 0000000000000000 x0 : 0000000000000004
Call trace:
pci_generic_config_read+0x34/0xac (P)
pci_user_read_config_dword+0x78/0x118
pci_read_config+0xe4/0x29c
sysfs_kf_bin_read+0x8c/0x9c
kernfs_fop_read_iter+0x9c/0x19c
vfs_read+0x24c/0x330
__arm64_sys_pread64+0xac/0xc8
invoke_syscall+0x44/0x100
el0_svc_common.constprop.0+0x3c/0xd4
do_el0_svc+0x18/0x20
el0_svc+0x24/0xa8
el0t_64_sync_handler+0x104/0x130
el0t_64_sync+0x154/0x158
Code: 7100067f 540002a0 71000a7f 54000160 (b9400000)
---[ end trace 0000000000000000 ]---
note: lspci[707] exited with irqs disabled
note: lspci[707] exited with preempt_count 1Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
In reply to Krzysztof WilczyńskiHi Krzysztof,
(CC corrected)
This patch is now commit 1ff54f4cbaed9ec6 ("PCI: dwc: Add debugfs based Silicon Debug support for DWC") in pci/next (next-20250304).
Quoted 15 lines · Krzysztof Wilczyński
[...]
Quoted 14 lines
Quoted 14 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +14
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;
Quoted 8 lines
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
And that is exactly what happens on Gray Hawk Single with R-Car
V4M: dw_pcie_find_rasdes_capability() returns NULL, causing dwc_pcie_rasdes_debugfs_init() to return -ENODEV.
Quoted 1 line
Given that callers of
dwc_pcie_debugfs_init()check for errors,
Debugfs issues should never be propagated upstream!
Quoted 4 lines
this probably should correctly bubble up any failure coming from
dwc_pcie_rasdes_debugfs_init().I made updates to the code directly on the current branch, have a look:
So while applying, you changed this like:
ret = dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
- dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+ dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }
return 0;
Hence this is now a fatal error, causing the probe to fail. Unfortunately something fails during cleanup:
pcie-rcar-gen4 e65d0000.pcie: failed to initialize RAS DES debugfs ------------[ cut here ]------------
WARNING: CPU: 3 PID: 36 at kernel/irq/irqdomain.c:393
irq_domain_remove+0xa8/0xb0
CPU: 3 UID: 0 PID: 36 Comm: kworker/u16:1 Not tainted
6.14.0-rc1-arm64-renesas-00134-g12c8c1363538 #2884
Hardware name: Renesas Gray Hawk Single board based on r8a779h0 (DT)
Workqueue: async async_run_entry_fn
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : irq_domain_remove+0xa8/0xb0
lr : irq_domain_remove+0x2c/0xb0
sp : ffff8000819b3b10
x29: ffff8000819b3b10 x28: 0000000000000000 x27: 0000000000000000
x26: ffff00044011d800 x25: ffff80008053294c x24: ffff000441740400
x23: ffff0004413a30f0 x22: ffff0004413a3130 x21: ffff0004413a3130
x20: ffff8000815c0ec8 x19: ffff0004415f8240 x18: 00000000ffffffff
x17: 6775626564205345 x16: 0000000000000020 x15: ffff8000819b37b0
x14: 0000000000000004 x13: ffff8000813e9dd8 x12: 0000000000000000
x11: ffff0004404b6448 x10: ffff800080e85400 x9 : 1fffe00088334301
x8 : 0000000000000001 x7 : ffff0004419a1800 x6 : ffff0004419a1808
x5 : ffff000441349030 x4 : fffffffffffffdc1 x3 : 0000000000000000
x2 : ffff0004403e0000 x1 : 0000000000000000 x0 : ffff00044134f630
Call trace:
irq_domain_remove+0xa8/0xb0 (P)
dw_pcie_host_init+0x394/0x710
rcar_gen4_pcie_probe+0x104/0x2f8
platform_probe+0x64/0xbc
really_probe+0xb8/0x294
__driver_probe_device+0x74/0x124
driver_probe_device+0x3c/0x158
__device_attach_driver+0xd4/0x154
bus_for_each_drv+0x84/0xe0
__device_attach_async_helper+0xac/0xd0
async_run_entry_fn+0x30/0xd8
process_one_work+0x144/0x280
worker_thread+0x2c4/0x3cc
kthread+0x128/0x1e0
ret_from_fork+0x10/0x20
---[ end trace 0000000000000000 ]---Worse, the PCI bus is still registered, so running "lspci" causes an Oops:
Unable to handle kernel NULL pointer dereference at virtual
address 0000000000000004
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=0000000483b53000
[0000000000000004] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
CPU: 3 UID: 0 PID: 707 Comm: lspci Tainted: G
W6.14.0-rc1-arm64-renesas-00134-g12c8c1363538 #2884
Tainted: [W]=WARN
Hardware name: Renesas Gray Hawk Single board based on r8a779h0 (DT)
pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : pci_generic_config_read+0x34/0xac
lr : pci_generic_config_read+0x20/0xac
sp : ffff8000825cbbf0
x29: ffff8000825cbbf0 x28: ffff0004491c4b84 x27: 0000000000000004
x26: 000000000000000f x25: ffff0004491c4b80 x24: 0000000000000040
x23: 0000000000000040 x22: ffff8000825cbc64 x21: ffff8000816fb4f8
x20: ffff8000825cbc14 x19: 0000000000000004 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : 0000000000000000 x7 : ffff000442c653c0 x6 : ffff8000805163d0
x5 : ffff8000804f3334 x4 : ffff8000825cbc14 x3 : ffff800080531990
x2 : 0000000000000004 x1 : 0000000000000000 x0 : 0000000000000004
Call trace:
pci_generic_config_read+0x34/0xac (P)
pci_user_read_config_dword+0x78/0x118
pci_read_config+0xe4/0x29c
sysfs_kf_bin_read+0x8c/0x9c
kernfs_fop_read_iter+0x9c/0x19c
vfs_read+0x24c/0x330
__arm64_sys_pread64+0xac/0xc8
invoke_syscall+0x44/0x100
el0_svc_common.constprop.0+0x3c/0xd4
do_el0_svc+0x18/0x20
el0_svc+0x24/0xa8
el0t_64_sync_handler+0x104/0x130
el0t_64_sync+0x154/0x158
Code: 7100067f 540002a0 71000a7f 54000160 (b9400000)
---[ end trace 0000000000000000 ]---
note: lspci[707] exited with irqs disabled
note: lspci[707] exited with preempt_count 1Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Hello,
Quoted 28 lines
This patch is now commit
1ff54f4cbaed9ec6("PCI: dwc: Add debugfs based Silicon Debug support for DWC") in pci/next (next-20250304).Quoted 15 lines · Krzysztof Wilczyński
[...]
Quoted 14 lines
Quoted 14 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +14
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;Quoted 8 lines
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
Quoted 3 lines
And that is exactly what happens on Gray Hawk Single with R-Car
V4M:dw_pcie_find_rasdes_capability()returns NULL, causingdwc_pcie_rasdes_debugfs_init()to return-ENODEV.
Thank you for testing and for catching this issue. Much appreciated.
Quoted 3 lines
Quoted 1 line
Given that callers of
dwc_pcie_debugfs_init()check for errors,Debugfs issues should never be propagated upstream!
Makes complete sense. Sorry for breaking things here!
Quoted 15 lines
Quoted 4 lines
this probably should correctly bubble up any failure coming from
dwc_pcie_rasdes_debugfs_init().I made updates to the code directly on the current branch, have a look:
So while applying, you changed this like:
ret =
dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
-dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }
Quoted 3 lines
return 0;
Hence this is now a fatal error, causing the probe to fail.
I removed the changed, and also move the log level to be a warning, per:
Would this be acceptable here?
Mani, would this be acceptable to you, too? Given that you posted the following recently:
That said, perhaps moving the log level to a debug would be better served here.
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 65 lines · Krzysztof Wilczyński
Hello,
Quoted 28 lines
This patch is now commit
1ff54f4cbaed9ec6("PCI: dwc: Add debugfs based Silicon Debug support for DWC") in pci/next (next-20250304).Quoted 15 lines · Krzysztof Wilczyński
[...]
Quoted 14 lines
Quoted 14 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +14
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;Quoted 8 lines
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
Quoted 3 lines
And that is exactly what happens on Gray Hawk Single with R-Car
V4M:dw_pcie_find_rasdes_capability()returns NULL, causingdwc_pcie_rasdes_debugfs_init()to return-ENODEV.Thank you for testing and for catching this issue. Much appreciated.
Quoted 3 lines
Quoted 1 line
Given that callers of
dwc_pcie_debugfs_init()check for errors,Debugfs issues should never be propagated upstream!
Makes complete sense. Sorry for breaking things here!
Quoted 15 lines
Quoted 4 lines
this probably should correctly bubble up any failure coming from
dwc_pcie_rasdes_debugfs_init().I made updates to the code directly on the current branch, have a look:
So while applying, you changed this like:
ret =
dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
-dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }Quoted 3 lines
return 0;
Hence this is now a fatal error, causing the probe to fail.
I removed the changed, and also move the log level to be a warning, per:
Quoted 9 lines
Would this be acceptable here?
Mani, would this be acceptable to you, too? Given that you posted the following recently:
That said, perhaps moving the log level to a debug would be better served here.
Even though debugfs_init() failure is not supposed to fail the probe(), dwc_pcie_rasdes_debugfs_init() has a devm_kzalloc() and propagating that failure would be canolically correct IMO.
So I would still opt to have my version + your previous one.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Hello,
[...]
Quoted 48 lines
Quoted 48 lines
Quoted 9 lines
Quoted 5 lines
Quoted 5 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 3 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +3
-0+ ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
And that is exactly what happens on Gray Hawk Single with R-Car
V4M:dw_pcie_find_rasdes_capability()returns NULL, causingdwc_pcie_rasdes_debugfs_init()to return-ENODEV.Thank you for testing and for catching this issue. Much appreciated.
Quoted 3 lines
Quoted 1 line
Given that callers of
dwc_pcie_debugfs_init()check for errors,Debugfs issues should never be propagated upstream!
Makes complete sense. Sorry for breaking things here!
Quoted 15 lines
Quoted 4 lines
this probably should correctly bubble up any failure coming from
dwc_pcie_rasdes_debugfs_init().I made updates to the code directly on the current branch, have a look:
So while applying, you changed this like:
ret =
dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
-dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }Quoted 3 lines
return 0;
Hence this is now a fatal error, causing the probe to fail.
I removed the changed, and also move the log level to be a warning, per:
Would this be acceptable here?
Mani, would this be acceptable to you, too? Given that you posted the following recently:
Quoted 8 lines
Quoted 2 lines
That said, perhaps moving the log level to a debug would be better served here.
Even though
debugfs_init()failure is not supposed to fail theprobe(),dwc_pcie_rasdes_debugfs_init()has adevm_kzalloc()and propagating that failure would be canolically correct IMO.So I would still opt to have my version + your previous one.
Sounds good!
I combined both changes (squashed your fix for the RAS DES capability detection) together directly on the branch.
Thank you!
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
In reply to Manivannan SadhasivamQuoted 43 lines · Manivannan Sadhasivam
Quoted 30 lines · Krzysztof Wilczyński
Quoted 30 lines · Krzysztof Wilczyński
Quoted 15 lines
[...]
Quoted 14 lines
Quoted 14 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +14
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) +{ +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;Quoted 8 lines
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
And that is exactly what happens on Gray Hawk Single with R-Car
V4M:dw_pcie_find_rasdes_capability()returns NULL, causingdwc_pcie_rasdes_debugfs_init()to return-ENODEV.Debugfs issues should never be propagated upstream!
...
Quoted 10 lines
Quoted 10 lines
So while applying, you changed this like:
ret =
dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
-dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
return 0;Hence this is now a fatal error, causing the probe to fail.
Even though
debugfs_init()failure is not supposed to fail theprobe(),dwc_pcie_rasdes_debugfs_init()has adevm_kzalloc()and propagating that failure would be canolically correct IMO.
I'm not sure about this. What's the requirement to propagate devm_kzalloc() failures? I think devres will free any allocs that were successful regardless.
IIUC, we resolved the Gray Hawk Single issue by changing dwc_pcie_rasdes_debugfs_init() to return success without doing anything when there's no RAS DES Capability.
But dwc_pcie_debugfs_init() can still return failure, and that still causes dw_pcie_ep_init_registers() to fail, which breaks the "don't propagate debugfs issues upstream" rule:
int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep)
{
...
ret = dwc_pcie_debugfs_init(pci);
if (ret)
goto err_remove_edma;return 0;
err_remove_edma:
dw_pcie_edma_remove(pci);return ret;
}
We can say that kzalloc() failure should "never" happen, and therefore it's OK to fail the driver probe if it happens, but that doesn't seem like a strong argument for breaking the "don't propagate debugfs issues" rule. And someday there may be other kinds of failures from dwc_pcie_debugfs_init().
Bjorn
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 76 lines · Bjorn Helgaas
Quoted 43 lines · Manivannan Sadhasivam
Quoted 30 lines · Krzysztof Wilczyński
Quoted 30 lines · Krzysztof Wilczyński
Quoted 15 lines
[...]
Quoted 14 lines
Quoted 14 lines
(quoted diff) +14
-0+int dwc_pcie_debugfs_init(struct dw_pcie *pci) +{ + char dirname[DWC_DEBUGFS_BUF_MAX]; + struct device *dev = pci->dev; + struct debugfs_info *debugfs; + struct dentry *dir; + int ret; + + /* Create main directory for each platform driver */ + snprintf(dirname, DWC_DEBUGFS_BUF_MAX, "dwc_pcie_%s", dev_name(dev)); + dir = debugfs_create_dir(dirname, NULL); + debugfs = devm_kzalloc(dev, sizeof(*debugfs), GFP_KERNEL); + if (!debugfs) + return -ENOMEM;Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret = dwc_pcie_rasdes_debugfs_init(pci, dir); + if (ret) + dev_dbg(dev, "RASDES debugfs init failed\n");What will happen if ret != 0? still return 0?
And that is exactly what happens on Gray Hawk Single with R-Car
V4M:dw_pcie_find_rasdes_capability()returns NULL, causingdwc_pcie_rasdes_debugfs_init()to return-ENODEV.Debugfs issues should never be propagated upstream!
...
Quoted 10 lines
Quoted 10 lines
So while applying, you changed this like:
ret =
dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
-dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
return 0;Hence this is now a fatal error, causing the probe to fail.
Even though
debugfs_init()failure is not supposed to fail theprobe(),dwc_pcie_rasdes_debugfs_init()has adevm_kzalloc()and propagating that failure would be canolically correct IMO.I'm not sure about this. What's the requirement to propagate
devm_kzalloc()failures? I think devres will free any allocs that were successful regardless.IIUC, we resolved the Gray Hawk Single issue by changing
dwc_pcie_rasdes_debugfs_init()to return success without doing anything when there's no RAS DES Capability.But
dwc_pcie_debugfs_init()can still return failure, and that still causesdw_pcie_ep_init_registers()to fail, which breaks the "don't propagate debugfs issues upstream" rule:int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep) { ... ret = dwc_pcie_debugfs_init(pci); if (ret) goto err_remove_edma;return 0;err_remove_edma: dw_pcie_edma_remove(pci);
Quoted 9 lines
return ret;}
We can say that
kzalloc()failure should "never" happen, and therefore it's OK to fail the driver probe if it happens, but that doesn't seem like a strong argument for breaking the "don't propagate debugfs issues" rule. And someday there may be other kinds of failures fromdwc_pcie_debugfs_init().
Fine with me. I was not too sure about propagating failure either.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Hello,
[...]
Quoted 31 lines
Quoted 31 lines
Quoted 3 lines
Even though
debugfs_init()failure is not supposed to fail theprobe(),dwc_pcie_rasdes_debugfs_init()has adevm_kzalloc()and propagating that failure would be canolically correct IMO.I'm not sure about this. What's the requirement to propagate
devm_kzalloc()failures? I think devres will free any allocs that were successful regardless.IIUC, we resolved the Gray Hawk Single issue by changing
dwc_pcie_rasdes_debugfs_init()to return success without doing anything when there's no RAS DES Capability.But
dwc_pcie_debugfs_init()can still return failure, and that still causesdw_pcie_ep_init_registers()to fail, which breaks the "don't propagate debugfs issues upstream" rule:int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep) { ... ret = dwc_pcie_debugfs_init(pci); if (ret) goto err_remove_edma;return 0;err_remove_edma: dw_pcie_edma_remove(pci);return ret;}
Quoted 8 lines
Quoted 6 lines
We can say that
kzalloc()failure should "never" happen, and therefore it's OK to fail the driver probe if it happens, but that doesn't seem like a strong argument for breaking the "don't propagate debugfs issues" rule. And someday there may be other kinds of failures fromdwc_pcie_debugfs_init().Fine with me. I was not too sure about propagating failure either.
What if we do this?
drivers/pci/controller/dwc/pcie-designware-debugfs.c +8 -10
@@ -162,7 +162,7 @@ void dwc_pcie_debugfs_deinit(struct dw_pcie *pci)debugfs_remove_recursive (pci->debugfs->debug_dir); } -int dwc_pcie_debugfs_init (struct dw_pcie *pci) +void dwc_pcie_debugfs_init (struct dw_pcie *pci) {char dirname[DWC_DEBUGFS_BUF_MAX ];struct device *dev = pci->dev;
@@ -174,17 +174,15 @@ int dwc_pcie_debugfs_init(struct dw_pcie *pci)snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); dir =debugfs_create_dir (dirname,NULL ); debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); -if (!debugfs) -return -ENOMEM ; +if (!debugfs) { +dev_err (dev,"failed to allocate memory for debugfs\n" ); +return ; + } debugfs->debug_dir = dir; pci->debugfs = debugfs; err =dwc_pcie_rasdes_debugfs_init (pci, dir); -if (err) { -dev_err (dev,"failed to initialize RAS DES debugfs, err=%d\n" , - err); -return err; - } - -return 0 ; +if (err) +dev_warn (dev,"failed to initialize RAS DES debugfs, err=%d" , + err); }
drivers/pci/controller/dwc/pcie-designware-ep.c +1 -3
@@ -838,9 +838,7 @@ int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep)dw_pcie_ep_init_non_sticky_registers (pci); - ret =dwc_pcie_debugfs_init (pci); -if (ret) - goto err_remove_edma; +dwc_pcie_debugfs_init (pci);return 0 ;
drivers/pci/controller/dwc/pcie-designware-host.c +1 -3
@@ -548,9 +548,7 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (pp->ops->post_init) pp->ops->post_init (pp); - ret =dwc_pcie_debugfs_init (pci); -if (ret) - goto err_stop_link; +dwc_pcie_debugfs_init (pci);return 0 ;
drivers/pci/controller/dwc/pcie-designware.h +2 -3
@@ -815,12 +815,11 @@ dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)#endif #ifdef CONFIG_PCIE_DW_DEBUGFS -int dwc_pcie_debugfs_init (struct dw_pcie *pci); +void dwc_pcie_debugfs_init (struct dw_pcie *pci);void dwc_pcie_debugfs_deinit (struct dw_pcie *pci);#else -static inline int dwc_pcie_debugfs_init (struct dw_pcie *pci) +static inline void dwc_pcie_debugfs_init (struct dw_pcie *pci) { -return 0 ; }static inline void dwc_pcie_debugfs_deinit (struct dw_pcie *pci) {
I think this would be fine, especially given the rules around debugfs and a quick look around Git history to see what the prefernce would be typically.
Thank you!
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 130 lines
Quoted 31 lines
Quoted 31 lines
Quoted 3 lines
Even though
debugfs_init()failure is not supposed to fail theprobe(),dwc_pcie_rasdes_debugfs_init()has adevm_kzalloc()and propagating that failure would be canolically correct IMO.I'm not sure about this. What's the requirement to propagate
devm_kzalloc()failures? I think devres will free any allocs that were successful regardless.IIUC, we resolved the Gray Hawk Single issue by changing
dwc_pcie_rasdes_debugfs_init()to return success without doing anything when there's no RAS DES Capability.But
dwc_pcie_debugfs_init()can still return failure, and that still causesdw_pcie_ep_init_registers()to fail, which breaks the "don't propagate debugfs issues upstream" rule:int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep) { ... ret = dwc_pcie_debugfs_init(pci); if (ret) goto err_remove_edma;return 0;err_remove_edma: dw_pcie_edma_remove(pci);return ret;}
Quoted 8 lines
Quoted 6 lines
We can say that
kzalloc()failure should "never" happen, and therefore it's OK to fail the driver probe if it happens, but that doesn't seem like a strong argument for breaking the "don't propagate debugfs issues" rule. And someday there may be other kinds of failures fromdwc_pcie_debugfs_init().Fine with me. I was not too sure about propagating failure either.
What if we do this?
drivers/pci/controller/dwc/pcie-designware-debugfs.c +8
-10@@ -162,7 +162,7 @@ void dwc_pcie_debugfs_deinit(struct dw_pcie *pci)debugfs_remove_recursive (pci->debugfs->debug_dir); } -int dwc_pcie_debugfs_init (struct dw_pcie *pci) +void dwc_pcie_debugfs_init (struct dw_pcie *pci) {char dirname[DWC_DEBUGFS_BUF_MAX ];struct device *dev = pci->dev;@@ -174,17 +174,15 @@ int dwc_pcie_debugfs_init(struct dw_pcie *pci)snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); dir =debugfs_create_dir (dirname,NULL ); debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); -if (!debugfs) -return -ENOMEM ; +if (!debugfs) { +dev_err (dev,"failed to allocate memory for debugfs\n" ); +return ; + } debugfs->debug_dir = dir; pci->debugfs = debugfs; err =dwc_pcie_rasdes_debugfs_init (pci, dir); -if (err) { -dev_err (dev,"failed to initialize RAS DES debugfs, err=%d\n" , - err); -return err; - } - -return 0 ; +if (err) +dev_warn (dev,"failed to initialize RAS DES debugfs, err=%d" , + err); }drivers/pci/controller/dwc/pcie-designware-ep.c +1
-3@@ -838,9 +838,7 @@ int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep)dw_pcie_ep_init_non_sticky_registers (pci); - ret =dwc_pcie_debugfs_init (pci); -if (ret) - goto err_remove_edma; +dwc_pcie_debugfs_init (pci);return 0 ;drivers/pci/controller/dwc/pcie-designware-host.c +1
-3@@ -548,9 +548,7 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (pp->ops->post_init) pp->ops->post_init (pp); - ret =dwc_pcie_debugfs_init (pci); -if (ret) - goto err_stop_link; +dwc_pcie_debugfs_init (pci);return 0 ;drivers/pci/controller/dwc/pcie-designware.h +2
-3@@ -815,12 +815,11 @@ dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)#endif #ifdef CONFIG_PCIE_DW_DEBUGFS -int dwc_pcie_debugfs_init (struct dw_pcie *pci); +void dwc_pcie_debugfs_init (struct dw_pcie *pci);void dwc_pcie_debugfs_deinit (struct dw_pcie *pci);#else -static inline int dwc_pcie_debugfs_init (struct dw_pcie *pci) +static inline void dwc_pcie_debugfs_init (struct dw_pcie *pci) { -return 0 ; }static inline void dwc_pcie_debugfs_deinit (struct dw_pcie *pci) {
Quoted 2 lines
I think this would be fine, especially given the rules around debugfs and a quick look around Git history to see what the prefernce would be typically.
Changed dev_warn() to dev_err() per Bjorn's feedback off mailing list, and squashed against the current code on the branch.
Thank you!
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
In reply to Krzysztof WilczyńskiHi Krzysztof,
Quoted 29 lines · Krzysztof Wilczyński
[...]
Quoted 28 lines
Quoted 28 lines
Quoted 3 lines
Even though
debugfs_init()failure is not supposed to fail theprobe(),dwc_pcie_rasdes_debugfs_init()has adevm_kzalloc()and propagating that failure would be canolically correct IMO.I'm not sure about this. What's the requirement to propagate
devm_kzalloc()failures? I think devres will free any allocs that were successful regardless.IIUC, we resolved the Gray Hawk Single issue by changing
dwc_pcie_rasdes_debugfs_init()to return success without doing anything when there's no RAS DES Capability.But
dwc_pcie_debugfs_init()can still return failure, and that still causesdw_pcie_ep_init_registers()to fail, which breaks the "don't propagate debugfs issues upstream" rule:int dw_pcie_ep_init_registers(struct dw_pcie_ep *ep) { ... ret = dwc_pcie_debugfs_init(pci); if (ret) goto err_remove_edma;return 0;err_remove_edma: dw_pcie_edma_remove(pci);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
return ret;}
We can say that
kzalloc()failure should "never" happen, and therefore it's OK to fail the driver probe if it happens, but that doesn't seem like a strong argument for breaking the "don't propagate debugfs issues" rule. And someday there may be other kinds of failures fromdwc_pcie_debugfs_init().
pcie-designware-debugfs.c only does small allocations. If any of these fail, you have much bigger problems, and the system will die soon, irrespective of propagating the -ENOMEM or not...
Another issue is that the caller does not handle failures correctly, given (A) the irqdomain WARNING I got, and (B) the half-registered PCI bus, oopsing on "lspci"...
Quoted 18 lines
Quoted 1 line
Fine with me. I was not too sure about propagating failure either.
What if we do this?
drivers/pci/controller/dwc/pcie-designware-debugfs.c +1
-1@@ -162,7 +162,7 @@ void dwc_pcie_debugfs_deinit(struct dw_pcie *pci)debugfs_remove_recursive (pci->debugfs->debug_dir); } -int dwc_pcie_debugfs_init (struct dw_pcie *pci) +void dwc_pcie_debugfs_init (struct dw_pcie *pci) {char dirname[DWC_DEBUGFS_BUF_MAX ];struct device *dev = pci->dev;
drivers/pci/controller/dwc/pcie-designware-debugfs.c int dwc_pcie_debugfs_init(struct dw_pcie *pci) · line 178
Quoted 7 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +2
-2@@ -174,17 +174,15 @@ int dwc_pcie_debugfs_init(struct dw_pcie *pci)snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); dir =debugfs_create_dir (dirname,NULL ); debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); -if (!debugfs) -return -ENOMEM ; +if (!debugfs) { +dev_err (dev,"failed to allocate memory for debugfs\n" );
There is no need to print an error message when a memory allocation fails, as the memory allocation core already takes care of that. So please drop the dev_err() call.
drivers/pci/controller/dwc/pcie-designware-debugfs.c int dwc_pcie_debugfs_init(struct dw_pcie *pci) · line 181
Quoted 3 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +2
-0+return ; + }
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Hello,
[...]
Quoted 3 lines
Another issue is that the caller does not handle failures correctly, given (A) the irqdomain WARNING I got, and (B) the half-registered PCI bus, oopsing on "lspci"...
This is something we will look into. A more robust DesignWare core is something we would definitely want to have.
Sorry about the issues with this...
[...]
Quoted 9 lines
Quoted 9 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +1
-1-int dwc_pcie_debugfs_init (struct dw_pcie *pci) +void dwc_pcie_debugfs_init (struct dw_pcie *pci) {char dirname[DWC_DEBUGFS_BUF_MAX ];struct device *dev = pci->dev;@@ -174,17 +174,15 @@ int dwc_pcie_debugfs_init(struct dw_pcie *pci)snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); dir =debugfs_create_dir (dirname,NULL ); debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL );
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c int dwc_pcie_debugfs_init(struct dw_pcie *pci) · line 178
Quoted 4 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +2
-2-if (!debugfs) -return -ENOMEM ; +if (!debugfs) { +dev_err (dev,"failed to allocate memory for debugfs\n" );There is no need to print an error message when a memory allocation fails, as the memory allocation core already takes care of that. So please drop the
dev_err()call.
Done. Thank you!
Krzysztof
RE: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 15 lines
-----Original Message-----
From: Krzysztof Wilczyński <[email protected]>
Sent: 06 March 2025 14:33
To: Geert Uytterhoeven <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>; Bjorn Helgaas <[email protected]>; Fan Ni <[email protected]>; Shradha Todi <[email protected]>; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yoshihiro Shimoda <[email protected]>; Linux-Renesas <linux-renesas- [email protected]>
Subject: Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 9 lines
Hello,
[...]
Quoted 3 lines
Another issue is that the caller does not handle failures correctly, given (A) the irqdomain WARNING I got, and (B) the half-registered PCI bus, oopsing on "lspci"...
This is something we will look into. A more robust DesignWare core is something we would definitely want to have.
The issue here was that " pci_host_probe(bridge)" was being called right before doing the debugfs init. So upon failure, the cleanup path should have included:
pci_stop_root_bus(pp->bridge->bus);
pci_remove_root_bus(pp->bridge->bus);I missed that, which was probably causing the half-registered PCI bus. Since we are going with no error propagation now, there is no issue anymore. Sorry for missing that.
Quoted 25 lines
Sorry about the issues with this...
[...]
Quoted 10 lines
Quoted 10 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +1
-1-int dwc_pcie_debugfs_init (struct dw_pcie *pci) +void dwc_pcie_debugfs_init (struct dw_pcie *pci) {char dirname[DWC_DEBUGFS_BUF_MAX ]; struct device *dev = pci->dev; @@ -174,17 +174,15 @@ int
dwc_pcie_debugfs_init(struct dw_pcie *pci)snprintf(dirname, DWC_DEBUGFS_BUF_MAX, "dwc_pcie_%s", dev_name(dev)); dir = debugfs_create_dir(dirname, NULL); debugfs = devm_kzalloc(dev, sizeof(*debugfs), GFP_KERNEL);- if (!debugfs)
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c int dwc_pcie_debugfs_init(struct dw_pcie *pci)
Quoted 4 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +3
-1-return -ENOMEM ; +if (!debugfs) { +dev_err (dev,"failed to allocate memory for + debugfs\n");There is no need to print an error message when a memory allocation fails, as the memory allocation core already takes care of that. So please drop the
dev_err()call.Done. Thank you!
Krzysztof
RE: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
In reply to Krzysztof WilczyńskiQuoted 70 lines
-----Original Message-----
From: Krzysztof Wilczyński <[email protected]>
Sent: 04 March 2025 21:17
To: Geert Uytterhoeven <[email protected]>
Cc: Fan Ni <[email protected]>; Shradha Todi <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Yoshihiro Shimoda <[email protected]>; Linux-Renesas <[email protected]>
Subject: Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWCHello,
Quoted 27 lines
This patch is now commit
1ff54f4cbaed9ec6("PCI: dwc: Add debugfs based Silicon Debug support for DWC") in pci/next (next-20250304).Quoted 14 lines · Krzysztof Wilczyński
[...]
Quoted 13 lines
Quoted 13 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +13
-0+int dwc_pcie_debugfs_init (struct dw_pcie *pci) { +char dirname[DWC_DEBUGFS_BUF_MAX ]; +struct device *dev = pci->dev; +struct debugfs_info *debugfs; +struct dentry *dir; +int ret; + +/* Create main directory for each platform driver */ +snprintf (dirname,DWC_DEBUGFS_BUF_MAX ,"dwc_pcie_%s" ,dev_name (dev)); + dir =debugfs_create_dir (dirname,NULL ); + debugfs =devm_kzalloc (dev,sizeof (*debugfs),GFP_KERNEL ); +if (!debugfs) +return -ENOMEM ;Quoted 8 lines
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c line 173
Quoted 6 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c new file +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret =dwc_pcie_rasdes_debugfs_init (pci, dir); +if (ret) +dev_dbg (dev,"RASDES debugfs init failed\n" );What will happen if ret != 0? still return 0?
Quoted 3 lines
And that is exactly what happens on Gray Hawk Single with R-Car
V4M:dw_pcie_find_rasdes_capability()returns NULL, causingdwc_pcie_rasdes_debugfs_init()to return-ENODEV.Thank you for testing and for catching this issue. Much appreciated.
Quoted 3 lines
Quoted 1 line
Given that callers of
dwc_pcie_debugfs_init()check for errors,Debugfs issues should never be propagated upstream!
Makes complete sense. Sorry for breaking things here!
Quoted 15 lines
Quoted 4 lines
this probably should correctly bubble up any failure coming from
dwc_pcie_rasdes_debugfs_init().I made updates to the code directly on the current branch, have a look:
So while applying, you changed this like:
ret =
dwc_pcie_rasdes_debugfs_init(pci, dir);
- if (ret)
-dev_dbg(dev, "RASDES debugfs init failed\n");
+ if (ret) {
+dev_err(dev, "failed to initialize RAS DES debugfs\n");
+ return ret;
+ }
Quoted 6 lines
Quoted 3 lines
return 0;Hence this is now a fatal error, causing the probe to fail.
I removed the changed, and also move the log level to be a warning, per:
Hey Krzysztof,
I think we shouldn't move the log level to be a WARN. I believe many controllers might not support RAS DES feature in their design and giving a warn dump would draw unnecessary attention.
My opinion is to silently let it fail unless the user is actually interested in getting the RAS DES feature up. We can wait for Mani's response though. But good catch to also add the error type, that's definitely a more informative error log.
Quoted 13 lines
Would this be acceptable here?
Mani, would this be acceptable to you, too? Given that you posted the following recently:
That said, perhaps moving the log level to a debug would be better served here.
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Hello,
Quoted 3 lines
I think we shouldn't move the log level to be a WARN. I believe many controllers might not support RAS DES feature in their design and giving a warn dump would draw unnecessary attention.
There will be no backtrack printed with neither dev_err() nor dev_warn(), which is what we were using here. Using dev_WARN() or the WARN() macro directly would be an overkill in this case, indeed.
Quoted 2 lines
My opinion is to silently let it fail unless the user is actually interested in getting the RAS DES feature up.
I think, what we have there now is fine. We don't error on the lack of RAS DES capability when the platform does not support it, and only return an error following a memory allocation failure, which should ideally never happen.
That said, have a look at the following:
https://web.git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=controller/dwc
This is how the code looks like at the moment.
We can still move it to dev_dbg(), so basically suppress any errors or warnings from being printed outside of the debug log level, if you think it would be better.
Thank you!
Krzysztof
RE: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 14 lines
-----Original Message-----
From: 'Krzysztof Wilczyński' <[email protected]>
Sent: 05 March 2025 13:15
To: Shradha Todi <[email protected]>
Cc: 'Geert Uytterhoeven' <[email protected]>; 'Fan Ni' <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; 'Yoshihiro Shimoda' <[email protected]>; 'Linux-Renesas' <[email protected]>
Subject: Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
Quoted 9 lines
Hello,
Quoted 3 lines
I think we shouldn't move the log level to be a WARN. I believe many controllers might not support RAS DES feature in their design and giving a warn dump would draw unnecessary attention.
There will be no backtrack printed with neither
dev_err()nordev_warn(), which is what we were using here. Usingdev_WARN()or theWARN()macro directly would be an overkill in this case, indeed.
Oh sorry, I thought we were talking about WARN() here.
Quoted 4 lines
Quoted 2 lines
My opinion is to silently let it fail unless the user is actually interested in getting the RAS DES feature up.
I think, what we have there now is fine. We don't error on the lack of RAS DES capability when the platform does not support it,
and
Quoted 9 lines
only return an error following a memory allocation failure, which should ideally never happen.
That said, have a look at the following:
https://web.git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=controller/dwc
This is how the code looks like at the moment.
We can still move it to
dev_dbg(), so basically suppress any errors or warnings from being printed outside of the debug log level,
if you
Quoted 2 lines
think it would be better.
No, the current version looks perfect. Thanks!
Quoted 3 lines
Thank you!
Krzysztof
Re: [PATCH v7 3/5] Add debugfs based silicon debug support in DWC
In reply to Krzysztof Wilczyński+ Geert (who reported the regression in -next)
Quoted 30 lines · Krzysztof Wilczyński
Hello,
[...]
Quoted 14 lines
Quoted 14 lines
(quoted diff) +14
-0+int dwc_pcie_debugfs_init(struct dw_pcie *pci) +{ + char dirname[DWC_DEBUGFS_BUF_MAX]; + struct device *dev = pci->dev; + struct debugfs_info *debugfs; + struct dentry *dir; + int ret; + + /* Create main directory for each platform driver */ + snprintf(dirname, DWC_DEBUGFS_BUF_MAX, "dwc_pcie_%s", dev_name(dev)); + dir = debugfs_create_dir(dirname, NULL); + debugfs = devm_kzalloc(dev, sizeof(*debugfs), GFP_KERNEL); + if (!debugfs) + return -ENOMEM;Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ + debugfs->debug_dir = dir; + pci->debugfs = debugfs; + ret = dwc_pcie_rasdes_debugfs_init(pci, dir); + if (ret) + dev_dbg(dev, "RASDES debugfs init failed\n");What will happen if ret != 0? still return 0?
Given that callers of
dwc_pcie_debugfs_init()check for errors, this probably should correctly bubble up any failure coming fromdwc_pcie_rasdes_debugfs_init().
Quoted 6 lines
I made updates to the code directly on the current branch, have a look:
Let me know if this is OK with you.
If the SoC has no RASDES capability, then this call is bound to fail (which will break existing platforms). I'd propose to return 0 if dw_pcie_find_rasdes_capability() fails in addition to this change:
drivers/pci/controller/dwc/pcie-designware-debugfs.c +1 -1
@@ -471,7 +471,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir) ras_cap =dw_pcie_find_rasdes_capability (pci);if (!ras_cap) {dev_dbg (dev,"no RASDES capability available\n" ); -return -ENODEV ; +return 0 ; } rasdes_info =devm_kzalloc (dev,sizeof (*rasdes_info),GFP_KERNEL );
This will fix the regressions like the one reported by Geert:
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
PATCH v7 4/5 Add debugfs based error injection support in DWC
In reply to Shradha TodiAdd support to provide error injection interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
--- Documentation/ABI/testing/debugfs-dwc-pcie | 70 ++++++++ .../controller/dwc/pcie-designware-debugfs.c | 165 +++++++++++++++++- 2 files changed, 233 insertions(+), 2 deletions(-)
Documentation/ABI/testing/debugfs-dwc-pcie +70 -0
@@ -11,3 +11,73 @@ Contact: Shradha Todi <[email protected]> Description: (RW) Write the lane number to be checked as valid or invalid. Read will return the status of PIPE RXVALID signal of the selected lane. The default selected lane is Lane0. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: rasdes_err_inj is the directory which can be used to inject errors in the + system. The possible errors that can be injected are: + + 1) TLP LCRC error injection TX Path - tx_lcrc + 2) 16b CRC error injection of ACK/NAK DLLP - b16_crc_dllp + 3) 16b CRC error injection of Update-FC DLLP - b16_crc_upd_fc + 4) TLP ECRC error injection TX Path - tx_ecrc + 5) TLP's FCRC error injection TX Path - fcrc_tlp + 6) Parity error of TSOS - parity_tsos + 7) Parity error on SKPOS - parity_skpos + 8) LCRC error injection RX Path - rx_lcrc + 9) ECRC error injection RX Path - rx_ecrc + 10) TLPs SEQ# error - tlp_err_seq + 11) DLLPS ACK/NAK SEQ# error - ack_nak_dllp_seq + 12) ACK/NAK DLLPs transmission block - ack_nak_dllp + 13) UpdateFC DLLPs transmission block - upd_fc_dllp + 14) Always transmission for NAK DLLP - nak_dllp + 15) Invert SYNC header - inv_sync_hdr_sym + 16) COM/PAD TS1 order set - com_pad_ts1 + 17) COM/PAD TS2 order set - com_pad_ts2 + 18) COM/FTS FTS order set - com_fts + 19) COM/IDL E-idle order set - com_idl + 20) END/EDB symbol - end_edb + 21) STP/SDP symbol - stp_sdp + 22) COM/SKP SKP order set - com_skp + 23) Posted TLP Header credit value control - posted_tlp_hdr + 24) Non-Posted TLP Header credit value control - non_post_tlp_hdr + 25) Completion TLP Header credit value control - cmpl_tlp_hdr + 26) Posted TLP Data credit value control - posted_tlp_data + 27) Non-Posted TLP Data credit value control - non_post_tlp_data + 28) Completion TLP Data credit value control - cmpl_tlp_data + 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlp + + (WO) Write to the attribute will prepare controller to inject the respective + error in the next transmission of data. Parameter required to write will + change in the following ways: + + i) Errors 9) - 10) are sequence errors. The write command for these will be + + echo <count> <diff> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injected + <diff> + The difference to add or subtract from natural sequence number to + generate sequence error. Range (-4095 : 4095) + + ii) Errors 23) - 28) are credit value error insertions. Write command: + + echo <count> <diff> <vc> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injected + <diff> + The difference to add or subtract from UpdateFC credit value. + Range (-4095 : 4095) + <vc> + Target VC number + + iii) All other errors. Write command: + + echo <count> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injected
drivers/pci/controller/dwc/pcie-designware-debugfs.c +163 -2
210 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v7 4/5] Add debugfs based error injection support in DWC
Quoted 5 lines · Shradha Todi
Add support to provide error injection interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
Signed-off-by Shradha Todi <[email protected]>
- Mani
Quoted 307 lines
--- Documentation/ABI/testing/debugfs-dwc-pcie | 70 ++++++++ .../controller/dwc/pcie-designware-debugfs.c | 165 +++++++++++++++++- 2 files changed, 233 insertions(+), 2 deletions(-)Documentation/ABI/testing/debugfs-dwc-pcie +70
-0@@ -11,3 +11,73 @@ Contact: Shradha Todi <[email protected]> Description: (RW) Write the lane number to be checked as valid or invalid. Read will return the status of PIPE RXVALID signal of the selected lane. The default selected lane is Lane0. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: rasdes_err_inj is the directory which can be used to inject errors in the + system. The possible errors that can be injected are: + + 1) TLP LCRC error injection TX Path - tx_lcrc + 2) 16b CRC error injection of ACK/NAK DLLP - b16_crc_dllp + 3) 16b CRC error injection of Update-FC DLLP - b16_crc_upd_fc + 4) TLP ECRC error injection TX Path - tx_ecrc + 5) TLP's FCRC error injection TX Path - fcrc_tlp + 6) Parity error of TSOS - parity_tsos + 7) Parity error on SKPOS - parity_skpos + 8) LCRC error injection RX Path - rx_lcrc + 9) ECRC error injection RX Path - rx_ecrc + 10) TLPs SEQ# error - tlp_err_seq + 11) DLLPS ACK/NAK SEQ# error - ack_nak_dllp_seq + 12) ACK/NAK DLLPs transmission block - ack_nak_dllp + 13) UpdateFC DLLPs transmission block - upd_fc_dllp + 14) Always transmission for NAK DLLP - nak_dllp + 15) Invert SYNC header - inv_sync_hdr_sym + 16) COM/PAD TS1 order set - com_pad_ts1 + 17) COM/PAD TS2 order set - com_pad_ts2 + 18) COM/FTS FTS order set - com_fts + 19) COM/IDL E-idle order set - com_idl + 20) END/EDB symbol - end_edb + 21) STP/SDP symbol - stp_sdp + 22) COM/SKP SKP order set - com_skp + 23) Posted TLP Header credit value control - posted_tlp_hdr + 24) Non-Posted TLP Header credit value control - non_post_tlp_hdr + 25) Completion TLP Header credit value control - cmpl_tlp_hdr + 26) Posted TLP Data credit value control - posted_tlp_data + 27) Non-Posted TLP Data credit value control - non_post_tlp_data + 28) Completion TLP Data credit value control - cmpl_tlp_data + 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlp + + (WO) Write to the attribute will prepare controller to inject the respective + error in the next transmission of data. Parameter required to write will + change in the following ways: + + i) Errors 9) - 10) are sequence errors. The write command for these will be + + echo <count> <diff> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injected + <diff> + The difference to add or subtract from natural sequence number to + generate sequence error. Range (-4095 : 4095) + + ii) Errors 23) - 28) are credit value error insertions. Write command: + + echo <count> <diff> <vc> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injected + <diff> + The difference to add or subtract from UpdateFC credit value. + Range (-4095 : 4095) + <vc> + Target VC number + + iii) All other errors. Write command: + + echo <count> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injecteddrivers/pci/controller/dwc/pcie-designware-debugfs.c +163
-2@@ -17,6 +17,20 @@#define PIPE_DETECT_LANE BIT(17)#define LANE_SELECT GENMASK(3, 0) +#define ERR_INJ0_OFF 0x34 +#define EINJ_VAL_DIFF GENMASK(28, 16) +#define EINJ_VC_NUM GENMASK(14, 12) +#define EINJ_TYPE_SHIFT 8 +#define EINJ0_TYPE GENMASK(11, 8) +#define EINJ1_TYPE BIT(8) +#define EINJ2_TYPE GENMASK(9, 8) +#define EINJ3_TYPE GENMASK(10, 8) +#define EINJ4_TYPE GENMASK(10, 8) +#define EINJ5_TYPE BIT(8) +#define EINJ_COUNT GENMASK(7, 0) + +#define ERR_INJ_ENABLE_REG 0x30 +#define DWC_DEBUGFS_BUF_MAX 128/** @@ -33,6 +47,72 @@ struct dwc_pcie_rasdes_info {struct mutex reg_event_lock; }; +/** +* struct dwc_pcie_rasdes_priv - Stores file specific private data information +* @pci: Reference to the dw_pcie structure +* @idx: Index to point to specific file related information in array of structs +* +* All debugfs files will have this struct as its private data. +*/ +struct dwc_pcie_rasdes_priv { +struct dw_pcie *pci; +int idx; +}; + +/** +* struct dwc_pcie_err_inj - Store details about each error injection supported by DWC RASDES +* @name: Name of the error that can be injected +* @err_inj_group: Group number to which the error belongs to. Value can range from 0 - 5 +* @err_inj_type: Each group can have multiple types of error +*/ +struct dwc_pcie_err_inj { +const char *name; +u32 err_inj_group; +u32 err_inj_type; +}; + +static const struct dwc_pcie_err_inj err_inj_list[] = { + {"tx_lcrc" ,0x0 ,0x0 }, + {"b16_crc_dllp" ,0x0 ,0x1 }, + {"b16_crc_upd_fc" ,0x0 ,0x2 }, + {"tx_ecrc" ,0x0 ,0x3 }, + {"fcrc_tlp" ,0x0 ,0x4 }, + {"parity_tsos" ,0x0 ,0x5 }, + {"parity_skpos" ,0x0 ,0x6 }, + {"rx_lcrc" ,0x0 ,0x8 }, + {"rx_ecrc" ,0x0 ,0xb }, + {"tlp_err_seq" ,0x1 ,0x0 }, + {"ack_nak_dllp_seq" ,0x1 ,0x1 }, + {"ack_nak_dllp" ,0x2 ,0x0 }, + {"upd_fc_dllp" ,0x2 ,0x1 }, + {"nak_dllp" ,0x2 ,0x2 }, + {"inv_sync_hdr_sym" ,0x3 ,0x0 }, + {"com_pad_ts1" ,0x3 ,0x1 }, + {"com_pad_ts2" ,0x3 ,0x2 }, + {"com_fts" ,0x3 ,0x3 }, + {"com_idl" ,0x3 ,0x4 }, + {"end_edb" ,0x3 ,0x5 }, + {"stp_sdp" ,0x3 ,0x6 }, + {"com_skp" ,0x3 ,0x7 }, + {"posted_tlp_hdr" ,0x4 ,0x0 }, + {"non_post_tlp_hdr" ,0x4 ,0x1 }, + {"cmpl_tlp_hdr" ,0x4 ,0x2 }, + {"posted_tlp_data" ,0x4 ,0x4 }, + {"non_post_tlp_data" ,0x4 ,0x5 }, + {"cmpl_tlp_data" ,0x4 ,0x6 }, + {"duplicate_dllp" ,0x5 ,0x0 }, + {"nullified_tlp" ,0x5 ,0x1 }, +}; + +static const u32 err_inj_type_mask[] = { +EINJ0_TYPE , +EINJ1_TYPE , +EINJ2_TYPE , +EINJ3_TYPE , +EINJ4_TYPE , +EINJ5_TYPE , +}; +static ssize_t lane_detect_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) {struct dw_pcie *pci = file->private_data;@@ -93,6 +173,63 @@ static ssize_t rx_valid_write(struct file *file, const char __user *buf, size_treturn lane_detect_write (file, buf, count, ppos); } +static ssize_t err_inj_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +u32 val, counter, vc_num, err_group, type_mask; +int val_diff =0 ; +char *kern_buf; + + err_group = err_inj_list[pdata->idx].err_inj_group; + type_mask = err_inj_type_mask[err_group]; + + kern_buf =memdup_user_nul (buf, count); +if (IS_ERR (kern_buf)) +return PTR_ERR (kern_buf); + +if (err_group ==4 ) { + val =sscanf (kern_buf,"%u %d %u" , &counter, &val_diff, &vc_num); +if ((val !=3 ) || (val_diff <-4095 || val_diff >4095 )) { +kfree (kern_buf); +return -EINVAL ; + } + }else if (err_group ==1 ) { + val =sscanf (kern_buf,"%u %d" , &counter, &val_diff); +if ((val !=2 ) || (val_diff <-4095 || val_diff >4095 )) { +kfree (kern_buf); +return -EINVAL ; + } + }else { + val =kstrtou32 (kern_buf,0 , &counter); +if (val) { +kfree (kern_buf); +return val; + } + } + + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +ERR_INJ0_OFF + (0x4 * err_group)); + val &= ~(type_mask |EINJ_COUNT ); + val |= ((err_inj_list[pdata->idx].err_inj_type <<EINJ_TYPE_SHIFT ) & type_mask); + val |=FIELD_PREP (EINJ_COUNT , counter); + +if (err_group ==1 || err_group ==4 ) { + val &= ~(EINJ_VAL_DIFF ); + val |=FIELD_PREP (EINJ_VAL_DIFF , val_diff); + } +if (err_group ==4 ) { + val &= ~(EINJ_VC_NUM ); + val |=FIELD_PREP (EINJ_VC_NUM , vc_num); + } + +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +ERR_INJ0_OFF + (0x4 * err_group), val); +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +ERR_INJ_ENABLE_REG , (0x1 << err_group)); + +kfree (kern_buf); +return count; +} +#define dwc_debugfs_create (name) \ debugfs_create_file(#name, 0644, rasdes_debug, pci, \ &dbg_ ## name ## _fops)@@ -107,6 +244,11 @@ static const struct file_operations dbg_ ## name ## _fops = { \DWC_DEBUGFS_FOPS (lane_detect);DWC_DEBUGFS_FOPS (rx_valid); +static const struct file_operations dwc_pcie_err_inj_ops = { + .open = simple_open, + .write = err_inj_write, +}; +static void dwc_pcie_rasdes_debugfs_deinit (struct dw_pcie *pci) {struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info;@@ -116,10 +258,11 @@ static void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci)static int dwc_pcie_rasdes_debugfs_init (struct dw_pcie *pci,struct dentry *dir) { -struct dentry *rasdes_debug; +struct dentry *rasdes_debug, *rasdes_err_inj;struct dwc_pcie_rasdes_info *rasdes_info; +struct dwc_pcie_rasdes_priv *priv_tmp;struct device *dev = pci->dev; -int ras_cap; +int ras_cap, i, ret; ras_cap =dw_pcie_find_rasdes_capability (pci);if (!ras_cap) {@@ -133,6 +276,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)/* Create subdirectories for Debug, Error injection, Statistics */ rasdes_debug =debugfs_create_dir ("rasdes_debug" , dir); + rasdes_err_inj =debugfs_create_dir ("rasdes_err_inj" , dir);mutex_init (&rasdes_info->reg_event_lock); rasdes_info->ras_cap_offset = ras_cap;@@ -142,7 +286,24 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)dwc_debugfs_create (lane_detect);dwc_debugfs_create (rx_valid); +/* Create debugfs files for Error injection subdirectory */ +for (i =0 ; i <ARRAY_SIZE (err_inj_list); i++) { + priv_tmp =devm_kzalloc (dev,sizeof (*priv_tmp),GFP_KERNEL ); +if (!priv_tmp) { + ret = -ENOMEM ; + goto err_deinit; + } + + priv_tmp->idx = i; + priv_tmp->pci = pci; +debugfs_create_file (err_inj_list[i].name,0200 , rasdes_err_inj, priv_tmp, + &dwc_pcie_err_inj_ops); + }return 0 ; + +err_deinit: +dwc_pcie_rasdes_debugfs_deinit (pci); +return ret; }void dwc_pcie_debugfs_deinit (struct dw_pcie *pci)Signature · 1 line
2.17.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v7 4/5] Add debugfs based error injection support in DWC
In reply to Shradha TodiHello,
[...]
Documentation/ABI/testing/debugfs-dwc-pcie Contact: Shradha Todi <[email protected]> · line 50
Quoted 2 lines
Documentation/ABI/testing/debugfs-dwc-pcie +2
-0+ 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlp
Would the above field called "duplicate_dllp" for duplicate TLPs be a potential typo? Perhaps this should be called "duplicate_tlp"?
I wanted to make sure we have the correct field name.
Thank you!
Krzysztof
Re: [PATCH v7 4/5] Add debugfs based error injection support in DWC
Hello,
[...]
Quoted 7 lines
Documentation/ABI/testing/debugfs-dwc-pcie Contact: Shradha Todi <[email protected]> · line 50
Quoted 2 lines
Documentation/ABI/testing/debugfs-dwc-pcie +2
-0+ 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlpWould the above field called "
duplicate_dllp" for duplicate TLPs be a potential typo? Perhaps this should be called "duplicate_tlp"?I wanted to make sure we have the correct field name.
Fan or Shradha, any thoughts on this?
Would the problem be with the name of the property of the description?
Thank you!
Krzysztof
Re: [PATCH v7 4/5] Add debugfs based error injection support in DWC
In reply to Krzysztof WilczyńskiQuoted 9 lines · Krzysztof Wilczyński
Hello,
[...]
Documentation/ABI/testing/debugfs-dwc-pcie Contact: Shradha Todi <[email protected]> · line 50
Quoted 2 lines
Documentation/ABI/testing/debugfs-dwc-pcie +2
-0+ 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlpWould the above field called "
duplicate_dllp" for duplicate TLPs be a potential typo? Perhaps this should be called "duplicate_tlp"?
Looks like a typo. As per Synopsys documentation, there is only 'duplicate TLP' field.
Good catch!
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v7 4/5] Add debugfs based error injection support in DWC
Hello,
[....]
Quoted 11 lines
Quoted 6 lines
Documentation/ABI/testing/debugfs-dwc-pcie Contact: Shradha Todi <[email protected]> · line 50
Quoted 2 lines
Documentation/ABI/testing/debugfs-dwc-pcie +2
-0+ 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlpWould the above field called "
duplicate_dllp" for duplicate TLPs be a potential typo? Perhaps this should be called "duplicate_tlp"?Looks like a typo. As per Synopsys documentation, there is only 'duplicate TLP' field.
Good catch!
Updated. Thank you!
Krzysztof
RE: [PATCH v7 4/5] Add debugfs based error injection support in DWC
Quoted 23 lines
-----Original Message-----
From: Krzysztof Wilczyński <[email protected]>
Sent: 04 March 2025 21:05
To: Manivannan Sadhasivam <[email protected]>
Cc: Shradha Todi <[email protected]>; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v7 4/5] Add debugfs based error injection support in DWCHello,
[....]
Quoted 7 lines
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlpWould the above field called "
duplicate_dllp" for duplicate TLPs be a potential typo? Perhaps this should be called "duplicate_tlp"?
Quoted 7 lines
Quoted 4 lines
Looks like a typo. As per Synopsys documentation, there is only 'duplicate TLP' field.
Good catch!
Updated. Thank you!
Sorry, this was a typo. Krzysztof, we need another change for this typo.
drivers/pci/controller/dwc/pcie-designware-debugfs.c +1 -1
@@ -113,7 +113,7 @@ static const struct dwc_pcie_err_inj err_inj_list[] = { {"posted_tlp_data", 0x4, 0x4}, {"non_post_tlp_data", 0x4, 0x5}, {"cmpl_tlp_data", 0x4, 0x6}, - {"duplicate_dllp", 0x5, 0x0}, + {"duplicate_tlp", 0x5, 0x0}, {"nullified_tlp", 0x5, 0x1}, };
So sorry for the inconvenience! Should I post a patch for this?
Quoted 1 line
Krzysztof
Re: [PATCH v7 4/5] Add debugfs based error injection support in DWC
Hello,
[...]
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlpWould the above field called "
duplicate_dllp" for duplicate TLPs be a potential typo? Perhaps this should be called "duplicate_tlp"?Looks like a typo. As per Synopsys documentation, there is only 'duplicate TLP' field.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Good catch!
Updated. Thank you!
Sorry, this was a typo. Krzysztof, we need another change for this typo.
Not a problem. I am glad we caught this early.
[...]
drivers/pci/controller/dwc/pcie-designware-debugfs.c static const struct dwc_pcie_err_inj err_inj_list[] = { · line 118
Quoted 10 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +1
-1@@ -113,7 +113,7 @@ static const struct dwc_pcie_err_inj err_inj_list[] = { {"posted_tlp_data", 0x4, 0x4}, {"non_post_tlp_data", 0x4, 0x5}, {"cmpl_tlp_data", 0x4, 0x6}, - {"duplicate_dllp", 0x5, 0x0}, + {"duplicate_tlp", 0x5, 0x0}, {"nullified_tlp", 0x5, 0x1}, };
Oh here too. No worries. I missed this one. :)
Quoted 1 line
So sorry for the inconvenience! Should I post a patch for this?
No, no need. I will update this directly on the branch.
Thank you!
Krzysztof
Re: [PATCH v7 4/5] Add debugfs based error injection support in DWC
In reply to Shradha TodiQuoted 6 lines · Shradha Todi
Add support to provide error injection interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
Signed-off-by Shradha Todi <[email protected]>---
LGTM.
Quoted 306 lines
Documentation/ABI/testing/debugfs-dwc-pcie | 70 ++++++++ .../controller/dwc/pcie-designware-debugfs.c | 165 +++++++++++++++++- 2 files changed, 233 insertions(+), 2 deletions(-)Documentation/ABI/testing/debugfs-dwc-pcie +70
-0@@ -11,3 +11,73 @@ Contact: Shradha Todi <[email protected]> Description: (RW) Write the lane number to be checked as valid or invalid. Read will return the status of PIPE RXVALID signal of the selected lane. The default selected lane is Lane0. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: rasdes_err_inj is the directory which can be used to inject errors in the + system. The possible errors that can be injected are: + + 1) TLP LCRC error injection TX Path - tx_lcrc + 2) 16b CRC error injection of ACK/NAK DLLP - b16_crc_dllp + 3) 16b CRC error injection of Update-FC DLLP - b16_crc_upd_fc + 4) TLP ECRC error injection TX Path - tx_ecrc + 5) TLP's FCRC error injection TX Path - fcrc_tlp + 6) Parity error of TSOS - parity_tsos + 7) Parity error on SKPOS - parity_skpos + 8) LCRC error injection RX Path - rx_lcrc + 9) ECRC error injection RX Path - rx_ecrc + 10) TLPs SEQ# error - tlp_err_seq + 11) DLLPS ACK/NAK SEQ# error - ack_nak_dllp_seq + 12) ACK/NAK DLLPs transmission block - ack_nak_dllp + 13) UpdateFC DLLPs transmission block - upd_fc_dllp + 14) Always transmission for NAK DLLP - nak_dllp + 15) Invert SYNC header - inv_sync_hdr_sym + 16) COM/PAD TS1 order set - com_pad_ts1 + 17) COM/PAD TS2 order set - com_pad_ts2 + 18) COM/FTS FTS order set - com_fts + 19) COM/IDL E-idle order set - com_idl + 20) END/EDB symbol - end_edb + 21) STP/SDP symbol - stp_sdp + 22) COM/SKP SKP order set - com_skp + 23) Posted TLP Header credit value control - posted_tlp_hdr + 24) Non-Posted TLP Header credit value control - non_post_tlp_hdr + 25) Completion TLP Header credit value control - cmpl_tlp_hdr + 26) Posted TLP Data credit value control - posted_tlp_data + 27) Non-Posted TLP Data credit value control - non_post_tlp_data + 28) Completion TLP Data credit value control - cmpl_tlp_data + 29) Generates duplicate TLPs - duplicate_dllp + 30) Generates Nullified TLPs - nullified_tlp + + (WO) Write to the attribute will prepare controller to inject the respective + error in the next transmission of data. Parameter required to write will + change in the following ways: + + i) Errors 9) - 10) are sequence errors. The write command for these will be + + echo <count> <diff> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injected + <diff> + The difference to add or subtract from natural sequence number to + generate sequence error. Range (-4095 : 4095) + + ii) Errors 23) - 28) are credit value error insertions. Write command: + + echo <count> <diff> <vc> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injected + <diff> + The difference to add or subtract from UpdateFC credit value. + Range (-4095 : 4095) + <vc> + Target VC number + + iii) All other errors. Write command: + + echo <count> > /sys/kernel/debug/dwc_pcie_<dev>/rasdes_err_inj/<error> + + <count> + Number of errors to be injecteddrivers/pci/controller/dwc/pcie-designware-debugfs.c +163
-2@@ -17,6 +17,20 @@#define PIPE_DETECT_LANE BIT(17)#define LANE_SELECT GENMASK(3, 0) +#define ERR_INJ0_OFF 0x34 +#define EINJ_VAL_DIFF GENMASK(28, 16) +#define EINJ_VC_NUM GENMASK(14, 12) +#define EINJ_TYPE_SHIFT 8 +#define EINJ0_TYPE GENMASK(11, 8) +#define EINJ1_TYPE BIT(8) +#define EINJ2_TYPE GENMASK(9, 8) +#define EINJ3_TYPE GENMASK(10, 8) +#define EINJ4_TYPE GENMASK(10, 8) +#define EINJ5_TYPE BIT(8) +#define EINJ_COUNT GENMASK(7, 0) + +#define ERR_INJ_ENABLE_REG 0x30 +#define DWC_DEBUGFS_BUF_MAX 128/** @@ -33,6 +47,72 @@ struct dwc_pcie_rasdes_info {struct mutex reg_event_lock; }; +/** +* struct dwc_pcie_rasdes_priv - Stores file specific private data information +* @pci: Reference to the dw_pcie structure +* @idx: Index to point to specific file related information in array of structs +* +* All debugfs files will have this struct as its private data. +*/ +struct dwc_pcie_rasdes_priv { +struct dw_pcie *pci; +int idx; +}; + +/** +* struct dwc_pcie_err_inj - Store details about each error injection supported by DWC RASDES +* @name: Name of the error that can be injected +* @err_inj_group: Group number to which the error belongs to. Value can range from 0 - 5 +* @err_inj_type: Each group can have multiple types of error +*/ +struct dwc_pcie_err_inj { +const char *name; +u32 err_inj_group; +u32 err_inj_type; +}; + +static const struct dwc_pcie_err_inj err_inj_list[] = { + {"tx_lcrc" ,0x0 ,0x0 }, + {"b16_crc_dllp" ,0x0 ,0x1 }, + {"b16_crc_upd_fc" ,0x0 ,0x2 }, + {"tx_ecrc" ,0x0 ,0x3 }, + {"fcrc_tlp" ,0x0 ,0x4 }, + {"parity_tsos" ,0x0 ,0x5 }, + {"parity_skpos" ,0x0 ,0x6 }, + {"rx_lcrc" ,0x0 ,0x8 }, + {"rx_ecrc" ,0x0 ,0xb }, + {"tlp_err_seq" ,0x1 ,0x0 }, + {"ack_nak_dllp_seq" ,0x1 ,0x1 }, + {"ack_nak_dllp" ,0x2 ,0x0 }, + {"upd_fc_dllp" ,0x2 ,0x1 }, + {"nak_dllp" ,0x2 ,0x2 }, + {"inv_sync_hdr_sym" ,0x3 ,0x0 }, + {"com_pad_ts1" ,0x3 ,0x1 }, + {"com_pad_ts2" ,0x3 ,0x2 }, + {"com_fts" ,0x3 ,0x3 }, + {"com_idl" ,0x3 ,0x4 }, + {"end_edb" ,0x3 ,0x5 }, + {"stp_sdp" ,0x3 ,0x6 }, + {"com_skp" ,0x3 ,0x7 }, + {"posted_tlp_hdr" ,0x4 ,0x0 }, + {"non_post_tlp_hdr" ,0x4 ,0x1 }, + {"cmpl_tlp_hdr" ,0x4 ,0x2 }, + {"posted_tlp_data" ,0x4 ,0x4 }, + {"non_post_tlp_data" ,0x4 ,0x5 }, + {"cmpl_tlp_data" ,0x4 ,0x6 }, + {"duplicate_dllp" ,0x5 ,0x0 }, + {"nullified_tlp" ,0x5 ,0x1 }, +}; + +static const u32 err_inj_type_mask[] = { +EINJ0_TYPE , +EINJ1_TYPE , +EINJ2_TYPE , +EINJ3_TYPE , +EINJ4_TYPE , +EINJ5_TYPE , +}; +static ssize_t lane_detect_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) {struct dw_pcie *pci = file->private_data;@@ -93,6 +173,63 @@ static ssize_t rx_valid_write(struct file *file, const char __user *buf, size_treturn lane_detect_write (file, buf, count, ppos); } +static ssize_t err_inj_write (struct file *file,const char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +u32 val, counter, vc_num, err_group, type_mask; +int val_diff =0 ; +char *kern_buf; + + err_group = err_inj_list[pdata->idx].err_inj_group; + type_mask = err_inj_type_mask[err_group]; + + kern_buf =memdup_user_nul (buf, count); +if (IS_ERR (kern_buf)) +return PTR_ERR (kern_buf); + +if (err_group ==4 ) { + val =sscanf (kern_buf,"%u %d %u" , &counter, &val_diff, &vc_num); +if ((val !=3 ) || (val_diff <-4095 || val_diff >4095 )) { +kfree (kern_buf); +return -EINVAL ; + } + }else if (err_group ==1 ) { + val =sscanf (kern_buf,"%u %d" , &counter, &val_diff); +if ((val !=2 ) || (val_diff <-4095 || val_diff >4095 )) { +kfree (kern_buf); +return -EINVAL ; + } + }else { + val =kstrtou32 (kern_buf,0 , &counter); +if (val) { +kfree (kern_buf); +return val; + } + } + + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +ERR_INJ0_OFF + (0x4 * err_group)); + val &= ~(type_mask |EINJ_COUNT ); + val |= ((err_inj_list[pdata->idx].err_inj_type <<EINJ_TYPE_SHIFT ) & type_mask); + val |=FIELD_PREP (EINJ_COUNT , counter); + +if (err_group ==1 || err_group ==4 ) { + val &= ~(EINJ_VAL_DIFF ); + val |=FIELD_PREP (EINJ_VAL_DIFF , val_diff); + } +if (err_group ==4 ) { + val &= ~(EINJ_VC_NUM ); + val |=FIELD_PREP (EINJ_VC_NUM , vc_num); + } + +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +ERR_INJ0_OFF + (0x4 * err_group), val); +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +ERR_INJ_ENABLE_REG , (0x1 << err_group)); + +kfree (kern_buf); +return count; +} +#define dwc_debugfs_create (name) \ debugfs_create_file(#name, 0644, rasdes_debug, pci, \ &dbg_ ## name ## _fops)@@ -107,6 +244,11 @@ static const struct file_operations dbg_ ## name ## _fops = { \DWC_DEBUGFS_FOPS (lane_detect);DWC_DEBUGFS_FOPS (rx_valid); +static const struct file_operations dwc_pcie_err_inj_ops = { + .open = simple_open, + .write = err_inj_write, +}; +static void dwc_pcie_rasdes_debugfs_deinit (struct dw_pcie *pci) {struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info;@@ -116,10 +258,11 @@ static void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci)static int dwc_pcie_rasdes_debugfs_init (struct dw_pcie *pci,struct dentry *dir) { -struct dentry *rasdes_debug; +struct dentry *rasdes_debug, *rasdes_err_inj;struct dwc_pcie_rasdes_info *rasdes_info; +struct dwc_pcie_rasdes_priv *priv_tmp;struct device *dev = pci->dev; -int ras_cap; +int ras_cap, i, ret; ras_cap =dw_pcie_find_rasdes_capability (pci);if (!ras_cap) {@@ -133,6 +276,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)/* Create subdirectories for Debug, Error injection, Statistics */ rasdes_debug =debugfs_create_dir ("rasdes_debug" , dir); + rasdes_err_inj =debugfs_create_dir ("rasdes_err_inj" , dir);mutex_init (&rasdes_info->reg_event_lock); rasdes_info->ras_cap_offset = ras_cap;@@ -142,7 +286,24 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)dwc_debugfs_create (lane_detect);dwc_debugfs_create (rx_valid); +/* Create debugfs files for Error injection subdirectory */ +for (i =0 ; i <ARRAY_SIZE (err_inj_list); i++) { + priv_tmp =devm_kzalloc (dev,sizeof (*priv_tmp),GFP_KERNEL ); +if (!priv_tmp) { + ret = -ENOMEM ; + goto err_deinit; + } + + priv_tmp->idx = i; + priv_tmp->pci = pci; +debugfs_create_file (err_inj_list[i].name,0200 , rasdes_err_inj, priv_tmp, + &dwc_pcie_err_inj_ops); + }return 0 ; + +err_deinit: +dwc_pcie_rasdes_debugfs_deinit (pci); +return ret; }void dwc_pcie_debugfs_deinit (struct dw_pcie *pci)Signature · 1 line
2.17.1
PATCH v7 5/5 Add debugfs based statistical counter support in DWC
In reply to Shradha TodiAdd support to provide statistical counter interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
--- Documentation/ABI/testing/debugfs-dwc-pcie | 61 +++++ .../controller/dwc/pcie-designware-debugfs.c | 229 +++++++++++++++++- 2 files changed, 289 insertions(+), 1 deletion(-)
Documentation/ABI/testing/debugfs-dwc-pcie +61 -0
@@ -81,3 +81,64 @@ Description: rasdes_err_inj is the directory which can be used to inject errors <count> Number of errors to be injected + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_event_counters/<event>/counter_enable +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: rasdes_event_counters is the directory which can be used to collect + statistical data about the number of times a certain event has occurred + in the controller. The list of possible events are: + + 1) EBUF Overflow + 2) EBUF Underrun + 3) Decode Error + 4) Running Disparity Error + 5) SKP OS Parity Error + 6) SYNC Header Error + 7) Rx Valid De-assertion + 8) CTL SKP OS Parity Error + 9) 1st Retimer Parity Error + 10) 2nd Retimer Parity Error + 11) Margin CRC and Parity Error + 12) Detect EI Infer + 13) Receiver Error + 14) RX Recovery Req + 15) N_FTS Timeout + 16) Framing Error + 17) Deskew Error + 18) Framing Error In L0 + 19) Deskew Uncompleted Error + 20) Bad TLP + 21) LCRC Error + 22) Bad DLLP + 23) Replay Number Rollover + 24) Replay Timeout + 25) Rx Nak DLLP + 26) Tx Nak DLLP + 27) Retry TLP + 28) FC Timeout + 29) Poisoned TLP + 30) ECRC Error + 31) Unsupported Request + 32) Completer Abort + 33) Completion Timeout + 34) EBUF SKP Add + 35) EBUF SKP Del + + (RW) Write 1 to enable the event counter and write 0 to disable the event counter. + Read will return whether the counter is currently enabled or disabled. Counter is + disabled by default. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_event_counters/<event>/counter_value +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RO) Read will return the current value of the event counter. To reset the counter, + counter should be disabled and enabled back using the 'counter_enable' attribute. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_event_counters/<event>/lane_select +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RW) Some lanes in the event list are lane specific events. These include + events 1) - 11) and 34) - 35). + Write lane number for which counter needs to be enabled/disabled/dumped. + Read will return the current selected lane number. Lane0 is selected by default.
drivers/pci/controller/dwc/pcie-designware-debugfs.c +228 -1
271 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
Quoted 5 lines · Shradha Todi
Add support to provide statistical counter interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
Signed-off-by Shradha Todi <[email protected]>
- Mani
Quoted 359 lines
--- Documentation/ABI/testing/debugfs-dwc-pcie | 61 +++++ .../controller/dwc/pcie-designware-debugfs.c | 229 +++++++++++++++++- 2 files changed, 289 insertions(+), 1 deletion(-)Documentation/ABI/testing/debugfs-dwc-pcie +61
-0@@ -81,3 +81,64 @@ Description: rasdes_err_inj is the directory which can be used to inject errors <count> Number of errors to be injected + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_event_counters/<event>/counter_enable +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: rasdes_event_counters is the directory which can be used to collect + statistical data about the number of times a certain event has occurred + in the controller. The list of possible events are: + + 1) EBUF Overflow + 2) EBUF Underrun + 3) Decode Error + 4) Running Disparity Error + 5) SKP OS Parity Error + 6) SYNC Header Error + 7) Rx Valid De-assertion + 8) CTL SKP OS Parity Error + 9) 1st Retimer Parity Error + 10) 2nd Retimer Parity Error + 11) Margin CRC and Parity Error + 12) Detect EI Infer + 13) Receiver Error + 14) RX Recovery Req + 15) N_FTS Timeout + 16) Framing Error + 17) Deskew Error + 18) Framing Error In L0 + 19) Deskew Uncompleted Error + 20) Bad TLP + 21) LCRC Error + 22) Bad DLLP + 23) Replay Number Rollover + 24) Replay Timeout + 25) Rx Nak DLLP + 26) Tx Nak DLLP + 27) Retry TLP + 28) FC Timeout + 29) Poisoned TLP + 30) ECRC Error + 31) Unsupported Request + 32) Completer Abort + 33) Completion Timeout + 34) EBUF SKP Add + 35) EBUF SKP Del + + (RW) Write 1 to enable the event counter and write 0 to disable the event counter. + Read will return whether the counter is currently enabled or disabled. Counter is + disabled by default. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_event_counters/<event>/counter_value +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RO) Read will return the current value of the event counter. To reset the counter, + counter should be disabled and enabled back using the 'counter_enable' attribute. + +What: /sys/kernel/debug/dwc_pcie_<dev>/rasdes_event_counters/<event>/lane_select +Date: Feburary 2025 +Contact: Shradha Todi <[email protected]> +Description: (RW) Some lanes in the event list are lane specific events. These include + events 1) - 11) and 34) - 35). + Write lane number for which counter needs to be enabled/disabled/dumped. + Read will return the current selected lane number. Lane0 is selected by default.drivers/pci/controller/dwc/pcie-designware-debugfs.c +228
-1@@ -31,6 +31,17 @@#define ERR_INJ_ENABLE_REG 0x30 +#define RAS_DES_EVENT_COUNTER_DATA_REG 0xc + +#define RAS_DES_EVENT_COUNTER_CTRL_REG 0x8 +#define EVENT_COUNTER_GROUP_SELECT GENMASK(27, 24) +#define EVENT_COUNTER_EVENT_SELECT GENMASK(23, 16) +#define EVENT_COUNTER_LANE_SELECT GENMASK(11, 8) +#define EVENT_COUNTER_STATUS BIT(7) +#define EVENT_COUNTER_ENABLE GENMASK(4, 2) +#define PER_EVENT_ON 0x3 +#define PER_EVENT_OFF 0x1 +#define DWC_DEBUGFS_BUF_MAX 128/** @@ -113,6 +124,61 @@ static const u32 err_inj_type_mask[] = { EINJ5_TYPE, }; +/** +* struct dwc_pcie_event_counter - Store details about each event counter supported in DWC RASDES +* @name: Name of the error counter +* @group_no: Group number that the event belongs to. Value ranges from 0 - 4 +* @event_no: Event number of the particular event. Value ranges from - +* Group 0: 0 - 10 +* Group 1: 5 - 13 +* Group 2: 0 - 7 +* Group 3: 0 - 5 +* Group 4: 0 - 1 +*/ +struct dwc_pcie_event_counter { +const char *name; +u32 group_no; +u32 event_no; +}; + +static const struct dwc_pcie_event_counter event_list[] = { + {"ebuf_overflow" ,0x0 ,0x0 }, + {"ebuf_underrun" ,0x0 ,0x1 }, + {"decode_err" ,0x0 ,0x2 }, + {"running_disparity_err" ,0x0 ,0x3 }, + {"skp_os_parity_err" ,0x0 ,0x4 }, + {"sync_header_err" ,0x0 ,0x5 }, + {"rx_valid_deassertion" ,0x0 ,0x6 }, + {"ctl_skp_os_parity_err" ,0x0 ,0x7 }, + {"retimer_parity_err_1st" ,0x0 ,0x8 }, + {"retimer_parity_err_2nd" ,0x0 ,0x9 }, + {"margin_crc_parity_err" ,0x0 ,0xA }, + {"detect_ei_infer" ,0x1 ,0x5 }, + {"receiver_err" ,0x1 ,0x6 }, + {"rx_recovery_req" ,0x1 ,0x7 }, + {"n_fts_timeout" ,0x1 ,0x8 }, + {"framing_err" ,0x1 ,0x9 }, + {"deskew_err" ,0x1 ,0xa }, + {"framing_err_in_l0" ,0x1 ,0xc }, + {"deskew_uncompleted_err" ,0x1 ,0xd }, + {"bad_tlp" ,0x2 ,0x0 }, + {"lcrc_err" ,0x2 ,0x1 }, + {"bad_dllp" ,0x2 ,0x2 }, + {"replay_num_rollover" ,0x2 ,0x3 }, + {"replay_timeout" ,0x2 ,0x4 }, + {"rx_nak_dllp" ,0x2 ,0x5 }, + {"tx_nak_dllp" ,0x2 ,0x6 }, + {"retry_tlp" ,0x2 ,0x7 }, + {"fc_timeout" ,0x3 ,0x0 }, + {"poisoned_tlp" ,0x3 ,0x1 }, + {"ecrc_error" ,0x3 ,0x2 }, + {"unsupported_request" ,0x3 ,0x3 }, + {"completer_abort" ,0x3 ,0x4 }, + {"completion_timeout" ,0x3 ,0x5 }, + {"ebuf_skp_add" ,0x4 ,0x0 }, + {"ebuf_skp_del" ,0x4 ,0x1 }, +}; +static ssize_t lane_detect_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) {struct dw_pcie *pci = file->private_data;@@ -230,6 +296,127 @@ static ssize_t err_inj_write(struct file *file, const char __user *buf, size_t creturn count; } +static void set_event_number (struct dwc_pcie_rasdes_priv *pdata,struct dw_pcie *pci, +struct dwc_pcie_rasdes_info *rinfo) +{ +u32 val; + + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG ); + val &= ~EVENT_COUNTER_ENABLE ; + val &= ~(EVENT_COUNTER_GROUP_SELECT |EVENT_COUNTER_EVENT_SELECT ); + val |=FIELD_PREP (EVENT_COUNTER_GROUP_SELECT , event_list[pdata->idx].group_no); + val |=FIELD_PREP (EVENT_COUNTER_EVENT_SELECT , event_list[pdata->idx].event_no); +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG , val); +} + +static ssize_t counter_enable_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG ); +mutex_unlock (&rinfo->reg_event_lock); + val =FIELD_GET (EVENT_COUNTER_STATUS , val); +if (val) + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Counter Enabled\n" ); +else + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Counter Disabled\n" ); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +} + +static ssize_t counter_enable_write (struct file *file,const char __user *buf, +size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +u32 val, enable; + + val =kstrtou32_from_user (buf, count,0 , &enable); +if (val) +return val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG ); +if (enable) + val |=FIELD_PREP (EVENT_COUNTER_ENABLE ,PER_EVENT_ON ); +else + val |=FIELD_PREP (EVENT_COUNTER_ENABLE ,PER_EVENT_OFF ); + +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG , val); +mutex_unlock (&rinfo->reg_event_lock); + +return count; +} + +static ssize_t counter_lane_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG ); +mutex_unlock (&rinfo->reg_event_lock); + val =FIELD_GET (EVENT_COUNTER_LANE_SELECT , val); + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Lane: %d\n" , val); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +} + +static ssize_t counter_lane_write (struct file *file,const char __user *buf, +size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +u32 val, lane; + + val =kstrtou32_from_user (buf, count,0 , &lane); +if (val) +return val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG ); + val &= ~(EVENT_COUNTER_LANE_SELECT ); + val |=FIELD_PREP (EVENT_COUNTER_LANE_SELECT , lane); +dw_pcie_writel_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_CTRL_REG , val); +mutex_unlock (&rinfo->reg_event_lock); + +return count; +} + +static ssize_t counter_value_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_DATA_REG ); +mutex_unlock (&rinfo->reg_event_lock); + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Counter value: %d\n" , val); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +} +#define dwc_debugfs_create (name) \ debugfs_create_file(#name, 0644, rasdes_debug, pci, \ &dbg_ ## name ## _fops)@@ -249,6 +436,23 @@ static const struct file_operations dwc_pcie_err_inj_ops = { .write = err_inj_write, }; +static const struct file_operations dwc_pcie_counter_enable_ops = { + .open = simple_open, + .read = counter_enable_read, + .write = counter_enable_write, +}; + +static const struct file_operations dwc_pcie_counter_lane_ops = { + .open = simple_open, + .read = counter_lane_read, + .write = counter_lane_write, +}; + +static const struct file_operations dwc_pcie_counter_value_ops = { + .open = simple_open, + .read = counter_value_read, +}; +static void dwc_pcie_rasdes_debugfs_deinit (struct dw_pcie *pci) {struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info;@@ -258,7 +462,7 @@ static void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci)static int dwc_pcie_rasdes_debugfs_init (struct dw_pcie *pci,struct dentry *dir) { -struct dentry *rasdes_debug, *rasdes_err_inj; +struct dentry *rasdes_debug, *rasdes_err_inj, *rasdes_event_counter, *rasdes_events;struct dwc_pcie_rasdes_info *rasdes_info;struct dwc_pcie_rasdes_priv *priv_tmp;struct device *dev = pci->dev;@@ -277,6 +481,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)/* Create subdirectories for Debug, Error injection, Statistics */ rasdes_debug =debugfs_create_dir ("rasdes_debug" , dir); rasdes_err_inj =debugfs_create_dir ("rasdes_err_inj" , dir); + rasdes_event_counter =debugfs_create_dir ("rasdes_event_counter" , dir);mutex_init (&rasdes_info->reg_event_lock); rasdes_info->ras_cap_offset = ras_cap;@@ -299,6 +504,28 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)debugfs_create_file (err_inj_list[i].name,0200 , rasdes_err_inj, priv_tmp, &dwc_pcie_err_inj_ops); } + +/* Create debugfs files for Statistical counter subdirectory */ +for (i =0 ; i <ARRAY_SIZE (event_list); i++) { + priv_tmp =devm_kzalloc (dev,sizeof (*priv_tmp),GFP_KERNEL ); +if (!priv_tmp) { + ret = -ENOMEM ; + goto err_deinit; + } + + priv_tmp->idx = i; + priv_tmp->pci = pci; + rasdes_events =debugfs_create_dir (event_list[i].name, rasdes_event_counter); +if (event_list[i].group_no ==0 || event_list[i].group_no ==4 ) { +debugfs_create_file ("lane_select" ,0644 , rasdes_events, + priv_tmp, &dwc_pcie_counter_lane_ops); + } +debugfs_create_file ("counter_value" ,0444 , rasdes_events, priv_tmp, + &dwc_pcie_counter_value_ops); +debugfs_create_file ("counter_enable" ,0644 , rasdes_events, priv_tmp, + &dwc_pcie_counter_enable_ops); + } +return 0 ; err_deinit:Signature · 1 line
2.17.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
In reply to Shradha TodiQuoted 4 lines · Shradha Todi
Add support to provide statistical counter interface to userspace. This set of debug registers are part of the RASDES feature present in DesignWare PCIe controllers.
One comment inline.
Quoted 14 lines
Signed-off-by Shradha Todi <[email protected]>--- Documentation/ABI/testing/debugfs-dwc-pcie | 61 +++++ .../controller/dwc/pcie-designware-debugfs.c | 229 +++++++++++++++++- 2 files changed, 289 insertions(+), 1 deletion(-)Documentation/ABI/testing/debugfs-dwc-pcie +0
-0@@ -81,3 +81,64 @@ Description: rasdes_err_inj is the directory which can be used to inject errors <count> Number of errors to be injected
...
Quoted 8 lines
Documentation/ABI/testing/debugfs-dwc-pcie +8
-0+ +static ssize_t counter_value_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) +{ + struct dwc_pcie_rasdes_priv *pdata = file->private_data; + struct dw_pcie *pci = pdata->pci; + struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; + char debugfs_buf[DWC_DEBUGFS_BUF_MAX]; + ssize_t pos;
Documentation/ABI/testing/debugfs-dwc-pcie
Quoted 10 lines
Documentation/ABI/testing/debugfs-dwc-pcie +10
-0+ u32 val; + + mutex_lock(&rinfo->reg_event_lock); + set_event_number(pdata, pci, rinfo); + val = dw_pcie_readl_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_DATA_REG); + mutex_unlock(&rinfo->reg_event_lock); + pos = scnprintf(debugfs_buf, DWC_DEBUGFS_BUF_MAX, "Counter value: %d\n", val); + + return simple_read_from_buffer(buf, count, ppos, debugfs_buf, pos); +}
Do we need to check whether the counter is enabled or not for the event before retrieving the counter value?
Fan
Quoted 77 lines
Documentation/ABI/testing/debugfs-dwc-pcie +42
-1+ #define dwc_debugfs_create(name) \ debugfs_create_file(#name, 0644, rasdes_debug, pci, \ &dbg_ ## name ## _fops)@@ -249,6 +436,23 @@ static const struct file_operations dwc_pcie_err_inj_ops = { .write = err_inj_write, }; +static const struct file_operations dwc_pcie_counter_enable_ops = { + .open = simple_open, + .read = counter_enable_read, + .write = counter_enable_write, +}; + +static const struct file_operations dwc_pcie_counter_lane_ops = { + .open = simple_open, + .read = counter_lane_read, + .write = counter_lane_write, +}; + +static const struct file_operations dwc_pcie_counter_value_ops = { + .open = simple_open, + .read = counter_value_read, +}; + static void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci) { struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info;@@ -258,7 +462,7 @@ static void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci) static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir) { - struct dentry *rasdes_debug, *rasdes_err_inj; + struct dentry *rasdes_debug, *rasdes_err_inj, *rasdes_event_counter, *rasdes_events; struct dwc_pcie_rasdes_info *rasdes_info; struct dwc_pcie_rasdes_priv *priv_tmp; struct device *dev = pci->dev;@@ -277,6 +481,7 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir) /* Create subdirectories for Debug, Error injection, Statistics */ rasdes_debug = debugfs_create_dir("rasdes_debug", dir); rasdes_err_inj = debugfs_create_dir("rasdes_err_inj", dir); + rasdes_event_counter = debugfs_create_dir("rasdes_event_counter", dir); mutex_init(&rasdes_info->reg_event_lock); rasdes_info->ras_cap_offset = ras_cap;@@ -299,6 +504,28 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir) debugfs_create_file(err_inj_list[i].name, 0200, rasdes_err_inj, priv_tmp, &dwc_pcie_err_inj_ops); } + + /* Create debugfs files for Statistical counter subdirectory */ + for (i = 0; i < ARRAY_SIZE(event_list); i++) { + priv_tmp = devm_kzalloc(dev, sizeof(*priv_tmp), GFP_KERNEL); + if (!priv_tmp) { + ret = -ENOMEM; + goto err_deinit; + } + + priv_tmp->idx = i; + priv_tmp->pci = pci; + rasdes_events = debugfs_create_dir(event_list[i].name, rasdes_event_counter); + if (event_list[i].group_no == 0 || event_list[i].group_no == 4) { + debugfs_create_file("lane_select", 0644, rasdes_events, + priv_tmp, &dwc_pcie_counter_lane_ops); + } + debugfs_create_file("counter_value", 0444, rasdes_events, priv_tmp, + &dwc_pcie_counter_value_ops); + debugfs_create_file("counter_enable", 0644, rasdes_events, priv_tmp, + &dwc_pcie_counter_enable_ops); + } + return 0; err_deinit:Signature · 1 line
2.17.1
Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
Hello,
[...]
Quoted 12 lines
Quoted 12 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +12
-0+static ssize_t counter_value_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_DATA_REG );
Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c static ssize_t err_inj_write(struct file *file, const char __user *buf, size_t c · line 418
Quoted 5 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +5
-0+mutex_unlock (&rinfo->reg_event_lock); + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Counter value: %d\n" , val); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +}Do we need to check whether the counter is enabled or not for the event before retrieving the counter value?
I believe, we have a patch that aims to address, have a look at:
https://lore.kernel.org/linux-pci/[email protected]
Thank you!
Krzysztof
Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
Quoted 24 lines · Krzysztof Wilczyński
Hello,
[...]
Quoted 12 lines
Quoted 12 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +12
-0+static ssize_t counter_value_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_DATA_REG );Quoted 8 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c static ssize_t err_inj_write(struct file *file, const char __user *buf, size_t c · line 418
Quoted 5 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +5
-0+mutex_unlock (&rinfo->reg_event_lock); + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Counter value: %d\n" , val); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +}Do we need to check whether the counter is enabled or not for the event before retrieving the counter value?
Quoted 3 lines
I believe, we have a patch that aims to address, have a look at:
Maybe I missed something, that seems to fix counter_enable_read(), but here is to retrieve counter value.
How dw_pcie_readl_dbi() can return something like "Counter Disabled"?
Fan
Quoted 4 lines
Thank you!
Krzysztof
Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
Quoted 25 lines · Fan Ni
Quoted 24 lines · Krzysztof Wilczyński
Hello,
[...]
Quoted 20 lines
Quoted 7 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +7
-0+static ssize_t counter_value_read (struct file *file,char __user *buf,size_t count,loff_t *ppos) +{ +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos;drivers/pci/controller/dwc/pcie-designware-debugfs.c static ssize_t err_inj_write(struct file *file, const char __user *buf, size_t c · line 418
Quoted 10 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +10
-0+u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_DATA_REG ); +mutex_unlock (&rinfo->reg_event_lock); + pos =scnprintf (debugfs_buf,DWC_DEBUGFS_BUF_MAX ,"Counter value: %d\n" , val); + +return simple_read_from_buffer (buf, count, ppos, debugfs_buf, pos); +}Do we need to check whether the counter is enabled or not for the event before retrieving the counter value?
Quoted 8 lines
Quoted 3 lines
I believe, we have a patch that aims to address, have a look at:
Maybe I missed something, that seems to fix
counter_enable_read(), but here is to retrieve counter value.
Howdw_pcie_readl_dbi()can return something like "Counter Disabled"?
Only way to know if a counter is enabled by reading back the status. And that is what the patch is doing.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
RE: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
In reply to Fan NiQuoted 42 lines
-----Original Message-----
From: Fan Ni <[email protected]>
Sent: 04 March 2025 02:33
To: Krzysztof Wilczyński <[email protected]>
Cc: Fan Ni <[email protected]>; Shradha Todi <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWCQuoted 28 lines · Krzysztof Wilczyński
Hello,
[...]
Quoted 13 lines
Quoted 13 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +13
-0+static ssize_t counter_value_read (struct file *file,char __user +*buf,size_t count,loff_t *ppos) { +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_DATA_REG ); +mutex_unlock (&rinfo->reg_event_lock);Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ pos = scnprintf(debugfs_buf, DWC_DEBUGFS_BUF_MAX, "Counter +value: %d\n", val); + + return simple_read_from_buffer(buf, count, ppos, debugfs_buf, +pos); }Do we need to check whether the counter is enabled or not for the event before retrieving the counter value?
I believe, we have a patch that aims to address, have a look at:
Quoted 7 lines
Quoted 2 lines
https://lore.kernel.org/linux-pci/20250225171239.19574-1-manivannan.sa
[email protected]Maybe I missed something, that seems to fix
counter_enable_read(), but here is to retrieve counter value. Howdw_pcie_readl_dbi()can return something like "Counter Disabled"?Fan
Hey Fan,
So the counter value will show 0 in case it is disabled so there will not be any issues as per say. We could add the check here but I feel I have already exposed the functionality to check if a counter is enabled or disabled, (by reading the counter_enable debugfs entry) so this could be handled in user space to only read the counter if it's enabled.
Quoted 4 lines
Quoted 4 lines
Thank you!
Krzysztof
Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
Quoted 48 lines · Shradha Todi
Quoted 48 lines
-----Original Message-----
From: Fan Ni <[email protected]>
Sent: 04 March 2025 02:33
To: Krzysztof Wilczyński <[email protected]>
Cc: Fan Ni <[email protected]>; Shradha Todi <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWCQuoted 25 lines · Krzysztof Wilczyński
Hello,
[...]
Quoted 13 lines
Quoted 13 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +13
-0+static ssize_t counter_value_read (struct file *file,char __user +*buf,size_t count,loff_t *ppos) { +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_DATA_REG ); +mutex_unlock (&rinfo->reg_event_lock);Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ pos = scnprintf(debugfs_buf, DWC_DEBUGFS_BUF_MAX, "Counter +value: %d\n", val); + + return simple_read_from_buffer(buf, count, ppos, debugfs_buf, +pos); }Do we need to check whether the counter is enabled or not for the event before retrieving the counter value?
Quoted 5 lines
I believe, we have a patch that aims to address, have a look at:
https://lore.kernel.org/linux-pci/20250225171239.19574-1-manivannan.sa
[email protected]Maybe I missed something, that seems to fix
counter_enable_read(), but here is to retrieve counter value. Howdw_pcie_readl_dbi()can return something like "Counter Disabled"?
Quoted 6 lines
Quoted 1 line
Fan
Hey Fan,
So the counter value will show 0 in case it is disabled so there will not be any issues as per say. We could add the check here but I feel I have already exposed the functionality to check if a counter is enabled or disabled, (by reading thecounter_enabledebugfs entry) so this could be handled in user space to only read the counter if it's enabled.
Ok.
Returning 0 when the counter is disabled makes sense to me.
Just some thought.
It seems natural to me if we make "counter_value" only visiable to users when the counter is enabled.
Fan
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Thank you!
Krzysztof
RE: [PATCH v7 5/5] Add debugfs based statistical counter support in DWC
Quoted 74 lines
-----Original Message-----
From: Fan Ni <[email protected]>
Sent: 05 March 2025 09:56
To: Shradha Todi <[email protected]>
Cc: 'Fan Ni' <[email protected]>; 'Krzysztof Wilczyński' <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWCQuoted 54 lines · Shradha Todi
Quoted 54 lines
-----Original Message-----
From: Fan Ni <[email protected]>
Sent: 04 March 2025 02:33
To: Krzysztof Wilczyński <[email protected]>
Cc: Fan Ni <[email protected]>; Shradha Todi <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v7 5/5] Add debugfs based statistical counter support in DWCQuoted 25 lines · Krzysztof Wilczyński
Hello,
[...]
Quoted 13 lines
Quoted 13 lines
drivers/pci/controller/dwc/pcie-designware-debugfs.c +13
-0+static ssize_t counter_value_read (struct file *file,char +__user *buf,size_t count,loff_t *ppos) { +struct dwc_pcie_rasdes_priv *pdata = file->private_data; +struct dw_pcie *pci = pdata->pci; +struct dwc_pcie_rasdes_info *rinfo = pci->debugfs->rasdes_info; +char debugfs_buf[DWC_DEBUGFS_BUF_MAX ]; +ssize_t pos; +u32 val; + +mutex_lock (&rinfo->reg_event_lock); +set_event_number (pdata, pci, rinfo); + val =dw_pcie_readl_dbi (pci, rinfo->ras_cap_offset +RAS_DES_EVENT_COUNTER_DATA_REG ); +mutex_unlock (&rinfo->reg_event_lock);Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ pos = scnprintf(debugfs_buf, DWC_DEBUGFS_BUF_MAX, "Counter +value: %d\n", val); + + return simple_read_from_buffer(buf, count, ppos, +debugfs_buf, pos); }Do we need to check whether the counter is enabled or not for the event before retrieving the counter value?
Quoted 6 lines
I believe, we have a patch that aims to address, have a look at:
https://lore.kernel.org/linux-pci/20250225171239.19574-1-manivanna
n.sa
[email protected]Maybe I missed something, that seems to fix
counter_enable_read(), but here is to retrieve counter value. Howdw_pcie_readl_dbi()can return something like "Counter Disabled"?Quoted 6 lines
Quoted 1 line
Fan
Hey Fan,
So the counter value will show 0 in case it is disabled so there will
not be any issues as per say. We could add the check here but I feel I
have already exposed the functionality to check if a counter is enabled or disabled, (by reading thecounter_enabledebugfs entry)
Quoted 8 lines
so this could be handled in user space to only read the counter if it's enabled. Ok.
Returning 0 when the counter is disabled makes sense to me.Just some thought.
It seems natural to me if we make "
counter_value" only visiable to users when the counter is enabled.
Hey Fan,
This looks like a good suggestion to me. I have implemented this and in the process of testing. Since there is no support in the debugfs framework for conditionally hiding certain files from user, the custom implementation is a little tricky and will need some discussion before taking in. So let's take this up as a top up patch and live with returning 0 when the counter is disabled for now?
Thanks a lot for the suggestion.
Shradha
Quoted 8 lines
Fan
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Thank you!
Krzysztof
Hello Shradha,
Quoted 22 lines · Shradha Todi
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 occurredHowever, 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.
Quoted 8 lines
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
I tested this series, and one thing that I noticed:
# for f in /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/counter_enable; do echo 1 > $f; done
# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/ctl_skp_os_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/deskew_uncompleted_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/framing_err_in_l0/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/margin_crc_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_1st/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_2nd/counter_enable:Counter Disabled
that there are some events that cannot be enabled when testing on my platform, rk3588, perhaps this is because my version of the DWC IP does not have these events.
(Because all the other events can be enabled successfully:
# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Enabled | wc -l 29 )
So the question is, how do we want to handle that?
E.g. counter_enable_write() could theoretically read back the dw_pcie_readl_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG); register after doing theww_pcie_writel_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG, val);
to actually check if it could enable the event.
If counter_enable_write() could not enable the specific event, should it perhaps return a failure to user space?
Or, do we want to keep the current behavior of just letting counter_enable_write() return success, even for events that are not supported by the specific DWC PCIe implementation?
Kind regards,
Niklas
Quoted 50 lines · Niklas Cassel
Hello Shradha,
Quoted 22 lines · Shradha Todi
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 occurredHowever, 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.
Quoted 8 lines
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 v6I tested this series, and one thing that I noticed:
# for f in /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/counter_enable; do echo 1 > $f; done# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/ctl_skp_os_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/deskew_uncompleted_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/framing_err_in_l0/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/margin_crc_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_1st/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_2nd/counter_enable:Counter Disabledthat there are some events that cannot be enabled when testing on my platform, rk3588, perhaps this is because my version of the DWC IP does not have these events.
Quoted 8 lines
(Because all the other events can be enabled successfully:
# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Enabled | wc -l 29 )So the question is, how do we want to handle that?
This is a really good question.
Quoted 10 lines
E.g.
counter_enable_write()could theoretically read back thedw_pcie_readl_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG); register after doing theww_pcie_writel_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG, val);to actually check if it could enable the event.
If
counter_enable_write()could not enable the specific event, should it perhaps return a failure to user space?
Yes, it would be appropriate to return -EOPNOTSUPP in that case. But I'd like to merge this series asap. So this patch can come on top of this series.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Hello,
[...]
Quoted 2 lines
Yes, it would be appropriate to return
-EOPNOTSUPPin that case. But I'd like to merge this series asap. So this patch can come on top of this series.
I pulled the series so that we can get some mileage out of the 0-day bot, so to speak, and also get some testing via the linux-next tree.
That said, while looking at the code, there have been bits where I wanted to get some clarification. Nothing will be a blocker.
Krzysztof
Quoted 67 lines · Manivannan Sadhasivam
Quoted 50 lines · Niklas Cassel
Hello Shradha,
Quoted 22 lines · Shradha Todi
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 occurredHowever, 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.
Quoted 8 lines
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 v6I tested this series, and one thing that I noticed:
# for f in /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/counter_enable; do echo 1 > $f; done# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/ctl_skp_os_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/deskew_uncompleted_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/framing_err_in_l0/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/margin_crc_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_1st/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_2nd/counter_enable:Counter Disabledthat there are some events that cannot be enabled when testing on my platform, rk3588, perhaps this is because my version of the DWC IP does not have these events.
Quoted 8 lines
(Because all the other events can be enabled successfully:
# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Enabled | wc -l 29 )So the question is, how do we want to handle that?
This is a really good question.
Quoted 5 lines
E.g.
counter_enable_write()could theoretically read back thedw_pcie_readl_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG); register after doing theww_pcie_writel_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG, val);
Quoted 8 lines
Quoted 5 lines
to actually check if it could enable the event.
If
counter_enable_write()could not enable the specific event, should it perhaps return a failure to user space?Yes, it would be appropriate to return
-EOPNOTSUPPin that case. But I'd like to merge this series asap. So this patch can come on top of this series.
I agree that returning an error is probably the nicest thing.
However, this series has been picked up already :)
Is there anyone who volunteers on implementing the proposed feature?
If you have time, it would be interesting to see if you see the same behavior on QCOM SoCs. (Assuming that your DWC PCIe controller does not implement all events that Samsung DWC PCIe controller does.)
Kind regards,
Niklas
Quoted 74 lines · Niklas Cassel
Quoted 73 lines · Manivannan Sadhasivam
Quoted 50 lines · Niklas Cassel
Hello Shradha,
Quoted 22 lines · Shradha Todi
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 occurredHowever, 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.
Quoted 8 lines
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 v6I tested this series, and one thing that I noticed:
# for f in /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/counter_enable; do echo 1 > $f; done# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/ctl_skp_os_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/deskew_uncompleted_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/framing_err_in_l0/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/margin_crc_parity_err/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_1st/counter_enable:Counter Disabled /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/retimer_parity_err_2nd/counter_enable:Counter Disabledthat there are some events that cannot be enabled when testing on my platform, rk3588, perhaps this is because my version of the DWC IP does not have these events.
Quoted 8 lines
(Because all the other events can be enabled successfully:
# grep "" /sys/kernel/debug/dwc_pcie_a40000000.pcie/rasdes_event_counter/*/* | grep Enabled | wc -l 29 )So the question is, how do we want to handle that?
This is a really good question.
Quoted 10 lines
E.g.
counter_enable_write()could theoretically read back thedw_pcie_readl_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG); register after doing theww_pcie_writel_dbi(pci, rinfo->ras_cap_offset + RAS_DES_EVENT_COUNTER_CTRL_REG, val);to actually check if it could enable the event.
If
counter_enable_write()could not enable the specific event, should it perhaps return a failure to user space?
Quoted 9 lines
Quoted 2 lines
Yes, it would be appropriate to return
-EOPNOTSUPPin that case. But I'd like to merge this series asap. So this patch can come on top of this series.I agree that returning an error is probably the nicest thing.
However, this series has been picked up already :)
Is there anyone who volunteers on implementing the proposed feature?
I did and submitted the fix [1].
Quoted 4 lines
If you have time, it would be interesting to see if you see the same behavior on QCOM SoCs. (Assuming that your DWC PCIe controller does not implement all events that Samsung DWC PCIe controller does.)
Yeah, I observed the same behavior on the Qcom platform, though only 2 counters were not supported. But I also noticed a null ptr dereference due to refclk dependency, so submitted a fix for that also.
- Mani
[1] https://lore.kernel.org/linux-pci/[email protected]/
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Krzysztof Wilczyński
AppliedHello,
Quoted 22 lines
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 occurredHowever, 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.
Quoted 3 lines
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.
Applied to controller/dwc, thank you!
Krzysztof
Hello,
[...]
Quoted 1 line
Applied to controller/dwc, thank you!
Updated the current branch with a few missing "Reviewed-by" tags from Fan Ni.
Thank you!
Krzysztof
Quoted 145 lines
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: <[email protected]>
X-Mailer: git-send-email 2.17.1
Precedence: bulk
X-Mailing-List: [email protected]
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:[email protected]>
List-Unsubscribe: <mailto:[email protected]>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJsWRmVeSWpSXmKPExsWy7bCmum7f2p3pBpev8Fhcaf/NbjH9sKLFkqYMi2MTVjBbNK2+y2qx4stMdotVC6+xWTT0/Ga12PT4GqvF5V1z2CzOzjvOZnFl6zoWi5Y/ LSwWd1s6WS2WXr/IZPF3215Gi0Vbv7BbLGx+yWjxf88Odovew7UWLXdMLd7/3MzmIOaxeMUU Vo8189YweuycdZfdY8GmUo+WI29ZPTat6mTzuHNtD5vHzoeWHk+uTGfy2Lyk3qNvyypGj8+b 5AJ4orJtMlITU1KLFFLzkvNTMvPSbZW8g+Od403NDAx1DS0tzJUU8hJzU22VXHwCdN0yc4C+ VVIoS8wpBQoFJBYXK+nb2RTll5akKmTkF5fYKqUWpOQUmBToFSfmFpfmpevlpZZYGRoYGJkC FSZkZ9w5vYalYLZqxYb7X5gaGB/IdjFyckgImEi83vKXqYuRi0NIYDejxLsX7UwgCSGBT4wS u6dkQySA7IMTF7PDdKyZ08QKkdjJKHFn3nso5wujxL2+j2BVbAJaEo1fu5hBbBGBVkaJI8/E QIqYBbYxSxxYsQIsISwQJPFjXRsLiM0ioCrx/e98oGYODl4BK4k9K+0htslLrN5wAKycV0BQ 4uTMJ2DlzEDx5q2zmSFqvnBIfJnNB2G7SCzadQPqUmGJV8e3QNlSEp/f7WWDsNMlVm6eAdWb I/Ft8xImCNte4sCVOSwgJzALaEqs36UPEZaVmHpqHRPEWj6J3t9PoMp5JXbMg7GVJb783cMC YUtKzDt2mRXC9pDYufkh2EghgViJ/v+2ExjlZyF5ZhaSZ2YhLF7AyLyKUTK1oDg3PTXZtMAw L7UcHq3J+bmbGMFJXstlB+ON+f/0DjEycTAeYpTgYFYS4dUt2ZEuxJuSWFmVWpQfX1Sak1p8 iNEUGMATmaVEk/OBeSavJN7QxNLAxMzMzMTS2MxQSZy3eWdLupBAemJJanZqakFqEUwfEwen VAOTyWph2UVGD0z1j0+NvfvEdnGQ413ON1OnCFx4vMfJeqvN3Mp7Kx86NXwKsN+sdkziZXTt kesTTnswSfQ/W1W2UrvUr+Mf14yGGbL9V1cY802NfhC1Su7CI57OFPH5lz5En/srKjG9MXbJ wbvLF2vMuPtkX2nEE4bFtdvOlN1YvEY1xMF6apLnj5CG0sSSXn3PgKUsajzVWQ/TfU7n/lD5 bfjrwVJLhqPcRqoTSkq8zi29HTM1wO3dCcNfq6we9H4Sbrx8ef67MN+3L8NLzveyuAo5iV1+ s8+BVbngfu6khvO+c9YriUadC2QxkJvBY3eiVHQx3yuDqBXzeubVRsnkfzzpt9tl19/cGTOv 1GuzKrEUZyQaajEXFScCAMosolJ7BAAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRmVeSWpSXmKPExsWy7bCSvG537Y50g2MLlC2utP9mt5h+WNFi SVOGxbEJK5gtmlbfZbVY8WUmu8WqhdfYLBp6frNabHp8jdXi8q45bBZn5x1ns7iydR2LRcuf FhaLuy2drBZLr19ksvi7bS+jxaKtX9gtFja/ZLT4v2cHu0Xv4VqLljumFu9/bmZzEPNYvGIK q8eaeWsYPXbOusvusWBTqUfLkbesHptWdbJ53Lm2h81j50NLjydXpjN5bF5S79G3ZRWjx+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/5z0wPMPHsW9quEntZSWW4oxEQy3mouJEAI4aFoM8AwAAX-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@epcas5p4.samsung.com>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 occurredHowever, 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 v6v6: https://lore.kernel.org/all/[email protected]/
- 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/[email protected]/
- 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/[email protected]/
- Addressed comments from Manivannan, Bjorn and Jonathan
- Addressed style related change requests from v3
- Added Documentation underDocumentation/ABI/testingand 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/[email protected]/
- 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/[email protected]/
- Addressed comments from Krzysztof Wilczyński, Bjorn Helgaas and posted v2 with a changed implementation for a better code designv1: https://lore.kernel.org/all/[email protected]/T/
[1] https://lore.kernel.org/all/[email protected]/
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 DWCDocumentation/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(-)
Quoted 8 lines
create mode 100644
Documentation/ABI/testing/debugfs-dwc-pciecreate mode 100644drivers/pci/controller/dwc/pcie-designware-debugfs.ccreate mode 100644include/linux/pcie-dwc.hSignature · 1 line
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.
Hello,
Quoted 3 lines
Thanks for adding the support!
Tested the patch in one of our internal SoC with DesginWare PCIe controller. The patch works fine.
I assume this was for an entire series, not any specific patch.
Quoted 1 line
Tested-by Hrishikesh Deleep <[email protected]>
Thank you for testing! I will add your tag to the current branch.
Krzysztof