aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-01-04 14:39:29 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-02-17 18:27:33 -0500
commitcada3c0841e1deaec4c0f92654610b028dc683ff (patch)
tree9c6085c8b8447795ddc749315a31fd3906a6159d /arch/arm/include
parentdc21af99fadcfa0ae65b52fd0895f85824f0c288 (diff)
ARM: P2V: extend to 16-bit translation offsets
MSM's memory is aligned to 2MB, which is more than we can do with our existing method as we're limited to the upper 8 bits. Extend this by using two instructions to 16 bits, automatically selected when MSM is enabled. Acked-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Nicolas Pitre <nicolas.pitre@linaro.org> Tested-by: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/memory.h21
-rw-r--r--arch/arm/include/asm/module.h4
2 files changed, 21 insertions, 4 deletions
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 7197879e1cb..2398b3fc026 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -154,29 +154,42 @@
154#ifndef __virt_to_phys 154#ifndef __virt_to_phys
155#ifdef CONFIG_ARM_PATCH_PHYS_VIRT 155#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
156 156
157/*
158 * Constants used to force the right instruction encodings and shifts
159 * so that all we need to do is modify the 8-bit constant field.
160 */
161#define __PV_BITS_31_24 0x81000000
162#define __PV_BITS_23_16 0x00810000
163
157extern unsigned long __pv_phys_offset; 164extern unsigned long __pv_phys_offset;
158#define PHYS_OFFSET __pv_phys_offset 165#define PHYS_OFFSET __pv_phys_offset
159 166
160#define __pv_stub(from,to,instr) \ 167#define __pv_stub(from,to,instr,type) \
161 __asm__("@ __pv_stub\n" \ 168 __asm__("@ __pv_stub\n" \
162 "1: " instr " %0, %1, %2\n" \ 169 "1: " instr " %0, %1, %2\n" \
163 " .pushsection .pv_table,\"a\"\n" \ 170 " .pushsection .pv_table,\"a\"\n" \
164 " .long 1b\n" \ 171 " .long 1b\n" \
165 " .popsection\n" \ 172 " .popsection\n" \
166 : "=r" (to) \ 173 : "=r" (to) \
167 : "r" (from), "I" (0x81000000)) 174 : "r" (from), "I" (type))
168 175
169static inline unsigned long __virt_to_phys(unsigned long x) 176static inline unsigned long __virt_to_phys(unsigned long x)
170{ 177{
171 unsigned long t; 178 unsigned long t;
172 __pv_stub(x, t, "add"); 179 __pv_stub(x, t, "add", __PV_BITS_31_24);
180#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
181 __pv_stub(t, t, "add", __PV_BITS_23_16);
182#endif
173 return t; 183 return t;
174} 184}
175 185
176static inline unsigned long __phys_to_virt(unsigned long x) 186static inline unsigned long __phys_to_virt(unsigned long x)
177{ 187{
178 unsigned long t; 188 unsigned long t;
179 __pv_stub(x, t, "sub"); 189 __pv_stub(x, t, "sub", __PV_BITS_31_24);
190#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
191 __pv_stub(t, t, "sub", __PV_BITS_23_16);
192#endif
180 return t; 193 return t;
181} 194}
182#else 195#else
diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h
index d072c21332e..a2b775b81cf 100644
--- a/arch/arm/include/asm/module.h
+++ b/arch/arm/include/asm/module.h
@@ -31,7 +31,11 @@ struct mod_arch_specific {
31 31
32/* Add __virt_to_phys patching state as well */ 32/* Add __virt_to_phys patching state as well */
33#ifdef CONFIG_ARM_PATCH_PHYS_VIRT 33#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
34#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
35#define MODULE_ARCH_VERMAGIC_P2V "p2v16 "
36#else
34#define MODULE_ARCH_VERMAGIC_P2V "p2v8 " 37#define MODULE_ARCH_VERMAGIC_P2V "p2v8 "
38#endif
35#else 39#else
36#define MODULE_ARCH_VERMAGIC_P2V "" 40#define MODULE_ARCH_VERMAGIC_P2V ""
37#endif 41#endif