Re: [PATCH v8 7/7] arm64: kvm: handle SError Interrupt by categorization

2018-01-15 Thread Christoffer Dall
On Fri, Jan 12, 2018 at 06:05:23PM +, James Morse wrote: > On 15/12/17 03:30, gengdongjiu wrote: > > On 2017/12/7 14:37, gengdongjiu wrote: [...] > > (I recall someone saying migration is needed for any new KVM/cpu features, > but I > can't find the thread) > I don't know of any hard

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

2017-08-01 Thread Christoffer Dall
On Tue, Aug 01, 2017 at 10:07:40AM -0400, Jintack Lim wrote: > On Sun, Jul 30, 2017 at 3:59 PM, Christoffer Dall <cd...@linaro.org> wrote: > > On Tue, Jul 18, 2017 at 11:58:30AM -0500, Jintack Lim wrote: > >> Nested virtualizaion is in use only if all

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

2017-08-01 Thread Christoffer Dall
On Tue, Aug 01, 2017 at 07:03:35AM -0400, Jintack Lim wrote: > Hi Christoffer, > > On Mon, Jul 31, 2017 at 8:59 AM, Christoffer Dall <cd...@linaro.org> wrote: > > On Tue, Jul 18, 2017 at 11:59:04AM -0500, Jintack Lim wrote: > >> Forward CPACR_EL1 traps to the v

Re: [RFC PATCH v2 00/38] Nested Virtualization on KVM/ARM

2017-07-31 Thread Christoffer Dall
ages and comments from the perspective of supporting > execution environments to VMs, rather than from the perspective of the guest > hypervisor running in them. > - Fixed a few bugs to make it run on the FastModel. > - Tested on ARMv8.3 with four configurations. (host/guest.

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

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:59:04AM -0500, Jintack Lim wrote: > Forward CPACR_EL1 traps to the virtual EL2 if virtual CPTR_EL2 is > configured to trap CPACR_EL1 accesses from EL1. > > This is for recursive nested virtualization. > > Signed-off-by: Jintack Lim > --- >

Re: [RFC PATCH v2 37/38] KVM: arm64: Respect the virtual HCR_EL2.NV1 bit setting

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:59:03AM -0500, Jintack Lim wrote: > Forward ELR_EL1, SPSR_EL1 and VBAR_EL1 traps to the virtual EL2 if the > virtual HCR_EL2.NV bit is set. > > This is for recursive nested virtualization. > > Signed-off-by: Jintack Lim > --- >

Re: [RFC PATCH v2 36/38] KVM: arm64: Respect virtual HCR_EL2.TVM and TRVM settings

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:59:02AM -0500, Jintack Lim wrote: > Forward the EL1 virtual memory register traps to the virtual EL2 if they > are not coming from the virtual EL2 and the virtual HCR_EL2.TVM or TRVM > bit is set. I noticed that all these recursive patches don't change how we program

Re: [RFC PATCH v2 35/38] KVM: arm64: Respect the virtual HCR_EL2.NV bit setting for EL12 register traps

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:59:01AM -0500, Jintack Lim wrote: > In addition to EL2 register accesses, setting NV bit will also make EL12 > register accesses trap to EL2. To emulate this for the virtual EL2, > forword traps due to EL12 register accessses to the virtual EL2 if the > virtual

Re: [RFC PATCH v2 33/38] KVM: arm64: Emulate appropriate VM control system registers

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:59AM -0500, Jintack Lim wrote: > Now that the virtual EL2 can access EL2 register states via EL1 > registers, we need to consider it when selecting the register to > emulate. I don't really understand what this patch does from the commit message. >From looking at

Re: [RFC PATCH v2 32/38] KVM: arm64: Trap and emulate CPTR_EL2 accesses via CPACR_EL1 from the virtual EL2 with VHE

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:58AM -0500, Jintack Lim wrote: > While the EL1 virtual memory control registers can be accessed in the > virtual EL2 with VHE without trap to manuplate the virtual EL2 states, > we can't do that for CPTR_EL2 for an unfortunate reason. > > This is because the top bit

Re: [RFC PATCH v2 31/38] KVM: arm64: Manage the shadow states when virtual E2H bit enabled

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:57AM -0500, Jintack Lim wrote: In the subject: s/virtual E2H bit enabled/virtual E2H bit is set/ > When creating the shadow context for the virtual EL2 execution, we can > directly copy the EL2 register states to the shadow EL1 register states > if the virtual

Re: [RFC PATCH v2 30/38] KVM: arm64: Allow the virtual EL2 to access EL2 states without trap

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:56AM -0500, Jintack Lim wrote: > When the virtual E2H bit is set, we can support EL2 register accesses > via EL1 registers from the virtual EL2 by doing trap-and-emulate. A > better alternative, however, is to allow the virtual EL2 to access EL2 > register states

Re: [RFC PATCH v2 29/38] KVM: arm64: Support a VM with VHE considering EL0 of the VHE host

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:55AM -0500, Jintack Lim wrote: nit: The subject is a little hard to understand. > On VHE systems, EL0 of the host kernel is considered as a part of 'VHE > host'; The execution of EL0 is affected by system registers set by the > VHE kernel including the hypervisor.

Re: [RFC PATCH v2 28/38] KVM: arm64: Emulate EL12 register accesses from the virtual EL2

2017-07-31 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:54AM -0500, Jintack Lim wrote: > With HCR_EL2.NV bit set, accesses to EL12 registers in the virtual EL2 > trap to EL2. Handle those traps just like we do for EL1 registers. > > One exception is CNTKCTL_EL12. We don't trap on CNTKCTL_EL1 for non-VHE > virtual EL2

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 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 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 14/38] KVM: arm64: Synchronize EL1 system registers on virtual EL2 entry and exit

2017-07-30 Thread Christoffer Dall
ese > registers on entry/exit to/from virtual EL2 state. > > Signed-off-by: Christoffer Dall <christoffer.d...@linaro.org> > Signed-off-by: Jintack Lim <jintack@linaro.org> > --- > arch/arm64/kvm/context.c | 58 > +

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 20/38] KVM: arm64: Handle eret instruction traps

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:46AM -0500, Jintack Lim wrote: > When HCR.NV bit is set, eret instructions trap to EL2 with EC code 0x1A. > Emulate eret instructions by setting pc and pstate. It may be worth noting in the commit message that this is all we have to do, because the rest of the logic

