Skip to content

Commit f59b86a

Browse files
Enric Balletbo i Serrabjorn-helgaas
authored andcommitted
PCI: rockchip: Fix IO outbound ATU register number
Since 62240a8 ("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+ torvalds#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 <[email protected]> Fixes: 62240a8 ("PCI: rockchip: Drop storing driver private outbound resource data) Link: https://lore.kernel.org/r/[email protected] Reported-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Andrew Murray <[email protected]>
1 parent e42617b commit f59b86a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/pci/controller/pcie-rockchip-host.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,12 @@ static int rockchip_pcie_cfg_atu(struct rockchip_pcie *rockchip)
834834
if (!entry)
835835
return -ENODEV;
836836

837+
/* store the register number offset to program RC io outbound ATU */
838+
offset = size >> 20;
839+
837840
size = resource_size(entry->res);
838841
pci_addr = entry->res->start - entry->offset;
839842

840-
offset = size >> 20;
841843
for (reg_no = 0; reg_no < (size >> 20); reg_no++) {
842844
err = rockchip_pcie_prog_ob_atu(rockchip,
843845
reg_no + 1 + offset,

0 commit comments

Comments
 (0)