Re: [PATCH] KVM: arm/arm64: initialize new VGIC even without host GIC

2016-08-02 Thread Stefan Agner
On 2016-08-02 07:34, Andre Przywara wrote: > The new VGIC code is always in the VCPU entry/exit path, even when the > actual GIC hardware initialization found the VGIC unusable (due to > non-aligned base addresses or a missing maintenance interrupt, for > instance). > Since in this case the VGIC st

Re: [PATCH] KVM: arm64: vgic-its: Handle errors from vgic_add_lpi

2016-08-02 Thread Christoffer Dall
On Tue, Aug 02, 2016 at 04:18:46PM +0100, Marc Zyngier wrote: > On 02/08/16 16:08, Christoffer Dall wrote: > > On Tue, Aug 02, 2016 at 11:35:27AM +0100, Marc Zyngier wrote: > >> On 01/08/16 19:29, Christoffer Dall wrote: > >>> During low memory conditions, we could be dereferencing a NULL pointer >

Re: [PATCH] KVM: arm64: vgic-its: Handle errors from vgic_add_lpi

2016-08-02 Thread Marc Zyngier
On 02/08/16 16:08, Christoffer Dall wrote: > On Tue, Aug 02, 2016 at 11:35:27AM +0100, Marc Zyngier wrote: >> On 01/08/16 19:29, Christoffer Dall wrote: >>> During low memory conditions, we could be dereferencing a NULL pointer >>> when vgic_add_lpi fails to allocate memory. >>> >>> Consider for ex

Re: [PATCH] KVM: arm64: vgic-its: Handle errors from vgic_add_lpi

2016-08-02 Thread Christoffer Dall
On Tue, Aug 02, 2016 at 11:35:27AM +0100, Marc Zyngier wrote: > On 01/08/16 19:29, Christoffer Dall wrote: > > During low memory conditions, we could be dereferencing a NULL pointer > > when vgic_add_lpi fails to allocate memory. > > > > Consider for example this call sequence: > > > > vgic_its

Re: [PATCH 33/55] KVM: arm64: vgic: Handle ITS related GICv3 redistributor registers

2016-08-02 Thread Marc Zyngier
On 02/08/16 15:55, Christoffer Dall wrote: > On Tue, Aug 02, 2016 at 03:46:49PM +0100, Marc Zyngier wrote: >> On 02/08/16 15:33, Christoffer Dall wrote: >>> On Tue, Aug 02, 2016 at 11:12:46AM +0100, Marc Zyngier wrote: On 02/08/16 10:40, Andre Przywara wrote: > Hi, > > On 01/08/16

Re: [PATCH 33/55] KVM: arm64: vgic: Handle ITS related GICv3 redistributor registers

2016-08-02 Thread Christoffer Dall
On Tue, Aug 02, 2016 at 03:46:49PM +0100, Marc Zyngier wrote: > On 02/08/16 15:33, Christoffer Dall wrote: > > On Tue, Aug 02, 2016 at 11:12:46AM +0100, Marc Zyngier wrote: > >> On 02/08/16 10:40, Andre Przywara wrote: > >>> Hi, > >>> > >>> On 01/08/16 19:20, Christoffer Dall wrote: > On Fri,

Re: [PATCH 33/55] KVM: arm64: vgic: Handle ITS related GICv3 redistributor registers

2016-08-02 Thread Marc Zyngier
On 02/08/16 15:33, Christoffer Dall wrote: > On Tue, Aug 02, 2016 at 11:12:46AM +0100, Marc Zyngier wrote: >> On 02/08/16 10:40, Andre Przywara wrote: >>> Hi, >>> >>> On 01/08/16 19:20, Christoffer Dall wrote: On Fri, Jul 22, 2016 at 06:28:50PM +0100, Marc Zyngier wrote: > From: Andre Przy

Re: [RFC PATCH v1 4/4] arm/arm64: vgic-new: Implement VGICv3 CPU interface access

2016-08-02 Thread Christoffer Dall
On Wed, Jul 20, 2016 at 06:32:28PM +0530, vijay.kil...@gmail.com wrote: > From: Vijaya Kumar K > > CPU sysregs access size is always 64 bits. MPIDR value > passed along with reg id is used to identify the CPU. Please provide a decent commit message along with a 200+ lines patch. Thanks, -Christ

Re: [RFC PATCH v1 2/4] arm/arm64: vgic-new: Add distributor and redistributor access

2016-08-02 Thread Christoffer Dall
On Wed, Jul 20, 2016 at 06:32:26PM +0530, vijay.kil...@gmail.com wrote: > From: Vijaya Kumar K > > VGICv3 Distributor and Redistributor registers are accessed using > KVM_DEV_ARM_VGIC_GRP_DIST_REGS and KVM_DEV_ARM_VGIC_GRP_DIST_REGS > with KVM_SET_DEVICE_ATTR and KVM_GET_DEVICE_ATTR ioctls. > The

[PATCH] KVM: arm/arm64: initialize new VGIC even without host GIC

2016-08-02 Thread Andre Przywara
The new VGIC code is always in the VCPU entry/exit path, even when the actual GIC hardware initialization found the VGIC unusable (due to non-aligned base addresses or a missing maintenance interrupt, for instance). Since in this case the VGIC structures aren't initialized properly, the host kernel

Re: [PATCH 33/55] KVM: arm64: vgic: Handle ITS related GICv3 redistributor registers

