diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-11-20 16:06:43 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-11-24 12:41:36 -0500 |
commit | 26a26d329688ab018e068b412b03d43d7c299f0a (patch) | |
tree | f33ea6faa4f8d9409098654354548fa28c7b41ad /arch/arm/include/asm/pgtable.h | |
parent | acaac256b3a14a09ab278409a72d119f2d75b02b (diff) |
ARM: dma-mapping: switch ARMv7 DMA mappings to retain 'memory' attribute
On ARMv7, it is invalid to map the same physical address multiple times
with different memory types. Since system RAM is already mapped as
'memory', subsequent remapping of it must retain this attribute.
However, DMA memory maps it as "strongly ordered". Fix this by introducing
'pgprot_dmacoherent()' which provides the necessary page table bits for
DMA mappings.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/include/asm/pgtable.h')
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 201ccaa11f61..11397687f42c 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -304,13 +304,23 @@ PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); | |||
304 | 304 | ||
305 | static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | 305 | static inline pte_t pte_mkspecial(pte_t pte) { return pte; } |
306 | 306 | ||
307 | #define __pgprot_modify(prot,mask,bits) \ | ||
308 | __pgprot((pgprot_val(prot) & ~(mask)) | (bits)) | ||
309 | |||
307 | /* | 310 | /* |
308 | * Mark the prot value as uncacheable and unbufferable. | 311 | * Mark the prot value as uncacheable and unbufferable. |
309 | */ | 312 | */ |
310 | #define pgprot_noncached(prot) \ | 313 | #define pgprot_noncached(prot) \ |
311 | __pgprot((pgprot_val(prot) & ~L_PTE_MT_MASK) | L_PTE_MT_UNCACHED) | 314 | __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED) |
312 | #define pgprot_writecombine(prot) \ | 315 | #define pgprot_writecombine(prot) \ |
313 | __pgprot((pgprot_val(prot) & ~L_PTE_MT_MASK) | L_PTE_MT_BUFFERABLE) | 316 | __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE) |
317 | #if __LINUX_ARM_ARCH__ >= 7 | ||
318 | #define pgprot_dmacoherent(prot) \ | ||
319 | __pgprot_modify(prot, L_PTE_MT_MASK|L_PTE_EXEC, L_PTE_MT_BUFFERABLE) | ||
320 | #else | ||
321 | #define pgprot_dmacoherent(prot) \ | ||
322 | __pgprot_modify(prot, L_PTE_MT_MASK|L_PTE_EXEC, L_PTE_MT_UNCACHED) | ||
323 | #endif | ||
314 | 324 | ||
315 | #define pmd_none(pmd) (!pmd_val(pmd)) | 325 | #define pmd_none(pmd) (!pmd_val(pmd)) |
316 | #define pmd_present(pmd) (pmd_val(pmd)) | 326 | #define pmd_present(pmd) (pmd_val(pmd)) |