[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170419164913.19674-8-lorenzo.pieralisi@arm.com>
Date: Wed, 19 Apr 2017 17:48:56 +0100
From: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
To: linux-pci@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Jayachandran C <jnair@...iumnetworks.com>,
Arnd Bergmann <arnd@...db.de>,
Will Deacon <will.deacon@....com>,
Catalin Marinas <catalin.marinas@....com>,
Russell King <linux@...linux.org.uk>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Pratyush Anand <pratyush.anand@...il.com>,
Jingoo Han <jingoohan1@...il.com>,
Mingkai Hu <mingkai.hu@...escale.com>,
John Garry <john.garry@...wei.com>,
Tanmay Inamdar <tinamdar@....com>,
Murali Karicheri <m-karicheri2@...com>,
Bharat Kumar Gogada <bharat.kumar.gogada@...inx.com>,
Ray Jui <rjui@...adcom.com>,
Wenrui Li <wenrui.li@...k-chips.com>,
Shawn Lin <shawn.lin@...k-chips.com>,
Minghuan Lian <minghuan.Lian@...escale.com>,
Jon Mason <jonmason@...adcom.com>,
Gabriele Paoloni <gabriele.paoloni@...wei.com>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Joao Pinto <Joao.Pinto@...opsys.com>,
Thierry Reding <thierry.reding@...il.com>,
Michal Simek <michal.simek@...inx.com>,
Stanimir Varbanov <svarbanov@...sol.com>,
Zhou Wang <wangzhou1@...ilicon.com>,
Roy Zang <tie-fei.zang@...escale.com>,
"Luis R. Rodriguez" <mcgrof@...nel.org>
Subject: [PATCH v4 07/21] PCI: ECAM: use pci_remap_cfgspace() to map config region
Current ECAM kernel implementation uses ioremap() to map the ECAM
configuration space memory region; this is not safe in that on some
architectures the ioremap interface provides mappings that allow posted
write transactions. This, as highlighted in the PCIe specifications
(4.0 - Rev0.3, "Ordering Considerations for the Enhanced Configuration
Address Mechanism"), can create ordering issues for software because
posted writes transactions on the CPU host bus are non posted in the
PCI express fabric.
Update the ioremap() interface to use pci_remap_cfgspace() whose
mapping attributes guarantee that non-posted writes transactions
are issued for memory writes within the ECAM memory mapped address
region.
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Jayachandran C <jnair@...iumnetworks.com>
---
drivers/pci/ecam.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c
index 2fee61b..c228a2e 100644
--- a/drivers/pci/ecam.c
+++ b/drivers/pci/ecam.c
@@ -84,12 +84,14 @@ struct pci_config_window *pci_ecam_create(struct device *dev,
if (!cfg->winp)
goto err_exit_malloc;
for (i = 0; i < bus_range; i++) {
- cfg->winp[i] = ioremap(cfgres->start + i * bsz, bsz);
+ cfg->winp[i] =
+ pci_remap_cfgspace(cfgres->start + i * bsz,
+ bsz);
if (!cfg->winp[i])
goto err_exit_iomap;
}
} else {
- cfg->win = ioremap(cfgres->start, bus_range * bsz);
+ cfg->win = pci_remap_cfgspace(cfgres->start, bus_range * bsz);
if (!cfg->win)
goto err_exit_iomap;
}
--
2.10.0
Powered by blists - more mailing lists