anolis-cloud-kernel/drivers/pci
Liguang Zhang 56cf8b6f8b PCI: pciehp: Clear cmd_busy bit in polling mode
ANBZ: #8731

commit 92912b1751 upstream.

Writes to a Downstream Port's Slot Control register are PCIe hotplug
"commands."  If the Port supports Command Completed events, software must
wait for a command to complete before writing to Slot Control again.

pcie_do_write_cmd() sets ctrl->cmd_busy when it writes to Slot Control.  If
software notification is enabled, i.e., PCI_EXP_SLTCTL_HPIE and
PCI_EXP_SLTCTL_CCIE are set, ctrl->cmd_busy is cleared by pciehp_isr().

But when software notification is disabled, as it is when pcie_init()
powers off an empty slot, pcie_wait_cmd() uses pcie_poll_cmd() to poll for
command completion, and it neglects to clear ctrl->cmd_busy, which leads to
spurious timeouts:

  pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x01c0 (issued 2264 msec ago)
  pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x05c0 (issued 2288 msec ago)

Clear ctrl->cmd_busy in pcie_poll_cmd() when it detects a Command Completed
event (PCI_EXP_SLTSTA_CC).

[bhelgaas: commit log]
Fixes: a5dd4b4b05 ("PCI: pciehp: Wait for hotplug command completion where necessary")
Link: https://lore.kernel.org/r/20211111054258.7309-1-zhangliguang@linux.alibaba.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215143
Link: https://lore.kernel.org/r/20211126173309.GA12255@wunner.de
Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org	# v4.19+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: chuguangqing <chuguangqing@inspur.com>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/3033
2024-04-10 03:10:56 +00:00
..
controller PCI: rcar: Fix missing MACCTLR register setting in initialization sequence 2019-12-17 20:35:54 +01:00
endpoint Merge branch 'remotes/lorenzo/pci/dwc' 2018-08-15 14:59:11 -05:00
hotplug PCI: pciehp: Clear cmd_busy bit in polling mode 2024-04-10 03:10:56 +00:00
iohub-sriov alinux: pci/iohub-sriov: fix iohub-sriov VF probe issue 2020-03-25 18:48:01 +08:00
pcie PCI/AER: Log which device prevents error recovery 2024-03-30 16:02:07 +00:00
switch switchtec: Fix unintended mask of MRPC event 2019-06-15 11:54:07 +02:00
Kconfig alinux: pci/iohub-sriov: Support for Alibaba PCIe IOHub SRIOV 2020-03-18 23:26:35 +08:00
Makefile alinux: pci/iohub-sriov: Support for Alibaba PCIe IOHub SRIOV 2020-03-18 23:26:35 +08:00
access.c PCI/AER: Save AER Capability for suspend/resume 2020-09-02 17:52:41 +08:00
ats.c PCI/ATS: Add pci_ats_page_aligned() interface 2020-09-02 17:52:36 +08:00
bus.c PCI: Replace dev_printk(KERN_DEBUG) with dev_info(), etc 2020-09-02 17:52:38 +08:00
ecam.c
host-bridge.c
iov.c Merge branch 'pci/virtualization' 2018-08-15 14:59:06 -05:00
irq.c PCI: Use IRQF_ONESHOT if pci_request_irq() called with no handler 2018-07-31 10:43:43 -05:00
mmap.c
msi.c genirq/affinity: Add support for allocating interrupt sets 2020-09-02 17:51:05 +08:00
of.c Merge branch 'pci/resource' 2018-08-15 14:59:01 -05:00
pci-acpi.c PCI/DPC: Add Error Disconnect Recover (EDR) support 2020-11-19 14:05:56 +08:00
pci-driver.c PCI/PM: Always return devices to D0 when thawing 2019-12-21 10:57:22 +01:00
pci-label.c
pci-mid.c x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:17:53 +02:00
pci-pf-stub.c
pci-stub.c PCI: Replace printk(KERN_INFO) with pr_info(), etc 2020-09-02 17:52:38 +08:00
pci-sysfs.c PCI: Decode PCIe 32 GT/s link speed 2024-01-17 12:08:18 +00:00
pci.c PCI: Decode PCIe 32 GT/s link speed 2024-01-17 12:08:18 +00:00
pci.h PCI: Add 32 GT/s decoding in some macros 2024-01-17 12:08:18 +00:00
probe.c PCI: Decode PCIe 32 GT/s link speed 2024-01-17 12:08:18 +00:00
proc.c
quirks.c anolis: PHYTIUM: smmu: one device per iommu group for VF/PF passthrough 2021-11-22 20:26:20 +08:00
remove.c PCI/ASPM: Fix link_state teardown on device removal 2018-11-13 11:08:45 -08:00
rom.c
search.c
setup-bus.c PCI: Don't disable bridge BARs when assigning bus resources 2021-07-21 17:20:40 +08:00
setup-irq.c
setup-res.c
slot.c PCI: Decode PCIe 32 GT/s link speed 2024-01-17 12:08:18 +00:00
syscall.c
vc.c PCI: Get rid of dev->has_secondary_link flag 2020-09-02 17:52:41 +08:00
vpd.c PCI/VPD: Check for VPD access completion before checking for timeout 2018-08-14 16:04:46 -05:00
xen-pcifront.c PCI: Replace dev_printk(KERN_DEBUG) with dev_info(), etc 2020-09-02 17:52:38 +08:00