Thread (8 messages) 8 messages, 2 authors, 2018-08-08

[PATCH v2 4/6] PCI: mvebu: use resource_size() to remap I/O space

flat view
STALE2984d

From: thomas.petazzoni@bootlin.com (Thomas Petazzoni)
Date: 2018-08-03 14:38:46
Also in: linux-pci
Subsystem: pci driver for mvebu (marvell armada 370 and armada xp soc support), pci native host bridge and endpoint drivers, pci subsystem, the rest · Maintainers: Thomas Petazzoni, Pali Rohár, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas, Linus Torvalds

Instead of hardcoding the remapping of IO_SPACE_LIMIT - SZ_64K, use
resource_size(), as suggested by Lorenzo Pieralisi.

However, we cannot use just IO_SPACE_LIMIT, because pci_ioremap_io()
has a bug (which will be fixed separately) and doesn't allow remapping
the last 64 KB before IO_SPACE_LIMIT, so we ensure that we do not
exceed this limit. A separate patch will be sent to fix the
pci_ioremap_io() issue, and once it is merged, we will be able to drop
this work-around. Note that this workaround already existed, since we
were mapping only up to IO_SPACE_LIMIT - SZ_64K.

Suggested-by: Lorenzo Pieralisi <redacted>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 drivers/pci/controller/pci-mvebu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index 9aa224f2f009..05f863435e5e 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -1218,10 +1218,10 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 		pcie->realio.flags = pcie->io.flags;
 		pcie->realio.start = PCIBIOS_MIN_IO;
 		pcie->realio.end = min_t(resource_size_t,
-					 IO_SPACE_LIMIT,
+					 IO_SPACE_LIMIT - SZ_64K,
 					 resource_size(&pcie->io) - 1);
 
-		for (i = 0; i < (IO_SPACE_LIMIT - SZ_64K); i += SZ_64K)
+		for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K)
 			pci_ioremap_io(i, pcie->io.start + i);
 	} else
 		pcie->realio = pcie->io;
-- 
2.14.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help