Skip to contentSkip to conversation

Arm64: introduce __hyp_func_call

RFC PATCH New Arun Chandran 2 participants 2 messages Sep 2, 2014 arm64

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Arm64: introduce __hyp_func_call

This adds a mechanism to __hyp_stub_vectors to allow a hypercall to call a function at EL2. It is needed for users who want to run a part of code with EL2 permissions. The current usecase is for KVM and kexec.

For kexec we need to move the final CPU up to the mode it started in before we branch to the new kernel. If we don't do that

* We loose EL2 in the next boot
* Arm64 bootwrapper may not be able to put CPUs at the spin-table code. Bootwrapper expects the final jump from kernel to cpu-return-addr to be done in EL2.

KVM can use this to set/get VBAR_EL2

---
* It is the codification of idea from "Mark Rutland <[email protected]>"
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-August/280026.html

* v1
removed the #define method for __hyp_set/get_vectors
---

---
 arch/arm64/include/asm/virt.h |    2 ++
 arch/arm64/kernel/hyp-stub.S  |   80 +++++++++++++++++++++++++++++++++++------
 2 files changed, 71 insertions(+), 11 deletions(-)
arch/arm64/include/asm/virt.h +2 -0
index 7a5df52..eb98e76 100644
@@ -37,6 +37,8 @@ extern u32 __boot_cpu_mode[2];
 void __hyp_set_vectors(phys_addr_t phys_vector_base);
 phys_addr_t __hyp_get_vectors(void);
 
+void __hyp_func_call(unsigned long func_addr) __attribute__((noreturn));
+
 /* Reports the availability of HYP mode */
 static inline bool is_hyp_mode_available(void)
 {
arch/arm64/kernel/hyp-stub.S +69 -11

99 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/1 Arm64: introduce __hyp_func_call

Hi Arun,

Quoted 7 lines · Arun Chandran

This adds a mechanism to __hyp_stub_vectors to allow a hypercall to call a function at EL2. It is needed for users who want to run a part of code with EL2 permissions. The current usecase is for KVM and kexec.

For kexec we need to move the final CPU up to the mode it started in before we branch to the new kernel. If we don't do that

I certainly appreciate you trying to help with the kexec work, but I already have a patch that does something similar to this in my kexec series [1].

Also, I think we need to consider this change in the context of the entire solution around how we handle exception level and kexec + KVM. I'm now working through the details of that, and when I have something I think is acceptable I'll post the kexec series for review.

[1] https://git.linaro.org/people/geoff.levand/linux-kexec.git

-Geoff