[PATCH v2 2/2] PCI: Handle TLP Log in Flit mode
Yazen Ghannam
yazen.ghannam at amd.com
Sat Feb 22 03:19:26 AEDT 2025
On Fri, Feb 07, 2025 at 06:18:36PM +0200, Ilpo Järvinen wrote:
> Flit mode introduced in PCIe r6.0 alters how the TLP Header Log is
> presented through AER and DPC Capability registers. The TLP Prefix Log
> Register is not present with Flit mode and the register becomes
> extension for TLP Header Log (PCIe r6.1 secs 7.8.4.12 & 7.9.14.13).
>
> Adapt pcie_read_tlp_log() and struct pcie_tlp_log to read and store
> also the extended TLP Header Log when the link is in Flit mode. As
> Prefix Log and Extended TLP Header are not present at the same time,
> C union can be used.
>
> Determining whether the error occurred while the Link was in Flit mode
> is bit complicated. In case of AER, Advanced Error Capabilities and
> Control Register directly tells whether the error was logged in Flit
> mode or not (PCIe r6.1 sec 7.8.4.7). DPC Capability (PCIe r6.1 sec
> 7.9.14), unfortunately, does not contain the same information.
>
> Unlike AER, the DPC capability does not provide way to discern whether
> the error was logged in Flit mode (this is confirmed by PCI WG to be an
> oversight in the spec). DPC will bring link down immediately following
> an error, which make it impossible to acquire the Flit mode status
> directly from the Link Status 2 register because Flit Mode Status is
> only set in certain Link states (PCIe r6.1 sec 7.5.3.20). As a
> workaround, use the flit_mode value stored into the struct pci_bus.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen at linux.intel.com>
> ---
> drivers/pci/pci.h | 3 +-
> drivers/pci/pcie/aer.c | 1 +
> drivers/pci/pcie/dpc.c | 18 +++++++++--
> drivers/pci/pcie/tlp.c | 56 ++++++++++++++++++++++++-----------
> include/linux/aer.h | 12 ++++++--
> include/ras/ras_event.h | 12 ++++----
> include/uapi/linux/pci_regs.h | 6 +++-
> 7 files changed, 77 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 9c6a4a980678..07cc9be6f80b 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -554,7 +554,8 @@ 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, int where2,
> - unsigned int tlp_len, struct pcie_tlp_log *log);
> + unsigned int tlp_len, bool flit,
> + struct pcie_tlp_log *log);
> unsigned int aer_tlp_log_len(struct pci_dev *dev, u32 aercc);
> void pcie_print_tlp_log(const struct pci_dev *dev,
> const struct pcie_tlp_log *log, const char *pfx);
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 508474e17183..9c3e8299ad50 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1245,6 +1245,7 @@ int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
> pcie_read_tlp_log(dev, aer + PCI_ERR_HEADER_LOG,
> aer + PCI_ERR_PREFIX_LOG,
> aer_tlp_log_len(dev, aercc),
> + aercc & PCI_ERR_CAP_TLP_LOG_FLIT,
> &info->tlp);
> }
> }
It seems Linux does not support "Multiple Error Handling", correct? We
save the TLP logs once for each device, and the user will need to know
that these are just for the "First" error, right?
Thanks,
Yazen
More information about the Linuxppc-dev
mailing list