From: Niklas Cassel <cassel@kernel.org>
To: Hans Zhang <18255117159@163.com>
Cc: jingoohan1@gmail.com, shradha.t@samsung.com,
manivannan.sadhasivam@linaro.org, lpieralisi@kernel.org,
kw@linux.com, robh@kernel.org, bhelgaas@google.com,
Frank.Li@nxp.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, rockswang7@gmail.com
Subject: Re: [v2] PCI: dwc: Add the debugfs property to provide the LTSSM status of the PCIe link
Date: Thu, 13 Feb 2025 15:34:21 +0100 [thread overview]
Message-ID: <Z64C7dzY3J7hCbZy@ryzen> (raw)
In-Reply-To: <20250206151343.26779-1-18255117159@163.com>
On Thu, Feb 06, 2025 at 11:13:43PM +0800, Hans Zhang wrote:
> Add the debugfs property to provide a view of the current link's LTSSM
> status from the root port device.
>
> /sys/kernel/debug/dwc_pcie_<dev>/ltssm_status
>
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> Changes since v1:
> https://lore.kernel.org/linux-pci/20250123071326.1810751-1-18255117159@163.com/
>
> - Do not place into sysfs node as recommended by maintainer. Shradha-based patch
> is put into debugfs.
> - Submissions based on the following patches:
> https://patchwork.kernel.org/project/linux-pci/patch/20250121111421.35437-2-shradha.t@samsung.com/
> https://patchwork.kernel.org/project/linux-pci/patch/20250121111421.35437-3-shradha.t@samsung.com/
> https://patchwork.kernel.org/project/linux-pci/patch/20250121111421.35437-4-shradha.t@samsung.com/
> https://patchwork.kernel.org/project/linux-pci/patch/20250121111421.35437-5-shradha.t@samsung.com/
> ---
> Documentation/ABI/testing/debugfs-dwc-pcie | 6 ++
> .../controller/dwc/pcie-designware-debugfs.c | 70 ++++++++++++++++---
> .../pci/controller/dwc/pcie-designware-ep.c | 4 +-
> .../pci/controller/dwc/pcie-designware-host.c | 54 +++++++++++++-
> drivers/pci/controller/dwc/pcie-designware.h | 43 ++++++++++--
> 5 files changed, 159 insertions(+), 18 deletions(-)
>
> diff --git a/Documentation/ABI/testing/debugfs-dwc-pcie b/Documentation/ABI/testing/debugfs-dwc-pcie
> index d3f84f46b400..bf0116012175 100644
> --- a/Documentation/ABI/testing/debugfs-dwc-pcie
> +++ b/Documentation/ABI/testing/debugfs-dwc-pcie
> @@ -142,3 +142,9 @@ Description: (RW) Some lanes in the event list are lane specific events. These i
> 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.
> +
> +What: /sys/kernel/debug/dwc_pcie_<dev>/ltssm_status
> +Date: February 2025
> +Contact: Hans Zhang <18255117159@163.com>
> +Description: (RO) Read will return the current value of the PCIe link status raw value and
> + string status.
> diff --git a/drivers/pci/controller/dwc/pcie-designware-debugfs.c b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> index 5d883b13be84..ddfb854aa684 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> @@ -465,7 +465,7 @@ static const struct file_operations dwc_pcie_counter_value_ops = {
> .read = counter_value_read,
> };
>
> -void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci)
> +static void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci)
> {
> struct dwc_pcie_rasdes_info *rinfo = pci->rasdes_info;
>
> @@ -473,13 +473,12 @@ void dwc_pcie_rasdes_debugfs_deinit(struct dw_pcie *pci)
> mutex_destroy(&rinfo->reg_lock);
> }
>
> -int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci)
> +static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)
> {
> - struct dentry *dir, *rasdes_debug, *rasdes_err_inj, *rasdes_event_counter, *rasdes_events;
> + 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;
> const struct dwc_pcie_vendor_id *vid;
> - char dirname[DWC_DEBUGFS_BUF_MAX];
> struct device *dev = pci->dev;
> int ras_cap, i, ret;
>
> @@ -498,12 +497,6 @@ int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci)
> if (!rasdes_info)
> return -ENOMEM;
>
> - /* 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);
> - if (IS_ERR(dir))
> - return PTR_ERR(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);
> @@ -559,3 +552,60 @@ int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci)
> dwc_pcie_rasdes_debugfs_deinit(pci);
> return ret;
> }
> +
> +static int dwc_pcie_ltssm_status_show(struct seq_file *s, void *v)
> +{
> + struct dw_pcie *pci = s->private;
> + enum dw_pcie_ltssm val;
> +
> + val = dw_pcie_get_ltssm(pci);
> + seq_printf(s, "%s (0x%02x)\n", dw_ltssm_sts_string(val), val);
> +
> + return 0;
> +}
> +
> +static int dwc_pcie_ltssm_status_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, dwc_pcie_ltssm_status_show, inode->i_private);
> +}
> +
> +static const struct file_operations dwc_pcie_ltssm_status_ops = {
> + .open = dwc_pcie_ltssm_status_open,
> + .read = seq_read,
> +};
> +
> +static void dwc_pcie_ltssm_debugfs_init(struct dw_pcie *pci, struct dentry *dir)
> +{
> + debugfs_create_file("ltssm_status", 0444, dir, pci,
> + &dwc_pcie_ltssm_status_ops);
> +}
> +
> +void dwc_pcie_debugfs_deinit(struct dw_pcie *pci)
> +{
> + dwc_pcie_rasdes_debugfs_deinit(pci);
> + debugfs_remove_recursive(pci->debugfs);
> +}
> +
> +int dwc_pcie_debugfs_init(struct dw_pcie *pci)
> +{
> + char dirname[DWC_DEBUGFS_BUF_MAX];
> + struct device *dev = pci->dev;
> + 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);
> + if (IS_ERR(dir))
> + return PTR_ERR(dir);
> +
> + pci->debugfs = dir;
> + ret = dwc_pcie_rasdes_debugfs_init(pci, dir);
> + if (ret)
> + dev_dbg(dev, "rasdes debugfs init failed\n");
> +
> + dwc_pcie_ltssm_debugfs_init(pci, dir);
> +
> + return 0;
> +}
> +
Stray newline here.
This causes:
/home/nks/src/linux/.git/worktrees/linux-scratch/rebase-apply/patch:136: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
when doing git am.
Also, this patch does not apply anymore, because of a conflict introduce by:
112aba9a7934 ("PCI: dwc: Remove LTSSM state test in dw_pcie_suspend_noirq()")
Which added:
+ DW_PCIE_LTSSM_DETECT_WAIT = 0x6,
to drivers/pci/controller/dwc/pcie-designware.h
Kind regards,
Niklas
next prev parent reply other threads:[~2025-02-13 14:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250206151446epcas5p43a35270da73181b97deb628ff49f3ddd@epcas5p4.samsung.com>
2025-02-06 15:13 ` [v2] PCI: dwc: Add the debugfs property to provide the LTSSM status of the PCIe link Hans Zhang
2025-02-12 11:39 ` Shradha Todi
2025-02-12 14:03 ` Hans Zhang
2025-02-13 14:34 ` Niklas Cassel [this message]
2025-02-14 8:34 ` Hans Zhang
2025-02-14 17:05 ` Bjorn Helgaas
2025-02-14 17:14 ` Hans Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z64C7dzY3J7hCbZy@ryzen \
--to=cassel@kernel.org \
--cc=18255117159@163.com \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@kernel.org \
--cc=rockswang7@gmail.com \
--cc=shradha.t@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.