linux/drivers/pci
Jiaxun Yang 6f709907ea PCI: loongson: Limit MRRS to 256
commit ef61a04057 upstream.

This is a partial revert of 8b3517f88f ("PCI: loongson: Prevent LS7A MRRS
increases") for MIPS-based Loongson.

Some MIPS Loongson systems don't support arbitrary Max_Read_Request_Size
(MRRS) settings.  8b3517f88f ("PCI: loongson: Prevent LS7A MRRS
increases") worked around that by (1) assuming that firmware configured
MRRS to the maximum supported value and (2) preventing the PCI core from
increasing MRRS.

Unfortunately, some firmware doesn't set that maximum MRRS correctly, which
results in devices not being initialized correctly.  One symptom, from the
Debian report below, is this:

  ata4.00: exception Emask 0x0 SAct 0x20000000 SErr 0x0 action 0x6 frozen
  ata4.00: failed command: WRITE FPDMA QUEUED
  ata4.00: cmd 61/20:e8:00:f0:e1/00:00:00:00:00/40 tag 29 ncq dma 16384 out
           res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
  ata4.00: status: { DRDY }
  ata4: hard resetting link

Limit MRRS to 256 because MIPS Loongson with higher MRRS support is
considered rare.

This must be done at device enablement stage because the MRRS setting may
get lost if PCI_COMMAND_MASTER on the parent bridge is cleared, and we are
only sure parent bridge is enabled at this point.

Fixes: 8b3517f88f ("PCI: loongson: Prevent LS7A MRRS increases")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217680
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1035587
Link: https://lore.kernel.org/r/20231201115028.84351-1-jiaxun.yang@flygoat.com
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 15:17:38 +01:00
..
controller PCI: loongson: Limit MRRS to 256 2023-12-20 15:17:38 +01:00
endpoint PCI: pci-epf-test: Register notifier if only core_init_notifier is enabled 2022-12-31 13:14:22 +01:00
hotplug Revert "PCI: acpiphp: Reassign resources on bridge if necessary" 2023-12-20 15:17:38 +01:00
pcie PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() 2023-11-28 16:56:28 +00:00
switch PCI: switchtec: Return -EFAULT for copy_to_user() errors 2023-03-10 09:39:37 +01:00
access.c
ats.c
bus.c PCI: s390: Fix use-after-free of PCI resources with per-function hotplug 2023-03-22 13:31:24 +01:00
ecam.c
host-bridge.c
iov.c PCI/IOV: Enlarge virtfn sysfs name buffer 2023-03-10 09:39:37 +01:00
irq.c PCI: Check for alloc failure in pci_request_irq() 2022-12-31 13:14:24 +01:00
Kconfig
Makefile
mmap.c
msi.c
of.c
p2pdma.c
pci-acpi.c PCI/sysfs: Protect driver's D3cold preference from user space 2023-11-28 16:56:28 +00:00
pci-bridge-emul.c
pci-bridge-emul.h
pci-driver.c PCI: Unify delay handling for reset and resume 2023-03-22 13:31:37 +01:00
pci-label.c
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c PCI/sysfs: Protect driver's D3cold preference from user space 2023-11-28 16:56:28 +00:00
pci.c PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk 2023-11-28 16:56:19 +00:00
pci.h PCI/ASPM: Remove pcie_aspm_pm_state_change() 2023-05-01 08:23:23 +09:00
probe.c
proc.c
quirks.c PCI: Disable ATS for specific Intel IPU E2000 devices 2023-11-28 16:56:19 +00:00
remove.c
rom.c
search.c
setup-bus.c PCI: Take other bus devices into account when distributing resources 2023-03-11 13:57:37 +01:00
setup-irq.c
setup-res.c PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge 2022-10-26 12:34:24 +02:00
slot.c
syscall.c
vc.c
vpd.c
xen-pcifront.c