diff mbox

[2/2] core/pci: Disable surprise hotplug on root port

Message ID 1489105546-28092-2-git-send-email-gwshan@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Gavin Shan March 10, 2017, 12:25 a.m. UTC
We are creating PCI slot on root port, where the PCI slot isn't
supported from hardware. For this case, the surprised hotplug
functionality shouldn't be enabled even the link state change
reporting is supported in hardware.

This disables surprise hotplug if PCI slot isn't supported in
hardware.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 core/pcie-slot.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index aca59dd..022668a 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -500,12 +500,14 @@  struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd)
 	 * Its PDC (Presence Detection Change) isn't reliable. To mark that as
 	 * broken on them.
 	 */
-	if (slot->slot_cap & PCICAP_EXP_SLOTCAP_HPLUG_SURP) {
-		slot->surprise_pluggable = 1;
-	} else if (slot->link_cap & PCICAP_EXP_LCAP_DL_ACT_REP) {
-		slot->surprise_pluggable = 1;
+	if (slot->pcie_cap & PCICAP_EXP_CAP_SLOT) {
+		if (slot->slot_cap & PCICAP_EXP_SLOTCAP_HPLUG_SURP) {
+			slot->surprise_pluggable = 1;
+		} else if (slot->link_cap & PCICAP_EXP_LCAP_DL_ACT_REP) {
+			slot->surprise_pluggable = 1;
 
-		pci_slot_add_flags(slot, PCI_SLOT_FLAG_BROKEN_PDC);
+			pci_slot_add_flags(slot, PCI_SLOT_FLAG_BROKEN_PDC);
+		}
 	}
 
 	/* Standard slot operations */