Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1954034pxu; Sun, 13 Dec 2020 08:40:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUPA/eg1Re9BkYxc+WiC1/fweqbz1QnVCh9zdLn72551xjrAwYAw6iYST09MQuC7D0tisy X-Received: by 2002:aa7:c7d8:: with SMTP id o24mr7482047eds.328.1607877639379; Sun, 13 Dec 2020 08:40:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607877639; cv=none; d=google.com; s=arc-20160816; b=KEwvupjMoctvpMF5fXQq2b/JNzkuJzCBRFWoTpGxf8WQiRDBTpIbvO6yj6wh1GGkLA 4WRXH3NhhBPRLrvNeB40qyCCCjA9UyHhAg0gLxO/GCqDu3DHl5mxW2MG7hp5cRGNz8MR iVkqeeYNs7S4BuIap4LwxS4zH9DTDqhHQcmZo2O2ksPxnKgJIrnT5WsrOiUkwTZL9Wor 6L3L3+HS70VpvHvkC70J1ZtsNYNMmCbP1Q5Gofez/c2qu8EBeBmz/+ki1uCEx63Og6bX /1Zz/pcv4tVvtIWnfsN6rYukStm7H8ms0ItamzkNltyn3pLnu2Jvqrwe2VLKEG+pBMqa DkBQ== 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=jQHoHNYAV8SPm9x4gENdfPMBg5XjWAXfV/w36dOvvcc=; b=T9X0AgdTTshIEC9BmQzhcVN02IzQK8jvc6W0YITzr02KgBxRKO7/PGctqqdQfHK5Yo uQ9ZdLyKQv7CCD25IJlewHL2/ZaHJAAWoVtv++u8XqdTVl3WFyWYXREW1E5Tz+WhvWCA Rotwbwcw6WkUZHyzdM2nyl3ckBlwhOp9Puf15q+XD3Oe1eYOf5Y3nc1OQ7fNS8TuK37P a/W6KJHUSae6A1Xi9vxlvlW/v+QN/HE/C7+fWvEwIpNa+KBKqBueFD635ngO00aNEvwD MgLBAWwght1yfNcqIHysy7RwBhVEl0+qNtz9lhNIOAND3xIZg8iinBJLJNMWFkFcNSM1 ms+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YQCrjFxn; 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 f21si9027459edr.152.2020.12.13.08.40.15; Sun, 13 Dec 2020 08:40:39 -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=YQCrjFxn; 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 S2407814AbgLLS5M (ORCPT + 99 others); Sat, 12 Dec 2020 13:57:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:29142 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407751AbgLLSwQ (ORCPT ); Sat, 12 Dec 2020 13:52:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607799050; 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=jQHoHNYAV8SPm9x4gENdfPMBg5XjWAXfV/w36dOvvcc=; b=YQCrjFxnF8WMpHwQ/HtGOK0/sQXDpunHlKvibHZ6EK/HwzjvjZaWfj/X3P0pCDjDU+4dSY /uNHjQVgVhnEtBfcC1OEHwAxDH8yYXSHYNxZW938OihUA0OD4kdyoCZyt9WlKPEFscYEWc jxu+plF0DDrIRsxRE/st4uEQLCaJvAs= 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-550-Y9AFZVqmOSWcsl6hBVA-ZQ-1; Sat, 12 Dec 2020 13:50:46 -0500 X-MC-Unique: Y9AFZVqmOSWcsl6hBVA-ZQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20C941005504; Sat, 12 Dec 2020 18:50:45 +0000 (UTC) Received: from laptop.redhat.com (ovpn-115-41.ams2.redhat.com [10.36.115.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24F2D1F069; Sat, 12 Dec 2020 18:50:38 +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 5/9] KVM: arm: move has_run_once after the map_resources Date: Sat, 12 Dec 2020 19:50:06 +0100 Message-Id: <20201212185010.26579-6-eric.auger@redhat.com> In-Reply-To: <20201212185010.26579-1-eric.auger@redhat.com> References: <20201212185010.26579-1-eric.auger@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org has_run_once is set to true at the beginning of kvm_vcpu_first_run_init(). This generally is not an issue except when exercising the code with KVM selftests. Indeed, if kvm_vgic_map_resources() fails due to erroneous user settings, has_run_once is set and this prevents from continuing executing the test. This patch moves the assignment after the kvm_vgic_map_resources(). Signed-off-by: Eric Auger --- arch/arm64/kvm/arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index c0ffb019ca8b..331fae6bff31 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -540,8 +540,6 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) if (!kvm_arm_vcpu_is_finalized(vcpu)) return -EPERM; - vcpu->arch.has_run_once = true; - if (likely(irqchip_in_kernel(kvm))) { /* * Map the VGIC hardware resources before running a vcpu the @@ -560,6 +558,8 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) static_branch_inc(&userspace_irqchip_in_use); } + vcpu->arch.has_run_once = true; + ret = kvm_timer_enable(vcpu); if (ret) return ret; -- 2.21.3