linux-stable/drivers/pci/controller
Enric Balletbo i Serra ca01e79874 PCI: rockchip: Fix IO outbound ATU register number
Since 62240a8800 ("PCI: rockchip: Drop storing driver private outbound
resource data), the offset calculation is wrong to access the register
number to program the IO outbound ATU.

Fix this by computing the ATU IO register number based on the number of MEM
registers, not the size of the IO region.

This causes 'synchronous external aborts' like the following:

  mwifiex_pcie 0000:01:00.0: enabling device (0000 -> 0002)
  mwifiex_pcie: PCI memory map Virt0: 00000000a573ad00 PCI memory map Virt2: 00000000783126c4
  Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP
  Modules linked in: mwifiex_pcie(+) mwifiex uvcvideo cfg80211 atmel_mxt_ts videobuf2_vmalloc ...
  CPU: 2 PID: 269 Comm: systemd-udevd Not tainted 5.4.0+ #327
  Hardware name: Google Kevin (DT)
  pstate: 60000005 (nZCv daif -PAN -UAO)
  pc : mwifiex_register_dev+0x264/0x3f8 [mwifiex_pcie]
  lr : mwifiex_register_dev+0x150/0x3f8 [mwifiex_pcie]
  sp : ffff800012073860
  x29: ffff800012073860 x28: ffff8000100a2e28
  x27: ffff8000118b6210 x26: ffff800008f57458
  x25: ffff0000ecfda000 x24: 0000000000000001
  x23: ffff0000e9905080 x22: ffff800008f5d000
  x21: ffff0000eecea078 x20: ffff0000e9905080
  x19: ffff0000eecea000 x18: 0000000000000001
  x17: 0000000000000000 x16: 0000000000000000
  x15: ffffffffffffffff x14: ffff8000118998c8
  x13: ffff000000000000 x12: 0000000000000008
  x11: 0101010101010101 x10: ffff7f7fffff7fff
  x9 : 0000000000000000 x8 : ffff0000e3c24240
  x7 : 0000000000000000 x6 : ffff0000e3c24148
  x5 : ffff0000e3c24148 x4 : ffff0000e7975ec8
  x3 : 0000000000000001 x2 : 0000000000002b42
  x1 : ffff800012c00008 x0 : ffff0000e9905080
  Call trace:
   mwifiex_register_dev+0x264/0x3f8 [mwifiex_pcie]
   mwifiex_add_card+0x2f8/0x430 [mwifiex]
   mwifiex_pcie_probe+0x98/0x148 [mwifiex_pcie]
   pci_device_probe+0x110/0x1a8
   ...
  Code: a8c67bfd d65f03c0 f942ac01 91002021 (b9400021)

Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fixes: 62240a8800 ("PCI: rockchip: Drop storing driver private outbound resource data)
Link: https://lore.kernel.org/r/20191211093450.7481-1-enric.balletbo@collabora.com
Reported-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reported-by: Vicente Bergas <vicencb@gmail.com>
Tested-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Andrew Murray <andrew.murray@arm.com>
2019-12-12 15:25:37 -06:00
..
cadence Merge branch 'remotes/lorenzo/pci/mmio-dma-ranges' 2019-11-28 08:54:53 -06:00
dwc Merge branch 'pci/trivial' 2019-11-28 08:54:55 -06:00
Kconfig Merge branch 'remotes/lorenzo/pci/mmio-dma-ranges' 2019-11-28 08:54:53 -06:00
Makefile PCI: cadence: Move all files to per-device cadence directory 2019-11-11 14:57:02 +00:00
pci-aardvark.c Merge branch 'remotes/lorenzo/pci/mmio-dma-ranges' 2019-11-28 08:54:53 -06:00
pci-ftpci100.c PCI: ftpci100: Use inbound resources for setup 2019-11-20 17:00:14 +00:00
pci-host-common.c PCI: of: Add inbound resource parsing to helpers 2019-11-20 16:59:58 +00:00
pci-host-generic.c PCI: Fix comment typos 2019-04-13 11:17:15 -05:00
pci-hyperv-intf.c PCI: hv: Add a Hyper-V PCI interface driver for software backchannel interface 2019-08-22 00:25:12 -07:00
pci-hyperv.c Merge branch 'remotes/lorenzo/pci/hv' 2019-11-28 08:54:43 -06:00
pci-mvebu.c PCI: mvebu: mvebu_pcie_map_registers __iomem fix 2019-10-17 11:02:47 +01:00
pci-rcar-gen2.c
pci-tegra.c PCI: tegra: Fix OF node reference leak 2019-08-12 11:36:18 +01:00
pci-thunder-ecam.c
pci-thunder-pem.c PCI: Remove unused includes and superfluous struct declaration 2019-11-21 07:49:29 -06:00
pci-v3-semi.c PCI: v3-semi: Use inbound resources for setup 2019-11-20 17:00:14 +00:00
pci-versatile.c PCI: of: Add inbound resource parsing to helpers 2019-11-20 16:59:58 +00:00
pci-xgene-msi.c
pci-xgene.c PCI: xgene: Use inbound resources for setup 2019-11-20 17:00:14 +00:00
pcie-altera-msi.c PCI: altera-msi: Allow building as module 2019-05-30 15:34:54 +01:00
pcie-altera.c PCI: of: Add inbound resource parsing to helpers 2019-11-20 16:59:58 +00:00
pcie-iproc-bcma.c
pcie-iproc-msi.c PCI: iproc-msi: Fix __iomem annotation in decode_msi_hwirq() 2019-10-17 11:01:24 +01:00
pcie-iproc-platform.c PCI: of: Add inbound resource parsing to helpers 2019-11-20 16:59:58 +00:00
pcie-iproc.c Merge branch 'remotes/lorenzo/pci/mmio-dma-ranges' 2019-11-28 08:54:53 -06:00
pcie-iproc.h PCI: iproc: Reject unconfigured physical functions from PAXC 2018-07-13 11:56:55 +01:00
pcie-mediatek.c PCI: of: Add inbound resource parsing to helpers 2019-11-20 16:59:58 +00:00
pcie-mobiveil.c Merge branch 'remotes/lorenzo/pci/mmio-dma-ranges' 2019-11-28 08:54:53 -06:00
pcie-rcar.c Merge branch 'remotes/lorenzo/pci/mmio-dma-ranges' 2019-11-28 08:54:53 -06:00
pcie-rockchip-ep.c PCI: rockchip: Fix rockchip_pcie_ep_assert_intx() bitwise operations 2019-04-15 10:39:26 +01:00
pcie-rockchip-host.c PCI: rockchip: Fix IO outbound ATU register number 2019-12-12 15:25:37 -06:00
pcie-rockchip.c
pcie-rockchip.h Merge branch 'remotes/lorenzo/pci/mmio-dma-ranges' 2019-11-28 08:54:53 -06:00
pcie-tango.c
pcie-xilinx-nwl.c PCI: of: Add inbound resource parsing to helpers 2019-11-20 16:59:58 +00:00
pcie-xilinx.c PCI: of: Add inbound resource parsing to helpers 2019-11-20 16:59:58 +00:00
vmd.c Merge branch 'pci/trivial' 2019-11-28 08:54:55 -06:00