[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241213070241.3334854-1-gthiagarajan@marvell.com>
Date: Fri, 13 Dec 2024 12:32:41 +0530
From: Gowthami Thiagarajan <gthiagarajan@...vell.com>
To: <bhelgaas@...gle.com>, <linux-pci@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
CC: Gowthami Thiagarajan <gthiagarajan@...vell.com>
Subject: [PATCH v2] PCI : Fix pcie_flag_reg in set_pcie_port_type
When an invalid PCIe topology is detected, the set_pcie_port_type function
does not set the port type correctly. This issue can occur in
configurations such as:
Root Port ---> Downstream Port ---> Root Port
In such cases, the topology is identified as invalid and due to the incorrect
port type setting, the extended configuration space of the child device becomes
inaccessible.
Signed-off-by: Gowthami Thiagarajan <gthiagarajan@...vell.com>
---
v1->v2:
Updated commit description
drivers/pci/probe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4f68414c3086..263ec21451d9 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1596,7 +1596,7 @@ void set_pcie_port_type(struct pci_dev *pdev)
if (pcie_downstream_port(parent)) {
pci_info(pdev, "claims to be downstream port but is acting as upstream port, correcting type\n");
pdev->pcie_flags_reg &= ~PCI_EXP_FLAGS_TYPE;
- pdev->pcie_flags_reg |= PCI_EXP_TYPE_UPSTREAM;
+ pdev->pcie_flags_reg |= PCI_EXP_TYPE_UPSTREAM << 4;
}
} else if (type == PCI_EXP_TYPE_UPSTREAM) {
/*
@@ -1607,7 +1607,7 @@ void set_pcie_port_type(struct pci_dev *pdev)
if (pci_pcie_type(parent) == PCI_EXP_TYPE_UPSTREAM) {
pci_info(pdev, "claims to be upstream port but is acting as downstream port, correcting type\n");
pdev->pcie_flags_reg &= ~PCI_EXP_FLAGS_TYPE;
- pdev->pcie_flags_reg |= PCI_EXP_TYPE_DOWNSTREAM;
+ pdev->pcie_flags_reg |= PCI_EXP_TYPE_DOWNSTREAM << 4;
}
}
}
--
2.25.1
Powered by blists - more mailing lists