From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 5/5] ARM: P2V: extend to 16-bit translation offsets
Date: Tue, 04 Jan 2011 20:23:38 +0000 [thread overview]
Message-ID: <E1PaDPu-00023p-QG@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20110104202052.GE24935@n2100.arm.linux.org.uk>
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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/Kconfig | 5 ++++-
arch/arm/include/asm/memory.h | 14 ++++++++++----
arch/arm/kernel/head.S | 18 ++++++++++++++++--
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 801192b..8a753cb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -200,7 +200,6 @@ config ARM_PATCH_PHYS_VIRT
bool "Patch physical to virtual translations at runtime (EXPERIMENTAL)"
depends on EXPERIMENTAL
depends on !XIP_KERNEL && !THUMB2_KERNEL && MMU
- depends on !ARCH_MSM
depends on !ARCH_REALVIEW || !SPARSEMEM
help
Patch phys-to-virt translation functions at runtime according to
@@ -209,6 +208,10 @@ config ARM_PATCH_PHYS_VIRT
This can only be used with non-XIP, non-Thumb2, MMU kernels where
the base of physical memory is at a 16MB boundary.
+config ARM_PATCH_PHYS_VIRT_16BIT
+ def_bool y
+ depends on ARM_PATCH_PHYS_VIRT && ARCH_MSM
+
source "init/Kconfig"
source "kernel/Kconfig.freezer"
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 288b690..e2b54fd 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -157,26 +157,32 @@
extern unsigned long __pv_phys_offset;
#define PHYS_OFFSET __pv_phys_offset
-#define __pv_stub(from,to,instr) \
+#define __pv_stub(from,to,instr,type) \
__asm__("@ __pv_stub\n" \
"1: " instr " %0, %1, %2\n" \
" .pushsection .pv_table,\"a\"\n" \
" .long 1b\n" \
" .popsection\n" \
: "=r" (to) \
- : "r" (from), "I" (1))
+ : "r" (from), "I" (type))
static inline unsigned long __virt_to_phys(unsigned long x)
{
unsigned long t;
- __pv_stub(x, t, "add");
+ __pv_stub(x, t, "add", 1);
+#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
+ __pv_stub(t, t, "add", 0);
+#endif
return t;
}
static inline unsigned long __phys_to_virt(unsigned long x)
{
unsigned long t;
- __pv_stub(x, t, "sub");
+ __pv_stub(x, t, "sub", 1);
+#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
+ __pv_stub(t, t, "sub", 0);
+#endif
return t;
}
#else
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 258b0ca..c0b77a0 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -463,18 +463,32 @@ __fixup_pv_table:
add r5, r5, r3 @ adjust table end address
add ip, ip, r3 @ our PHYS_OFFSET
str ip, [r7, r3]! @ save to __pv_phys_offset
+#ifndef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
mov r6, r3, lsr #24 @ constant for add/sub instructions
teq r3, r6, lsl #24 @ must be 16MiB aligned
+#else
+ mov r6, r3, lsr #16 @ constant for add/sub instructions
+ teq r3, r6, lsl #16 @ must be 64kiB aligned
+#endif
bne __error
- orr r6, r6, #0x400 @ mask in rotate right 8 bits
str r6, [r7, #4] @ save to __pv_offset
__fixup_a_pv_table:
+#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
+ and r0, r6, #255 @ offset bits 23-16
+ mov r6, r6, lsr #8 @ offset bits 31-24
+ orr r0, r0, #0x400 @ mask in rotate right 8 bits
+#else
+ mov r0, #0 @ just in case...
+#endif
+ orr r6, r6, #0x400 @ mask in rotate right 8 bits
2: cmp r4, r5
ldrlo r7, [r4], #4
ldrlo ip, [r7, r3]
+ tst ip, #1 @ existing constant tells us LS or MS byte
bic ip, ip, #0x000000ff
bic ip, ip, #0x00000f00
- orr ip, ip, r6
+ orrne ip, ip, r6 @ mask in offset bits 31-24
+ orreq ip, ip, r0 @ mask in offset bits 23-16
strlo ip, [r7, r3]
blo 2b
mov pc, lr
--
1.6.2.5
next prev parent reply other threads:[~2011-01-04 20:23 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-04 20:20 [RFC 0/5] runtime P2V translations Russell King - ARM Linux
2011-01-04 20:22 ` [RFC 1/5] ARM: P2V: separate PHYS_OFFSET from platform definitions Russell King - ARM Linux
2011-01-04 21:10 ` Nicolas Pitre
2011-01-05 22:30 ` Russell King - ARM Linux
2011-01-04 21:23 ` Uwe Kleine-König
2011-01-05 0:04 ` Russell King - ARM Linux
2011-01-05 6:25 ` Uwe Kleine-König
2011-01-05 3:28 ` viresh kumar
2011-01-05 17:04 ` H Hartley Sweeten
2011-01-06 5:02 ` Magnus Damm
2011-02-07 15:57 ` Tony Lindgren
2011-02-07 16:36 ` Jean-Christophe PLAGNIOL-VILLARD
2011-02-08 11:22 ` Wan ZongShun
2011-02-17 5:33 ` Kukjin Kim
2011-02-17 15:16 ` Eric Miao
2011-02-17 18:07 ` JD (Jiandong) Zheng
2011-01-04 20:22 ` [RFC 2/5] ARM: P2V: avoid initializers and assembly using PHYS_OFFSET Russell King - ARM Linux
2011-01-04 21:12 ` Nicolas Pitre
2011-01-06 8:51 ` Sascha Hauer
2011-01-06 9:08 ` Russell King - ARM Linux
2011-02-07 15:59 ` Tony Lindgren
2011-02-07 16:51 ` Uwe Kleine-König
2011-02-07 16:52 ` Uwe Kleine-König
2011-02-17 5:36 ` Kukjin Kim
2011-02-17 14:11 ` Russell King - ARM Linux
2011-02-17 16:19 ` David Brown
2011-02-17 15:16 ` Eric Miao
2011-01-04 20:22 ` [RFC 3/5] ARM: P2V: make head.S use PLAT_PHYS_OFFSET Russell King - ARM Linux
2011-01-04 21:13 ` Nicolas Pitre
2011-02-07 16:12 ` Tony Lindgren
2011-01-04 20:23 ` [RFC 4/5] ARM: P2V: introduce phys_to_virt/virt_to_phys runtime patching Russell King - ARM Linux
2011-01-04 21:27 ` Nicolas Pitre
2011-01-05 0:08 ` Russell King - ARM Linux
2011-02-07 16:15 ` Tony Lindgren
2011-02-09 12:17 ` Jamie Iles
2011-02-09 13:06 ` Russell King - ARM Linux
2011-01-04 20:23 ` Russell King - ARM Linux [this message]
2011-01-04 21:41 ` [RFC 5/5] ARM: P2V: extend to 16-bit translation offsets Nicolas Pitre
2011-01-05 0:15 ` Russell King - ARM Linux
2011-01-04 23:14 ` David Brown
2011-01-04 23:18 ` David Brown
2011-01-05 0:13 ` Russell King - ARM Linux
2011-02-07 16:19 ` Tony Lindgren
2011-02-17 14:15 ` [RFC 0/5] runtime P2V translations Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1PaDPu-00023p-QG@rmk-PC.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).