From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>
Cc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
Oliver O'Halloran <oohall@gmail.com>,
Lukas Wunner <lukas@wunner.de>,
LKML <linux-kernel@vger.kernel.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 6/7] PCI: Add TLP Prefix reading into pcie_read_tlp_log()
Date: Fri, 10 May 2024 15:12:47 +0300 (EEST) [thread overview]
Message-ID: <7d69ae9f-9d2f-2482-eaa7-d3e31037c8d1@linux.intel.com> (raw)
In-Reply-To: <20240510100730.18805-7-ilpo.jarvinen@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2990 bytes --]
On Fri, 10 May 2024, Ilpo Järvinen wrote:
> pcie_read_tlp_log() handles only 4 Header Log DWORDs but TLP Prefix Log
> (PCIe r6.1 secs 7.8.4.12 & 7.9.14.13) may also be present.
>
> Generalize pcie_read_tlp_log() and struct pcie_tlp_log to handle also
> TLP Prefix Log. The relevant registers are formatted identically in AER
> and DPC Capability, but has these variations:
>
> a) The offsets of TLP Prefix Log registers vary.
> b) DPC RP PIO TLP Prefix Log register can be < 4 DWORDs.
>
> Therefore callers must pass the offset of the TLP Prefix Log register
> and the entire length to pcie_read_tlp_log() to be able to read the
> correct number of TLP Prefix DWORDs from the correct offset.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/pci/pci.h | 5 +++-
> drivers/pci/pcie/aer.c | 4 ++-
> drivers/pci/pcie/dpc.c | 13 +++++-----
> drivers/pci/pcie/tlp.c | 47 +++++++++++++++++++++++++++++++----
> include/linux/aer.h | 1 +
> include/uapi/linux/pci_regs.h | 1 +
> 6 files changed, 57 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 0e9917f8bf3f..3d9034d89be8 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -420,7 +420,10 @@ struct aer_err_info {
> int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info);
> void aer_print_error(struct pci_dev *dev, struct aer_err_info *info);
>
> -int pcie_read_tlp_log(struct pci_dev *dev, int where, struct pcie_tlp_log *log);
> +int pcie_read_tlp_log(struct pci_dev *dev, int where, int where2,
> + unsigned int tlp_len, struct pcie_tlp_log *log);
> +unsigned int aer_tlp_log_len(struct pci_dev *dev);
> +unsigned int dpc_tlp_log_len(struct pci_dev *dev);
> #endif /* CONFIG_PCIEAER */
>
> #ifdef CONFIG_PCIEPORTBUS
> diff --git a/drivers/pci/pcie/tlp.c b/drivers/pci/pcie/tlp.c
> index 65ac7b5d8a87..3615ca520c9a 100644
> --- a/drivers/pci/pcie/tlp.c
> +++ b/drivers/pci/pcie/tlp.c
> @@ -11,26 +11,63 @@
>
> #include "../pci.h"
>
> +/**
> + * aer_tlp_log_len - Calculates AER Capability TLP Header/Prefix Log length
> + * @dev: PCIe device
> + *
> + * Return: TLP Header/Prefix Log length
> + */
> +unsigned int aer_tlp_log_len(struct pci_dev *dev)
> +{
> + return 4 + dev->eetlp_prefix_max;
> +}
> +
> +/**
> + * dpc_tlp_log_len - Calculates DPC RP PIO TLP Header/Prefix Log length
> + * @dev: PCIe device
> + *
> + * Return: TLP Header/Prefix Log length
> + */
> +unsigned int dpc_tlp_log_len(struct pci_dev *pdev)
> +{
> + /* Remove ImpSpec Log register from the count */
> + if (pdev->dpc_rp_log_size >= 5)
Scratch this. LKP's randconfig build seems to have caught this failing to
build when AER is enabled but DPC is not because this member doesn't exist
w/o DPC.
> + return pdev->dpc_rp_log_size - 1;
> +
> + return pdev->dpc_rp_log_size;
> +}
--
i.
next prev parent reply other threads:[~2024-05-10 12:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 10:07 [PATCH v4 0/7] PCI: Consolidate TLP Log reading and printing Ilpo Järvinen
2024-05-10 10:07 ` [PATCH v4 1/7] PCI: Don't expose pcie_read_tlp_log() outside of PCI subsystem Ilpo Järvinen
2024-05-10 10:07 ` [PATCH v4 2/7] PCI: Move TLP Log handling to own file Ilpo Järvinen
2024-05-10 10:07 ` [PATCH v4 3/7] PCI: Make pcie_read_tlp_log() signature same Ilpo Järvinen
2024-05-10 10:07 ` [PATCH v4 4/7] PCI: Use unsigned int i in pcie_read_tlp_log() Ilpo Järvinen
2024-05-10 10:07 ` [PATCH v4 5/7] PCI: Store # of supported End-End TLP Prefixes Ilpo Järvinen
2024-05-10 10:07 ` [PATCH v4 6/7] PCI: Add TLP Prefix reading into pcie_read_tlp_log() Ilpo Järvinen
2024-05-10 12:12 ` Ilpo Järvinen [this message]
2024-05-10 10:07 ` [PATCH v4 7/7] PCI: Create helper to print TLP Header and Prefix Log Ilpo Järvinen
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=7d69ae9f-9d2f-2482-eaa7-d3e31037c8d1@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lukas@wunner.de \
--cc=mahesh@linux.ibm.com \
--cc=oohall@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).