From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934353AbdKGNoe (ORCPT ); Tue, 7 Nov 2017 08:44:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933271AbdKGNoc (ORCPT ); Tue, 7 Nov 2017 08:44:32 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 71CB46A7C2 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eric.auger@redhat.com Subject: Re: [PATCH v5 07/26] KVM: arm/arm64: vITS: Add a helper to update the affinity of an LPI To: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20171027142855.21584-1-marc.zyngier@arm.com> <20171027142855.21584-8-marc.zyngier@arm.com> Cc: Mark Rutland , Andre Przywara , Shameerali Kolothum Thodi , Christoffer Dall , Shanker Donthineni From: Auger Eric Message-ID: Date: Tue, 7 Nov 2017 14:44:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171027142855.21584-8-marc.zyngier@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 07 Nov 2017 13:44:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 27/10/2017 16:28, Marc Zyngier wrote: > In order help integrating the vITS code with GICv4, let's add in order to > a new helper that deals with updating the affinity of an LPI, > which will later be augmented with super duper extra GICv4 > goodness. > > Reviewed-by: Christoffer Dall > Signed-off-by: Marc Zyngier Reviewed-by: Eric Auger Eric > --- > virt/kvm/arm/vgic/vgic-its.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c > index 475dffd0a44c..8ee03f1e89fc 100644 > --- a/virt/kvm/arm/vgic/vgic-its.c > +++ b/virt/kvm/arm/vgic/vgic-its.c > @@ -335,6 +335,15 @@ static int vgic_copy_lpi_list(struct kvm_vcpu *vcpu, u32 **intid_ptr) > return i; > } > > +static int update_affinity(struct vgic_irq *irq, struct kvm_vcpu *vcpu) > +{ > + spin_lock(&irq->irq_lock); > + irq->target_vcpu = vcpu; > + spin_unlock(&irq->irq_lock); > + > + return 0; > +} > + > /* > * Promotes the ITS view of affinity of an ITTE (which redistributor this LPI > * is targeting) to the VGIC's view, which deals with target VCPUs. > @@ -349,10 +358,7 @@ static void update_affinity_ite(struct kvm *kvm, struct its_ite *ite) > return; > > vcpu = kvm_get_vcpu(kvm, ite->collection->target_addr); > - > - spin_lock(&ite->irq->irq_lock); > - ite->irq->target_vcpu = vcpu; > - spin_unlock(&ite->irq->irq_lock); > + update_affinity(ite->irq, vcpu); > } > > /* > @@ -693,11 +699,7 @@ static int vgic_its_cmd_handle_movi(struct kvm *kvm, struct vgic_its *its, > ite->collection = collection; > vcpu = kvm_get_vcpu(kvm, collection->target_addr); > > - spin_lock(&ite->irq->irq_lock); > - ite->irq->target_vcpu = vcpu; > - spin_unlock(&ite->irq->irq_lock); > - > - return 0; > + return update_affinity(ite->irq, vcpu); > } > > /* >