Skip to content

Commit 497a923

Browse files
tpetazzoniJason Cooper
authored andcommitted
ARM: mvebu: implement L2/PCIe deadlock workaround
The Marvell Armada 375 and Armada 38x SOCs, which use the Cortex-A9 CPU core, the PL310 cache and the Marvell PCIe hardware block are affected a L2/PCIe deadlock caused by a system erratum when hardware I/O coherency is used. This deadlock can be avoided by mapping the PCIe memory areas as strongly-ordered (note: MT_UNCACHED is strongly-ordered), and by removing the outer cache sync done in software. This is implemented in this patch by: * Registering a custom arch_ioremap_caller function that allows to make sure PCI memory regions are mapped MT_UNCACHED. * Adding at runtime the 'arm,io-coherent' property to the PL310 cache controller. This cannot be done permanently in the DT, because the hardware I/O coherency can only be enabled when CONFIG_SMP is enabled, in the current kernel situation. Signed-off-by: Thomas Petazzoni <[email protected]> Link: https://lkml.kernel.org/r/1400165974-9059-4-git-send-email-thomas.petazzoni@free-electrons.com Signed-off-by: Jason Cooper <[email protected]>
1 parent b0063aa commit 497a923

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

arch/arm/mach-mvebu/coherency.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/pci.h>
3333
#include <asm/smp_plat.h>
3434
#include <asm/cacheflush.h>
35+
#include <asm/mach/map.h>
3536
#include "armada-370-xp.h"
3637
#include "coherency.h"
3738
#include "mvebu-soc-id.h"
@@ -309,9 +310,47 @@ static void __init armada_370_coherency_init(struct device_node *np)
309310
set_cpu_coherent();
310311
}
311312

313+
/*
314+
* This ioremap hook is used on Armada 375/38x to ensure that PCIe
315+
* memory areas are mapped as MT_UNCACHED instead of MT_DEVICE. This
316+
* is needed as a workaround for a deadlock issue between the PCIe
317+
* interface and the cache controller.
318+
*/
319+
static void __iomem *
320+
armada_pcie_wa_ioremap_caller(phys_addr_t phys_addr, size_t size,
321+
unsigned int mtype, void *caller)
322+
{
323+
struct resource pcie_mem;
324+
325+
mvebu_mbus_get_pcie_mem_aperture(&pcie_mem);
326+
327+
if (pcie_mem.start <= phys_addr && (phys_addr + size) <= pcie_mem.end)
328+
mtype = MT_UNCACHED;
329+
330+
return __arm_ioremap_caller(phys_addr, size, mtype, caller);
331+
}
332+
312333
static void __init armada_375_380_coherency_init(struct device_node *np)
313334
{
335+
struct device_node *cache_dn;
336+
314337
coherency_cpu_base = of_iomap(np, 0);
338+
arch_ioremap_caller = armada_pcie_wa_ioremap_caller;
339+
340+
/*
341+
* Add the PL310 property "arm,io-coherent". This makes sure the
342+
* outer sync operation is not used, which allows to
343+
* workaround the system erratum that causes deadlocks when
344+
* doing PCIe in an SMP situation on Armada 375 and Armada
345+
* 38x.
346+
*/
347+
for_each_compatible_node(cache_dn, NULL, "arm,pl310-cache") {
348+
struct property *p;
349+
350+
p = kzalloc(sizeof(*p), GFP_KERNEL);
351+
p->name = kstrdup("arm,io-coherent", GFP_KERNEL);
352+
of_add_property(cache_dn, p);
353+
}
315354
}
316355

317356
static int coherency_type(void)

0 commit comments

Comments
 (0)