Re: [RFC PATCH v2 08/38] KVM: arm64: Add EL2 special registers to vcpu context

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:34AM -0500, Jintack Lim wrote: > To support the virtual EL2 execution, we need to maintain the EL2 > special registers such as SPSR_EL2, ELR_EL2 and SP_EL2 in vcpu context. > > Note that SP_EL2 is not accessible in EL2, so we don't need a trap > handler for this

Re: [RFC PATCH v2 25/38] KVM: arm64: Respect virtual CPTR_EL2.TFP setting

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:51AM -0500, Jintack Lim wrote: > Forward traps due to FP/ASIMD register accesses to the virtual EL2 if > virtual CPTR_EL2.TFP is set. Note that if TFP bit is set, then even > accesses to FP/ASIMD register from EL2 as well as NS EL0/1 will trap to > EL2. So, we don't

Re: [RFC PATCH v2 22/38] KVM: arm64: Handle PSCI call via smc from the guest

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:48AM -0500, Jintack Lim wrote: > VMs used to execute hvc #0 for the psci call if EL3 is not implemented. > However, when we come to provide the virtual EL2 mode to the VM, the > host OS inside the VM calls kvm_call_hyp() which is also hvc #0. So, > it's hard to

Re: [RFC PATCH v2 24/38] KVM: arm64: Respect virtual HCR_EL2.TWX setting

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:50AM -0500, Jintack Lim wrote: > Forward exceptions due to WFI or WFE instructions to the virtual EL2 if > they are not coming from the virtual EL2 and virtual HCR_EL2.TWX is set. > > Signed-off-by: Jintack Lim > --- >

Re: [RFC PATCH v2 14/38] KVM: arm64: Synchronize EL1 system registers on virtual EL2 entry and exit

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:40AM -0500, Jintack Lim wrote: > When running in virtual EL2 we use the shadow EL1 systerm register array > for the save/restore process, so that hardware and especially the memory > subsystem behaves as code written for EL2 expects while really running > in EL1. > >

Re: [RFC PATCH v2 16/38] KVM: arm64: Support to inject exceptions to the virtual EL2

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:42AM -0500, Jintack Lim wrote: The subject should be changed to "KVM: arm64: Support injecting exceptions to virtual EL2" > Support inject synchronous exceptions to the virtual EL2 as injecting > described in ARM ARM AArch64.TakeException(). > > This can be

Re: [RFC PATCH v2 04/38] KVM: arm/arm64: Check if nested virtualization is in use

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:30AM -0500, Jintack Lim wrote: > Nested virtualizaion is in use only if all three conditions are met: > - The architecture supports nested virtualization. > - The kernel parameter is set. > - The userspace uses nested virtualiztion feature. > > Signed-off-by: Jintack

Re: [RFC PATCH v2 02/38] KVM: arm/arm64: Enable nested virtualization via command-line

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:28AM -0500, Jintack Lim wrote: > Add a new kernel parameter(kvm-arm.nested) to enable KVM/ARM nested > virtualization support. This kernel parameter on arm architecture is > ignored since nested virtualization is not supported on arm. > > Note that this kernel

Re: [RFC PATCH v2 04/38] KVM: arm/arm64: Check if nested virtualization is in use

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:30AM -0500, Jintack Lim wrote: > Nested virtualizaion is in use only if all three conditions are met: > - The architecture supports nested virtualization. > - The kernel parameter is set. > - The userspace uses nested virtualiztion feature. > > Signed-off-by: Jintack

Re: [RFC PATCH v2 10/38] KVM: arm/arm64: Add a framework to prepare virtual EL2 execution

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:36AM -0500, Jintack Lim wrote: > From: Christoffer Dall > > Add functions setting up and restoring the guest's context on each entry > and exit. These functions will come in handy when we want to use > different context for normal