diff options
author | Cyril Chemparathy <cyril@ti.com> | 2012-09-21 11:56:03 -0400 |
---|---|---|
committer | Tushar Behera <tushar.behera@linaro.org> | 2013-01-22 11:41:19 +0530 |
commit | 9cd38cdb7148dd2de345b70ba3b61602490b0c4f (patch) | |
tree | 396b60975af1e3bdf286d8e8c7ae9f1ba1fa9a16 | |
parent | 215641ae33d8758827da37adcfed7d10fe7efc02 (diff) | |
download | linux-topics-9cd38cdb7148dd2de345b70ba3b61602490b0c4f.tar.gz |
ARM: LPAE: support 64-bit virt_to_phys patching
This patch adds support for 64-bit physical addresses in virt_to_phys()
patching. This does not do real 64-bit add/sub, but instead patches in the
upper 32-bits of the phys_offset directly into the output of virt_to_phys.
There is no corresponding change on the phys_to_virt() side, because
computations on the upper 32-bits would be discarded anyway.
Signed-off-by: Cyril Chemparathy <cyril@ti.com>
-rw-r--r-- | arch/arm/include/asm/memory.h | 38 | ||||
-rw-r--r-- | arch/arm/kernel/head.S | 4 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 2 |
3 files changed, 41 insertions, 3 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index a4fc01e1648..064345455a3 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -154,13 +154,47 @@ #ifdef CONFIG_ARM_PATCH_PHYS_VIRT extern unsigned long __pv_offset; -extern unsigned long __pv_phys_offset; +extern phys_addr_t __pv_phys_offset; #define PHYS_OFFSET __virt_to_phys(PAGE_OFFSET) static inline phys_addr_t __virt_to_phys(unsigned long x) { - unsigned long t; + phys_addr_t t; + +#ifndef CONFIG_ARM_LPAE early_patch_imm8("add", t, x, __pv_offset, 0); +#else + unsigned long __tmp; + +#ifndef __ARMEB__ +#define PV_PHYS_HIGH "(__pv_phys_offset + 4)" +#else +#define PV_PHYS_HIGH "__pv_phys_offset" +#endif + + early_patch_stub( + /* type */ PATCH_IMM8, + /* code */ + "ldr %[tmp], =__pv_offset\n" + "ldr %[tmp], [%[tmp]]\n" + "add %Q[to], %[from], %[tmp]\n" + "ldr %[tmp], =" PV_PHYS_HIGH "\n" + "ldr %[tmp], [%[tmp]]\n" + "mov %R[to], %[tmp]\n", + /* pad */ 4, + /* patch_data */ + ".long __pv_offset\n" + "add %Q[to], %[from], %[imm]\n" + ".long " PV_PHYS_HIGH "\n" + "mov %R[to], %[imm]\n", + /* operands */ + : [to] "=r" (t), + [tmp] "=&r" (__tmp) + : [from] "r" (x), + [imm] "I" (__IMM8), + "i" (&__pv_offset), + "i" (&__pv_phys_offset)); +#endif return t; } diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 37e6da63d44..1ae52e1d896 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -538,7 +538,11 @@ ENDPROC(__fixup_pv_offsets) .align 1: .long . +#if defined(CONFIG_ARM_LPAE) && defined(__ARMEB__) + .long __pv_phys_offset + 4 +#else .long __pv_phys_offset +#endif .long __pv_offset .long PAGE_OFFSET #endif diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index bf78b9dd647..dca8bc3f22e 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -152,7 +152,7 @@ DEFINE_PER_CPU(struct cpuinfo_arm, cpu_data); */ unsigned long __pv_offset = 0xdeadbeef; EXPORT_SYMBOL(__pv_offset); -unsigned long __pv_phys_offset = 0xdeadbeef; +phys_addr_t __pv_phys_offset = 0xdeadbeef; EXPORT_SYMBOL(__pv_phys_offset); #endif |