Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp162425pxb; Thu, 14 Jan 2021 02:40:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEk0Ef2HECkHctIXdyMW4hWuUg02WLwTHxq1xhnQH1KLAHVscDSJe/tEHp/2tfMpOpm8rn X-Received: by 2002:aa7:d64d:: with SMTP id v13mr5322270edr.196.1610620835245; Thu, 14 Jan 2021 02:40:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610620835; cv=none; d=google.com; s=arc-20160816; b=lRD9Fwp3TFHewRK66MrOMiUUBF8uQq6SxEF2UtKkpTla+UV21hHaJZwvmw0O3WItfv 9eGIiQxExjfKP9Hb41zaOS1jUn0kXKqXZhmgAVsOnZ/mfXauzFawrbvAQJJc1077CDRU DoFuVvbRYd1mM/+pokj4nPKQfbpuBQGGPWYoO/lxJrcptnVrDL1XWZN9PZDf9xfadt4M Uy20u+Z+HyouaHvvxEp3kxVazmAiHKu3ikrugoxmJUXHcnzXRcw+xlNjYQNWBlGzx9Q3 9Ewha7u0ZEKElknwsy2L5U4+zQIbELqzcBZ5poaoVOJ/3Bf+UgoKZWlh5fVdT9L+b0Gs fheQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G/DGlxtUTpbf673LGXUSi2zEyclPdvE3HTLHgWRcors=; b=Q/gMfTwPCOoqhZwdTM4qaoOA3RYiXIKwTL2Z69nnW0RLJjMfp85RbvoUiB4Te+kXFF NI8PMg+iE6mM4wZM6H9lMkdYGwNwknngisRVTizN7HBvLa4d5q8oBXH8VCKLhcpgVlfM +OAFNgn5POFl0Ol1f8rbmms6lGAOos0a32UXFMiUdqDDGetEv2Vxodm5L0feXU8y8Wbg RtSUisqsrCA/UN8GaLw0cfV3Ija99TtSAJX0ToW8TEY/0Lls550wxG/H8BzB15czKXee D71MMW7OsoknTJ3OfM0yz3YCK42RTNBRPc9yXFIpAEO2B/UzWcBGa9250BROAypMJ2bc +BtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dOKgHEVZ; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 97si2359504edr.112.2021.01.14.02.40.09; Thu, 14 Jan 2021 02:40:35 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dOKgHEVZ; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728711AbhANKjE (ORCPT + 99 others); Thu, 14 Jan 2021 05:39:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49342 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728682AbhANKi7 (ORCPT ); Thu, 14 Jan 2021 05:38:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610620654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G/DGlxtUTpbf673LGXUSi2zEyclPdvE3HTLHgWRcors=; b=dOKgHEVZ7+jgG3d7WWSSp3XZqVYwv9BJlkvSl3c+ekqDOyH0Colvu61U/u1pWTaqnJ2JQf msCqg45H+jNXqDFU2peiy97+h3BJ0Aav04GKKumqiawj4cpbyCbXlEYdbEbeqbXdkfXaC9 9B6c69+UnTXyvnnRnbGhTFgpbQr9vJc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-514-H3suqp5uOO2vw0f5Oogxeg-1; Thu, 14 Jan 2021 05:37:31 -0500 X-MC-Unique: H3suqp5uOO2vw0f5Oogxeg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7538E8066E1; Thu, 14 Jan 2021 10:37:29 +0000 (UTC) Received: from laptop.redhat.com (ovpn-114-165.ams2.redhat.com [10.36.114.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 823E112D7E; Thu, 14 Jan 2021 10:37:26 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, drjones@redhat.com Cc: alexandru.elisei@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH v2 4/9] KVM: arm/arm64: vgic: Reset base address on kvm_vgic_dist_destroy() Date: Thu, 14 Jan 2021 11:37:03 +0100 Message-Id: <20210114103708.26763-5-eric.auger@redhat.com> In-Reply-To: <20210114103708.26763-1-eric.auger@redhat.com> References: <20210114103708.26763-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v1 -> v2: - use dist-> in the else and add braces --- arch/arm64/kvm/vgic/vgic-init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c index 052917deb149..cf6faa0aeddb 100644 --- a/arch/arm64/kvm/vgic/vgic-init.c +++ b/arch/arm64/kvm/vgic/vgic-init.c @@ -335,13 +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 { + dist->vgic_cpu_base = VGIC_ADDR_UNDEF; } if (vgic_has_its(kvm)) @@ -362,6 +365,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