2016-08-02 Thread Christoffer Dall
On Tue, Aug 02, 2016 at 11:12:46AM +0100, Marc Zyngier wrote: > On 02/08/16 10:40, Andre Przywara wrote: > > Hi, > > > > On 01/08/16 19:20, Christoffer Dall wrote: > >> On Fri, Jul 22, 2016 at 06:28:50PM +0100, Marc Zyngier wrote: > >>> From: Andre Przywara > >>> > >>> In the GICv3 redistributor

Re: [RFC PATCH v1] arm/arm64: vgic-new: Create dist and redist iodevs earlier

2016-08-02 Thread Christoffer Dall
Hi Vijaya, On Tue, Jul 05, 2016 at 08:41:31PM +0530, vijay.kil...@gmail.com wrote: > From: Vijaya Kumar K > > The dist and redist regions are created and registered in > vgic_register_dist_iodevs() and vgic_v3_init_redist_iodev() > calls for distributor and redistributor respectively when > vgic

Re: [PATCH] KVM: arm64: ITS: return 1 on successful MSI injection

2016-08-02 Thread Christoffer Dall
On Tue, Aug 02, 2016 at 01:28:44PM +0100, Marc Zyngier wrote: > On 02/08/16 13:23, Christoffer Dall wrote: > > On Tue, Aug 02, 2016 at 12:10:58PM +0100, Andre Przywara wrote: > >> According to the KVM API documentation a successful MSI injection > >> should return a value > 0 on success. > >> Since

[PATCH v2] KVM: arm64: ITS: return 1 on successful MSI injection

2016-08-02 Thread Andre Przywara
According to the KVM API documentation a successful MSI injection should return a value > 0 on success. Return possible errors in vgic_its_trigger_msi() and report a successful injection back to userland, while also reporting the case where the MSI could not be delivered due to the guest not having

Re: [PATCH] KVM: arm64: ITS: return 1 on successful MSI injection

2016-08-02 Thread Marc Zyngier
On 02/08/16 13:23, Christoffer Dall wrote: > On Tue, Aug 02, 2016 at 12:10:58PM +0100, Andre Przywara wrote: >> According to the KVM API documentation a successful MSI injection >> should return a value > 0 on success. >> Since we pass the return value of vgic_its_inject_msi() directly on >> to upp

Re: [PATCH] KVM: arm64: ITS: return 1 on successful MSI injection

2016-08-02 Thread Christoffer Dall
On Tue, Aug 02, 2016 at 12:10:58PM +0100, Andre Przywara wrote: > According to the KVM API documentation a successful MSI injection > should return a value > 0 on success. > Since we pass the return value of vgic_its_inject_msi() directly on > to upper layers and userland, we need to use the same s

Re: [PATCH] KVM: arm64: ITS: return 1 on successful MSI injection

2016-08-02 Thread Marc Zyngier
On 02/08/16 12:10, Andre Przywara wrote: > According to the KVM API documentation a successful MSI injection > should return a value > 0 on success. > Since we pass the return value of vgic_its_inject_msi() directly on > to upper layers and userland, we need to use the same semantics here. > Briefl

[PATCH] KVM: arm64: ITS: return 1 on successful MSI injection

2016-08-02 Thread Andre Przywara
According to the KVM API documentation a successful MSI injection should return a value > 0 on success. Since we pass the return value of vgic_its_inject_msi() directly on to upper layers and userland, we need to use the same semantics here. Briefly tested with QEMU and kvmtool on GICv3 hardware an

Re: [PATCH] KVM: arm64: vgic-its: Handle errors from vgic_add_lpi

2016-08-02 Thread Marc Zyngier
On 01/08/16 19:29, Christoffer Dall wrote: > During low memory conditions, we could be dereferencing a NULL pointer > when vgic_add_lpi fails to allocate memory. > > Consider for example this call sequence: > > vgic_its_cmd_handle_mapi > itte->irq = vgic_add_lpi(kvm, lpi_nr); >

Re: [PATCH 41/55] KVM: arm64: vgic-its: Implement MSI injection in ITS emulation

2016-08-02 Thread Marc Zyngier
On 01/08/16 19:20, Christoffer Dall wrote: > On Fri, Jul 22, 2016 at 06:28:58PM +0100, Marc Zyngier wrote: >> From: Andre Przywara >> >> When userland wants to inject an MSI into the guest, it uses the >> KVM_SIGNAL_MSI ioctl, which carries the doorbell address along with >> the payload and the de

Re: [PATCH 33/55] KVM: arm64: vgic: Handle ITS related GICv3 redistributor registers

2016-08-02 Thread Marc Zyngier
On 02/08/16 10:40, Andre Przywara wrote: > Hi, > > On 01/08/16 19:20, Christoffer Dall wrote: >> On Fri, Jul 22, 2016 at 06:28:50PM +0100, Marc Zyngier wrote: >>> From: Andre Przywara >>> >>> In the GICv3 redistributor there are the PENDBASER and PROPBASER >>> registers which we did not emulate s

Re: [PATCH 33/55] KVM: arm64: vgic: Handle ITS related GICv3 redistributor registers

2016-08-02 Thread Andre Przywara
Hi, On 01/08/16 19:20, Christoffer Dall wrote: > On Fri, Jul 22, 2016 at 06:28:50PM +0100, Marc Zyngier wrote: >> From: Andre Przywara >> >> In the GICv3 redistributor there are the PENDBASER and PROPBASER >> registers which we did not emulate so far, as they only make sense >> when having an ITS