aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2015-10-27 12:18:48 +0000
committerAlex Shi <alex.shi@linaro.org>2016-05-24 16:42:28 +0800
commit29f183d36f6ecb3fa08b14e27e4db2e80ac152b0 (patch)
treecc95a13057c78d71f25b837f4c2c8fc144621bce
parent7142507a8e6d872063d22c81e91f9c34dc32a328 (diff)
downloadlinux-linaro-stable-29f183d36f6ecb3fa08b14e27e4db2e80ac152b0.tar.gz
arm64: KVM: Map the kernel RO section into HYP
In order to run C code in HYP, we must make sure that the kernel's RO section is mapped into HYP (otherwise things break badly). Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Christoffer Dall <christoffer.dall@linaro.org> (cherry picked from commit 910917bb7db070cc67557a6b3c8fcceaa5c398a7) Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rw-r--r--arch/arm/kvm/arm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 171978c4676c..92fdc6f4a204 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -44,6 +44,7 @@
#include <asm/kvm_emulate.h>
#include <asm/kvm_coproc.h>
#include <asm/kvm_psci.h>
+#include <asm/sections.h>
#ifdef REQUIRES_VIRT
__asm__(".arch_extension virt");
@@ -1013,6 +1014,12 @@ static int init_hyp_mode(void)
goto out_free_mappings;
}
+ err = create_hyp_mappings(__start_rodata, __end_rodata);
+ if (err) {
+ kvm_err("Cannot map rodata section\n");
+ goto out_free_mappings;
+ }
+
/*
* Map the Hyp stack pages
*/