1
0
Fork 0
alistair23-linux/drivers/pci/hotplug
Keith Busch 34fb6bf9b1 PCI: pciehp: Fix hot-add vs powerfault detection order
If both hot-add and power fault were observed in a single interrupt, we
handled the hot-add first, then the power fault, in this path:

  pciehp_ist
    if (events & (PDC | DLLSC))
      pciehp_handle_presence_or_link_change
        case OFF_STATE:
          pciehp_enable_slot
            __pciehp_enable_slot
              board_added
                pciehp_power_on_slot
                  ctrl->power_fault_detected = 0
                  pcie_write_cmd(ctrl, PCI_EXP_SLTCTL_PWR_ON, PCI_EXP_SLTCTL_PCC)
                pciehp_green_led_on(p_slot)             # power LED on
		pciehp_set_attention_status(p_slot, 0)  # attention LED off
    if ((events & PFD) && !ctrl->power_fault_detected)
      ctrl->power_fault_detected = 1
      pciehp_set_attention_status(1)                    # attention LED on
      pciehp_green_led_off(slot)                        # power LED off

This left the attention indicator on (even though the hot-add succeeded)
and the power indicator off (even though the slot power was on).

Fix this by checking for power faults before checking for new devices.

Prior to 0e94916e60, this was successful because everything was chained
through work queues and the order was:

  INT_PRESENCE_ON -> INT_POWER_FAULT -> ENABLE_REQ

The ENABLE_REQ cleared the power fault at the end, but now everything is
handled inline with the interrupt thread, such that the work ENABLE_REQ was
doing happens before power fault handling now.

Fixes: 0e94916e60 ("PCI: pciehp: Handle events synchronously")
Signed-off-by: Keith Busch <keith.busch@intel.com>
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
2018-09-11 08:47:42 -05:00
..
Kconfig PCI: shpchp: Convert SHPC to be builtin only 2018-06-02 00:18:28 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acpi_pcihp.c PCI: shpchp: Separate existence of SHPC and permission to use it 2018-06-26 15:38:28 -05:00
acpiphp.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
acpiphp_core.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
acpiphp_glue.c PCI: Fix is_added/is_busmaster race condition 2018-07-31 11:27:54 -05:00
acpiphp_ibm.c More ACPI updates for v4.16-rc1 2018-02-09 09:44:25 -08:00
cpci_hotplug.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpci_hotplug_core.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
cpci_hotplug_pci.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpcihp_generic.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpcihp_zt5550.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpcihp_zt5550.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpqphp.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpqphp_core.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
cpqphp_ctrl.c PCI: cpqphp: Fix possible NULL pointer dereference 2018-02-28 14:35:54 -06:00
cpqphp_nvram.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpqphp_nvram.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
cpqphp_pci.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
cpqphp_sysfs.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
ibmphp.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
ibmphp_core.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
ibmphp_ebda.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
ibmphp_hpc.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
ibmphp_pci.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
ibmphp_res.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
pci_hotplug_core.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
pciehp.h PCI: pciehp: Support interrupts sent from D3hot 2018-07-31 11:08:56 -05:00
pciehp_core.c PCI: pciehp: Deduplicate presence check on probe & resume 2018-07-31 13:27:24 -05:00
pciehp_ctrl.c PCI: pciehp: Avoid implicit fallthroughs in switch statements 2018-07-31 13:26:33 -05:00
pciehp_hpc.c PCI: pciehp: Fix hot-add vs powerfault detection order 2018-09-11 08:47:42 -05:00
pciehp_pci.c PCI: pciehp: Declare pciehp_unconfigure_device() void 2018-07-23 17:04:11 -05:00
pnv_php.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
rpadlpar.h PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
rpadlpar_core.c pci-v4.16-changes 2018-02-06 09:59:40 -08:00
rpadlpar_sysfs.c pci-v4.16-changes 2018-02-06 09:59:40 -08:00
rpaphp.h pci-v4.16-changes 2018-02-06 09:59:40 -08:00
rpaphp_core.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
rpaphp_pci.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
rpaphp_slot.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
s390_pci_hpc.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
sgi_hotplug.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
shpchp.h PCI: shpchp: Add shpchp_is_native() 2018-06-04 12:08:06 -05:00
shpchp_core.c PCI: hotplug: Demidlayer registration with the core 2018-07-23 17:04:13 -05:00
shpchp_ctrl.c PCI: Mark fall-through switch cases before enabling -Wimplicit-fallthrough 2018-07-12 16:55:57 -05:00
shpchp_hpc.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00
shpchp_pci.c Merge branch 'pci/spdx' into next 2018-02-01 11:40:07 -06:00
shpchp_sysfs.c PCI: Add SPDX GPL-2.0+ to replace GPL v2 or later boilerplate 2018-01-28 15:49:06 -06:00