Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1443067pxf; Fri, 12 Mar 2021 09:34:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoeHSyq0m1NJsQdK9VMlxE0gQaSUQV7yrLRY1v0b84AyFHRcMzpwbdFGax995NvoZVprBz X-Received: by 2002:aa7:d813:: with SMTP id v19mr2845594edq.213.1615570482148; Fri, 12 Mar 2021 09:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615570482; cv=none; d=google.com; s=arc-20160816; b=U0Yz2a140x3h5Y+O1WW6/QviteS3Eh+v3i2lJ/W7AdX/1cc9/pEAOMe+PhLAzDs/mm +JyVZMakK95UOjwNdt24yuhuzTUpNSIj1LljGDZAeMoW5zOhEe1iHTnUH8Hp0QBKBdEh lbx1aZPVwJ2afoEzqrL8ANEcMnwl8krh/mBJl/O62gV1Nkk2vDV5zHW1Q+HobF77QpuD 6Ouap5wJTqYC1ai1Rp/gtwP/GhZW+fim97ECtqpe31AURjTOEH2o5WEIgxIt1gvcgQ8D MbihKEGYT1A3QI1BBXDx3qKL4HR2Ln20v1zf3ICQ4NFd718CW9JZcinGo8ZECCddbAaG fhoA== 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=DByFG8WE9w4blwkYdOK3/Dq3mki0T+Put1GzIk14928=; b=B1WYtk+ayjfydFJZOLoUezIVRLm/D/phWX/w40YbNqmfopGdpx5sRN1y9Qc/Eilc6S 4yKHnBTYBSD76P0wdL4Jb+RcyecVPpsaIHaAbi/LgsjHM7D792X3yjPBjBDvCOaTeTkh JE4mYpMSNrqiTnoaBKSCYuE3F+YqoNg0hATFZWwAtVNKbIWWnDdU1dltbVA1+lPL8LgJ LsSY72QmcMkpixRaFTIF3lrSRzwiukY7duBVTCRNyAFwHLjuJR3FnXRuHKVta9ZAK00G maTy14wGuElQbSUs6xbDZ4w8gDuRbQBnNKt6Z6m/zA/t+X9tEO3dbwTrm+SMDeTWjzZ2 RY9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eYwQQLc0; 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 m18si4863646edd.73.2021.03.12.09.34.19; Fri, 12 Mar 2021 09:34:42 -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=eYwQQLc0; 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 S232996AbhCLRdJ (ORCPT + 99 others); Fri, 12 Mar 2021 12:33:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24407 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232971AbhCLRcn (ORCPT ); Fri, 12 Mar 2021 12:32:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615570362; 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=DByFG8WE9w4blwkYdOK3/Dq3mki0T+Put1GzIk14928=; b=eYwQQLc0Pyb4sJgCoXSjwqXyAJZ3mgEQlmdvthNe4zf8brLR/5O36G5VbEu6vbWm7gRfWs rHjXvlXR70aPlua9rIg523giZ8Bf5qKrMVw+RYwv4m6E3U0ADDFJ1awJL0MyOLRHCPZ9R4 UuUGq6Ruq5sPRHqpeDmqBhAzMGmoGdc= 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-75-vduMqSMCPhSY4Aut4ULgdQ-1; Fri, 12 Mar 2021 12:32:41 -0500 X-MC-Unique: vduMqSMCPhSY4Aut4ULgdQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EEDB108BD07; Fri, 12 Mar 2021 17:32:39 +0000 (UTC) Received: from laptop.redhat.com (ovpn-112-254.ams2.redhat.com [10.36.112.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89C481009962; Fri, 12 Mar 2021 17:32:25 +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, alexandru.elisei@arm.com Cc: james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, shuah@kernel.org, pbonzini@redhat.com Subject: [PATCH v3 4/8] KVM: arm/arm64: vgic: Reset base address on kvm_vgic_dist_destroy() Date: Fri, 12 Mar 2021 18:31:58 +0100 Message-Id: <20210312173202.89576-5-eric.auger@redhat.com> In-Reply-To: <20210312173202.89576-1-eric.auger@redhat.com> References: <20210312173202.89576-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.26.2