Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9146569pxu; Mon, 28 Dec 2020 07:45:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPKg9rHkRzhdVeRYi7RKMbf+2BseNUUAolnOPxyFLfVzKvwA7IVmFGEEn14ekN9eGA8D1E X-Received: by 2002:a17:907:20a4:: with SMTP id pw4mr41551667ejb.499.1609170340814; Mon, 28 Dec 2020 07:45:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609170340; cv=none; d=google.com; s=arc-20160816; b=wf4B2H1o5icmBwM5jwLd9m/2PikFBaiklmbQwK//fLsGJBRvNcVZJDUl4qk36+i1Aq nBi0BpJyVek/NhcwHb4aCU96VoHCh2nUIEJTuExy2+Jhxj3/o5wLuBq9mxldegoq8AoD CzE7Dv3ntYzs14MUTvRn8BB9O/1wLb8vHv+oRrbyA98SrMkylB5yChJLqmLyuinpEpVB MZiH7ObKD7pIq7xf2QoBk5250UidsJz280H+f8sYYct7OK4vFyLycjRV1CXP6n8Q9hr5 hXq0JpsNuObNUoAbLJIQe6uiBq1Tkbs67UR9gbog4e7NQV2CgMnj/mPB5dZr/SvDJpDg 27sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=r49FgEJGTXG/VQ7NFURIPdbuDMHELnoaNhnSk0iFY2w=; b=FldswcyiJIc7oox9B52EBJjELDFDSh4nxqqYdm1W8MTqGl1+w2ymPrxdqH2A4lm9Xt GOQE/cHPbWO57z2wgUtDX1bhbBK4zN+fUXmiZt/6BshU+M1WNdqNTTDUV7YnvgNakRQo tNigydkMur+aqIcltmSOYeJwO06HGWSc0pfG70tCN3ZVXf2+d7KIVu5+EuGDtv9lhKNs m77sFUmCUnYceWNWS2jW652xKL3yaCUmA98Qb7Gupj0QM+wDRUJqM8IxL5yUwOTvTJ0k cIEBSwBgLNeJ+0tMhtqQI9cFQngioJU+uhb8Zs3qxEwT2l7PJ1AqEVr+jcWulFrXMUOh YJtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si17746227ejc.540.2020.12.28.07.45.17; Mon, 28 Dec 2020 07:45:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406523AbgL1PnQ (ORCPT + 99 others); Mon, 28 Dec 2020 10:43:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:40180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633231AbgL1PmP (ORCPT ); Mon, 28 Dec 2020 10:42:15 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FE1A20776; Mon, 28 Dec 2020 15:41:34 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1ktueK-004Fep-Aa; Mon, 28 Dec 2020 15:41:32 +0000 Date: Mon, 28 Dec 2020 15:41:31 +0000 Message-ID: <878s9ios44.wl-maz@kernel.org> From: Marc Zyngier To: Eric Auger Cc: eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, drjones@redhat.com, alexandru.elisei@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: Re: [PATCH 4/9] KVM: arm/arm64: vgic: Reset base address on kvm_vgic_dist_destroy() In-Reply-To: <20201212185010.26579-5-eric.auger@redhat.com> References: <20201212185010.26579-1-eric.auger@redhat.com> <20201212185010.26579-5-eric.auger@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: eric.auger@redhat.com, eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, drjones@redhat.com, alexandru.elisei@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 12 Dec 2020 18:50:05 +0000, Eric Auger wrote: > > On vgic_dist_destroy(), the addresses are not reset. However for > kvm selftest purpose this would allow to continue the test execution > even after a failure when running KVM_RUN. So let's reset the > base addresses. > > Signed-off-by: Eric Auger > --- > arch/arm64/kvm/vgic/vgic-init.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c > index 32e32d67a127..6147bed56b1b 100644 > --- a/arch/arm64/kvm/vgic/vgic-init.c > +++ b/arch/arm64/kvm/vgic/vgic-init.c > @@ -335,14 +335,16 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm) > kfree(dist->spis); > dist->spis = NULL; > dist->nr_spis = 0; > + dist->vgic_dist_base = VGIC_ADDR_UNDEF; > > - if (kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) { > + if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) { > list_for_each_entry_safe(rdreg, next, &dist->rd_regions, list) { > list_del(&rdreg->list); > kfree(rdreg); > } > INIT_LIST_HEAD(&dist->rd_regions); > - } > + } else > + kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF; Since you have converted the hunk above to use dist->, you could do the same thing here. And the coding style dictates that you need {} on the else side as well. > > if (vgic_has_its(kvm)) > vgic_lpi_translation_cache_destroy(kvm); > @@ -362,6 +364,7 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu) > vgic_flush_pending_lpis(vcpu); > > INIT_LIST_HEAD(&vgic_cpu->ap_list_head); > + vgic_cpu->rd_iodev.base_addr = VGIC_ADDR_UNDEF; > } > > /* To be called with kvm->lock held */ > -- > 2.21.3 > > Thanks, M. -- Without deviation from the norm, progress is not possible.