From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758421AbdJMPks (ORCPT ); Fri, 13 Oct 2017 11:40:48 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:49329 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756659AbdJMPkp (ORCPT ); Fri, 13 Oct 2017 11:40:45 -0400 X-Google-Smtp-Source: AOwi7QCyr96nRn9Qzefuha09lSy7Sxqv7AMw4S8Az8oNrE/2Q7bJvcZiIg7/GVlKTMhl1MdUBjyP4A== Date: Fri, 13 Oct 2017 17:40:50 +0200 From: Christoffer Dall To: Eric Auger Cc: eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, marc.zyngier@arm.com, peter.maydell@linaro.org, andre.przywara@arm.com, wanghaibin.wang@huawei.com, wu.wubin@huawei.com Subject: Re: [PATCH v2 10/10] KVM: arm/arm64: vgic-its: Implement KVM_DEV_ARM_ITS_CTRL_RESET Message-ID: <20171013154050.GM8927@cbox> References: <1506518920-18571-1-git-send-email-eric.auger@redhat.com> <1506518920-18571-11-git-send-email-eric.auger@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1506518920-18571-11-git-send-email-eric.auger@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 27, 2017 at 03:28:40PM +0200, Eric Auger wrote: > On reset we clear the valid bits of GITS_CBASER and GITS_BASER. > We also clear command queue registers and free the device, > collection and lpi lists. , and lpi lists. (https://imgur.com/gallery/fycHx for your amusemnt) Otherwise: Reviewed-by: Christoffer Dall > > Signed-off-by: Eric Auger > --- > arch/arm/include/uapi/asm/kvm.h | 1 + > arch/arm64/include/uapi/asm/kvm.h | 1 + > virt/kvm/arm/vgic/vgic-its.c | 18 ++++++++++++++++++ > 3 files changed, 20 insertions(+) > > diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h > index 5db2d4c..7ef0c06 100644 > --- a/arch/arm/include/uapi/asm/kvm.h > +++ b/arch/arm/include/uapi/asm/kvm.h > @@ -215,6 +215,7 @@ struct kvm_arch_memory_slot { > #define KVM_DEV_ARM_ITS_SAVE_TABLES 1 > #define KVM_DEV_ARM_ITS_RESTORE_TABLES 2 > #define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 > +#define KVM_DEV_ARM_ITS_CTRL_RESET 4 > > /* KVM_IRQ_LINE irq field index values */ > #define KVM_ARM_IRQ_TYPE_SHIFT 24 > diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h > index 9f3ca24..b5306ce 100644 > --- a/arch/arm64/include/uapi/asm/kvm.h > +++ b/arch/arm64/include/uapi/asm/kvm.h > @@ -227,6 +227,7 @@ struct kvm_arch_memory_slot { > #define KVM_DEV_ARM_ITS_SAVE_TABLES 1 > #define KVM_DEV_ARM_ITS_RESTORE_TABLES 2 > #define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3 > +#define KVM_DEV_ARM_ITS_CTRL_RESET 4 > > /* Device Control API on vcpu fd */ > #define KVM_ARM_VCPU_PMU_V3_CTRL 0 > diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c > index eaefba2..fa18946 100644 > --- a/virt/kvm/arm/vgic/vgic-its.c > +++ b/virt/kvm/arm/vgic/vgic-its.c > @@ -2380,6 +2380,19 @@ static int vgic_its_commit_v0(struct vgic_its *its) > return 0; > } > > +static void vgic_its_reset(struct kvm *kvm, struct vgic_its *its) > +{ > + /* We need to keep the ABI specific field values */ > + its->baser_coll_table &= ~GITS_BASER_VALID; > + its->baser_device_table &= ~GITS_BASER_VALID; > + its->cbaser = 0; > + its->creadr = 0; > + its->cwriter = 0; > + its->enabled = 0; > + vgic_its_free_device_list(kvm, its); > + vgic_its_free_collection_list(kvm, its); > +} > + > static int vgic_its_has_attr(struct kvm_device *dev, > struct kvm_device_attr *attr) > { > @@ -2394,6 +2407,8 @@ static int vgic_its_has_attr(struct kvm_device *dev, > switch (attr->attr) { > case KVM_DEV_ARM_VGIC_CTRL_INIT: > return 0; > + case KVM_DEV_ARM_ITS_CTRL_RESET: > + return 0; > case KVM_DEV_ARM_ITS_SAVE_TABLES: > return 0; > case KVM_DEV_ARM_ITS_RESTORE_TABLES: > @@ -2438,6 +2453,9 @@ static int vgic_its_set_attr(struct kvm_device *dev, > case KVM_DEV_ARM_VGIC_CTRL_INIT: > /* Nothing to do */ > return 0; > + case KVM_DEV_ARM_ITS_CTRL_RESET: > + vgic_its_reset(dev->kvm, its); > + return 0; > case KVM_DEV_ARM_ITS_SAVE_TABLES: > return abi->save_tables(its); > case KVM_DEV_ARM_ITS_RESTORE_TABLES: > -- > 2.5.5 >