Re: [PATCH v6 15/64] KVM: arm64: nv: Handle HCR_EL2.E2H specially

2022-02-01 Thread Marc Zyngier
On 2022-02-01 16:51, Russell King (Oracle) wrote: On Fri, Jan 28, 2022 at 12:18:23PM +, Marc Zyngier wrote: HCR_EL2.E2H is nasty, as a flip of this bit completely changes the way we deal with a lot of the state. So when the guest flips this bit (sysregs are live), do the put/load dance so

Re: [PATCH v6 19/64] KVM: arm64: nv: Trap SPSR_EL1, ELR_EL1 and VBAR_EL1 from virtual EL2

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:27PM +, Marc Zyngier wrote: > From: Jintack Lim > > For the same reason we trap virtual memory register accesses at virtual > EL2, we need to trap SPSR_EL1, ELR_EL1 and VBAR_EL1 accesses. ARM v8.3 > introduces the HCR_EL2.NV1 bit to be able to trap on those

Re: [PATCH v6 18/64] KVM: arm64: nv: Trap EL1 VM register accesses in virtual EL2

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:26PM +, Marc Zyngier wrote: > From: Christoffer Dall > > When running in virtual EL2 mode, we actually run the hardware in EL1 > and therefore have to use the EL1 registers to ensure correct operation. > > By setting the HCR.TVM and HCR.TVRM we ensure that the

Re: [PATCH v6 17/64] KVM: arm64: nv: Emulate PSTATE.M for a guest hypervisor

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:25PM +, Marc Zyngier wrote: > From: Christoffer Dall > > We can no longer blindly copy the VCPU's PSTATE into SPSR_EL2 and return > to the guest and vice versa when taking an exception to the hypervisor, > because we emulate virtual EL2 in EL1 and therefore have

Re: [PATCH v6 15/64] KVM: arm64: nv: Handle HCR_EL2.E2H specially

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:23PM +, Marc Zyngier wrote: > HCR_EL2.E2H is nasty, as a flip of this bit completely changes the way > we deal with a lot of the state. So when the guest flips this bit > (sysregs are live), do the put/load dance so that we have a consistent > state. > > Yes,

Re: [PATCH v6 14/64] KVM: arm64: nv: Handle SPSR_EL2 specially

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:22PM +, Marc Zyngier wrote: > SPSR_EL2 needs special attention when running nested on ARMv8.3: > > If taking an exception while running at vEL2 (actually EL1), the > HW will update the SPSR_EL1 register with the EL1 mode. We need > to track this in order to make

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

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:21PM +, Marc Zyngier wrote: > 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. > > With the

Re: [PATCH v6 12/64] KVM: arm64: nv: Add non-VHE-EL2->EL1 translation helpers

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:20PM +, Marc Zyngier wrote: > Some EL2 system registers immediately affect the current execution > of the system, so we need to use their respective EL1 counterparts. > For this we need to define a mapping between the two. In general, > this only affects non-VHE

Re: [kvm-unit-tests PATCH v3 0/3] GIC ITS tests

2022-02-01 Thread Andrew Jones
On Tue, Feb 01, 2022 at 01:10:13PM +, Alex Bennée wrote: > > Gentle ping, I'm trying to clear this off my internal JIRA so let me > know if you want me to do anything to help. > Sorry Alex! I've been juggling too many balls lately and completely dropped this one. I'll rebase arm/queue now

Re: [PATCH v6 07/64] KVM: arm64: nv: Handle HCR_EL2.NV system register traps

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:15PM +, 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 v6 01/64] arm64: Add ARM64_HAS_NESTED_VIRT cpufeature

2022-02-01 Thread Russell King (Oracle)
On Fri, Jan 28, 2022 at 12:18:09PM +, 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, together > with the 'kvm-arm.mode=nested' command line option. > > This will be used to

Re: [kvm-unit-tests PATCH v3 0/3] GIC ITS tests

2022-02-01 Thread Alex Bennée
Andrew Jones writes: > On Tue, Nov 30, 2021 at 02:11:34PM +, Alex Bennée wrote: >> >> Andrew Jones writes: >> >> > On Fri, Nov 19, 2021 at 04:30:47PM +, Alex Bennée wrote: >> >> >> >> Andrew Jones writes: >> >> >> >> > On Fri, Nov 12, 2021 at 02:08:01PM +, Alex Bennée wrote:

Re: [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge

2022-02-01 Thread Pierre Gondois
On 1/31/22 5:04 PM, Ard Biesheuvel wrote: On Mon, 31 Jan 2022 at 17:03, Marc Zyngier wrote: It appears that the way INTx is emulated is "slightly" out of spec in kvmtool. We happily inject an edge interrupt, even if the spec mandates a level. This doesn't change much for either the guest

Re: [PATCH][kvmtool] virtio/pci: Signal INTx interrupts as level instead of edge

2022-02-01 Thread Pierre Gondois
On 1/31/22 5:04 PM, Ard Biesheuvel wrote: On Mon, 31 Jan 2022 at 17:03, Marc Zyngier wrote: It appears that the way INTx is emulated is "slightly" out of spec in kvmtool. We happily inject an edge interrupt, even if the spec mandates a level. This doesn't change much for either the guest