Hi Peter,
I'm current studying the kvm and its bootwrapper code, and find a confused point, hoping to get a answer here.
First I quote words from ARM virt extension spec, it says: "When in Hyp Mode: An MSR instruction which attempts to modify the CSPR.M bits is UNPREDICTABLE, except in Debug state."
While in bootwrapper, I see code would set cpu into hyp mode and launch the kernel. In kernel booting stage, it would first set the cpu mode to SVC in the start of arch/arm/kernel/head.S. And the most important is the kernel set cpu mode by directly using the MSR method which is forbidden by the virt extension spec...
So here is my question: 1. Could the kernel set SVC behavior lead to any issue? 2. And could we set the cpu into SVC in bootwrapper before launch the kernel?
I tried to switch to SVC before launching kernel by insert a SVC entry in hyp vector table, and copy the desired mode into spsr first then call the eret instruction. However the bootwarpper seems get hang there and I didn't figure out why...
Thanks, Lei