Re: [PATCH 07/59] KVM: arm64: nv: Add EL2 system registers to vcpu context

2019-06-24 Thread Alexandru Elisei
On 6/21/19 10:37 AM, Marc Zyngier wrote: > From: Jintack Lim > > ARM v8.3 introduces a new bit in the HCR_EL2, which is the NV bit. When > this bit is set, accessing EL2 registers in EL1 traps to EL2. In > addition, executing the following instructions in EL1 will trap to EL2: > tlbi, at, eret,

Re: [PATCH RFC 11/14] arm64: Move the ASID allocator code in a separate file

2019-06-24 Thread Catalin Marinas
On Mon, Jun 24, 2019 at 12:35:35AM +0800, Guo Ren wrote: > On Fri, Jun 21, 2019 at 10:16 PM Catalin Marinas > wrote: > > BTW, if you find the algorithm fairly straightforward ;), see this > > bug-fix which took a formal model to identify: a8ffaaa060b8 ("arm64: > > asid: Do not replace

Re: [PATCH 15/59] KVM: arm64: nv: Refactor vcpu_{read,write}_sys_reg

2019-06-24 Thread Julien Thierry
On 06/21/2019 10:37 AM, Marc Zyngier wrote: > Extract the direct HW accessors for later reuse. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/sys_regs.c | 247 +- > 1 file changed, 139 insertions(+), 108 deletions(-) > > diff --git

Re: [PATCH 09/59] KVM: arm64: nv: Add nested virt VCPU primitives for vEL2 VCPU state

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 10:37:53AM +0100, Marc Zyngier wrote: > From: Christoffer Dall > > When running a nested hypervisor we commonly have to figure out if > the VCPU mode is running in the context of a guest hypervisor or guest > guest, or just a normal guest. > > Add convenient primitives

Re: [PATCH 01/59] KVM: arm64: Migrate _elx sysreg accessors to msr_s/mrs_s

2019-06-24 Thread Alexandru Elisei
On 6/21/19 10:37 AM, Marc Zyngier wrote: > From: Dave Martin > > Currently, the {read,write}_sysreg_el*() accessors for accessing > particular ELs' sysregs in the presence of VHE rely on some local > hacks and define their system register encodings in a way that is > inconsistent with the core

Re: [PATCH 08/59] KVM: arm64: nv: Reset VMPIDR_EL2 and VPIDR_EL2 to sane values

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 10:37:52AM +0100, Marc Zyngier wrote: > The VMPIDR_EL2 and VPIDR_EL2 are architecturally UNKNOWN at reset, but > let's be nice to a guest hypervisor behaving foolishly and reset these > to something reasonable anyway. Why be nice? Generally we do try to initialise UNKNOWN

Re: [PATCH 07/59] KVM: arm64: nv: Add EL2 system registers to vcpu context

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 10:37:51AM +0100, Marc Zyngier wrote: > From: Jintack Lim > > ARM v8.3 introduces a new bit in the HCR_EL2, which is the NV bit. When > this bit is set, accessing EL2 registers in EL1 traps to EL2. In > addition, executing the following instructions in EL1 will trap to

Re: [PATCH 06/59] KVM: arm64: nv: Allow userspace to set PSR_MODE_EL2x

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 02:50:08PM +0100, Marc Zyngier wrote: > On 21/06/2019 14:24, Julien Thierry wrote: > > > > > > On 21/06/2019 10:37, Marc Zyngier wrote: > >> From: Christoffer Dall > >> > >> We were not allowing userspace to set a more privileged mode for the VCPU > >> than EL1, but we

Re: [PATCH 13/59] KVM: arm64: nv: Handle virtual EL2 registers in vcpu_read/write_sys_reg()

2019-06-24 Thread Julien Thierry
On 06/21/2019 10:37 AM, Marc Zyngier wrote: > From: Andre Przywara > > KVM internally uses accessor functions when reading or writing the > guest's system registers. This takes care of accessing either the stored > copy or using the "live" EL1 system registers when the host uses VHE. > >

Re: [PATCH 05/59] KVM: arm64: nv: Reset VCPU to EL2 registers if VCPU nested virt is set

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 10:37:49AM +0100, Marc Zyngier wrote: > From: Christoffer Dall > > Reset the VCPU with PSTATE.M = EL2h when the nested virtualization > feature is enabled on the VCPU. > > Signed-off-by: Christoffer Dall > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/reset.c | 7

Re: [PATCH 04/59] KVM: arm64: nv: Introduce nested virtualization VCPU feature

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 10:37:48AM +0100, Marc Zyngier wrote: > From: Christoffer Dall > > Introduce the feature bit and a primitive that checks if the feature is > set behind a static key check based on the cpus_have_const_cap check. > > Checking nested_virt_in_use() on systems without nested

Re: [PATCH 03/59] arm64: Add ARM64_HAS_NESTED_VIRT cpufeature

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 10:37:47AM +0100, Marc Zyngier wrote: > From: Jintack Lim > > Add a new ARM64_HAS_NESTED_VIRT feature to indicate that the > CPU has the ARMv8.3 nested virtualization capability. > > This will be used to support nested virtualization in KVM. > > Signed-off-by: Jintack

Re: [PATCH RFC 11/14] arm64: Move the ASID allocator code in a separate file

2019-06-24 Thread Will Deacon
On Mon, Jun 24, 2019 at 12:35:35AM +0800, Guo Ren wrote: > On Fri, Jun 21, 2019 at 10:16 PM Catalin Marinas > wrote: > > > > On Wed, Jun 19, 2019 at 07:51:03PM +0800, Guo Ren wrote: > > > On Wed, Jun 19, 2019 at 4:54 PM Julien Grall wrote: > > > > On 6/19/19 9:07 AM, Guo Ren wrote: > > > > >

Re: [PATCH 01/59] KVM: arm64: Migrate _elx sysreg accessors to msr_s/mrs_s

2019-06-24 Thread Dave Martin
On Fri, Jun 21, 2019 at 10:37:45AM +0100, Marc Zyngier wrote: > From: Dave Martin > > Currently, the {read,write}_sysreg_el*() accessors for accessing > particular ELs' sysregs in the presence of VHE rely on some local > hacks and define their system register encodings in a way that is >

Re: [PATCH RFC 11/14] arm64: Move the ASID allocator code in a separate file

2019-06-24 Thread Will Deacon
On Thu, Jun 20, 2019 at 05:33:03PM +0800, Guo Ren wrote: > On Wed, Jun 19, 2019 at 8:39 PM Will Deacon wrote: > > > > On Wed, Jun 19, 2019 at 08:18:04PM +0800, Guo Ren wrote: > > > On Wed, Jun 19, 2019 at 5:12 PM Will Deacon wrote: > > > > This is one place where I'd actually prefer not to go

Re: [PATCH 05/59] KVM: arm64: nv: Reset VCPU to EL2 registers if VCPU nested virt is set

2019-06-24 Thread Suzuki K Poulose
On 21/06/2019 10:37, Marc Zyngier wrote: From: Christoffer Dall Reset the VCPU with PSTATE.M = EL2h when the nested virtualization feature is enabled on the VCPU. Signed-off-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm64/kvm/reset.c | 7 +++ 1 file changed, 7