linux-sg2042/drivers/pci
Jiaxun Yang 0c196180b5 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 17:00:20 +01:00
..
controller PCI: loongson: Limit MRRS to 256 2023-12-20 17:00:20 +01:00
endpoint PCI: epf-test: Fix DMA transfer completion detection 2023-07-23 13:49:36 +02:00
hotplug Revert "PCI: acpiphp: Reassign resources on bridge if necessary" 2023-12-20 17:00:20 +01:00
msi PCI/MSI: Correct 'can_mask' test in msi_add_msi_desc() 2022-08-26 10:47:54 -05:00
pcie PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common() 2023-11-28 17:07:11 +00:00
switch PCI: switchtec: Return -EFAULT for copy_to_user() errors 2023-03-10 09:33:31 +01:00
Kconfig cxl for 6.0 2022-08-10 11:07:26 -07:00
Makefile PCI/DOE: Add DOE mailbox support functions 2022-07-19 15:38:04 -07:00
access.c PCI: Add locking to RMW PCI Express Capability Register accessors 2023-09-13 09:42:46 +02:00
ats.c
bus.c PCI: s390: Fix use-after-free of PCI resources with per-function hotplug 2023-03-22 13:33:45 +01:00
doe.c PCI/DOE: Fix destroy_work_on_stack() race 2023-09-13 09:42:45 +02:00
ecam.c
host-bridge.c
iov.c PCI/IOV: Enlarge virtfn sysfs name buffer 2023-03-10 09:33:31 +01:00
irq.c PCI: Check for alloc failure in pci_request_irq() 2022-12-31 13:32:33 +01:00
mmap.c PCI: Remove pci_mmap_page_range() wrapper 2022-07-29 12:08:44 -05:00
of.c
p2pdma.c PCI/P2PDMA: Use for_each_pci_dev() helper 2022-09-19 13:44:38 -05:00
pci-acpi.c PCI/sysfs: Protect driver's D3cold preference from user space 2023-11-28 17:07:08 +00:00
pci-bridge-emul.c PCI: pci-bridge-emul: Set position of PCI capabilities to real HW value 2022-08-25 12:07:56 +02:00
pci-bridge-emul.h PCI: pci-bridge-emul: Set position of PCI capabilities to real HW value 2022-08-25 12:07:56 +02:00
pci-driver.c PCI: Unify delay handling for reset and resume 2023-03-10 09:34:30 +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 17:07:08 +00:00
pci.c PCI: Use FIELD_GET() in Sapphire RX 5600 XT Pulse quirk 2023-11-28 17:07:00 +00:00
pci.h PCI/DPC: Await readiness of secondary bus after reset 2023-03-10 09:34:31 +01:00
probe.c PCI: Do error check on own line to split long "if" conditions 2023-11-28 17:07:00 +00:00
proc.c PCI: Remove pci_mmap_page_range() wrapper 2022-07-29 12:08:44 -05:00
quirks.c PCI: Lengthen reset delay for VideoPropulsion Torrent QN16e card 2023-12-08 08:51:18 +01:00
remove.c
rom.c
search.c
setup-bus.c PCI: Distribute available resources for root buses, too 2023-03-11 13:55:38 +01:00
setup-irq.c
setup-res.c PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge 2022-09-21 17:52:47 -05:00
slot.c
syscall.c
vc.c
vgaarb.c
vpd.c
xen-pcifront.c xen/pcifront: move xenstore config scanning into sub-function 2022-10-07 07:36:44 +02:00