* [PATCH v3 1/6] PCI/portdrv: Group PCI Exp Cap services into a single mask
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
@ 2026-12-04 18:15 ` Yazen Ghannam
2026-12-04 18:15 ` [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word() Yazen Ghannam
` (5 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Yazen Ghannam @ 2026-12-04 18:15 UTC (permalink / raw)
To: bhelgaas, linux-pci, linux-kernel, linux-acpi, linux-edac; +Cc: Yazen Ghannam
PME, hotplug and bandwidth notification share the PCI Express Capability
interrupt vector. The set is open-coded as a bitmask in two places.
Define PCIE_PORT_SERVICES_EXPCAP beside the service bits and use it.
Assign the shared vector by iterating the mask, so adding a service is a
single edit.
The loop writes only the irqs[] slots of services in the mask. The old
code also filled the other slots of the group, which were never read.
No functional change intended.
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
drivers/pci/pcie/portdrv.c | 16 ++++++++--------
drivers/pci/pcie/portdrv.h | 5 +++++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index f1beb440a3dc..17a2d4a12349 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -67,8 +67,7 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
* 7.8.2, 7.10.10, 7.31.2.
*/
- if (mask & (PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP |
- PCIE_PORT_SERVICE_BWCTRL)) {
+ if (mask & PCIE_PORT_SERVICES_EXPCAP) {
pcie_capability_read_word(dev, PCI_EXP_FLAGS, ®16);
*pme = FIELD_GET(PCI_EXP_FLAGS_IRQ, reg16);
nvec = *pme + 1;
@@ -114,6 +113,8 @@ static int pcie_port_enable_irq_vec(struct pci_dev *dev, int *irqs, int mask)
{
int nr_entries, nvec, pcie_irq;
u32 pme = 0, aer = 0, dpc = 0;
+ unsigned long expcap;
+ unsigned int i;
/* Allocate the maximum possible number of MSI/MSI-X vectors */
nr_entries = pci_alloc_irq_vectors(dev, 1, PCIE_PORT_MAX_MSI_ENTRIES,
@@ -148,13 +149,12 @@ static int pcie_port_enable_irq_vec(struct pci_dev *dev, int *irqs, int mask)
return nr_entries;
}
- /* PME, hotplug and bandwidth notification share an MSI/MSI-X vector */
- if (mask & (PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP |
- PCIE_PORT_SERVICE_BWCTRL)) {
+ /* These services share the PCIe Capability Interrupt Message Number */
+ expcap = mask & PCIE_PORT_SERVICES_EXPCAP;
+ if (expcap) {
pcie_irq = pci_irq_vector(dev, pme);
- irqs[PCIE_PORT_SERVICE_PME_SHIFT] = pcie_irq;
- irqs[PCIE_PORT_SERVICE_HP_SHIFT] = pcie_irq;
- irqs[PCIE_PORT_SERVICE_BWCTRL_SHIFT] = pcie_irq;
+ for_each_set_bit(i, &expcap, PCIE_PORT_DEVICE_MAXSERVICES)
+ irqs[i] = pcie_irq;
}
if (mask & PCIE_PORT_SERVICE_AER)
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index e1b6a8af6f71..31fda7a09f0f 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -23,6 +23,11 @@
#define PCIE_PORT_SERVICE_BWCTRL_SHIFT 4 /* Bandwidth Controller (notifications) */
#define PCIE_PORT_SERVICE_BWCTRL (1 << PCIE_PORT_SERVICE_BWCTRL_SHIFT)
+/* Services sharing the PCI Express Capability Interrupt Message Number */
+#define PCIE_PORT_SERVICES_EXPCAP (PCIE_PORT_SERVICE_PME | \
+ PCIE_PORT_SERVICE_HP | \
+ PCIE_PORT_SERVICE_BWCTRL)
+
#define PCIE_PORT_DEVICE_MAXSERVICES 5
#ifdef CONFIG_PCIEAER
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word()
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
2026-12-04 18:15 ` [PATCH v3 1/6] PCI/portdrv: Group PCI Exp Cap services into a single mask Yazen Ghannam
@ 2026-12-04 18:15 ` Yazen Ghannam
2026-12-04 18:35 ` sashiko-bot
2026-12-04 18:15 ` [PATCH v3 3/6] PCI/FLIT: Add support for Flit Logging Extended Capability Yazen Ghannam
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Yazen Ghannam @ 2026-12-04 18:15 UTC (permalink / raw)
To: bhelgaas, linux-pci, linux-kernel, linux-acpi, linux-edac; +Cc: Yazen Ghannam
A word register that shares its dword with RW1CS bits cannot use
pci_clear_and_set_config_dword(). Writing the dword back would clear any
status bits that are set.
Add the word-sized counterpart. Only the PCI core needs it, so declare it
in drivers/pci/pci.h and don't export it.
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
drivers/pci/access.c | 11 +++++++++++
drivers/pci/pci.h | 2 ++
2 files changed, 13 insertions(+)
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index b123da16b63b..38619bc9c7f9 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -613,6 +613,17 @@ int pci_write_config_dword(const struct pci_dev *dev, int where,
}
EXPORT_SYMBOL(pci_write_config_dword);
+void pci_clear_and_set_config_word(const struct pci_dev *dev, int pos,
+ u16 clear, u16 set)
+{
+ u16 val;
+
+ pci_read_config_word(dev, pos, &val);
+ val &= ~clear;
+ val |= set;
+ pci_write_config_word(dev, pos, val);
+}
+
void pci_clear_and_set_config_dword(const struct pci_dev *dev, int pos,
u32 clear, u32 set)
{
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index aa392bb6a482..2f21246380dd 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -286,6 +286,8 @@ void pci_dev_adjust_pme(struct pci_dev *dev);
void pci_dev_complete_resume(struct pci_dev *pci_dev);
void pci_config_pm_runtime_get(struct pci_dev *dev);
void pci_config_pm_runtime_put(struct pci_dev *dev);
+void pci_clear_and_set_config_word(const struct pci_dev *dev, int pos,
+ u16 clear, u16 set);
void pci_pm_power_up_and_verify_state(struct pci_dev *pci_dev);
void pci_pm_init(struct pci_dev *dev);
void pci_ea_init(struct pci_dev *dev);
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word()
2026-12-04 18:15 ` [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word() Yazen Ghannam
@ 2026-12-04 18:35 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-12-04 18:35 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] PCI: pci_clear_and_set_config_word() ignores
pci_read_config_word() error
--
commit 6deeae1d914f6910d535248cb7317e53525dce50
Author: Yazen Ghannam <yazen.ghannam@amd.com>
PCI: Add pci_clear_and_set_config_word()
This commit adds pci_clear_and_set_config_word() to drivers/pci/access.c
and declares it in drivers/pci/pci.h for internal PCI core use.
> diff --git a/drivers/pci/access.c b/drivers/pci/access.c
> index b123da16b63ba..38619bc9c7f91 100644
> --- a/drivers/pci/access.c
> +++ b/drivers/pci/access.c
> @@ -613,6 +613,17 @@ int pci_write_config_dword(const struct pci_dev *dev, int where,
> }
> EXPORT_SYMBOL(pci_write_config_dword);
>
> +void pci_clear_and_set_config_word(const struct pci_dev *dev, int pos,
> + u16 clear, u16 set)
> +{
> + u16 val;
> +
> + pci_read_config_word(dev, pos, &val);
> + val &= ~clear;
> + val |= set;
> + pci_write_config_word(dev, pos, val);
> +}
[Severity: Medium]
Should pci_clear_and_set_config_word() check the return value of
pci_read_config_word() before writing back?
When bus->ops->read() fails transiently (for example,
dw_pcie_rd_other_conf() returning PCIBIOS_SET_FAILED), PCI_OP_READ()
populates val with 0xffff via PCI_SET_ERROR_RESPONSE().
Because pci_write_config_word() only skips the write when
pci_dev_is_disconnected(dev) is true, a succeeding write programs
(0xffff & ~clear) | set into the register, setting all unmasked bits to 1
and clearing any RW1C bits in that word.
Sibling helpers such as pcie_capability_clear_and_set_word_unlocked()
check the read return value and abort before writing.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204181556.1418843-1-yazen.ghannam@amd.com?part=2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 3/6] PCI/FLIT: Add support for Flit Logging Extended Capability
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
2026-12-04 18:15 ` [PATCH v3 1/6] PCI/portdrv: Group PCI Exp Cap services into a single mask Yazen Ghannam
2026-12-04 18:15 ` [PATCH v3 2/6] PCI: Add pci_clear_and_set_config_word() Yazen Ghannam
@ 2026-12-04 18:15 ` Yazen Ghannam
2026-12-04 18:42 ` sashiko-bot
2026-12-04 18:15 ` [PATCH v3 4/6] PCI/FLIT: Add support for the Extended Flit Error Counter Yazen Ghannam
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Yazen Ghannam @ 2026-12-04 18:15 UTC (permalink / raw)
To: bhelgaas, linux-pci, linux-kernel, linux-acpi, linux-edac; +Cc: Yazen Ghannam
PCIe r7.1 requires the Flit Logging Extended Capability on ports and
RCRBs that support Flit Mode.[1] It logs flits received with errors and
counts them against a programmable trigger.
Add a port service driver for it, with _OSC negotiation of control like
the other port services.
[1] PCIe r7.1, sec 7.7.9
Link: https://pcisig.com/specification/extend-osc-negotiate-control-pcie-flit-logging-extended-capability
Originally-by: Avadhut Naik <avadhut.naik@amd.com>
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
drivers/acpi/pci_root.c | 15 +-
drivers/pci/controller/vmd.c | 1 +
drivers/pci/pci.c | 2 +
drivers/pci/pci.h | 14 ++
drivers/pci/pcie/Kconfig | 9 +
drivers/pci/pcie/Makefile | 1 +
drivers/pci/pcie/flit.c | 407 ++++++++++++++++++++++++++++++++++
drivers/pci/pcie/portdrv.c | 4 +
drivers/pci/pcie/portdrv.h | 13 +-
drivers/pci/probe.c | 3 +
include/linux/acpi.h | 1 +
include/linux/pci.h | 6 +
include/uapi/linux/pci_regs.h | 19 +-
13 files changed, 489 insertions(+), 6 deletions(-)
create mode 100644 drivers/pci/pcie/flit.c
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index b08261b6372f..49532d209684 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -137,6 +137,7 @@ static struct pci_osc_bit_struct pci_osc_control_bit[] = {
{ OSC_PCI_EXPRESS_CAPABILITY_CONTROL, "PCIeCapability" },
{ OSC_PCI_EXPRESS_LTR_CONTROL, "LTR" },
{ OSC_PCI_EXPRESS_DPC_CONTROL, "DPC" },
+ { OSC_PCI_EXPRESS_FLIT_CONTROL, "FlitLogging" },
};
static struct pci_osc_bit_struct cxl_osc_support_bit[] = {
@@ -522,6 +523,11 @@ static u32 calculate_control(void)
(control & OSC_PCI_EXPRESS_AER_CONTROL))
control |= OSC_PCI_EXPRESS_DPC_CONTROL;
+ /* An OS requesting Flit Logging control must also request AER control */
+ if (IS_ENABLED(CONFIG_PCIE_FLIT) &&
+ (control & OSC_PCI_EXPRESS_AER_CONTROL))
+ control |= OSC_PCI_EXPRESS_FLIT_CONTROL;
+
return control;
}
@@ -1012,7 +1018,8 @@ static void acpi_pci_root_release_info(struct pci_host_bridge *bridge)
#define OSC_PCIE_PORT_SERVICE_CONTROLS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
OSC_PCI_EXPRESS_PME_CONTROL | \
OSC_PCI_EXPRESS_AER_CONTROL | \
- OSC_PCI_EXPRESS_DPC_CONTROL)
+ OSC_PCI_EXPRESS_DPC_CONTROL | \
+ OSC_PCI_EXPRESS_FLIT_CONTROL)
struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
struct acpi_pci_root_ops *ops,
@@ -1095,17 +1102,19 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
OSC_OWNER(ctrl, OSC_PCI_EXPRESS_PME_CONTROL, host_bridge->native_pme);
OSC_OWNER(ctrl, OSC_PCI_EXPRESS_LTR_CONTROL, host_bridge->native_ltr);
OSC_OWNER(ctrl, OSC_PCI_EXPRESS_DPC_CONTROL, host_bridge->native_dpc);
+ OSC_OWNER(ctrl, OSC_PCI_EXPRESS_FLIT_CONTROL, host_bridge->native_flit);
OSC_OWNER(ext_ctrl, OSC_CXL_ERROR_REPORTING_CONTROL,
host_bridge->native_cxl_error);
- dev_info(&root->device->dev, "OS native features: SHPCHotplug%c PCIeHotplug%c PME%c AER%c DPC%c LTR%c\n",
+ dev_info(&root->device->dev, "OS native features: SHPCHotplug%c PCIeHotplug%c PME%c AER%c DPC%c LTR%c FlitLogging%c\n",
FLAG(host_bridge->native_shpc_hotplug),
FLAG(host_bridge->native_pcie_hotplug),
FLAG(host_bridge->native_pme),
FLAG(host_bridge->native_aer),
FLAG(host_bridge->native_dpc),
- FLAG(host_bridge->native_ltr));
+ FLAG(host_bridge->native_ltr),
+ FLAG(host_bridge->native_flit));
acpi_dev_power_up_children_with_adr(device);
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 9d97a832785e..36d67b9c8f62 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -907,6 +907,7 @@ static void vmd_copy_host_bridge_flags(struct pci_host_bridge *root_bridge,
vmd_bridge->native_pme = root_bridge->native_pme;
vmd_bridge->native_ltr = root_bridge->native_ltr;
vmd_bridge->native_dpc = root_bridge->native_dpc;
+ vmd_bridge->native_flit = root_bridge->native_flit;
}
/*
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7c6f2aba8144..5effe559a876 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1823,6 +1823,7 @@ int pci_save_state(struct pci_dev *dev)
pci_save_dpc_state(dev);
pci_save_aer_state(dev);
+ pci_save_flit_state(dev);
pci_save_ptm_state(dev);
pci_save_tph_state(dev);
return pci_save_vc_state(dev);
@@ -1895,6 +1896,7 @@ void pci_restore_state(struct pci_dev *dev)
pci_aer_clear_status(dev);
pci_restore_aer_state(dev);
+ pci_restore_flit_state(dev);
pci_restore_config_space(dev);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 2f21246380dd..c755b2f3aef7 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -954,6 +954,20 @@ static inline void pci_dpc_init(struct pci_dev *pdev) { }
static inline bool pci_dpc_recovered(struct pci_dev *pdev) { return false; }
#endif
+#ifdef CONFIG_PCIE_FLIT
+void pci_flit_init(struct pci_dev *pdev);
+void pci_flit_exit(struct pci_dev *pdev);
+void pci_save_flit_state(struct pci_dev *pdev);
+void pci_restore_flit_state(struct pci_dev *pdev);
+bool pci_flit_uses_irq(struct pci_dev *pdev);
+#else
+static inline void pci_flit_init(struct pci_dev *pdev) { }
+static inline void pci_flit_exit(struct pci_dev *pdev) { }
+static inline void pci_save_flit_state(struct pci_dev *pdev) { }
+static inline void pci_restore_flit_state(struct pci_dev *pdev) { }
+static inline bool pci_flit_uses_irq(struct pci_dev *pdev) { return false; }
+#endif
+
#ifdef CONFIG_PCIEPORTBUS
void pci_rcec_init(struct pci_dev *dev);
void pci_rcec_exit(struct pci_dev *dev);
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
index 4d097c53f140..b30147d064eb 100644
--- a/drivers/pci/pcie/Kconfig
+++ b/drivers/pci/pcie/Kconfig
@@ -140,3 +140,12 @@ config PCIE_PTM
config PCIE_EDR
def_bool y
depends on PCIE_DPC && ACPI
+
+config PCIE_FLIT
+ bool "PCI Express Flit Logging support"
+ depends on PCIEAER
+ help
+ This enables support for the PCI Express Flit Logging Extended
+ Capability, which logs errors encountered by a port operating
+ in PCIe Flit Mode. If your system doesn't have this capability
+ or you do not want to use this feature, it is safe to answer N.
diff --git a/drivers/pci/pcie/Makefile b/drivers/pci/pcie/Makefile
index b0b43a18c304..14a5222920b9 100644
--- a/drivers/pci/pcie/Makefile
+++ b/drivers/pci/pcie/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_PCIE_PME) += pme.o
obj-$(CONFIG_PCIE_DPC) += dpc.o
obj-$(CONFIG_PCIE_PTM) += ptm.o
obj-$(CONFIG_PCIE_EDR) += edr.o
+obj-$(CONFIG_PCIE_FLIT) += flit.o
diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
new file mode 100644
index 000000000000..00409dd7bb95
--- /dev/null
+++ b/drivers/pci/pcie/flit.c
@@ -0,0 +1,407 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Service driver for PCIe Flit Logging Extended Capability
+ *
+ * Copyright (c) 2026, Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Authors: Avadhut Naik <Avadhut.Naik@amd.com>
+ * Yazen Ghannam <Yazen.Ghannam@amd.com>
+ */
+
+#define pr_fmt(fmt) "Flit: " fmt
+#define dev_fmt pr_fmt
+
+#include <linux/bitfield.h>
+#include <linux/dev_printk.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/pci.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+
+#include "portdrv.h"
+#include "../pci.h"
+
+/* Highest trigger that fires: an event needs the count to exceed it */
+#define FLIT_DEFAULT_TRIGGER 0xfe
+
+/* More Entries can be set again mid-drain, so bound the loop */
+#define FLIT_MAX_LOG_ENTRIES 0xff
+
+/* An entry with none of these set and Flit Error Log 2 zero is Reserved */
+#define FLIT_ERR_LOG1_ERROR (PCI_FLIT_ERR_LOG1_UNRECOG | \
+ PCI_FLIT_ERR_LOG1_FEC_UNCOR | \
+ PCI_FLIT_ERR_LOG1_SYND_PARITY0 | \
+ PCI_FLIT_ERR_LOG1_SYND_CHECK0)
+
+enum flit_save_slot {
+ FLIT_SAVE_CNTR_CTRL,
+ FLIT_SAVE_SLOTS
+};
+
+struct flit_cntr {
+ u16 ctrl; /* Control register offset */
+ u16 sta; /* Status register offset */
+ enum flit_save_slot slot; /* save buffer slot of Control */
+ u32 en; /* Counter Enable */
+ u32 intr_en; /* Interrupt Enable */
+ u32 trigger; /* Trigger Event on Error Count */
+ u32 intr_gen; /* Status: Interrupt Generated */
+};
+
+static const struct flit_cntr flit_base_cntr = {
+ .ctrl = PCI_FLIT_ERR_CNTR_CTRL,
+ .sta = PCI_FLIT_ERR_CNTR_STA,
+ .slot = FLIT_SAVE_CNTR_CTRL,
+ .en = PCI_FLIT_ERR_CNTR_CTRL_EN,
+ .intr_en = PCI_FLIT_ERR_CNTR_CTRL_INTR_EN,
+ .trigger = PCI_FLIT_ERR_CNTR_CTRL_TRIGGER,
+ .intr_gen = PCI_FLIT_ERR_CNTR_STA_INTR_GEN,
+};
+
+struct flit_info {
+ spinlock_t lock; /* serializes Counter Control read-modify-write */
+ const struct flit_cntr *cntr; /* the counter the driver runs */
+ u32 enable; /* what flit_cntr_enable() turns on */
+ u16 trigger; /* Trigger Event on Error Count to program */
+ bool cntr_enabled; /* Counter Enable as the driver intends it */
+};
+
+/* The port types pcie_portdrv_probe() claims */
+static bool flit_is_port(struct pci_dev *pdev)
+{
+ if (!pci_is_pcie(pdev))
+ return false;
+
+ switch (pci_pcie_type(pdev)) {
+ case PCI_EXP_TYPE_ROOT_PORT:
+ case PCI_EXP_TYPE_UPSTREAM:
+ case PCI_EXP_TYPE_DOWNSTREAM:
+ case PCI_EXP_TYPE_RC_EC:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/* Flit Logging control is only meaningful alongside AER control */
+static bool flit_is_native(struct pci_dev *pdev)
+{
+ struct pci_host_bridge *host = pci_find_host_bridge(pdev->bus);
+
+ return host->native_flit && host->native_aer;
+}
+
+static u32 flit_cntr_read(struct pci_dev *pdev, u16 reg)
+{
+ int pos = pdev->flit_cap + reg;
+ u16 val16;
+
+ pci_read_config_word(pdev, pos, &val16);
+
+ /* Keep an error response recognizable to PCI_POSSIBLE_ERROR() */
+ return PCI_POSSIBLE_ERROR(val16) ? ~0U : val16;
+}
+
+static void flit_cntr_write(struct pci_dev *pdev, u16 reg, u32 val)
+{
+ pci_write_config_word(pdev, pdev->flit_cap + reg, val);
+}
+
+void pci_flit_init(struct pci_dev *pdev)
+{
+ struct flit_info *info;
+ u16 trigger;
+ u32 ctrl;
+
+ if (!flit_is_port(pdev) || !flit_is_native(pdev))
+ return;
+
+ pdev->flit_cap = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_FLIT);
+ if (!pdev->flit_cap)
+ return;
+
+ info = kzalloc_obj(*info);
+ if (!info) {
+ pdev->flit_cap = 0;
+ return;
+ }
+
+ pdev->flit_info = info;
+
+ spin_lock_init(&info->lock);
+
+ info->cntr = &flit_base_cntr;
+ info->enable = info->cntr->en | info->cntr->intr_en;
+
+ ctrl = flit_cntr_read(pdev, info->cntr->ctrl);
+ trigger = field_get(info->cntr->trigger, ctrl);
+ info->trigger = trigger ? trigger : FLIT_DEFAULT_TRIGGER;
+
+ pci_add_ext_cap_save_buffer(pdev, PCI_EXT_CAP_ID_FLIT,
+ FLIT_SAVE_SLOTS * sizeof(u32));
+}
+
+void pci_flit_exit(struct pci_dev *pdev)
+{
+ kfree(pdev->flit_info);
+ pdev->flit_info = NULL;
+ pdev->flit_cap = 0;
+}
+
+static u32 *flit_save_slots(struct pci_dev *pdev)
+{
+ struct pci_cap_saved_state *save_state;
+
+ save_state = pci_find_saved_ext_cap(pdev, PCI_EXT_CAP_ID_FLIT);
+
+ return save_state ? save_state->cap.data : NULL;
+}
+
+void pci_save_flit_state(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ const struct flit_cntr *cntr;
+ u16 flit = pdev->flit_cap;
+ unsigned long flags;
+ u32 *slots;
+ u16 ctrl;
+
+ if (!flit)
+ return;
+
+ slots = flit_save_slots(pdev);
+ if (!slots)
+ return;
+
+ cntr = info->cntr;
+
+ spin_lock_irqsave(&info->lock, flags);
+ pci_read_config_word(pdev, flit + PCI_FLIT_ERR_CNTR_CTRL, &ctrl);
+ slots[FLIT_SAVE_CNTR_CTRL] = ctrl;
+
+ /* Counter Enable is clear in the register while an event is serviced */
+ if (info->cntr_enabled)
+ slots[cntr->slot] |= cntr->en;
+ else
+ slots[cntr->slot] &= ~cntr->en;
+ spin_unlock_irqrestore(&info->lock, flags);
+}
+
+void pci_restore_flit_state(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ u16 flit = pdev->flit_cap;
+ unsigned long flags;
+ u32 *slots;
+
+ if (!flit)
+ return;
+
+ slots = flit_save_slots(pdev);
+ if (!slots)
+ return;
+
+ /* Event servicing can run during a runtime resume or slot reset */
+ spin_lock_irqsave(&info->lock, flags);
+ pci_write_config_word(pdev, flit + PCI_FLIT_ERR_CNTR_CTRL,
+ slots[FLIT_SAVE_CNTR_CTRL]);
+ spin_unlock_irqrestore(&info->lock, flags);
+}
+
+/* A lost update can leave the trigger at zero, which never fires */
+static void __flit_cntr_ctrl_update(struct pci_dev *pdev, u32 clear, u32 set)
+{
+ const struct flit_cntr *cntr = pdev->flit_info->cntr;
+ int pos = pdev->flit_cap + cntr->ctrl;
+
+ lockdep_assert_held(&pdev->flit_info->lock);
+
+ pci_clear_and_set_config_word(pdev, pos, clear, set);
+}
+
+/* pcie_do_recovery() restores the save buffer without saving it first */
+static void __flit_save_state_update(struct pci_dev *pdev,
+ enum flit_save_slot slot,
+ u32 clear, u32 set)
+{
+ u32 *slots;
+
+ lockdep_assert_held(&pdev->flit_info->lock);
+
+ slots = flit_save_slots(pdev);
+ if (!slots)
+ return;
+
+ slots[slot] &= ~clear;
+ slots[slot] |= set;
+}
+
+static void flit_cntr_enable(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ const struct flit_cntr *cntr = info->cntr;
+ u32 ctrl = cntr->en | cntr->intr_en;
+ unsigned long flags;
+
+ spin_lock_irqsave(&info->lock, flags);
+ info->cntr_enabled = true;
+
+ /* A 0->1 transition of Counter Enable clears stale event status */
+ __flit_cntr_ctrl_update(pdev, cntr->en, 0);
+ __flit_cntr_ctrl_update(pdev, cntr->trigger | ctrl,
+ field_prep(cntr->trigger, info->trigger) |
+ info->enable);
+ __flit_save_state_update(pdev, cntr->slot, ctrl, info->enable);
+ spin_unlock_irqrestore(&info->lock, flags);
+}
+
+static void flit_cntr_disable(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ unsigned long flags;
+
+ spin_lock_irqsave(&info->lock, flags);
+ info->cntr_enabled = false;
+ __flit_cntr_ctrl_update(pdev, info->enable, 0);
+ __flit_save_state_update(pdev, info->cntr->slot, info->enable, 0);
+ spin_unlock_irqrestore(&info->lock, flags);
+}
+
+/* Stop counting until the log is drained */
+static void flit_cntr_pause(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ unsigned long flags;
+
+ spin_lock_irqsave(&info->lock, flags);
+ __flit_cntr_ctrl_update(pdev, info->cntr->en, 0);
+ spin_unlock_irqrestore(&info->lock, flags);
+}
+
+/* Re-arm event generation, unless flit_cntr_disable() ran meanwhile */
+static void flit_cntr_resume(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ unsigned long flags;
+
+ spin_lock_irqsave(&info->lock, flags);
+ if (info->cntr_enabled)
+ __flit_cntr_ctrl_update(pdev, 0, info->cntr->en);
+ spin_unlock_irqrestore(&info->lock, flags);
+}
+
+static void flit_report(struct pci_dev *pdev, u32 err_log1, u32 err_log2)
+{
+ if (!(err_log1 & FLIT_ERR_LOG1_ERROR) && !err_log2)
+ return;
+
+ pci_warn(pdev, "ErrLog1: 0x%08x ErrLog2: 0x%08x\n", err_log1, err_log2);
+}
+
+static void flit_drain_log(struct pci_dev *pdev)
+{
+ u16 flit = pdev->flit_cap;
+ u32 err_log1, err_log2;
+ unsigned int i;
+
+ for (i = 0; i < FLIT_MAX_LOG_ENTRIES; i++) {
+ pci_read_config_dword(pdev, flit + PCI_FLIT_ERR_LOG1, &err_log1);
+
+ if (PCI_POSSIBLE_ERROR(err_log1) || !(err_log1 & PCI_FLIT_ERR_LOG1_VALID))
+ break;
+
+ pci_read_config_dword(pdev, flit + PCI_FLIT_ERR_LOG2, &err_log2);
+
+ flit_report(pdev, err_log1, err_log2);
+
+ /* Clearing Valid loads the next entry */
+ pci_write_config_dword(pdev, flit + PCI_FLIT_ERR_LOG1, err_log1);
+
+ if (!(err_log1 & PCI_FLIT_ERR_LOG1_MORE))
+ break;
+ }
+}
+
+static irqreturn_t flit_ist(int irq, void *context)
+{
+ struct pcie_device *dev = (struct pcie_device *)context;
+ struct pci_dev *pdev = dev->port;
+
+ flit_drain_log(pdev);
+ flit_cntr_resume(pdev);
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t flit_isr(int irq, void *context)
+{
+ struct pcie_device *dev = (struct pcie_device *)context;
+ struct pci_dev *pdev = dev->port;
+ const struct flit_cntr *cntr;
+ u32 sta;
+
+ cntr = pdev->flit_info->cntr;
+
+ sta = flit_cntr_read(pdev, cntr->sta);
+ if (PCI_POSSIBLE_ERROR(sta) || !(sta & cntr->intr_gen))
+ return IRQ_NONE;
+
+ /* On INTx the line stays asserted until the status is cleared */
+ flit_cntr_pause(pdev);
+ flit_cntr_write(pdev, cntr->sta, cntr->intr_gen);
+ return IRQ_WAKE_THREAD;
+}
+
+bool pci_flit_uses_irq(struct pci_dev *pdev)
+{
+ return !!pdev->flit_info;
+}
+
+static int flit_probe(struct pcie_device *dev)
+{
+ struct pci_dev *pdev = dev->port;
+ int status;
+
+ status = request_threaded_irq(dev->irq, flit_isr, flit_ist,
+ IRQF_SHARED, "pcie-flit", dev);
+ if (status) {
+ pci_warn(pdev, "request Flit IRQ %d failed: %d\n", dev->irq, status);
+ return status;
+ }
+
+ flit_cntr_enable(pdev);
+
+ return 0;
+}
+
+/* No suspend callbacks: pci_save_state() would save the counter disabled */
+static int flit_cntr_restore(struct pcie_device *dev)
+{
+ flit_cntr_enable(dev->port);
+ return 0;
+}
+
+/* Disable first, or an event can assert a shared INTx line with no handler */
+static void flit_cntr_remove(struct pcie_device *dev)
+{
+ flit_cntr_disable(dev->port);
+ free_irq(dev->irq, dev);
+}
+
+static struct pcie_port_service_driver flitdriver = {
+ .name = "flit",
+ .port_type = PCIE_ANY_PORT,
+ .service = PCIE_PORT_SERVICE_FLIT,
+ .probe = flit_probe,
+ .resume = flit_cntr_restore,
+ .runtime_resume = flit_cntr_restore,
+ .slot_reset = flit_cntr_restore,
+ .remove = flit_cntr_remove,
+};
+
+int __init pcie_flit_init(void)
+{
+ return pcie_port_service_register(&flitdriver);
+}
diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 17a2d4a12349..dd59b0147edd 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -273,6 +273,9 @@ static int get_port_device_capability(struct pci_dev *dev)
services |= PCIE_PORT_SERVICE_BWCTRL;
}
+ if (pci_flit_uses_irq(dev))
+ services |= PCIE_PORT_SERVICE_FLIT;
+
return services;
}
@@ -829,6 +832,7 @@ static void __init pcie_init_services(void)
pcie_dpc_init();
pcie_bwctrl_init();
pcie_hp_init();
+ pcie_flit_init();
}
static int __init pcie_portdrv_init(void)
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index 31fda7a09f0f..a342338e2bf7 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -22,13 +22,16 @@
#define PCIE_PORT_SERVICE_DPC (1 << PCIE_PORT_SERVICE_DPC_SHIFT)
#define PCIE_PORT_SERVICE_BWCTRL_SHIFT 4 /* Bandwidth Controller (notifications) */
#define PCIE_PORT_SERVICE_BWCTRL (1 << PCIE_PORT_SERVICE_BWCTRL_SHIFT)
+#define PCIE_PORT_SERVICE_FLIT_SHIFT 5 /* Flit Logging */
+#define PCIE_PORT_SERVICE_FLIT (1 << PCIE_PORT_SERVICE_FLIT_SHIFT)
/* Services sharing the PCI Express Capability Interrupt Message Number */
#define PCIE_PORT_SERVICES_EXPCAP (PCIE_PORT_SERVICE_PME | \
PCIE_PORT_SERVICE_HP | \
- PCIE_PORT_SERVICE_BWCTRL)
+ PCIE_PORT_SERVICE_BWCTRL | \
+ PCIE_PORT_SERVICE_FLIT)
-#define PCIE_PORT_DEVICE_MAXSERVICES 5
+#define PCIE_PORT_DEVICE_MAXSERVICES 6
#ifdef CONFIG_PCIEAER
int pcie_aer_init(void);
@@ -54,6 +57,12 @@ int pcie_dpc_init(void);
static inline int pcie_dpc_init(void) { return 0; }
#endif
+#ifdef CONFIG_PCIE_FLIT
+int pcie_flit_init(void);
+#else
+static inline int pcie_flit_init(void) { return 0; }
+#endif
+
int pcie_bwctrl_init(void);
/* Port Type */
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 9a178e0e5f7f..1fe043d4489e 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -676,6 +676,7 @@ static void pci_init_host_bridge(struct pci_host_bridge *bridge)
bridge->native_pme = port_services;
bridge->native_ltr = 1;
bridge->native_dpc = port_services;
+ bridge->native_flit = port_services;
bridge->domain_nr = PCI_DOMAIN_NR_NOT_SET;
bridge->native_cxl_error = 1;
bridge->dev.type = &pci_host_bridge_type;
@@ -2472,6 +2473,7 @@ static void pci_configure_device(struct pci_dev *dev)
static void pci_release_capabilities(struct pci_dev *dev)
{
+ pci_flit_exit(dev);
pci_aer_exit(dev);
pci_rcec_exit(dev);
pci_iov_release(dev);
@@ -2674,6 +2676,7 @@ static void pci_init_capabilities(struct pci_dev *dev)
pci_acs_init(dev); /* Access Control Services */
pci_ptm_init(dev); /* Precision Time Measurement */
pci_aer_init(dev); /* Advanced Error Reporting */
+ pci_flit_init(dev); /* Flit Logging */
pci_dpc_init(dev); /* Downstream Port Containment */
pci_rcec_init(dev); /* Root Complex Event Collector */
pci_doe_init(dev); /* Data Object Exchange */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 9d3f039ebd94..fa9d0bfbcb82 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -667,6 +667,7 @@ extern u32 osc_sb_native_usb4_control;
#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010
#define OSC_PCI_EXPRESS_LTR_CONTROL 0x00000020
#define OSC_PCI_EXPRESS_DPC_CONTROL 0x00000080
+#define OSC_PCI_EXPRESS_FLIT_CONTROL 0x00000800
/* CXL _OSC: Capabilities DWORD 4: Support Field */
#define OSC_CXL_1_1_PORT_REG_ACCESS_SUPPORT 0x00000001
diff --git a/include/linux/pci.h b/include/linux/pci.h
index aa3765a20a96..46cbc76edeaa 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -599,6 +599,11 @@ struct pci_dev {
u8 tph_mode; /* TPH mode */
u8 tph_req_type; /* TPH requester type */
#endif
+
+#ifdef CONFIG_PCIE_FLIT
+ u16 flit_cap; /* Flit Logging Capability offset */
+ struct flit_info *flit_info; /* Flit Logging state */
+#endif
};
static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
@@ -667,6 +672,7 @@ struct pci_host_bridge {
unsigned int native_pme:1; /* OS may use PCIe PME */
unsigned int native_ltr:1; /* OS may use PCIe LTR */
unsigned int native_dpc:1; /* OS may use PCIe DPC */
+ unsigned int native_flit:1; /* OS may use PCIe Flit logging */
unsigned int native_cxl_error:1; /* OS may use CXL RAS/Events */
unsigned int preserve_config:1; /* Preserve FW resource setup */
unsigned int size_windows:1; /* Enable root bus sizing */
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index facaa324bd86..73482024359b 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -763,7 +763,8 @@
#define PCI_EXT_CAP_ID_DEV3 0x2F /* Device 3 Capability/Control/Status */
#define PCI_EXT_CAP_ID_IDE 0x30 /* Integrity and Data Encryption */
#define PCI_EXT_CAP_ID_PL_64GT 0x31 /* Physical Layer 64.0 GT/s */
-#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_64GT
+#define PCI_EXT_CAP_ID_FLIT 0x32 /* Flit Logging */
+#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_FLIT
#define PCI_EXT_CAP_DSN_SIZEOF 12
#define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40
@@ -1187,6 +1188,22 @@
/* Physical Layer 64.0 GT/s */
#define PCI_PL_64GT_LE_CTRL 0x20 /* Lane Equalization Control Register */
+/* Flit Logging Extended Capability */
+#define PCI_FLIT_ERR_LOG1 0x04 /* Flit Error Log 1 Register */
+#define PCI_FLIT_ERR_LOG1_VALID 0x00000001 /* Flit Error Log Valid */
+#define PCI_FLIT_ERR_LOG1_MORE 0x00002000 /* More Entries Valid */
+#define PCI_FLIT_ERR_LOG1_UNRECOG 0x00004000 /* Unrecognized Flit */
+#define PCI_FLIT_ERR_LOG1_FEC_UNCOR 0x00008000 /* FEC Uncorrectable Error in Flit */
+#define PCI_FLIT_ERR_LOG1_SYND_PARITY0 0x00ff0000 /* Syndrome Parity for ECC Group 0 */
+#define PCI_FLIT_ERR_LOG1_SYND_CHECK0 0xff000000 /* Syndrome Check for ECC Group 0 */
+#define PCI_FLIT_ERR_LOG2 0x08 /* Flit Error Log 2 Register */
+#define PCI_FLIT_ERR_CNTR_CTRL 0x0c /* Flit Error Counter Control Register */
+#define PCI_FLIT_ERR_CNTR_CTRL_EN 0x0001 /* Flit Error Counter Enable */
+#define PCI_FLIT_ERR_CNTR_CTRL_INTR_EN 0x0002 /* Flit Error Counter Interrupt Enable */
+#define PCI_FLIT_ERR_CNTR_CTRL_TRIGGER 0x0ff0 /* Trigger Event on Error Count */
+#define PCI_FLIT_ERR_CNTR_STA 0x0e /* Flit Error Counter Status Register */
+#define PCI_FLIT_ERR_CNTR_STA_INTR_GEN 0x0008 /* Interrupt Generated based on Trigger */
+
/* Native PCIe Enclosure Management */
#define PCI_NPEM_CAP 0x04 /* NPEM capability register */
#define PCI_NPEM_CAP_CAPABLE 0x00000001 /* NPEM Capable */
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v3 3/6] PCI/FLIT: Add support for Flit Logging Extended Capability
2026-12-04 18:15 ` [PATCH v3 3/6] PCI/FLIT: Add support for Flit Logging Extended Capability Yazen Ghannam
@ 2026-12-04 18:42 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-12-04 18:42 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [Medium] PCI/FLIT: flitdriver omits suspend and runtime_suspend
callbacks
- [Medium] PCI/FLIT: flit_cntr_enable() omits trigger update in saved
state buffer
- [Medium] PCI/FLIT: unratelimited pci_warn() in flit_report() can flood
logs
- [Medium] PCI/FLIT: restore and enable paths overwrite
flit_cntr_pause() mid-drain
- [Low] PCI/FLIT: pci_flit_init() ignores PCI_POSSIBLE_ERROR() from
flit_cntr_read()
--
commit 9ae9be8138a1e81dfc7aa4e70ca57f2664899c69
Author: Yazen Ghannam <yazen.ghannam@amd.com>
PCI/FLIT: Add support for Flit Logging Extended Capability
This commit adds a PCIe port service driver for the Flit Logging Extended
Capability, along with ACPI _OSC control negotiation and config state
save/restore support.
Link: https://pcisig.com/specification/extend-osc-negotiate-control-pcie-flit-logging-extended-capability
> diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
> new file mode 100644
> index 0000000000000..00409dd7bb956
> --- /dev/null
> +++ b/drivers/pci/pcie/flit.c
[ ... ]
> + ctrl = flit_cntr_read(pdev, info->cntr->ctrl);
> + trigger = field_get(info->cntr->trigger, ctrl);
> + info->trigger = trigger ? trigger : FLIT_DEFAULT_TRIGGER;
[Severity: Low]
Should pci_flit_init() check PCI_POSSIBLE_ERROR(ctrl) before extracting
trigger?
flit_cntr_read() translates a 0xffff config read error to ~0U for
PCI_POSSIBLE_ERROR(), so a failed read leaves trigger as 0xff instead of
falling back to FLIT_DEFAULT_TRIGGER (0xfe). Because an event requires the
count to exceed the trigger, 0xff prevents Flit events from ever firing on
that port.
[ ... ]
> +static void flit_cntr_enable(struct pci_dev *pdev)
> +{
> + struct flit_info *info = pdev->flit_info;
> + const struct flit_cntr *cntr = info->cntr;
> + u32 ctrl = cntr->en | cntr->intr_en;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&info->lock, flags);
> + info->cntr_enabled = true;
> +
> + /* A 0->1 transition of Counter Enable clears stale event status */
> + __flit_cntr_ctrl_update(pdev, cntr->en, 0);
> + __flit_cntr_ctrl_update(pdev, cntr->trigger | ctrl,
> + field_prep(cntr->trigger, info->trigger) |
> + info->enable);
> + __flit_save_state_update(pdev, cntr->slot, ctrl, info->enable);
> + spin_unlock_irqrestore(&info->lock, flags);
> +}
[Severity: Medium]
Should __flit_save_state_update() also update cntr->trigger with
field_prep(cntr->trigger, info->trigger)?
If flit_probe() runs after pci_save_state() captured the hardware reset
default trigger of 0 (for instance under driver_async_probe=flit or a manual
sysfs bind), slots[FLIT_SAVE_CNTR_CTRL] still holds trigger 0. During
pcie_portdrv_slot_reset(), flit_cntr_restore() runs before
pci_restore_state() with no save in between, so pci_restore_flit_state()
writes that stale 0 trigger back to PCI_FLIT_ERR_CNTR_CTRL and stops Flit
events from firing.
[ ... ]
> +/* Stop counting until the log is drained */
> +static void flit_cntr_pause(struct pci_dev *pdev)
> +{
> + struct flit_info *info = pdev->flit_info;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&info->lock, flags);
> + __flit_cntr_ctrl_update(pdev, info->cntr->en, 0);
> + spin_unlock_irqrestore(&info->lock, flags);
> +}
> +
> +/* Re-arm event generation, unless flit_cntr_disable() ran meanwhile */
> +static void flit_cntr_resume(struct pci_dev *pdev)
> +{
> + struct flit_info *info = pdev->flit_info;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&info->lock, flags);
> + if (info->cntr_enabled)
> + __flit_cntr_ctrl_update(pdev, 0, info->cntr->en);
> + spin_unlock_irqrestore(&info->lock, flags);
> +}
[Severity: Medium]
Can pci_restore_flit_state() and flit_cntr_enable() re-enable cntr->en while
flit_ist() is still draining the log?
flit_cntr_pause() clears cntr->en in hardware without recording paused state
in struct flit_info, so a concurrent restore or enable re-arms the counter
mid-drain:
CPU0 (slot_reset) CPU1 (flit_isr / flit_ist)
pcie_portdrv_slot_reset()
flit_cntr_restore()
flit_cntr_enable()
flit_isr()
flit_cntr_pause()
return IRQ_WAKE_THREAD
pci_restore_state()
pci_restore_flit_state() <-- re-enables cntr->en mid-drain
flit_ist() (draining log)
flit_isr() (2nd IRQ)
flit_cntr_pause()
return IRQ_WAKE_THREAD
flit_ist() finishes 1st pass
flit_cntr_resume() <-- unpauses early
The same race can happen during pci_pm_runtime_resume() or flit_probe() when
flit_isr() pauses the counter before flit_cntr_enable() runs, where the 0->1
toggle of cntr->en can also clear pending event status. Tracking whether an
event drain is in progress under info->lock would prevent restore and enable
paths from re-enabling cntr->en early.
> +static void flit_report(struct pci_dev *pdev, u32 err_log1, u32 err_log2)
> +{
> + if (!(err_log1 & FLIT_ERR_LOG1_ERROR) && !err_log2)
> + return;
> +
> + pci_warn(pdev, "ErrLog1: 0x%08x ErrLog2: 0x%08x\n", err_log1, err_log2);
> +}
[Severity: Medium]
Should pci_warn() in flit_report() be ratelimited?
flit_drain_log() can invoke flit_report() up to 255 times per interrupt,
including for FEC-correctable syndrome errors, and flit_ist() immediately
re-arms the counter via flit_cntr_resume(). On a noisy Flit Mode link this
can flood dmesg and slow serial consoles enough to cause latency spikes or
soft lockups. Draining the FIFO while ratelimiting the log messages (as AER
does with per-device ratelimit_state) would avoid this.
[ ... ]
> +/* No suspend callbacks: pci_save_state() would save the counter disabled */
> +static int flit_cntr_restore(struct pcie_device *dev)
> +{
> + flit_cntr_enable(dev->port);
> + return 0;
> +}
> +
> +/* Disable first, or an event can assert a shared INTx line with no handler */
> +static void flit_cntr_remove(struct pcie_device *dev)
> +{
> + flit_cntr_disable(dev->port);
> + free_irq(dev->irq, dev);
> +}
> +
> +static struct pcie_port_service_driver flitdriver = {
> + .name = "flit",
> + .port_type = PCIE_ANY_PORT,
> + .service = PCIE_PORT_SERVICE_FLIT,
> + .probe = flit_probe,
> + .resume = flit_cntr_restore,
> + .runtime_resume = flit_cntr_restore,
> + .slot_reset = flit_cntr_restore,
> + .remove = flit_cntr_remove,
> +};
[Severity: Medium]
Can omitting .suspend and .runtime_suspend on flitdriver cause spurious
wakeups and a D3cold config-write race with flit_ist()?
PCIE_PORT_SERVICE_FLIT is part of PCIE_PORT_SERVICES_EXPCAP and shares its
IRQ with PME, which calls enable_irq_wake() in pcie_pme_suspend(). Leaving
the Flit counter and its interrupt enabled across suspend allows Flit events
to fire the shared wakeup IRQ and spuriously wake the system during s2idle.
During runtime suspend, pci_pm_runtime_suspend() transitions the port to
D3hot/D3cold without synchronizing threaded IRQs, and flit_ist() holds no
runtime PM reference:
CPU0 (runtime suspend) CPU1 (flit_ist)
flit_isr()
return IRQ_WAKE_THREAD
pci_pm_runtime_suspend()
pci_save_state()
pci_finish_runtime_suspend()
(port enters D3cold)
flit_ist()
flit_drain_log()
flit_cntr_resume()
pci_clear_and_set_config_word()
<-- reads/writes 0xffff in D3cold
Saving the counter enabled also causes pci_restore_state() to re-enable Flit
interrupts in pci_restore_flit_state() before pci_restore_config_space() and
pci_restore_msi_state() restore PCI_COMMAND and MSI/MSI-X vectors. Since
flitdriver already re-enables the counter in .resume and .runtime_resume,
.suspend and .runtime_suspend can disable the hardware counter/interrupt and
call synchronize_irq(dev->irq).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204181556.1418843-1-yazen.ghannam@amd.com?part=3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 4/6] PCI/FLIT: Add support for the Extended Flit Error Counter
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
` (2 preceding siblings ...)
2026-12-04 18:15 ` [PATCH v3 3/6] PCI/FLIT: Add support for Flit Logging Extended Capability Yazen Ghannam
@ 2026-12-04 18:15 ` Yazen Ghannam
2026-12-04 18:40 ` sashiko-bot
2026-12-04 18:15 ` [PATCH v3 5/6] PCI/FLIT: Signal Flit Error Counter events with ERR_COR Yazen Ghannam
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Yazen Ghannam @ 2026-12-04 18:15 UTC (permalink / raw)
To: bhelgaas, linux-pci, linux-kernel, linux-acpi, linux-edac; +Cc: Yazen Ghannam
Capability Version 2h adds an optional Extended Flit Error Counter, with
a 16-bit count and trigger and programmable decrement rates.[1] Use it
in place of the Flit Error Counter where present.
[1] PCIe r7.1, sec 6.38.1 and 7.7.9.17 to 7.7.9.20
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
drivers/pci/pcie/flit.c | 106 ++++++++++++++++++++++++++++++++--
include/uapi/linux/pci_regs.h | 10 ++++
2 files changed, 110 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
index 00409dd7bb95..97395b694238 100644
--- a/drivers/pci/pcie/flit.c
+++ b/drivers/pci/pcie/flit.c
@@ -37,12 +37,15 @@
enum flit_save_slot {
FLIT_SAVE_CNTR_CTRL,
+ FLIT_SAVE_EXT_CNTR_CTRL1,
+ FLIT_SAVE_EXT_CNTR_CTRL2,
FLIT_SAVE_SLOTS
};
struct flit_cntr {
u16 ctrl; /* Control register offset */
u16 sta; /* Status register offset */
+ bool dword; /* Control and Status are dwords */
enum flit_save_slot slot; /* save buffer slot of Control */
u32 en; /* Counter Enable */
u32 intr_en; /* Interrupt Enable */
@@ -60,14 +63,31 @@ static const struct flit_cntr flit_base_cntr = {
.intr_gen = PCI_FLIT_ERR_CNTR_STA_INTR_GEN,
};
+static const struct flit_cntr flit_ext_cntr = {
+ .ctrl = PCI_FLIT_EXT_CNTR_CTRL1,
+ .sta = PCI_FLIT_EXT_CNTR_STA,
+ .dword = true,
+ .slot = FLIT_SAVE_EXT_CNTR_CTRL1,
+ .en = PCI_FLIT_EXT_CNTR_CTRL1_EN,
+ .intr_en = PCI_FLIT_EXT_CNTR_CTRL1_INTR_EN,
+ .trigger = PCI_FLIT_EXT_CNTR_CTRL1_TRIGGER,
+ .intr_gen = PCI_FLIT_EXT_CNTR_STA_INTR_GEN,
+};
+
struct flit_info {
spinlock_t lock; /* serializes Counter Control read-modify-write */
const struct flit_cntr *cntr; /* the counter the driver runs */
+ u32 cntr_cap; /* Flit Error Counter Capability, 0 in 1h */
u32 enable; /* what flit_cntr_enable() turns on */
u16 trigger; /* Trigger Event on Error Count to program */
bool cntr_enabled; /* Counter Enable as the driver intends it */
};
+static bool flit_ext(struct flit_info *info)
+{
+ return info->cntr == &flit_ext_cntr;
+}
+
/* The port types pcie_portdrv_probe() claims */
static bool flit_is_port(struct pci_dev *pdev)
{
@@ -93,10 +113,46 @@ static bool flit_is_native(struct pci_dev *pdev)
return host->native_flit && host->native_aer;
}
+static u32 flit_read_cntr_cap(struct pci_dev *pdev)
+{
+ u32 hdr, cap;
+
+ pci_read_config_dword(pdev, pdev->flit_cap, &hdr);
+ if (PCI_EXT_CAP_VER(hdr) < 2)
+ return 0;
+
+ pci_read_config_dword(pdev, pdev->flit_cap + PCI_FLIT_ERR_CNTR_CAP, &cap);
+
+ return cap;
+}
+
+static void flit_select_cntr(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+
+ info->cntr = &flit_base_cntr;
+ if (!(info->cntr_cap & PCI_FLIT_ERR_CNTR_CAP_EXT))
+ return;
+
+ /* Running both counters, or both interrupts, is undefined */
+ pci_clear_and_set_config_word(pdev,
+ pdev->flit_cap + PCI_FLIT_ERR_CNTR_CTRL,
+ PCI_FLIT_ERR_CNTR_CTRL_EN |
+ PCI_FLIT_ERR_CNTR_CTRL_INTR_EN, 0);
+
+ info->cntr = &flit_ext_cntr;
+}
+
static u32 flit_cntr_read(struct pci_dev *pdev, u16 reg)
{
int pos = pdev->flit_cap + reg;
u16 val16;
+ u32 val;
+
+ if (pdev->flit_info->cntr->dword) {
+ pci_read_config_dword(pdev, pos, &val);
+ return val;
+ }
pci_read_config_word(pdev, pos, &val16);
@@ -106,12 +162,18 @@ static u32 flit_cntr_read(struct pci_dev *pdev, u16 reg)
static void flit_cntr_write(struct pci_dev *pdev, u16 reg, u32 val)
{
- pci_write_config_word(pdev, pdev->flit_cap + reg, val);
+ int pos = pdev->flit_cap + reg;
+
+ if (pdev->flit_info->cntr->dword)
+ pci_write_config_dword(pdev, pos, val);
+ else
+ pci_write_config_word(pdev, pos, val);
}
void pci_flit_init(struct pci_dev *pdev)
{
struct flit_info *info;
+ unsigned int slots;
u16 trigger;
u32 ctrl;
@@ -130,17 +192,24 @@ void pci_flit_init(struct pci_dev *pdev)
pdev->flit_info = info;
+ info->cntr_cap = flit_read_cntr_cap(pdev);
+
spin_lock_init(&info->lock);
- info->cntr = &flit_base_cntr;
+ flit_select_cntr(pdev);
info->enable = info->cntr->en | info->cntr->intr_en;
ctrl = flit_cntr_read(pdev, info->cntr->ctrl);
trigger = field_get(info->cntr->trigger, ctrl);
info->trigger = trigger ? trigger : FLIT_DEFAULT_TRIGGER;
+ slots = flit_ext(info) ? FLIT_SAVE_SLOTS : FLIT_SAVE_CNTR_CTRL + 1;
pci_add_ext_cap_save_buffer(pdev, PCI_EXT_CAP_ID_FLIT,
- FLIT_SAVE_SLOTS * sizeof(u32));
+ slots * sizeof(u32));
+
+ pci_dbg(pdev, "Flit Logging Extended Capability present, using the %s\n",
+ flit_ext(info) ? "Extended Flit Error Counter" :
+ "Flit Error Counter");
}
void pci_flit_exit(struct pci_dev *pdev)
@@ -165,7 +234,7 @@ void pci_save_flit_state(struct pci_dev *pdev)
const struct flit_cntr *cntr;
u16 flit = pdev->flit_cap;
unsigned long flags;
- u32 *slots;
+ u32 *slots, ctrl1;
u16 ctrl;
if (!flit)
@@ -181,6 +250,17 @@ void pci_save_flit_state(struct pci_dev *pdev)
pci_read_config_word(pdev, flit + PCI_FLIT_ERR_CNTR_CTRL, &ctrl);
slots[FLIT_SAVE_CNTR_CTRL] = ctrl;
+ if (flit_ext(info)) {
+ pci_read_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL1,
+ &ctrl1);
+ pci_read_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL2,
+ &slots[FLIT_SAVE_EXT_CNTR_CTRL2]);
+
+ /* Reads as zero, but restoring a one would clear the counter */
+ ctrl1 &= ~PCI_FLIT_EXT_CNTR_CTRL1_CLEAR;
+ slots[FLIT_SAVE_EXT_CNTR_CTRL1] = ctrl1;
+ }
+
/* Counter Enable is clear in the register while an event is serviced */
if (info->cntr_enabled)
slots[cntr->slot] |= cntr->en;
@@ -203,10 +283,21 @@ void pci_restore_flit_state(struct pci_dev *pdev)
if (!slots)
return;
- /* Event servicing can run during a runtime resume or slot reset */
+ /*
+ * Event servicing can run during a runtime resume or slot reset. Write
+ * Flit Error Counter Control first so the two counters never overlap,
+ * and the decrement rates before the counter they apply to.
+ */
spin_lock_irqsave(&info->lock, flags);
pci_write_config_word(pdev, flit + PCI_FLIT_ERR_CNTR_CTRL,
slots[FLIT_SAVE_CNTR_CTRL]);
+
+ if (flit_ext(info)) {
+ pci_write_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL2,
+ slots[FLIT_SAVE_EXT_CNTR_CTRL2]);
+ pci_write_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL1,
+ slots[FLIT_SAVE_EXT_CNTR_CTRL1]);
+ }
spin_unlock_irqrestore(&info->lock, flags);
}
@@ -218,7 +309,10 @@ static void __flit_cntr_ctrl_update(struct pci_dev *pdev, u32 clear, u32 set)
lockdep_assert_held(&pdev->flit_info->lock);
- pci_clear_and_set_config_word(pdev, pos, clear, set);
+ if (cntr->dword)
+ pci_clear_and_set_config_dword(pdev, pos, clear, set);
+ else
+ pci_clear_and_set_config_word(pdev, pos, clear, set);
}
/* pcie_do_recovery() restores the save buffer without saving it first */
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 73482024359b..803bfb6fbf49 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -1203,6 +1203,16 @@
#define PCI_FLIT_ERR_CNTR_CTRL_TRIGGER 0x0ff0 /* Trigger Event on Error Count */
#define PCI_FLIT_ERR_CNTR_STA 0x0e /* Flit Error Counter Status Register */
#define PCI_FLIT_ERR_CNTR_STA_INTR_GEN 0x0008 /* Interrupt Generated based on Trigger */
+#define PCI_FLIT_ERR_CNTR_CAP 0x3c /* Flit Error Counter Capability Register */
+#define PCI_FLIT_ERR_CNTR_CAP_EXT 0x00000002 /* Extended Flit Error Counter Supported */
+#define PCI_FLIT_EXT_CNTR_CTRL1 0x40 /* Ext Flit Error Counter Control 1 */
+#define PCI_FLIT_EXT_CNTR_CTRL1_EN 0x00000001 /* Ext Flit Error Counter Enable */
+#define PCI_FLIT_EXT_CNTR_CTRL1_INTR_EN 0x00000002 /* Ext Flit Error Counter Intr Enable */
+#define PCI_FLIT_EXT_CNTR_CTRL1_CLEAR 0x00000010 /* Clear Ext Flit Error Counter */
+#define PCI_FLIT_EXT_CNTR_CTRL1_TRIGGER 0x001fffe0 /* Trigger Event on Ext Error Count */
+#define PCI_FLIT_EXT_CNTR_CTRL2 0x44 /* Ext Flit Error Counter Control 2 */
+#define PCI_FLIT_EXT_CNTR_STA 0x48 /* Ext Flit Error Counter Status */
+#define PCI_FLIT_EXT_CNTR_STA_INTR_GEN 0x00000080 /* Intr Generated on Ext Trigger */
/* Native PCIe Enclosure Management */
#define PCI_NPEM_CAP 0x04 /* NPEM capability register */
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v3 4/6] PCI/FLIT: Add support for the Extended Flit Error Counter
2026-12-04 18:15 ` [PATCH v3 4/6] PCI/FLIT: Add support for the Extended Flit Error Counter Yazen Ghannam
@ 2026-12-04 18:40 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-12-04 18:40 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] PCI/FLIT: extended Flit error counter never cleared via CLEAR
bit
- [Medium] PCI/FLIT: slot_reset enables CTRL1 before restoring
ERR_CNTR_CTRL and CTRL2
- [Medium] PCI/FLIT: missing PCI_POSSIBLE_ERROR() checks in
flit_read_cntr_cap()
- [Medium] PCI/FLIT: flit_cntr_enable() omits trigger when updating
saved state buffer
- [Low] PCI/FLIT: pci_flit_init() lacks PCI_POSSIBLE_ERROR() check on
ctrl read
--
commit d722ed5d293f00a76cfef74bc7d0010083c5e137
Author: Yazen Ghannam <yazen.ghannam@amd.com>
PCI/FLIT: Add support for the Extended Flit Error Counter
This commit adds support for the Capability Version 2h Extended Flit Error
Counter in drivers/pci/pcie/flit.c, selecting it over the base counter when
supported and extending register access and save/restore handling to cover
the 32-bit control and status registers.
> diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
> index 00409dd7bb956..97395b6942389 100644
> --- a/drivers/pci/pcie/flit.c
> +++ b/drivers/pci/pcie/flit.c
[ ... ]
> @@ -93,10 +113,46 @@ static bool flit_is_native(struct pci_dev *pdev)
> return host->native_flit && host->native_aer;
> }
>
> +static u32 flit_read_cntr_cap(struct pci_dev *pdev)
> +{
> + u32 hdr, cap;
> +
> + pci_read_config_dword(pdev, pdev->flit_cap, &hdr);
> + if (PCI_EXT_CAP_VER(hdr) < 2)
> + return 0;
> +
> + pci_read_config_dword(pdev, pdev->flit_cap + PCI_FLIT_ERR_CNTR_CAP, &cap);
> +
> + return cap;
> +}
> +
> +static void flit_select_cntr(struct pci_dev *pdev)
> +{
> + struct flit_info *info = pdev->flit_info;
> +
> + info->cntr = &flit_base_cntr;
> + if (!(info->cntr_cap & PCI_FLIT_ERR_CNTR_CAP_EXT))
> + return;
> +
> + /* Running both counters, or both interrupts, is undefined */
> + pci_clear_and_set_config_word(pdev,
> + pdev->flit_cap + PCI_FLIT_ERR_CNTR_CTRL,
> + PCI_FLIT_ERR_CNTR_CTRL_EN |
> + PCI_FLIT_ERR_CNTR_CTRL_INTR_EN, 0);
> +
> + info->cntr = &flit_ext_cntr;
> +}
[Severity: Medium]
Should flit_read_cntr_cap() check PCI_POSSIBLE_ERROR() on both hdr and
cap? If a config read returns 0xffffffff, PCI_EXT_CAP_VER(hdr) is 0xf,
bypassing the version check and returning 0xffffffff so flit_select_cntr()
selects flit_ext_cntr.
On a Capability Version 1h device, later accesses to offsets 0x40 through
0x48 would then reach past the end of the Flit Logging capability and
could corrupt an adjacent extended capability.
[ ... ]
> @@ -130,17 +192,24 @@ void pci_flit_init(struct pci_dev *pdev)
>
> pdev->flit_info = info;
>
> + info->cntr_cap = flit_read_cntr_cap(pdev);
> +
> spin_lock_init(&info->lock);
>
> - info->cntr = &flit_base_cntr;
> + flit_select_cntr(pdev);
> info->enable = info->cntr->en | info->cntr->intr_en;
>
> ctrl = flit_cntr_read(pdev, info->cntr->ctrl);
> trigger = field_get(info->cntr->trigger, ctrl);
> info->trigger = trigger ? trigger : FLIT_DEFAULT_TRIGGER;
[Severity: Low]
Does pci_flit_init() need a PCI_POSSIBLE_ERROR(ctrl) check here? On an
all-ones error response, field_get() extracts 0xff or 0xffff instead of
falling back to FLIT_DEFAULT_TRIGGER, which can never be exceeded and
silently disables trigger events.
[ ... ]
> @@ -181,6 +250,17 @@ void pci_save_flit_state(struct pci_dev *pdev)
> pci_read_config_word(pdev, flit + PCI_FLIT_ERR_CNTR_CTRL, &ctrl);
> slots[FLIT_SAVE_CNTR_CTRL] = ctrl;
>
> + if (flit_ext(info)) {
> + pci_read_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL1,
> + &ctrl1);
> + pci_read_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL2,
> + &slots[FLIT_SAVE_EXT_CNTR_CTRL2]);
> +
> + /* Reads as zero, but restoring a one would clear the counter */
> + ctrl1 &= ~PCI_FLIT_EXT_CNTR_CTRL1_CLEAR;
> + slots[FLIT_SAVE_EXT_CNTR_CTRL1] = ctrl1;
> + }
[Severity: High]
Is the Extended Flit Error Counter ever cleared via
PCI_FLIT_EXT_CNTR_CTRL1_CLEAR?
For the base counter, flit_isr() writes cntr->intr_gen to
PCI_FLIT_ERR_CNTR_STA, zeroing the RW 8-bit count along with INTR_GEN.
For the extended counter, the 16-bit count in PCI_FLIT_EXT_CNTR_STA is
read-only and needs PCI_FLIT_EXT_CNTR_CTRL1_CLEAR.
That bit is never set anywhere in flit.c, and decrement rates in
PCI_FLIT_EXT_CNTR_CTRL2 are never programmed. After the first trigger,
flit_cntr_resume() re-enables the counter while the count still exceeds
info->trigger, causing an interrupt storm or lost notifications.
Stale counts left by firmware are likewise never cleared in
flit_cntr_enable().
[ ... ]
> @@ -203,10 +283,21 @@ void pci_restore_flit_state(struct pci_dev *pdev)
> if (!slots)
> return;
>
> - /* Event servicing can run during a runtime resume or slot reset */
> + /*
> + * Event servicing can run during a runtime resume or slot reset. Write
> + * Flit Error Counter Control first so the two counters never overlap,
> + * and the decrement rates before the counter they apply to.
> + */
> spin_lock_irqsave(&info->lock, flags);
> pci_write_config_word(pdev, flit + PCI_FLIT_ERR_CNTR_CTRL,
> slots[FLIT_SAVE_CNTR_CTRL]);
> +
> + if (flit_ext(info)) {
> + pci_write_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL2,
> + slots[FLIT_SAVE_EXT_CNTR_CTRL2]);
> + pci_write_config_dword(pdev, flit + PCI_FLIT_EXT_CNTR_CTRL1,
> + slots[FLIT_SAVE_EXT_CNTR_CTRL1]);
> + }
> spin_unlock_irqrestore(&info->lock, flags);
> }
[Severity: Medium]
Can slot_reset violate the restore ordering documented here by enabling
PCI_FLIT_EXT_CNTR_CTRL1 before PCI_FLIT_ERR_CNTR_CTRL and
PCI_FLIT_EXT_CNTR_CTRL2 are restored?
drivers/pci/pcie/portdrv.c:pcie_portdrv_slot_reset() {
size_t off = offsetof(struct pcie_port_service_driver, slot_reset);
device_for_each_child(&dev->dev, &off, pcie_port_device_iter);
pci_restore_state(dev);
return PCI_ERS_RESULT_RECOVERED;
}
flit_cntr_restore() calls flit_cntr_enable() first, enabling CTRL1 while
CTRL2 still holds post-reset defaults. pci_restore_flit_state() then
writes ERR_CNTR_CTRL and CTRL2 without clearing CTRL1 EN first (which
also happens on a non-reset resume).
In addition, if a Flit interrupt fires between flit_cntr_restore() and
pci_restore_flit_state(), restoring slots[FLIT_SAVE_EXT_CNTR_CTRL1]
unconditionally writes EN=1 and prematurely re-enables a paused counter
while flit_ist() is still draining the log.
[Severity: Medium]
Can pci_restore_flit_state() clobber the programmed trigger threshold back
to 0 after a slot reset?
drivers/pci/pcie/flit.c:flit_cntr_enable() {
...
__flit_cntr_ctrl_update(pdev, cntr->trigger | ctrl,
field_prep(cntr->trigger, info->trigger) |
info->enable);
__flit_save_state_update(pdev, cntr->slot, ctrl, info->enable);
...
}
If a port boots with a hardware trigger of 0 and pci_save_state() runs
before flit_probe() (for example with driver_async_probe=flit), the save
buffer captures trigger as 0.
Because __flit_save_state_update() omits cntr->trigger,
pci_restore_flit_state() during pcie_portdrv_slot_reset() overwrites the
programmed trigger with 0 and stops events from firing.
Updating cntr->trigger alongside ctrl in __flit_save_state_update() would
keep the save buffer consistent.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204181556.1418843-1-yazen.ghannam@amd.com?part=4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 5/6] PCI/FLIT: Signal Flit Error Counter events with ERR_COR
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
` (3 preceding siblings ...)
2026-12-04 18:15 ` [PATCH v3 4/6] PCI/FLIT: Add support for the Extended Flit Error Counter Yazen Ghannam
@ 2026-12-04 18:15 ` Yazen Ghannam
2026-12-04 18:46 ` sashiko-bot
2026-12-04 18:15 ` [PATCH v3 6/6] PCI/FLIT: Manage Flit Logging on Endpoint Upstream Ports Yazen Ghannam
2026-12-04 18:53 ` [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support sashiko-bot
6 siblings, 1 reply; 13+ messages in thread
From: Yazen Ghannam @ 2026-12-04 18:15 UTC (permalink / raw)
To: bhelgaas, linux-pci, linux-kernel, linux-acpi, linux-edac; +Cc: Yazen Ghannam
A Flit Error Counter event is signaled with the PCI Express Capability
interrupt, which only a port service can own. An Endpoint has no way to
report one.
Capability Version 2h can signal the event with an ERR_COR Message
instead.[1] Use it when supported, and keep the interrupt otherwise.
The event sets no AER status bit, so AER logs the ERR_COR but nothing
services it. Have AER check each correctable error source with the Flit
driver, both to find the source and to drain the log and restart the
counter.
A counter stays silent until its event is serviced. AER clears Root
Error Status when it enables a Root Port or RCEC, which can discard an
ERR_COR, so service every ERR_COR counter below it then.
The Extended Flit Error Counter has no ERR_COR enable of its own. Read
Flit Error Counter ERR_COR Enable as covering both counters.
[1] PCIe r7.1, sec 6.2.4.1.3, 6.2.12, 7.7.9.4, 7.7.9.5, 7.7.9.17 and
7.7.9.20
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
drivers/pci/pci.h | 6 ++
drivers/pci/pcie/aer.c | 22 +++++
drivers/pci/pcie/flit.c | 150 +++++++++++++++++++++++++++++++++-
include/uapi/linux/pci_regs.h | 8 ++
4 files changed, 184 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index c755b2f3aef7..c76c812b9524 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -960,12 +960,18 @@ void pci_flit_exit(struct pci_dev *pdev);
void pci_save_flit_state(struct pci_dev *pdev);
void pci_restore_flit_state(struct pci_dev *pdev);
bool pci_flit_uses_irq(struct pci_dev *pdev);
+bool pci_flit_err_cor_pending(struct pci_dev *pdev);
+void pci_flit_handle_err_cor(struct pci_dev *pdev);
+void pci_flit_rearm(struct pci_dev *pdev);
#else
static inline void pci_flit_init(struct pci_dev *pdev) { }
static inline void pci_flit_exit(struct pci_dev *pdev) { }
static inline void pci_save_flit_state(struct pci_dev *pdev) { }
static inline void pci_restore_flit_state(struct pci_dev *pdev) { }
static inline bool pci_flit_uses_irq(struct pci_dev *pdev) { return false; }
+static inline bool pci_flit_err_cor_pending(struct pci_dev *pdev) { return false; }
+static inline void pci_flit_handle_err_cor(struct pci_dev *pdev) { }
+static inline void pci_flit_rearm(struct pci_dev *pdev) { }
#endif
#ifdef CONFIG_PCIEPORTBUS
diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 1973b6eba6b3..376ee7498108 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -1210,6 +1210,11 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info)
if (!(reg16 & PCI_EXP_AER_FLAGS))
return false;
+ /* A Flit Error Counter event sets no AER status bit */
+ if (e_info->severity == AER_CORRECTABLE &&
+ pci_flit_err_cor_pending(dev))
+ return true;
+
if (!aer) {
pcie_capability_read_word(dev, PCI_EXP_DEVSTA, ®16);
return reg16 & severity2devsta[e_info->severity] &&
@@ -1594,6 +1599,8 @@ static inline void aer_process_err_devices(struct aer_err_info *e_info)
/* Report all before handling them, to not lose records by reset etc. */
for (i = 0; i < e_info->error_dev_num && e_info->dev[i]; i++) {
+ if (e_info->severity == AER_CORRECTABLE)
+ pci_flit_handle_err_cor(e_info->dev[i]);
if (aer_get_device_error_info(e_info, i))
aer_print_error(e_info, i);
}
@@ -1766,6 +1773,12 @@ static int clear_status_iter(struct pci_dev *dev, void *data)
return 0;
}
+static int flit_rearm_iter(struct pci_dev *dev, void *data)
+{
+ pci_flit_rearm(dev);
+ return 0;
+}
+
/**
* aer_enable_rootport - enable Root Port's interrupts when receiving messages
* @rpc: pointer to a Root Port data structure
@@ -1805,6 +1818,15 @@ static void aer_enable_rootport(struct aer_rpc *rpc)
pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, ®32);
pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, reg32);
+ /* Re-arm Flit Error Counters whose ERR_COR was never serviced */
+ if (IS_ENABLED(CONFIG_PCIE_FLIT)) {
+ pci_flit_rearm(pdev);
+ if (pci_pcie_type(pdev) == PCI_EXP_TYPE_RC_EC)
+ pcie_walk_rcec(pdev, flit_rearm_iter, NULL);
+ else if (pdev->subordinate)
+ pci_walk_bus(pdev->subordinate, flit_rearm_iter, NULL);
+ }
+
aer_enable_irq(pdev);
}
diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
index 97395b694238..83a6b50221ef 100644
--- a/drivers/pci/pcie/flit.c
+++ b/drivers/pci/pcie/flit.c
@@ -12,10 +12,12 @@
#define pr_fmt(fmt) "Flit: " fmt
#define dev_fmt pr_fmt
+#include <linux/aer.h>
#include <linux/bitfield.h>
#include <linux/dev_printk.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
@@ -51,6 +53,7 @@ struct flit_cntr {
u32 intr_en; /* Interrupt Enable */
u32 trigger; /* Trigger Event on Error Count */
u32 intr_gen; /* Status: Interrupt Generated */
+ u32 err_cor_gen; /* Status: ERR_COR Generated */
};
static const struct flit_cntr flit_base_cntr = {
@@ -61,6 +64,7 @@ static const struct flit_cntr flit_base_cntr = {
.intr_en = PCI_FLIT_ERR_CNTR_CTRL_INTR_EN,
.trigger = PCI_FLIT_ERR_CNTR_CTRL_TRIGGER,
.intr_gen = PCI_FLIT_ERR_CNTR_STA_INTR_GEN,
+ .err_cor_gen = PCI_FLIT_ERR_CNTR_STA_ERR_COR,
};
static const struct flit_cntr flit_ext_cntr = {
@@ -72,14 +76,18 @@ static const struct flit_cntr flit_ext_cntr = {
.intr_en = PCI_FLIT_EXT_CNTR_CTRL1_INTR_EN,
.trigger = PCI_FLIT_EXT_CNTR_CTRL1_TRIGGER,
.intr_gen = PCI_FLIT_EXT_CNTR_STA_INTR_GEN,
+ .err_cor_gen = PCI_FLIT_EXT_CNTR_STA_ERR_COR,
};
struct flit_info {
spinlock_t lock; /* serializes Counter Control read-modify-write */
+ struct mutex service_lock; /* serializes flit_service() */
const struct flit_cntr *cntr; /* the counter the driver runs */
u32 cntr_cap; /* Flit Error Counter Capability, 0 in 1h */
u32 enable; /* what flit_cntr_enable() turns on */
+ u32 event; /* Status bit that flags an event to service */
u16 trigger; /* Trigger Event on Error Count to program */
+ bool err_cor; /* events are signaled with ERR_COR */
bool cntr_enabled; /* Counter Enable as the driver intends it */
};
@@ -143,6 +151,48 @@ static void flit_select_cntr(struct pci_dev *pdev)
info->cntr = &flit_ext_cntr;
}
+/*
+ * The Root Port or RCEC needs AER to log the ERR_COR, and system firmware must
+ * not claim it through SIG_SFW Enable or RC ECS Handling. The device itself
+ * needs no AER Capability.
+ */
+static bool flit_err_cor_usable(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ struct pci_dev *root;
+ u32 root_cmd, sfw;
+ u16 ctrl;
+
+ if (!(info->cntr_cap & PCI_FLIT_ERR_CNTR_CAP_ERR_COR))
+ return false;
+
+ if (!pci_aer_available())
+ return false;
+
+ pci_read_config_word(pdev, pdev->flit_cap + PCI_FLIT_ERR_CNTR_CTRL,
+ &ctrl);
+ if (ctrl & PCI_FLIT_ERR_CNTR_CTRL_SIG_SFW_EN)
+ return false;
+
+ if (pci_pcie_type(pdev) == PCI_EXP_TYPE_RC_EC)
+ root = pdev;
+ else
+ root = pcie_find_root_port(pdev);
+
+ if (!root || !root->aer_cap)
+ return false;
+
+ if (pdev->devcap & PCI_EXP_DEVCAP_ECS)
+ sfw = PCI_ERR_ROOT_CMD_ECS_SIG_OS_SFW;
+ else
+ sfw = PCI_ERR_ROOT_CMD_ECS_LEGACY_SFW;
+
+ pci_read_config_dword(root, root->aer_cap + PCI_ERR_ROOT_COMMAND,
+ &root_cmd);
+
+ return !(root_cmd & sfw);
+}
+
static u32 flit_cntr_read(struct pci_dev *pdev, u16 reg)
{
int pos = pdev->flit_cap + reg;
@@ -170,6 +220,8 @@ static void flit_cntr_write(struct pci_dev *pdev, u16 reg, u32 val)
pci_write_config_word(pdev, pos, val);
}
+static void flit_cntr_enable(struct pci_dev *pdev);
+
void pci_flit_init(struct pci_dev *pdev)
{
struct flit_info *info;
@@ -193,11 +245,20 @@ void pci_flit_init(struct pci_dev *pdev)
pdev->flit_info = info;
info->cntr_cap = flit_read_cntr_cap(pdev);
+ info->err_cor = flit_err_cor_usable(pdev);
spin_lock_init(&info->lock);
+ mutex_init(&info->service_lock);
flit_select_cntr(pdev);
- info->enable = info->cntr->en | info->cntr->intr_en;
+
+ if (info->err_cor) {
+ info->enable = info->cntr->en;
+ info->event = info->cntr->err_cor_gen;
+ } else {
+ info->enable = info->cntr->en | info->cntr->intr_en;
+ info->event = info->cntr->intr_gen;
+ }
ctrl = flit_cntr_read(pdev, info->cntr->ctrl);
trigger = field_get(info->cntr->trigger, ctrl);
@@ -210,6 +271,12 @@ void pci_flit_init(struct pci_dev *pdev)
pci_dbg(pdev, "Flit Logging Extended Capability present, using the %s\n",
flit_ext(info) ? "Extended Flit Error Counter" :
"Flit Error Counter");
+
+ /* ERR_COR needs no port service, so start here, after pci_aer_init() */
+ if (info->err_cor) {
+ pci_dbg(pdev, "Flit Error Counter events signaled with ERR_COR\n");
+ flit_cntr_enable(pdev);
+ }
}
void pci_flit_exit(struct pci_dev *pdev)
@@ -332,6 +399,19 @@ static void __flit_save_state_update(struct pci_dev *pdev,
slots[slot] |= set;
}
+/* The extended counter has no ERR_COR enable, so this one covers both */
+static void __flit_err_cor_enable(struct pci_dev *pdev)
+{
+ u16 ctrl = PCI_FLIT_ERR_CNTR_CTRL_ERR_COR_EN;
+
+ lockdep_assert_held(&pdev->flit_info->lock);
+
+ pci_clear_and_set_config_word(pdev,
+ pdev->flit_cap + PCI_FLIT_ERR_CNTR_CTRL,
+ 0, ctrl);
+ __flit_save_state_update(pdev, FLIT_SAVE_CNTR_CTRL, 0, ctrl);
+}
+
static void flit_cntr_enable(struct pci_dev *pdev)
{
struct flit_info *info = pdev->flit_info;
@@ -344,6 +424,10 @@ static void flit_cntr_enable(struct pci_dev *pdev)
/* A 0->1 transition of Counter Enable clears stale event status */
__flit_cntr_ctrl_update(pdev, cntr->en, 0);
+
+ if (info->err_cor)
+ __flit_err_cor_enable(pdev);
+
__flit_cntr_ctrl_update(pdev, cntr->trigger | ctrl,
field_prep(cntr->trigger, info->trigger) |
info->enable);
@@ -448,9 +532,71 @@ static irqreturn_t flit_isr(int irq, void *context)
return IRQ_WAKE_THREAD;
}
+/*
+ * flit_isr() and flit_ist() in one, for ERR_COR. The AER thread and the
+ * rearm walk can both get here, and must not drain one log at once.
+ */
+static void flit_service(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+
+ mutex_lock(&info->service_lock);
+ flit_cntr_pause(pdev);
+ flit_cntr_write(pdev, info->cntr->sta, info->event);
+ flit_drain_log(pdev);
+ flit_cntr_resume(pdev);
+ mutex_unlock(&info->service_lock);
+}
+
bool pci_flit_uses_irq(struct pci_dev *pdev)
{
- return !!pdev->flit_info;
+ return pdev->flit_info && !pdev->flit_info->err_cor;
+}
+
+/**
+ * pci_flit_err_cor_pending - check for a counter event signaled with ERR_COR
+ * @pdev: PCI device that may have sent an ERR_COR
+ *
+ * Return: true if @pdev has an event awaiting pci_flit_handle_err_cor().
+ */
+bool pci_flit_err_cor_pending(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+ u32 sta;
+
+ if (!info || !info->err_cor)
+ return false;
+
+ sta = flit_cntr_read(pdev, info->cntr->sta);
+
+ return !PCI_POSSIBLE_ERROR(sta) && (sta & info->event);
+}
+
+/**
+ * pci_flit_handle_err_cor - service a counter event signaled with ERR_COR
+ * @pdev: PCI device AER identified as the source of an ERR_COR
+ *
+ * Called from the AER interrupt thread for every correctable error source.
+ */
+void pci_flit_handle_err_cor(struct pci_dev *pdev)
+{
+ if (pci_flit_err_cor_pending(pdev))
+ flit_service(pdev);
+}
+
+/**
+ * pci_flit_rearm - service a counter whose ERR_COR may have been discarded
+ * @pdev: PCI device reporting to a Root Port or RCEC AER is enabling
+ *
+ * An ERR_COR that AER cleared while enabling the Root Port or RCEC would
+ * leave the counter silent for good.
+ */
+void pci_flit_rearm(struct pci_dev *pdev)
+{
+ struct flit_info *info = pdev->flit_info;
+
+ if (info && info->err_cor)
+ flit_service(pdev);
}
static int flit_probe(struct pcie_device *dev)
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 803bfb6fbf49..7302d8edee41 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -505,6 +505,7 @@
#define PCI_EXP_DEVCAP_ATN_IND 0x00002000 /* Attention Indicator Present */
#define PCI_EXP_DEVCAP_PWR_IND 0x00004000 /* Power Indicator Present */
#define PCI_EXP_DEVCAP_RBER 0x00008000 /* Role-Based Error Reporting */
+#define PCI_EXP_DEVCAP_ECS 0x00010000 /* ERR_COR Subclass Capable */
#define PCI_EXP_DEVCAP_PWR_VAL 0x03fc0000 /* Slot Power Limit Value */
#define PCI_EXP_DEVCAP_PWR_SCL 0x0c000000 /* Slot Power Limit Scale */
#define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */
@@ -824,6 +825,8 @@
#define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 /* Correctable Err Reporting Enable */
#define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 /* Non-Fatal Err Reporting Enable */
#define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 /* Fatal Err Reporting Enable */
+#define PCI_ERR_ROOT_CMD_ECS_LEGACY_SFW 0x00000008 /* ECS Legacy Handling by SFW */
+#define PCI_ERR_ROOT_CMD_ECS_SIG_OS_SFW 0x00000020 /* ECS SIG_OS Handling by SFW */
#define PCI_ERR_ROOT_STATUS 0x30
#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */
#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 /* Multiple ERR_COR */
@@ -1201,9 +1204,13 @@
#define PCI_FLIT_ERR_CNTR_CTRL_EN 0x0001 /* Flit Error Counter Enable */
#define PCI_FLIT_ERR_CNTR_CTRL_INTR_EN 0x0002 /* Flit Error Counter Interrupt Enable */
#define PCI_FLIT_ERR_CNTR_CTRL_TRIGGER 0x0ff0 /* Trigger Event on Error Count */
+#define PCI_FLIT_ERR_CNTR_CTRL_ERR_COR_EN 0x1000 /* Flit Error Counter ERR_COR Enable */
+#define PCI_FLIT_ERR_CNTR_CTRL_SIG_SFW_EN 0x2000 /* Flit Error Counter SIG_SFW Enable */
#define PCI_FLIT_ERR_CNTR_STA 0x0e /* Flit Error Counter Status Register */
#define PCI_FLIT_ERR_CNTR_STA_INTR_GEN 0x0008 /* Interrupt Generated based on Trigger */
+#define PCI_FLIT_ERR_CNTR_STA_ERR_COR 0x0020 /* Flit Error Counter ERR_COR Status */
#define PCI_FLIT_ERR_CNTR_CAP 0x3c /* Flit Error Counter Capability Register */
+#define PCI_FLIT_ERR_CNTR_CAP_ERR_COR 0x00000001 /* ERR_COR Signaling Supported */
#define PCI_FLIT_ERR_CNTR_CAP_EXT 0x00000002 /* Extended Flit Error Counter Supported */
#define PCI_FLIT_EXT_CNTR_CTRL1 0x40 /* Ext Flit Error Counter Control 1 */
#define PCI_FLIT_EXT_CNTR_CTRL1_EN 0x00000001 /* Ext Flit Error Counter Enable */
@@ -1213,6 +1220,7 @@
#define PCI_FLIT_EXT_CNTR_CTRL2 0x44 /* Ext Flit Error Counter Control 2 */
#define PCI_FLIT_EXT_CNTR_STA 0x48 /* Ext Flit Error Counter Status */
#define PCI_FLIT_EXT_CNTR_STA_INTR_GEN 0x00000080 /* Intr Generated on Ext Trigger */
+#define PCI_FLIT_EXT_CNTR_STA_ERR_COR 0x00000100 /* ERR_COR Generated on Ext Trigger */
/* Native PCIe Enclosure Management */
#define PCI_NPEM_CAP 0x04 /* NPEM capability register */
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v3 5/6] PCI/FLIT: Signal Flit Error Counter events with ERR_COR
2026-12-04 18:15 ` [PATCH v3 5/6] PCI/FLIT: Signal Flit Error Counter events with ERR_COR Yazen Ghannam
@ 2026-12-04 18:46 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-12-04 18:46 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
Thank you for your contribution! Sashiko AI review found 10 potential
issues to consider:
- [Medium] PCI/AER: aer_root_reset() clears root status without
re-arming Flit counters
- [Medium] PCI/AER: find_device_iter() overflow permanently silences
Flit counters
- [Medium] PCI/FLIT: pci_flit_init() enables ERR_COR before device is on
bus->devices
- [Medium] PCI/FLIT: flit_err_cor_usable() ignores pcie_ports_disabled
on non-ACPI
- [Medium] PCI/FLIT: pci_flit_rearm() accesses D3cold devices and resets
idle counters
- [Medium] PCI/FLIT: Root Port runtime resume discards Flit ERR_COR
without re-arming
- [Medium] PCI/AER: aer_enable_rootport() rearms Flit counters before
aer_enable_irq()
- [Medium] PCI/FLIT: pci_restore_flit_state() races with flit_service()
counter pause
- [Medium] PCI/FLIT: flit_cntr_enable() leaves ERR_COR_EN set in IRQ
fallback mode
- [Low] PCI/AER: is_error_source() gates Flit ERR_COR check on
PCI_EXP_AER_FLAGS
--
commit 9ac7a72e2e543419624dd388eb814ff690ac98e9
Author: Yazen Ghannam <yazen.ghannam@amd.com>
PCI/FLIT: Signal Flit Error Counter events with ERR_COR
This commit uses ERR_COR signaling instead of the PCIe Capability
interrupt for Flit Error Counter events when Capability Version 2h
supports it. It hooks into AER to identify and service those events and
re-arms ERR_COR counters when AER enables a Root Port or RCEC.
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 1973b6eba6b38..376ee74981087 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1210,6 +1210,11 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info)
> if (!(reg16 & PCI_EXP_AER_FLAGS))
> return false;
>
> + /* A Flit Error Counter event sets no AER status bit */
> + if (e_info->severity == AER_CORRECTABLE &&
> + pci_flit_err_cor_pending(dev))
> + return true;
> +
[Severity: Low]
Should the pci_flit_err_cor_pending() check come before the
PCI_EXP_AER_FLAGS check?
Flit Error Counter ERR_COR generation is gated by
PCI_FLIT_ERR_CNTR_CTRL_ERR_COR_EN rather than PCI_EXP_DEVCTL, and
flit_err_cor_usable() only checks the Root Port's aer_cap. If
PCI_EXP_AER_FLAGS is clear on the device -- for example after an OOM in
pci_aer_init() skips pci_enable_pcie_error_reporting() -- a multi-error
search skips the device and leaves its Flit Error Counter permanently
silent.
[ ... ]
> @@ -1594,6 +1599,8 @@ static inline void aer_process_err_devices(struct aer_err_info *e_info)
>
> /* Report all before handling them, to not lose records by reset etc. */
> for (i = 0; i < e_info->error_dev_num && e_info->dev[i]; i++) {
> + if (e_info->severity == AER_CORRECTABLE)
> + pci_flit_handle_err_cor(e_info->dev[i]);
> if (aer_get_device_error_info(e_info, i))
> aer_print_error(e_info, i);
> }
[Severity: Medium]
Can an AER multi-error overflow permanently silence Flit Error Counters on
devices beyond the fifth match?
find_device_iter() stops walking the bus once add_error_device() hits
AER_MAX_MULTI_ERR_DEVICES (5), so aer_process_err_devices() never calls
pci_flit_handle_err_cor() for any remaining device with a pending Flit
ERR_COR. Because a Flit counter stays silent until its err_cor_gen bit is
cleared, an overflowed device stops reporting Flit errors until another
multi-error burst visits it first or the Root Port re-arms it.
[ ... ]
> @@ -1805,6 +1818,15 @@ static void aer_enable_rootport(struct aer_rpc *rpc)
> pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, ®32);
> pci_write_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS, reg32);
>
> + /* Re-arm Flit Error Counters whose ERR_COR was never serviced */
> + if (IS_ENABLED(CONFIG_PCIE_FLIT)) {
> + pci_flit_rearm(pdev);
> + if (pci_pcie_type(pdev) == PCI_EXP_TYPE_RC_EC)
> + pcie_walk_rcec(pdev, flit_rearm_iter, NULL);
> + else if (pdev->subordinate)
> + pci_walk_bus(pdev->subordinate, flit_rearm_iter, NULL);
> + }
> +
> aer_enable_irq(pdev);
> }
[Severity: Medium]
Can re-arming Flit Error Counters before aer_enable_irq() drop a new
ERR_COR?
While the walk drains logs on downstream devices, an earlier re-armed
device can reach its trigger and emit an ERR_COR while
PCI_ERR_ROOT_CMD_COR_EN is still clear. On Root Ports or RCECs that do
not retroactively fire an MSI/MSI-X when PCI_ERR_ROOT_CMD_COR_EN is set
with PCI_ERR_ROOT_COR_RCV already latched, that event is never serviced
and the counter stays silent. Moving the re-arm walk after
aer_enable_irq() avoids this window since flit_service() already
serializes with aer_isr() via service_lock.
[Severity: Medium]
Does aer_root_reset() also need to re-arm Flit Error Counters when it
clears PCI_ERR_ROOT_STATUS?
aer_root_reset() masks AER interrupts on root, runs FLR or a secondary bus
reset, clears PCI_ERR_ROOT_STATUS, and re-enables interrupts:
drivers/pci/pcie/aer.c:aer_root_reset() {
...
if (host->native_aer && aer) {
/* Clear Root Error Status */
pci_read_config_dword(root, aer + PCI_ERR_ROOT_STATUS, ®32);
pci_write_config_dword(root, aer + PCI_ERR_ROOT_STATUS, reg32);
aer_enable_irq(root);
}
...
}
Any Flit ERR_COR sent by root or an un-reset sibling port during that
reset window is discarded when PCI_ERR_ROOT_STATUS is cleared, leaving
that counter permanently silent.
> diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
> index 97395b6942389..83a6b50221ef1 100644
> --- a/drivers/pci/pcie/flit.c
> +++ b/drivers/pci/pcie/flit.c
[ ... ]
> @@ -143,6 +151,48 @@ static void flit_select_cntr(struct pci_dev *pdev)
> info->cntr = &flit_ext_cntr;
> }
>
> +/*
> + * The Root Port or RCEC needs AER to log the ERR_COR, and system firmware must
> + * not claim it through SIG_SFW Enable or RC ECS Handling. The device itself
> + * needs no AER Capability.
> + */
> +static bool flit_err_cor_usable(struct pci_dev *pdev)
> +{
> + struct flit_info *info = pdev->flit_info;
> + struct pci_dev *root;
> + u32 root_cmd, sfw;
> + u16 ctrl;
> +
> + if (!(info->cntr_cap & PCI_FLIT_ERR_CNTR_CAP_ERR_COR))
> + return false;
> +
> + if (!pci_aer_available())
> + return false;
[Severity: Medium]
Should flit_err_cor_usable() also check pcie_ports_disabled?
On non-ACPI platforms booted with pcie_ports=compat (or PowerNV, which
sets pcie_ports_disabled unconditionally), pci_init_host_bridge() leaves
native_flit set while pcie_portdrv_init() skips registering aerdriver.
Because pci_aer_available() does not check pcie_ports_disabled,
pci_flit_init() enables ERR_COR signaling with no AER driver bound to
service the messages.
[ ... ]
> @@ -210,6 +271,12 @@ void pci_flit_init(struct pci_dev *pdev)
> pci_dbg(pdev, "Flit Logging Extended Capability present, using the %s\n",
> flit_ext(info) ? "Extended Flit Error Counter" :
> "Flit Error Counter");
> +
> + /* ERR_COR needs no port service, so start here, after pci_aer_init() */
> + if (info->err_cor) {
> + pci_dbg(pdev, "Flit Error Counter events signaled with ERR_COR\n");
> + flit_cntr_enable(pdev);
> + }
> }
[Severity: Medium]
Can enabling the ERR_COR counter here lose the first event on hotplug or
rescan?
pci_device_add() calls pci_init_capabilities() (and then several other
initializers, including DOE mailbox exchanges and
platform_pci_configure_wake()) before adding dev to bus->devices. If the
counter fires an ERR_COR beneath an already-probed Root Port before dev is
on bus->devices, aer_irq() clears Root Error Status, find_source_device()
cannot locate dev, and the counter stays permanently silent.
[ ... ]
> @@ -344,6 +424,10 @@ static void flit_cntr_enable(struct pci_dev *pdev)
>
> /* A 0->1 transition of Counter Enable clears stale event status */
> __flit_cntr_ctrl_update(pdev, cntr->en, 0);
> +
> + if (info->err_cor)
> + __flit_err_cor_enable(pdev);
> +
> __flit_cntr_ctrl_update(pdev, cntr->trigger | ctrl,
> field_prep(cntr->trigger, info->trigger) |
> info->enable);
[Severity: Medium]
When falling back to IRQ mode on a Capability Version 2h port, does
flit_cntr_enable() leave PCI_FLIT_ERR_CNTR_CTRL_ERR_COR_EN set?
If ERR_COR_EN was already set in hardware (for example across kexec into a
kernel booted with pci=noaer), neither flit_select_cntr() nor
flit_cntr_enable() clears it or its saved copy in FLIT_SAVE_CNTR_CTRL.
Each trigger then emits both a PCIe interrupt and an unhandled ERR_COR
message.
[ ... ]
> @@ -448,9 +532,71 @@ static irqreturn_t flit_isr(int irq, void *context)
> return IRQ_WAKE_THREAD;
> }
>
> +/*
> + * flit_isr() and flit_ist() in one, for ERR_COR. The AER thread and the
> + * rearm walk can both get here, and must not drain one log at once.
> + */
> +static void flit_service(struct pci_dev *pdev)
> +{
> + struct flit_info *info = pdev->flit_info;
> +
> + mutex_lock(&info->service_lock);
> + flit_cntr_pause(pdev);
> + flit_cntr_write(pdev, info->cntr->sta, info->event);
> + flit_drain_log(pdev);
> + flit_cntr_resume(pdev);
> + mutex_unlock(&info->service_lock);
> +}
[Severity: Medium]
Can pci_restore_flit_state() race with flit_service() and re-enable the
counter while it is paused?
flit_service() runs without device_lock() and drops info->lock right after
flit_cntr_pause(). A concurrent pci_restore_flit_state() (from
pci_reset_function(), DPC slot reset, or runtime resume) takes only
info->lock and writes the saved control register with cntr->en set:
CPU0 CPU1
flit_service()
flit_cntr_pause()
/* cntr->en: 1 -> 0 */
pci_restore_flit_state()
/* writes saved cntr->en = 1 */
/* new event latches sta */
flit_cntr_write(sta, event) <-- clears new event before AER runs
flit_drain_log()
flit_cntr_resume() <-- no 0 -> 1 transition to re-arm
If errors reach the trigger before flit_cntr_write(), the RW1C write
clears the new event status and flit_cntr_resume() misses the 0->1
transition needed to re-arm the counter. Tracking the paused state under
info->lock and masking cntr->en in pci_restore_flit_state() while paused
would prevent this.
> +
> bool pci_flit_uses_irq(struct pci_dev *pdev)
> {
> - return !!pdev->flit_info;
> + return pdev->flit_info && !pdev->flit_info->err_cor;
> +}
[Severity: Medium]
Does Root Port runtime resume discard latched Flit ERR_COR events without
re-arming the counters?
Returning false here keeps flitdriver (and its runtime_resume callback)
from binding in ERR_COR mode, while aerdriver has no runtime_resume
callback. When a Root Port runtime-resumes from D3hot,
pci_restore_state() calls pci_aer_clear_status() to clear
PCI_ERR_ROOT_STATUS, and pci_restore_flit_state() writes Counter Enable
with no 0->1 transition, leaving any counter whose ERR_COR was latched
during D3hot permanently silent.
[ ... ]
> +/**
> + * pci_flit_rearm - service a counter whose ERR_COR may have been discarded
> + * @pdev: PCI device reporting to a Root Port or RCEC AER is enabling
> + *
> + * An ERR_COR that AER cleared while enabling the Root Port or RCEC would
> + * leave the counter silent for good.
> + */
> +void pci_flit_rearm(struct pci_dev *pdev)
> +{
> + struct flit_info *info = pdev->flit_info;
> +
> + if (info && info->err_cor)
> + flit_service(pdev);
> }
[Severity: Medium]
Can pci_flit_rearm() access D3cold subordinate devices during system
resume?
Because pcie_portdrv_probe() sets DPM_FLAG_SMART_SUSPEND, runtime-
suspended subordinate ports can stay in D3cold when the parent Root Port
runs aer_resume() -> aer_enable_rootport(). Calling flit_service()
without checking runtime PM or PCI_D3cold state issues config
read-modify-writes to D3cold devices right before aer_enable_irq(),
causing spurious Unsupported Request errors and risking corrupting the
control register if racing with runtime resume.
Also, because pci_flit_rearm() does not check pci_flit_err_cor_pending(),
it pauses and resumes healthy idle D0 counters (dropping accumulated
counts) and drains logs under pci_bus_sem on every Root Port probe and
resume.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204181556.1418843-1-yazen.ghannam@amd.com?part=5
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 6/6] PCI/FLIT: Manage Flit Logging on Endpoint Upstream Ports
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
` (4 preceding siblings ...)
2026-12-04 18:15 ` [PATCH v3 5/6] PCI/FLIT: Signal Flit Error Counter events with ERR_COR Yazen Ghannam
@ 2026-12-04 18:15 ` Yazen Ghannam
2026-12-04 18:53 ` sashiko-bot
2026-12-04 18:53 ` [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support sashiko-bot
6 siblings, 1 reply; 13+ messages in thread
From: Yazen Ghannam @ 2026-12-04 18:15 UTC (permalink / raw)
To: bhelgaas, linux-pci, linux-kernel, linux-acpi, linux-edac; +Cc: Yazen Ghannam
An Endpoint implements the Flit Logging Extended Capability in Function 0
of its Upstream Port.[1] The port bus driver does not bind to Endpoints,
so with _OSC control granted, nothing manages those instances.
ERR_COR signaling needs no driver binding. pci_flit_init() starts the
counter, its state is saved and restored with the device, and AER
services its events. Manage the capability on Endpoints where ERR_COR
is usable, and leave other Endpoints as found.
Function Level Reset does not affect the capability, so an Endpoint
driver resetting its device does not disturb it.[2]
[1] PCIe r7.1, sec 7.7.9
[2] PCIe r7.1, sec 6.6.2
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
drivers/pci/pcie/flit.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
index 83a6b50221ef..050360295f2f 100644
--- a/drivers/pci/pcie/flit.c
+++ b/drivers/pci/pcie/flit.c
@@ -113,6 +113,21 @@ static bool flit_is_port(struct pci_dev *pdev)
}
}
+/* No port service binds to an Endpoint, so it can only use ERR_COR */
+static bool flit_is_endpoint(struct pci_dev *pdev)
+{
+ if (!pci_is_pcie(pdev))
+ return false;
+
+ switch (pci_pcie_type(pdev)) {
+ case PCI_EXP_TYPE_ENDPOINT:
+ case PCI_EXP_TYPE_LEG_END:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* Flit Logging control is only meaningful alongside AER control */
static bool flit_is_native(struct pci_dev *pdev)
{
@@ -229,7 +244,8 @@ void pci_flit_init(struct pci_dev *pdev)
u16 trigger;
u32 ctrl;
- if (!flit_is_port(pdev) || !flit_is_native(pdev))
+ if (!(flit_is_port(pdev) || flit_is_endpoint(pdev)) ||
+ !flit_is_native(pdev))
return;
pdev->flit_cap = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_FLIT);
@@ -247,6 +263,12 @@ void pci_flit_init(struct pci_dev *pdev)
info->cntr_cap = flit_read_cntr_cap(pdev);
info->err_cor = flit_err_cor_usable(pdev);
+ /* Leave an Endpoint without ERR_COR as found */
+ if (!info->err_cor && flit_is_endpoint(pdev)) {
+ pci_flit_exit(pdev);
+ return;
+ }
+
spin_lock_init(&info->lock);
mutex_init(&info->service_lock);
--
2.55.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v3 6/6] PCI/FLIT: Manage Flit Logging on Endpoint Upstream Ports
2026-12-04 18:15 ` [PATCH v3 6/6] PCI/FLIT: Manage Flit Logging on Endpoint Upstream Ports Yazen Ghannam
@ 2026-12-04 18:53 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-12-04 18:53 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
Thank you for your contribution! Sashiko AI review found 7 potential
issues to consider:
- [High] vfio/pci: host-managed Endpoint Flit Logging capability left
raw RW
- [Medium] PCI/FLIT: aer_root_reset() clears PCI_ERR_ROOT_STATUS without
re-arming Flit
- [Medium] PCI/FLIT: pci_flit_init() enables ERR_COR before bus->devices
insertion
- [Medium] PCI/FLIT: pci_flit_init() ignores pcie_ports_disabled on
non-ACPI hosts
- [Medium] PCI/FLIT: flit_report() emits unratelimited pci_warn() in
drain loop
- [Medium] PCI/FLIT: pci_flit_rearm() accesses config space of D3cold
Endpoints
- [Medium] PCI/FLIT: aerdriver lacks runtime_resume to re-arm ERR_COR
Flit counters
--
commit 3b2b4ec344229286e14d4e998c43a9ee5c0536f6
Author: Yazen Ghannam <yazen.ghannam@amd.com>
PCI/FLIT: Manage Flit Logging on Endpoint Upstream Ports
This commit extends pci_flit_init() to manage the Flit Logging Extended
Capability on PCIe Endpoints when ERR_COR signaling is usable, leaving
other Endpoints untouched.
> diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
> index 83a6b50221ef1..050360295f2f7 100644
> --- a/drivers/pci/pcie/flit.c
> +++ b/drivers/pci/pcie/flit.c
[ ... ]
> @@ -229,7 +244,8 @@ void pci_flit_init(struct pci_dev *pdev)
> u16 trigger;
> u32 ctrl;
>
> - if (!flit_is_port(pdev) || !flit_is_native(pdev))
> + if (!(flit_is_port(pdev) || flit_is_endpoint(pdev)) ||
> + !flit_is_native(pdev))
> return;
[Severity: High]
Does vfio-pci leave the host-managed Flit Logging capability registers
directly writable by an assigned guest?
PCI_EXT_CAP_ID_FLIT is missing from pci_ext_cap_length[] in
drivers/vfio/pci/vfio_pci_config.c, so vfio_ecap_init() leaves its
registers unmapped (PCI_CAP_ID_INVALID) in vdev->pci_config_map.
vfio_pci_config_rw_single() then routes accesses to unassigned_perms,
allowing raw hardware reads and writes.
An untrusted guest assigned a Flit-capable Endpoint can lower the trigger
threshold to 1 to amplify host ERR_COR interrupts and kernel warnings, set
PCI_FLIT_ERR_CNTR_CTRL_SIG_SFW_EN to redirect events to host firmware, or
disable host Flit monitoring. Adding PCI_EXT_CAP_ID_FLIT to
pci_ext_cap_length[] and vfio_ext_cap_len() would map the capability under
default read-only ecap_perms.
[Severity: Medium]
Should flit_is_native() or flit_err_cor_usable() check pcie_ports_disabled?
On non-ACPI hosts where pcie_ports_disabled is true (such as PowerNV, where
pnv_pci_init() sets it unconditionally for EEH, or DT hosts booted with
pcie_ports=compat), pci_init_host_bridge() still sets native_aer and
native_flit, and pci_aer_available() does not check pcie_ports_disabled.
pci_flit_init() therefore enables ERR_COR signaling on Endpoints and Ports
even though pcie_portdrv_init() aborts and no AER driver ever binds to
service the generated ERR_COR messages.
[Severity: Medium]
Can aer_enable_rootport() access config space on a D3cold Endpoint via
pci_flit_rearm() during system resume?
Unlike pcieport devices, a runtime-suspended Endpoint in PCI_D3cold can
skip pci_pm_resume_noirq() via direct_complete or DPM_FLAG_MAY_SKIP_RESUME
(for example amdgpu with BOCO). When dpm_resume() runs aer_resume() ->
aer_enable_rootport() on the Root Port, flit_rearm_iter() unconditionally
calls pci_flit_rearm() -> flit_service() on subordinate Endpoints.
flit_service() then issues config reads and unchecked read-modify-write
config writes to the powered-off Endpoint right after aer_enable_rootport()
clears Root Port AER status and before aer_enable_irq(), which can latch
Unsupported Request completions and trigger spurious AER errors on resume.
Skipping pci_flit_rearm() when pdev->current_state != PCI_D0 would avoid
touching powered-off Endpoints.
[Severity: Medium]
What re-arms ERR_COR Flit Error Counters after a Root Port runtime-resumes
from D3hot?
When an unbound Endpoint runtime-suspends, pci_pm_runtime_suspend() leaves
it in D0 with its Flit Error Counter active, allowing the parent Root Port
to enter D3hot. If the Endpoint triggers an ERR_COR while the Root Port is
in D3hot, PCI_ERR_ROOT_STATUS latches the event without delivering an
interrupt.
On Root Port runtime resume, pci_pm_runtime_resume() -> pci_restore_state()
-> pci_aer_clear_status() clears PCI_ERR_ROOT_STATUS, discarding the
pending ERR_COR. Because aerdriver has no .runtime_resume callback to
invoke pci_flit_rearm() and pci_restore_flit_state() does not clear status
or toggle Counter Enable, the Endpoint's Flit Error Counter stays
permanently silent until a full system suspend/resume.
> @@ -247,6 +263,12 @@ void pci_flit_init(struct pci_dev *pdev)
> info->cntr_cap = flit_read_cntr_cap(pdev);
> info->err_cor = flit_err_cor_usable(pdev);
>
> + /* Leave an Endpoint without ERR_COR as found */
> + if (!info->err_cor && flit_is_endpoint(pdev)) {
> + pci_flit_exit(pdev);
> + return;
> + }
> +
> spin_lock_init(&info->lock);
> mutex_init(&info->service_lock);
[Severity: Medium]
Does aer_root_reset() need to call pci_flit_rearm() after clearing
PCI_ERR_ROOT_STATUS?
aer_root_reset() disables AER IRQs on root, resets the device or link,
unconditionally clears PCI_ERR_ROOT_STATUS, and re-enables AER IRQs without
calling pci_flit_rearm() on root or its subordinate hierarchy.
If a Flit Error Counter on root, a sibling Endpoint under the same root, or
the retrained link triggers an ERR_COR while AER IRQs are masked, clearing
PCI_ERR_ROOT_STATUS discards it. Endpoints have no flitdriver slot_reset
callback, so the ERR_COR Generated status bit remains latched and the
counter stays permanently silent.
[Severity: Medium]
Can a hotplugged Endpoint lose its first Flit ERR_COR if it fires before
pci_device_add() inserts the device onto bus->devices?
CPU0 (hotplug) CPU1 (Root Port AER)
pci_device_add()
pci_init_capabilities()
pci_flit_init()
flit_cntr_enable()
pci_doe_init() / ...
aer_irq()
clear PCI_ERR_ROOT_STATUS
aer_isr()
find_source_device()
pci_walk_bus() <-- dev not listed
list_add_tail(&dev->bus_list,
&bus->devices)
pci_flit_init() enables the ERR_COR counter inside pci_init_capabilities(),
before dev is added to bus->devices. Under an already-probed Root Port,
aer_enable_rootport() does not run again for a hotplugged Endpoint, so a
missed ERR_COR leaves ERR_COR_GEN latched and the counter permanently
silent.
Enabling or re-arming the ERR_COR counter after
list_add_tail(&dev->bus_list, &bus->devices) would close this window.
[Severity: Medium]
Is flit_report() missing ratelimiting in the drain loop?
flit_drain_log() can call flit_report() -> pci_warn() up to
FLIT_MAX_LOG_ENTRIES (255) times per ERR_COR event before flit_service()
immediately re-arms the counter. In aer_process_err_devices(),
pci_flit_handle_err_cor() is also called without checking
e_info->ratelimit_print[i], bypassing AER's per-device ratelimiting.
On a degrading link or malfunctioning Endpoint, repeated Flit ERR_COR
events can flood the kernel log buffer and stall serial consoles.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204181556.1418843-1-yazen.ghannam@amd.com?part=6
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support
2026-12-04 18:15 [PATCH v3 0/6] PCIe Flit Logging Ext Capability Support Yazen Ghannam
` (5 preceding siblings ...)
2026-12-04 18:15 ` [PATCH v3 6/6] PCI/FLIT: Manage Flit Logging on Endpoint Upstream Ports Yazen Ghannam
@ 2026-12-04 18:53 ` sashiko-bot
6 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-12-04 18:53 UTC (permalink / raw)
To: Yazen Ghannam, linux-pci
Sashiko has finished reviewing this 6-patch series:
- Patch 1: no issues found.
- Patch 2 ("PCI: Add pci_clear_and_set_config_word()"): 1 potential
issue (1 Medium)
- Patch 3 ("PCI/FLIT: Add support for Flit Logging Extended Capa..."): 5
potential issues (4 Medium, 1 Low)
- Patch 4 ("PCI/FLIT: Add support for the Extended Flit Error Co..."): 5
potential issues (1 High, 3 Medium, 1 Low)
- Patch 5 ("PCI/FLIT: Signal Flit Error Counter events with ERR_COR"):
10 potential issues (9 Medium, 1 Low)
- Patch 6 ("PCI/FLIT: Manage Flit Logging on Endpoint Upstream P..."): 7
potential issues (1 High, 6 Medium)
Detailed reviews have been sent as separate replies to patches 2-6.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204181556.1418843-1-yazen.ghannam@amd.com
^ permalink raw reply [flat|nested] 13+ messages in thread