aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-06-16 09:42:25 -0400
committerGregory CLEMENT <gregory.clement@free-electrons.com>2016-06-16 10:43:10 -0400
commitc5379ba8fccd99d5f99632c789f0393d84a57805 (patch)
tree03e2cf4a0b3fbf9e716c555b5ae3840d80a0d4f9
parent1a695a905c18548062509178b98bc91e67510864 (diff)
ARM: mvebu: fix HW I/O coherency related deadlocks
Until now, our understanding for HW I/O coherency to work on the Cortex-A9 based Marvell SoC was that only the PCIe regions should be mapped strongly-ordered. However, we were still encountering some deadlocks, especially when testing the CESA crypto engine. After checking with the HW designers, it was concluded that all the MMIO registers should be mapped as strongly ordered for the HW I/O coherency mechanism to work properly. This fixes some easy to reproduce deadlocks with the CESA crypto engine driver (dmcrypt on a sufficiently large disk partition). Tested-by: Terry Stockert <stockert@inkblotadmirer.me> Tested-by: Romain Perier <romain.perier@free-electrons.com> Cc: Terry Stockert <stockert@inkblotadmirer.me> Cc: Romain Perier <romain.perier@free-electrons.com> Cc: <stable@vger.kernel.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
-rw-r--r--arch/arm/mach-mvebu/coherency.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 7e989d61159c..474abff7e855 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -162,22 +162,16 @@ exit:
162} 162}
163 163
164/* 164/*
165 * This ioremap hook is used on Armada 375/38x to ensure that PCIe 165 * This ioremap hook is used on Armada 375/38x to ensure that all MMIO
166 * memory areas are mapped as MT_UNCACHED instead of MT_DEVICE. This 166 * areas are mapped as MT_UNCACHED instead of MT_DEVICE. This is
167 * is needed as a workaround for a deadlock issue between the PCIe 167 * needed for the HW I/O coherency mechanism to work properly without
168 * interface and the cache controller. 168 * deadlock.
169 */ 169 */
170static void __iomem * 170static void __iomem *
171armada_pcie_wa_ioremap_caller(phys_addr_t phys_addr, size_t size, 171armada_wa_ioremap_caller(phys_addr_t phys_addr, size_t size,
172 unsigned int mtype, void *caller) 172 unsigned int mtype, void *caller)
173{ 173{
174 struct resource pcie_mem; 174 mtype = MT_UNCACHED;
175
176 mvebu_mbus_get_pcie_mem_aperture(&pcie_mem);
177
178 if (pcie_mem.start <= phys_addr && (phys_addr + size) <= pcie_mem.end)
179 mtype = MT_UNCACHED;
180
181 return __arm_ioremap_caller(phys_addr, size, mtype, caller); 175 return __arm_ioremap_caller(phys_addr, size, mtype, caller);
182} 176}
183 177
@@ -186,7 +180,7 @@ static void __init armada_375_380_coherency_init(struct device_node *np)
186 struct device_node *cache_dn; 180 struct device_node *cache_dn;
187 181
188 coherency_cpu_base = of_iomap(np, 0); 182 coherency_cpu_base = of_iomap(np, 0);
189 arch_ioremap_caller = armada_pcie_wa_ioremap_caller; 183 arch_ioremap_caller = armada_wa_ioremap_caller;
190 184
191 /* 185 /*
192 * We should switch the PL310 to I/O coherency mode only if 186 * We should switch the PL310 to I/O coherency mode only if