[PATCH 2/2] PCI: dwc: ep: Add MSI-X Enable checks before raising MSI-X to the host
From: Manivannan Sadhasivam
Date: Wed Feb 25 2026 - 11:27:32 EST
PCIe spec r7, sec 7.7.2.2 mandates that a Function should raise MSI-X only
if the MSI-X Enable bit is set and MSI enable bit is clear.
Hence, add those checks to be spec compliant.
Suggested-by: Bjorn Helgaas <helgaas@xxxxxxxxxx>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
---
drivers/pci/controller/dwc/pcie-designware-ep.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
index fcbd648e049e..47bc33346342 100644
--- a/drivers/pci/controller/dwc/pcie-designware-ep.c
+++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
@@ -1018,6 +1018,15 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
if (!ep_func || !ep_func->msix_cap)
return -EINVAL;
+ /*
+ * PCIe spec r7, sec 7.7.2.2 mandates that a Function should raise MSI-X
+ * only if the MSI-X Enable bit is set and MSI Enable bit is clear.
+ */
+ if (!dw_pcie_ep_msix_enabled(ep, ep_func, func_no) ||
+ (dw_pcie_ep_msix_enabled(ep, ep_func, func_no) &&
+ dw_pcie_ep_msi_enabled(ep, ep_func, func_no)))
+ return -EOPNOTSUPP;
+
reg = ep_func->msix_cap + PCI_MSIX_TABLE;
tbl_offset = dw_pcie_ep_readl_dbi(ep, func_no, reg);
bir = FIELD_GET(PCI_MSIX_TABLE_BIR, tbl_offset);
--
2.51.0