• Mika Westerberg's avatar
    PCI: hotplug: Drop checking of PCI_BRIDGE_CONTROL in *_unconfigure_device() · 0f4bd801
    Mika Westerberg authored
    When removing a bridge, pciehp_unconfigure_device() reads the
    PCI_BRIDGE_CONTROL byte.  If this is a surprise hot-unplug, the device is
    already gone and the read returns ~0, which pciehp_unconfigure_device()
    interprets as having PCI_BRIDGE_CTL_VGA set.  This results in failure of
    the remove operation:
    
      pciehp 0000:00:1c.0:pcie004: Slot(0): Link Down
      pciehp 0000:00:1c.0:pcie004: Slot(0): Card present
      pciehp 0000:00:1c.0:pcie004: Cannot remove display device 0000:01:00.0
    
    Because of this the hierarchy is left untouched preventing further hotplug
    operations.
    
    Now, it is not clear why the check is there in the first place and why we
    would like to prevent removing a bridge if it has PCI_BRIDGE_CTL_VGA set.
    In case of PCIe surprise hot-unplug, it would not even be possible to
    prevent the removal.
    
    Given this and the issue described above, I think it makes sense to drop
    the whole PCI_BRIDGE_CONTROL check from pciehp_unconfigure_device().  While
    there do the same for shpchp_configure_device() based on the same reasoning
    and the fact that the same bug might trigger in standard PCI hotplug as
    well.
    Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
    [bhelgaas: changelog]
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    0f4bd801
shpchp_pci.c 2.72 KB