Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp163830pxb; Thu, 14 Jan 2021 02:43:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUjpRosQEq6eZYZfE1UcCzygbE8Gbvvh/M/9qCjzfDcaoleCHXElugvDIZkHV1WRzkzjUm X-Received: by 2002:a05:6402:5246:: with SMTP id t6mr5269219edd.62.1610621004940; Thu, 14 Jan 2021 02:43:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610621004; cv=none; d=google.com; s=arc-20160816; b=gGEFxPsrl8kaiI+eRK1JS5+XKVQucwJiG0Siqxn65a8HLtO3wuKjRNl1Vu6UyJhezX Fh6hC3yYA4sxxocDXrG6cs2+ENch+NF+vF2ThVsCG+QKlePXA95V4doaKFUCtC22Mmzs BBh3h50qhJdIIEYjHCSyonWbcrNgEebyOMamG0bq4zewbCG/4yIwgpoK1w0nAcjXWIEx SfDdZHRLvR9L2XbBBnPf6rP1EV3tBMVbILlNnKtsmXyvPl5LN/GepGefZDLzgRdn0MZ9 j2ax7GBDVrzkRj6mp9CjKenATT0CerU3kcR9qz125fko5RCO/u+OQi364M1DBLN6YcJM VkXQ== 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=+hJXtfkfIsQuOWJQwFllSA/VmwaaMSwqBRVC3R1TgZY=; b=yjIkJYht75x8qUzgHjYH6uQBvQ+iODCvq5NwjLuAe/Ewq4wuA4LPZiPgkEuDGKChwq qNQ29NtVuoeSJm5dGIMjEPX9EXM6TeKcmt88CybIEGhDMR0VWa7kwRBQX9+ZgcbLyWiB xg1mDJJ5wL/t4gpybyZJombFiXbbIa5Zyin7mKZuTgLOxyEC2rPVK/vc9hz1BGgtPMrf FGTtr2abKefCuYfFxM9ORc0BWfdEzoSsCyjfg64iYFx3mZdJzU6WVwXpn1LP3wuanHu5 cKR505yy0kS33Eyz1adf1tognFY/9UC769NJDoPL0tvCQvAJ5w338to5950qdo6Nk04/ 7u+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HlEtjwXp; 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 qo17si2171016ejb.296.2021.01.14.02.43.00; Thu, 14 Jan 2021 02:43:24 -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=HlEtjwXp; 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 S1728998AbhANKkq (ORCPT + 99 others); Thu, 14 Jan 2021 05:40:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40317 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728727AbhANKjH (ORCPT ); Thu, 14 Jan 2021 05:39:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610620661; 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=+hJXtfkfIsQuOWJQwFllSA/VmwaaMSwqBRVC3R1TgZY=; b=HlEtjwXpnWQk0qi6f7mi5oob+b4yZ1Ukea3Tv7OUjOOaVDWz0+nms81C64YosfC4I4/xx1 odEQxpQ0rWdeRjOdi5Vd3+a60Il/WII33IOB68Tfk2rEnothgxTEjSLRomic+DvMO5Qy45 XA3DNnNQCs7KXZNxWbREPHygqXAdtvs= 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-201-qAFO6Wd9NrmhCjLZgaESvQ-1; Thu, 14 Jan 2021 05:37:40 -0500 X-MC-Unique: qAFO6Wd9NrmhCjLZgaESvQ-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 7F37C107ACF8; Thu, 14 Jan 2021 10:37:38 +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 B07287047A; Thu, 14 Jan 2021 10:37:29 +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 5/9] KVM: arm: move has_run_once after the map_resources Date: Thu, 14 Jan 2021 11:37:04 +0100 Message-Id: <20210114103708.26763-6-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 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. for instance, 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 --- v1 -> v2: - slight reword of the commit msg (for instance) --- 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 04c44853b103..580760e58980 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -573,8 +573,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 @@ -591,6 +589,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