Re: [RFC PATCH v2 21/38] KVM: arm64: Set a handler for the system instruction traps

2017-07-30 Thread Christoffer Dall
On Tue, Jul 18, 2017 at 11:58:47AM -0500, Jintack Lim wrote: > When HCR.NV bit is set, execution of the EL2 translation regime address > aranslation instructions and TLB maintenance instructions are trapped to translation > EL2. In addition, execution of the EL1 translation regime address >

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 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 <christoffer.d...@linaro.org> > > 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 c

Re: [RFC PATCH v2 00/38] Nested Virtualization on KVM/ARM

2017-07-19 Thread Christoffer Dall
Hi Jintack, On Tue, Jul 18, 2017 at 10:23:05PM -0400, Jintack Lim wrote: > On Tue, Jul 18, 2017 at 12:58 PM, Jintack Lim wrote: > > Nested virtualization is the ability to run a virtual machine inside another > > virtual machine. In other words, it’s about running a

Re: [PATCH v4 3/3] arm64: kvm: inject SError with user space specified syndrome

2017-07-04 Thread Christoffer Dall
Hi Dongjiu, On Tue, Jul 04, 2017 at 12:46:23PM +0800, gengdongjiu wrote: > Hi Christoffer, > thanks for the review. > > > On 2017/7/3 16:39, Christoffer Dall wrote: > > Hi Dongjiu, > > > > On Mon, Jun 26, 2017 at 08:46:39PM +0800, Dongjiu Geng wrote: >

Re: [PATCH v4 2/3] arm64: kvm: route synchronous external abort exceptions to el2

2017-07-04 Thread Christoffer Dall
Hi Dongjiu, On Tue, Jul 04, 2017 at 02:30:21PM +0800, gengdongjiu wrote: > Hi Christoffer, > > On 2017/7/3 16:23, Christoffer Dall wrote: > > On Tue, Jun 27, 2017 at 08:15:49PM +0800, gengdongjiu wrote: > >> correct the commit message: > >> > >> In th

Re: [PATCH v4 1/3] arm64: kvm: support user space to detect RAS extension feature

2017-07-04 Thread Christoffer Dall
Hi Dongjiu, On Tue, Jul 04, 2017 at 03:04:54PM +0800, gengdongjiu wrote: > Hi Christoffer, > > On 2017/7/3 16:21, Christoffer Dall wrote: > > On Mon, Jun 26, 2017 at 08:45:43PM +0800, Dongjiu Geng wrote: > >> Handle userspace's detection for RAS extension, because some

Re: [PATCH v4] arm64: kvm: inject SError with user space specified syndrome

2017-07-03 Thread Christoffer Dall
On Mon, Jul 3, 2017 at 4:09 PM, gengdongjiu <gengdj.1...@gmail.com> wrote: > Hi Christoffer, > thank you very much for your review. > > > 2017-07-03 15:50 GMT+08:00, Christoffer Dall <cd...@linaro.org>: >> Hi Dongjiu, >> >> It seems you sent th

Re: [PATCH v4 3/3] arm64: kvm: inject SError with user space specified syndrome

2017-07-03 Thread Christoffer Dall
Hi Dongjiu, On Mon, Jun 26, 2017 at 08:46:39PM +0800, Dongjiu Geng wrote: > when SError happen, kvm notifies user space to record the CPER, > user space specifies and passes the contents of ESR_EL1 on taking > a virtual SError interrupt to KVM, KVM enables virtual system > error or asynchronous

Re: [PATCH v4 2/3] arm64: kvm: route synchronous external abort exceptions to el2

2017-07-03 Thread Christoffer Dall
On Tue, Jun 27, 2017 at 08:15:49PM +0800, gengdongjiu wrote: > correct the commit message: > > In the firmware-first RAS solution, OS receives an synchronous > external abort, then trapped to EL3 by SCR_EL3.EA. Firmware inspects > the HCR_EL2.TEA and chooses the target to send APEI's SEA

Re: [PATCH v4 1/3] arm64: kvm: support user space to detect RAS extension feature

2017-07-03 Thread Christoffer Dall
On Mon, Jun 26, 2017 at 08:45:43PM +0800, Dongjiu Geng wrote: > Handle userspace's detection for RAS extension, because sometimes > the userspace needs to know the CPU's capacity Why? Can you please provide some more rationale. > > Signed-off-by: Dongjiu Geng > --- >

Re: [PATCH v4] arm64: kvm: inject SError with user space specified syndrome

2017-07-03 Thread Christoffer Dall
Hi Dongjiu, It seems you sent this patch twice, once on its own and then part of a series? Also, please use a cover letter when sending patch series. Thanks, -Christoffer On Mon, Jun 26, 2017 at 07:39:15PM +0800, Dongjiu Geng wrote: > when SError happen, kvm notifies user space to record the