From nobody Tue Nov 18 10:38:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610032755; cv=none; d=zohomail.com; s=zohoarc; b=Pu7Wz40WzhYCL20VcyWEwMvP6vwX0bjvPBeLLY98JlYNKRvx2mAujF/R9awaHoY0MibdE98Ol1LtOQ67HBaA+b3054Q5c7HY2sxcCB9OkDYSufQpLuYmsYfr/4ZSjjenWURGyoLuUhSHezXgGpWgi3baaf0s2f1ukwKXlAlod58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610032755; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bwZ+YtabfE3XF+JdFX7aENgvlpN01uhKvbles7B2O9M=; b=Kr55ljCj/JH/A2AuyDsuwTKvdDqCHdqw2dtoyUflD8ctMbh/Kh3RqBbGbS1gCY0pyYdW3JccXL9cz61FWQx8kUJ3YqhYAAUxI/H1EtAqQ5vtl64ZmjKzeLkE33L4f2UV1JK+arIWXQgfVWXxUGSIt2MFBGt+vxeYZpFB3o1aJdc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610032755085176.64499242941906; Thu, 7 Jan 2021 07:19:15 -0800 (PST) Received: from localhost ([::1]:51014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxX4E-000581-4o for importer@patchew.org; Thu, 07 Jan 2021 10:19:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxX01-0008Ui-LZ for qemu-devel@nongnu.org; Thu, 07 Jan 2021 10:14:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56489) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kxWzx-0006QJ-Rz for qemu-devel@nongnu.org; Thu, 07 Jan 2021 10:14:53 -0500 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-10-ElqEJQT3OjuMZ5VbZLUMQQ-1; Thu, 07 Jan 2021 10:14:47 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07CDF8030A1 for ; Thu, 7 Jan 2021 15:14:46 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.40.195.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72B8460861; Thu, 7 Jan 2021 15:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610032489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bwZ+YtabfE3XF+JdFX7aENgvlpN01uhKvbles7B2O9M=; b=Okz29zzuz+QFTMRQW3geBwtlZ3NlxM64aBEDbpTQyHCGvzva15f9Ey4WRvr8RmVG0o9XU1 b5lwgKQ5F7JPMd5we/FEywnXXDa4EIi47l+4M/7Uki1x+yaga+YzQoysMxjDJdwbXxu0Ac HAg8awmePA5vBBa7WUGLgLsoUVe0xf4= X-MC-Unique: ElqEJQT3OjuMZ5VbZLUMQQ-1 From: Vitaly Kuznetsov To: qemu-devel@nongnu.org Subject: [PATCH v3 16/19] i386: use global kvm_state in hyperv_enabled() check Date: Thu, 7 Jan 2021 16:14:43 +0100 Message-Id: <20210107151443.540963-1-vkuznets@redhat.com> In-Reply-To: <20210107150640.539239-1-vkuznets@redhat.com> References: <20210107150640.539239-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=vkuznets@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=vkuznets@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.246, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Marcelo Tosatti , Eduardo Habkost , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" There is no need to use vCPU-specific kvm state in hyperv_enabled() check and we need to do that when feature expansion happens early, before vCPU specific KVM state is created. Signed-off-by: Vitaly Kuznetsov --- target/i386/kvm/kvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index a8858b93f3d4..36309cda3860 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -718,8 +718,7 @@ unsigned long kvm_arch_vcpu_id(CPUState *cs) =20 static bool hyperv_enabled(X86CPU *cpu) { - CPUState *cs =3D CPU(cpu); - return kvm_check_extension(cs->kvm_state, KVM_CAP_HYPERV) > 0 && + return kvm_check_extension(kvm_state, KVM_CAP_HYPERV) > 0 && ((cpu->hyperv_spinlock_attempts !=3D HYPERV_SPINLOCK_NEVER_NOTIFY)= || cpu->hyperv_features || cpu->hyperv_passthrough); } --=20 2.29.2