Skip to content

Commit 1c8c3cf

Browse files
tpetazzoniRussell King
authored andcommitted
ARM: 8060/1: mm: allow sub-architectures to override PCI I/O memory type
Due to a design incompatibility between the PCIe Marvell controller and the Cortex-A9, stressing PCIe devices with a lot of traffic quickly causes a deadlock. One part of the workaround for this is to have all PCIe regions mapped as strongly-ordered (MT_UNCACHED) instead of the default MT_DEVICE. While the arch_ioremap_caller() mechanism allows sub-architecture code to override ioremap(), used to map PCIe memory regions, there isn't such a mechanism to override the behavior of pci_ioremap_io(). This commit adds the arch_pci_ioremap_mem_type variable, initialized to MT_DEVICE by default, and that sub-architecture code can override. We have chosen to expose a single variable rather than offering the possibility of overriding the entire pci_ioremap_io(), because implementing pci_ioremap_io() requires calling functions (get_mem_type()) that are private to the arch/arm/mm/ code. Signed-off-by: Thomas Petazzoni <[email protected]> Acked-by: Catalin Marinas <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 437b680 commit 1c8c3cf

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

arch/arm/include/asm/io.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
179179
/* PCI fixed i/o mapping */
180180
#define PCI_IO_VIRT_BASE 0xfee00000
181181

182+
#if defined(CONFIG_PCI)
183+
void pci_ioremap_set_mem_type(int mem_type);
184+
#else
185+
static inline void pci_ioremap_set_mem_type(int mem_type) {}
186+
#endif
187+
182188
extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
183189

184190
/*

arch/arm/mm/ioremap.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,21 @@ void __arm_iounmap(volatile void __iomem *io_addr)
438438
EXPORT_SYMBOL(__arm_iounmap);
439439

440440
#ifdef CONFIG_PCI
441+
static int pci_ioremap_mem_type = MT_DEVICE;
442+
443+
void pci_ioremap_set_mem_type(int mem_type)
444+
{
445+
pci_ioremap_mem_type = mem_type;
446+
}
447+
441448
int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr)
442449
{
443450
BUG_ON(offset + SZ_64K > IO_SPACE_LIMIT);
444451

445452
return ioremap_page_range(PCI_IO_VIRT_BASE + offset,
446453
PCI_IO_VIRT_BASE + offset + SZ_64K,
447454
phys_addr,
448-
__pgprot(get_mem_type(MT_DEVICE)->prot_pte));
455+
__pgprot(get_mem_type(pci_ioremap_mem_type)->prot_pte));
449456
}
450457
EXPORT_SYMBOL_GPL(pci_ioremap_io);
451458
#endif

0 commit comments

Comments
 (0)