aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2013-07-31 12:44:42 -0400
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2013-10-10 20:25:06 -0400
commit4dc9a81715973cb137a14399420bb35b0ed7d6ef (patch)
treecb54075d8504d655d9aa422dbe38e072e7a0cdc3
parentca5a45c06cd4764fb8510740f7fc550d9a0208d4 (diff)
ARM: mm: Introduce virt_to_idmap() with an arch hook
On some PAE systems (e.g. TI Keystone), memory is above the 32-bit addressable limit, and the interconnect provides an aliased view of parts of physical memory in the 32-bit addressable space. This alias is strictly for boot time usage, and is not otherwise usable because of coherency limitations. On such systems, the idmap mechanism needs to take this aliased mapping into account. This patch introduces virt_to_idmap() and a arch function pointer which can be populated by platform which needs it. Also populate necessary idmap spots with now available virt_to_idmap(). Avoided #ifdef approach to be compatible with multi-platform builds. Most architecture won't touch it and in that case virt_to_idmap() fall-back to existing virt_to_phys() macro. Cc: Russell King <linux@arm.linux.org.uk> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
-rw-r--r--arch/arm/include/asm/memory.h16
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/mm/idmap.c5
3 files changed, 20 insertions, 3 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index c133bd915f48..d9b96c65e594 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -173,6 +173,7 @@
173 */ 173 */
174#define __PV_BITS_31_24 0x81000000 174#define __PV_BITS_31_24 0x81000000
175 175
176extern phys_addr_t (*arch_virt_to_idmap) (unsigned long x);
176extern unsigned long __pv_phys_offset; 177extern unsigned long __pv_phys_offset;
177#define PHYS_OFFSET __pv_phys_offset 178#define PHYS_OFFSET __pv_phys_offset
178 179
@@ -259,6 +260,21 @@ static inline void *phys_to_virt(phys_addr_t x)
259#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 260#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
260 261
261/* 262/*
263 * These are for systems that have a hardware interconnect supported alias of
264 * physical memory for idmap purposes. Most cases should leave these
265 * untouched.
266 */
267static inline phys_addr_t __virt_to_idmap(unsigned long x)
268{
269 if (arch_virt_to_idmap)
270 return arch_virt_to_idmap(x);
271 else
272 return __virt_to_phys(x);
273}
274
275#define virt_to_idmap(x) __virt_to_idmap((unsigned long)(x))
276
277/*
262 * Virtual <-> DMA view memory address translations 278 * Virtual <-> DMA view memory address translations
263 * Again, these are *only* valid on the kernel direct mapped RAM 279 * Again, these are *only* valid on the kernel direct mapped RAM
264 * memory. Use of these is *deprecated* (and that doesn't mean 280 * memory. Use of these is *deprecated* (and that doesn't mean
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 72024ea8a3a6..a0eb830c3daf 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -80,7 +80,7 @@ void __init smp_set_ops(struct smp_operations *ops)
80 80
81static unsigned long get_arch_pgd(pgd_t *pgd) 81static unsigned long get_arch_pgd(pgd_t *pgd)
82{ 82{
83 phys_addr_t pgdir = virt_to_phys(pgd); 83 phys_addr_t pgdir = virt_to_idmap(pgd);
84 BUG_ON(pgdir & ARCH_PGD_MASK); 84 BUG_ON(pgdir & ARCH_PGD_MASK);
85 return pgdir >> ARCH_PGD_SHIFT; 85 return pgdir >> ARCH_PGD_SHIFT;
86} 86}
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 83cb3ac27095..c0a1e48f6733 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -10,6 +10,7 @@
10#include <asm/system_info.h> 10#include <asm/system_info.h>
11 11
12pgd_t *idmap_pgd; 12pgd_t *idmap_pgd;
13phys_addr_t (*arch_virt_to_idmap) (unsigned long x);
13 14
14#ifdef CONFIG_ARM_LPAE 15#ifdef CONFIG_ARM_LPAE
15static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, 16static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
@@ -67,8 +68,8 @@ static void identity_mapping_add(pgd_t *pgd, const char *text_start,
67 unsigned long addr, end; 68 unsigned long addr, end;
68 unsigned long next; 69 unsigned long next;
69 70
70 addr = virt_to_phys(text_start); 71 addr = virt_to_idmap(text_start);
71 end = virt_to_phys(text_end); 72 end = virt_to_idmap(text_end);
72 73
73 prot |= PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AF; 74 prot |= PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AF;
74 75