Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] pciehp: handle sticky power-fault status

This patch disables power fault, MRL sensor and presence detection
interrupts when a PCIe slot is powered-off and enables those
interrupts when it is powered-on again. This is necessary to prevent
the associated events from causing an endless cycle of interrupts
due to the power-fault bit, which stays set till power is restored
to the slot.

Signed-off-by: Thomas Schaefer <thomas.schaefer@kontron.com>
Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Thomas Schaefer and committed by
Greg Kroah-Hartman
c7ab337f 9d265124

+17 -2
+17 -2
drivers/pci/hotplug/pciehp_hpc.c
··· 787 787 788 788 slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_ON; 789 789 790 + /* Enable detection that we turned off at slot power-off time */ 790 791 if (!pciehp_poll_mode) 791 - slot_cmd = slot_cmd | HP_INTR_ENABLE; 792 + slot_cmd = slot_cmd | 793 + PWR_FAULT_DETECT_ENABLE | 794 + MRL_DETECT_ENABLE | 795 + PRSN_DETECT_ENABLE | 796 + HP_INTR_ENABLE; 792 797 793 798 retval = pcie_write_cmd(slot, slot_cmd); 794 799 ··· 838 833 839 834 slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_OFF; 840 835 836 + /* 837 + * If we get MRL or presence detect interrupts now, the isr 838 + * will notice the sticky power-fault bit too and issue power 839 + * indicator change commands. This will lead to an endless loop 840 + * of command completions, since the power-fault bit remains on 841 + * till the slot is powered on again. 842 + */ 841 843 if (!pciehp_poll_mode) 842 - slot_cmd = slot_cmd | HP_INTR_ENABLE; 844 + slot_cmd = (slot_cmd & 845 + ~PWR_FAULT_DETECT_ENABLE & 846 + ~MRL_DETECT_ENABLE & 847 + ~PRSN_DETECT_ENABLE) | HP_INTR_ENABLE; 843 848 844 849 retval = pcie_write_cmd(slot, slot_cmd); 845 850