From nobody Mon Feb 9 18:20:01 2026 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=1619109767; cv=none; d=zohomail.com; s=zohoarc; b=TPM8ara9UOez9y/ALIQiHVO83NwJex/BRfQf8b3Qyxw2SJYJAGKi5DBc3hIxy6/fvAL5w4iCxa6eREL9wSo0fQy4pP/HoKQW7PeekpH1OL9qjvC4J0wWdBOayyhdJUULbRfrSKBbModwIBrYmG0xQchwyVaN/bubIeMrPul5ELg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619109767; 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=mesguA59MEbJdOvu630ATJmztH2kbkjG70qJ8Hl4xB0=; b=XTO3WwzS1JKa6GzwmM7t+fqcQ+lulbnRYIu/2oBuoxKTSgR5vj/VHq5085e8gIMjboPvEwkxVuFosqSRvczirYhQIB7+HBdiIfYjXP5fJoi8SwotToDCo6mY09rcbSpAzm1j+A53+tVSEKdupVdTm97+vB/kOvKjFIBh0OnK020= 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 1619109767829484.4360896102985; Thu, 22 Apr 2021 09:42:47 -0700 (PDT) Received: from localhost ([::1]:54656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZcPe-0001d5-L8 for importer@patchew.org; Thu, 22 Apr 2021 12:42:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZbwg-0004Pz-2D for qemu-devel@nongnu.org; Thu, 22 Apr 2021 12:12:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZbwd-0003RG-E0 for qemu-devel@nongnu.org; Thu, 22 Apr 2021 12:12:49 -0400 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-470-T09YcqJmP5ShXHLkcWZsQA-1; Thu, 22 Apr 2021 12:12:06 -0400 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 855AF801814 for ; Thu, 22 Apr 2021 16:12:05 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.40.194.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8AAB5B4A0; Thu, 22 Apr 2021 16:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619107966; 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=mesguA59MEbJdOvu630ATJmztH2kbkjG70qJ8Hl4xB0=; b=C23G1twHVV75lyL07zcQ4/NY13xdqNddvvtI/il1AZ29Iz/dUy7tkFJf2KH3dI6CRqrs+g /HiD44JDCnhdIA3WxmvmzTm9DbwJ8EPWfBk+TFhHyC1LTgtgPPSYq77B4QUas/UK2WSEZJ x7hbxZOpw2rGmvEIUHEoZDb+rW2tIfA= X-MC-Unique: T09YcqJmP5ShXHLkcWZsQA-1 From: Vitaly Kuznetsov To: qemu-devel@nongnu.org Subject: [PATCH v6 14/19] i386: use global kvm_state in hyperv_enabled() check Date: Thu, 22 Apr 2021 18:11:25 +0200 Message-Id: <20210422161130.652779-15-vkuznets@redhat.com> In-Reply-To: <20210422161130.652779-1-vkuznets@redhat.com> References: <20210422161130.652779-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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 Reviewed-by: Eduardo Habkost --- 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 5d08f3a39ef7..a42263b24fca 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -715,8 +715,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.30.2