On Thu, Aug 23, 2012 at 11:08 AM, Lei Wen <adrian.wenl@xxxxxxxxx> wrote: > Hi Christoffer, > > [snip] > >> diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S >> index 1dc8926..4db26cb 100644 >> --- a/arch/arm/kvm/init.S >> +++ b/arch/arm/kvm/init.S >> @@ -15,5 +15,135 @@ >> * along with this program; if not, write to the Free Software >> * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. >> */ >> + >> +#include <linux/linkage.h> >> +#include <asm/unified.h> >> #include <asm/asm-offsets.h> >> #include <asm/kvm_asm.h> >> +#include <asm/kvm_arm.h> >> + >> +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ >> +@ Hypervisor initialization >> +@ - should be called with: >> +@ r0 = Hypervisor pgd pointer >> +@ r1 = top of Hyp stack (kernel VA) >> +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ >> + .text >> + .arm >> + .pushsection .hyp.idmap.text,"ax" >> + .align 12 >> +__kvm_hyp_init: >> + .globl __kvm_hyp_init >> + >> + @ Hyp-mode exception vector >> + nop >> + nop >> + nop >> + nop >> + nop >> + b __do_hyp_init >> + nop >> + nop >> + >> +__do_hyp_init: >> + @ Set the sp to end of this page and push data for later use >> + mov sp, pc >> + bic sp, sp, #0x0ff >> + bic sp, sp, #0xf00 >> + add sp, sp, #0x1000 >> + push {r0, r1, r2, r12} > > Is safe to use the stack here? Since our HYP memory mapping is > gotten valid after the following HTTBR being set as I think. > yes, as you can see in the end of this block we have a .align 12 before __kvm_hyp_init_end giving us the stack space we need in this page (as long as this init code doesn't grow beyond ~3K >> + >> + @ Set the HTTBR to point to the hypervisor PGD pointer passed to >> + @ function and set the upper bits equal to the kernel PGD. >> + mrrc p15, 1, r1, r2, c2 >> + mcrr p15, 4, r0, r2, c2 >> + > > [snip] > > Thanks, > Lei -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html