aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig10
-rw-r--r--arch/arm/include/asm/memory.h7
-rw-r--r--arch/arm/include/asm/module.h4
-rw-r--r--arch/arm/kernel/head.S61
4 files changed, 14 insertions, 68 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8882a535cf44..272eadc7a12c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -205,20 +205,12 @@ config ARM_PATCH_PHYS_VIRT
205 kernel in system memory. 205 kernel in system memory.
206 206
207 This can only be used with non-XIP MMU kernels where the base 207 This can only be used with non-XIP MMU kernels where the base
208 of physical memory is at a 16MB boundary, or theoretically 64K 208 of physical memory is at a 16MB boundary.
209 for the MSM machine class.
210 209
211 Only disable this option if you know that you do not require 210 Only disable this option if you know that you do not require
212 this feature (eg, building a kernel for a single machine) and 211 this feature (eg, building a kernel for a single machine) and
213 you need to shrink the kernel to the minimal size. 212 you need to shrink the kernel to the minimal size.
214 213
215config ARM_PATCH_PHYS_VIRT_16BIT
216 def_bool y
217 depends on ARM_PATCH_PHYS_VIRT && ARCH_MSM
218 help
219 This option extends the physical to virtual translation patching
220 to allow physical memory down to a theoretical minimum of 64K
221 boundaries.
222 214
223source "init/Kconfig" 215source "init/Kconfig"
224 216
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index b8de516e600e..441fc4fe8263 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -160,7 +160,6 @@
160 * so that all we need to do is modify the 8-bit constant field. 160 * so that all we need to do is modify the 8-bit constant field.
161 */ 161 */
162#define __PV_BITS_31_24 0x81000000 162#define __PV_BITS_31_24 0x81000000
163#define __PV_BITS_23_16 0x00810000
164 163
165extern unsigned long __pv_phys_offset; 164extern unsigned long __pv_phys_offset;
166#define PHYS_OFFSET __pv_phys_offset 165#define PHYS_OFFSET __pv_phys_offset
@@ -178,9 +177,6 @@ static inline unsigned long __virt_to_phys(unsigned long x)
178{ 177{
179 unsigned long t; 178 unsigned long t;
180 __pv_stub(x, t, "add", __PV_BITS_31_24); 179 __pv_stub(x, t, "add", __PV_BITS_31_24);
181#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
182 __pv_stub(t, t, "add", __PV_BITS_23_16);
183#endif
184 return t; 180 return t;
185} 181}
186 182
@@ -188,9 +184,6 @@ static inline unsigned long __phys_to_virt(unsigned long x)
188{ 184{
189 unsigned long t; 185 unsigned long t;
190 __pv_stub(x, t, "sub", __PV_BITS_31_24); 186 __pv_stub(x, t, "sub", __PV_BITS_31_24);
191#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
192 __pv_stub(t, t, "sub", __PV_BITS_23_16);
193#endif
194 return t; 187 return t;
195} 188}
196#else 189#else
diff --git a/arch/arm/include/asm/module.h b/arch/arm/include/asm/module.h
index 543b44916d2c..6c6809f982f1 100644
--- a/arch/arm/include/asm/module.h
+++ b/arch/arm/include/asm/module.h
@@ -31,11 +31,7 @@ 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
37#define MODULE_ARCH_VERMAGIC_P2V "p2v8 " 34#define MODULE_ARCH_VERMAGIC_P2V "p2v8 "
38#endif
39#else 35#else
40#define MODULE_ARCH_VERMAGIC_P2V "" 36#define MODULE_ARCH_VERMAGIC_P2V ""
41#endif 37#endif
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 742b6108a001..136abb610948 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -488,13 +488,8 @@ __fixup_pv_table:
488 add r5, r5, r3 @ adjust table end address 488 add r5, r5, r3 @ adjust table end address
489 add r7, r7, r3 @ adjust __pv_phys_offset address 489 add r7, r7, r3 @ adjust __pv_phys_offset address
490 str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset 490 str r8, [r7] @ save computed PHYS_OFFSET to __pv_phys_offset
491#ifndef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
492 mov r6, r3, lsr #24 @ constant for add/sub instructions 491 mov r6, r3, lsr #24 @ constant for add/sub instructions
493 teq r3, r6, lsl #24 @ must be 16MiB aligned 492 teq r3, r6, lsl #24 @ must be 16MiB aligned
494#else
495 mov r6, r3, lsr #16 @ constant for add/sub instructions
496 teq r3, r6, lsl #16 @ must be 64kiB aligned
497#endif
498THUMB( it ne @ cross section branch ) 493THUMB( it ne @ cross section branch )
499 bne __error 494 bne __error
500 str r6, [r7, #4] @ save to __pv_offset 495 str r6, [r7, #4] @ save to __pv_offset
@@ -510,20 +505,8 @@ ENDPROC(__fixup_pv_table)
510 .text 505 .text
511__fixup_a_pv_table: 506__fixup_a_pv_table:
512#ifdef CONFIG_THUMB2_KERNEL 507#ifdef CONFIG_THUMB2_KERNEL
513#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT 508 lsls r6, #24
514 lsls r0, r6, #24 509 beq 2f
515 lsr r6, #8
516 beq 1f
517 clz r7, r0
518 lsr r0, #24
519 lsl r0, r7
520 bic r0, 0x0080
521 lsrs r7, #1
522 orrcs r0, #0x0080
523 orr r0, r0, r7, lsl #12
524#endif
5251: lsls r6, #24
526 beq 4f
527 clz r7, r6 510 clz r7, r6
528 lsr r6, #24 511 lsr r6, #24
529 lsl r6, r7 512 lsl r6, r7
@@ -532,43 +515,25 @@ __fixup_a_pv_table:
532 orrcs r6, #0x0080 515 orrcs r6, #0x0080
533 orr r6, r6, r7, lsl #12 516 orr r6, r6, r7, lsl #12
534 orr r6, #0x4000 517 orr r6, #0x4000
535 b 4f 518 b 2f
5362: @ at this point the C flag is always clear 5191: add r7, r3
537 add r7, r3 520 ldrh ip, [r7, #2]
538#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
539 ldrh ip, [r7]
540 tst ip, 0x0400 @ the i bit tells us LS or MS byte
541 beq 3f
542 cmp r0, #0 @ set C flag, and ...
543 biceq ip, 0x0400 @ immediate zero value has a special encoding
544 streqh ip, [r7] @ that requires the i bit cleared
545#endif
5463: ldrh ip, [r7, #2]
547 and ip, 0x8f00 521 and ip, 0x8f00
548 orrcc ip, r6 @ mask in offset bits 31-24 522 orr ip, r6 @ mask in offset bits 31-24
549 orrcs ip, r0 @ mask in offset bits 23-16
550 strh ip, [r7, #2] 523 strh ip, [r7, #2]
5514: cmp r4, r5 5242: cmp r4, r5
552 ldrcc r7, [r4], #4 @ use branch for delay slot 525 ldrcc r7, [r4], #4 @ use branch for delay slot
553 bcc 2b 526 bcc 1b
554 bx lr 527 bx lr
555#else 528#else
556#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT 529 b 2f
557 and r0, r6, #255 @ offset bits 23-16 5301: ldr ip, [r7, r3]
558 mov r6, r6, lsr #8 @ offset bits 31-24
559#else
560 mov r0, #0 @ just in case...
561#endif
562 b 3f
5632: ldr ip, [r7, r3]
564 bic ip, ip, #0x000000ff 531 bic ip, ip, #0x000000ff
565 tst ip, #0x400 @ rotate shift tells us LS or MS byte 532 orr ip, ip, r6 @ mask in offset bits 31-24
566 orrne ip, ip, r6 @ mask in offset bits 31-24
567 orreq ip, ip, r0 @ mask in offset bits 23-16
568 str ip, [r7, r3] 533 str ip, [r7, r3]
5693: cmp r4, r5 5342: cmp r4, r5
570 ldrcc r7, [r4], #4 @ use branch for delay slot 535 ldrcc r7, [r4], #4 @ use branch for delay slot
571 bcc 2b 536 bcc 1b
572 mov pc, lr 537 mov pc, lr
573#endif 538#endif
574ENDPROC(__fixup_a_pv_table) 539ENDPROC(__fixup_a_pv_table)