diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-04 14:09:43 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-02-17 18:27:32 -0500 |
commit | dc21af99fadcfa0ae65b52fd0895f85824f0c288 (patch) | |
tree | d2d293d79fdb405f25ca7fb18aa16aba6ecea261 /arch/arm/Kconfig | |
parent | 5b7de4547b388d3949620e21d072e35b6f2638fa (diff) |
ARM: P2V: introduce phys_to_virt/virt_to_phys runtime patching
This idea came from Nicolas, Eric Miao produced an initial version,
which was then rewritten into this.
Patch the physical to virtual translations at runtime. As we modify
the code, this makes it incompatible with XIP kernels, but allows us
to achieve this with minimal loss of performance.
As many translations are of the form:
physical = virtual + (PHYS_OFFSET - PAGE_OFFSET)
virtual = physical - (PHYS_OFFSET - PAGE_OFFSET)
we generate an 'add' instruction for __virt_to_phys(), and a 'sub'
instruction for __phys_to_virt(). We calculate at run time (PHYS_OFFSET
- PAGE_OFFSET) by comparing the address prior to MMU initialization with
where it should be once the MMU has been initialized, and place this
constant into the above add/sub instructions.
Once we have (PHYS_OFFSET - PAGE_OFFSET), we can calculate the real
PHYS_OFFSET as PAGE_OFFSET is a build-time constant, and save this for
the C-mode PHYS_OFFSET variable definition to use.
At present, we are unable to support Realview with Sparsemem enabled
as this uses a complex mapping function, and MSM as this requires a
constant which will not fit in our math instruction.
Add a module version magic string for this feature to prevent
incompatible modules being loaded.
Tested-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/Kconfig')
-rw-r--r-- | arch/arm/Kconfig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5cff165b7eb0..4147f76e7988 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -191,6 +191,19 @@ config VECTORS_BASE | |||
191 | help | 191 | help |
192 | The base address of exception vectors. | 192 | The base address of exception vectors. |
193 | 193 | ||
194 | config ARM_PATCH_PHYS_VIRT | ||
195 | bool "Patch physical to virtual translations at runtime (EXPERIMENTAL)" | ||
196 | depends on EXPERIMENTAL | ||
197 | depends on !XIP_KERNEL && !THUMB2_KERNEL && MMU | ||
198 | depends on !ARCH_MSM | ||
199 | depends on !ARCH_REALVIEW || !SPARSEMEM | ||
200 | help | ||
201 | Patch phys-to-virt translation functions at runtime according to | ||
202 | the position of the kernel in system memory. | ||
203 | |||
204 | This can only be used with non-XIP, non-Thumb2, MMU kernels where | ||
205 | the base of physical memory is at a 16MB boundary. | ||
206 | |||
194 | source "init/Kconfig" | 207 | source "init/Kconfig" |
195 | 208 | ||
196 | source "kernel/Kconfig.freezer" | 209 | source "kernel/Kconfig.freezer" |