From nobody Thu Jun 4 20:00:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1780418758; cv=none; d=zohomail.com; s=zohoarc; b=eGT+4xWYpYjuflfVMjQrhg9uVLGq6uW55U3zg9WLtdnrBoy4dgBzQ0Sq1ITuEDJv0NY+DWc+oSc4xB+VSntTB2Y2QBC50AzdR2AI5L8IPuNrQkN6BajPEr9fJpwuWwSoTvaUje8no608A9LNgEglX61IJYipcl0PUE2mWteieuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780418758; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=gdIPFE2aHGSUEMqN/XXEahpVfUfPeR9UEH/DYHUoops=; b=iZd9kVNyMYDPplmSWNQS4T30wX5iZT/d8DKK+wVKrW41S8PK6Kafa/YQdhPopBtW+Z0ur2nDcMINdIjEW2Chj3O8gpaeLSvr+XnoD+JHjeTdIkhbp+3ZuPMVVCtKCazXoinI6nEcSlU74bEzoRRTRwWUjC/mciVgEEhLWY1Dk8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1780418758432309.42356226809204; Tue, 2 Jun 2026 09:45:58 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6B55D41AA9; Tue, 2 Jun 2026 12:45:57 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A224941AB1; Tue, 2 Jun 2026 12:45:11 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id CD39641A04; Tue, 2 Jun 2026 12:45:01 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D4DFE4198F for ; Tue, 2 Jun 2026 12:45:00 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-JCnTVHhiNtCrKLJr8MUVOQ-1; Tue, 02 Jun 2026 12:44:58 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1E3761956048 for ; Tue, 2 Jun 2026 16:44:58 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.88.75]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B08B730001A2 for ; Tue, 2 Jun 2026 16:44:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780418700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gdIPFE2aHGSUEMqN/XXEahpVfUfPeR9UEH/DYHUoops=; b=bHJHK6xw3AdWM887zg5OwnTyctJFAU6Y+41tGB0KUmEVYzQkpsNzppR3T6wgg4QON3+Qdu uhhEVk4KKmSiWan3GmGs8AxFqXQzRaRqOHCR87RW5B/gpyzFyr5pmD/vH4LI731hlwyXX3 Q2HlQLNuRRnJzBIftS6inEZ9VR4Qm6A= X-MC-Unique: JCnTVHhiNtCrKLJr8MUVOQ-1 X-Mimecast-MFC-AGG-ID: JCnTVHhiNtCrKLJr8MUVOQ_1780418698 To: devel@lists.libvirt.org Subject: [PATCH 1/3] hyperv: fix error handling of hypervGetProcessorsByName() Date: Tue, 2 Jun 2026 11:44:52 -0500 Message-ID: <20260602164455.746257-2-jjongsma@redhat.com> In-Reply-To: <20260602164455.746257-1-jjongsma@redhat.com> References: <20260602164455.746257-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: sXweuF4Eg1OmQXbNjqBQWA1gW-T1sdUzCY5Iy_GNeG8_1780418698 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2AJFABEXLIT6UK3C3VMEXFYS3NK7CCBX X-Message-ID-Hash: 2AJFABEXLIT6UK3C3VMEXFYS3NK7CCBX X-MailFrom: jjongsma@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jonathon Jongsma via Devel Reply-To: Jonathon Jongsma X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1780418762027154100 Content-Type: text/plain; charset="utf-8"; x-default="true" We were checking the output pointer for NULL rather than checking the dereferenced value for NULL. So the case where no processors were returned would not have returned an error as expected. Reviewed-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index f80433693e..1031076a28 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -69,7 +69,7 @@ hypervGetProcessorsByName(hypervPrivate *priv, const char= *name, if (hypervGetWmiClass(Win32_Processor, processorList) < 0) return -1; =20 - if (!processorList) { + if (!*processorList) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not look up processor(s) on '%1$s'"), name); --=20 2.54.0 From nobody Thu Jun 4 20:00:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1780418872; cv=none; d=zohomail.com; s=zohoarc; b=L/frBJYunYIOOfNqiYmsP2MRm1Z9dBNVrk/eIG97JLCWFxDED0NUiJha+v1TN+M3Q6n9XZJ6ikRRgim9rtPfNYXvVolJzWabhObmYsHQVK837VJM/2yb+JgBiBsSugNSUiJFSfgrx064BRoLAl8XPInL0JDmNqauuWheduUQZRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780418872; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=Id95JXgSNZmKpO56Kkii+gUjSjSAsbiO9LFnX3ZiiQ8=; b=X6+MeGRB5Pz0Oyn4x0Wv4vFHZyEXDFWcySoEcqc/DkAfCaHOsH8g5iMkp6ZanKspevYlDSjg+qnLSS8SM8Kdq2po6/G95GMi9pTzP5aUdX/ia5zdH7cS3BW4+P9NYeKTASY89Ff7Zr4Ysc+uIshiR5382K1bjKGGanRQpxSbHyY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1780418872463350.04965630920356; Tue, 2 Jun 2026 09:47:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 9480B41B3C; Tue, 2 Jun 2026 12:47:51 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A515A41D69; Tue, 2 Jun 2026 12:45:20 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B2E65419F5; Tue, 2 Jun 2026 12:45:02 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D721B4198F for ; Tue, 2 Jun 2026 12:45:01 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-53-KmfHFj2AMj6BI-wUzRPNlw-1; Tue, 02 Jun 2026 12:44:59 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 12D631800616 for ; Tue, 2 Jun 2026 16:44:59 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.88.75]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A692130001A2 for ; Tue, 2 Jun 2026 16:44:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780418701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Id95JXgSNZmKpO56Kkii+gUjSjSAsbiO9LFnX3ZiiQ8=; b=EiQLb232LC4MVlujeTekl13lOEbm3VUaWHF6bBYkcx0Voqa2kkL8i6oDolKFge/PAIMpOC k860SocxDgiOLJTpz+FsA9VjQagUH/wWvcxMOxLGqtYi60ep2VQDKMpgfRO8l1kt7ZKz3E 9waYeEkybwfjM2wpTco5Ks439vYN0JM= X-MC-Unique: KmfHFj2AMj6BI-wUzRPNlw-1 X-Mimecast-MFC-AGG-ID: KmfHFj2AMj6BI-wUzRPNlw_1780418699 To: devel@lists.libvirt.org Subject: [PATCH 2/3] hyperv: Rename hypervGetProcessorsByName() to hypervGetProcessorList() Date: Tue, 2 Jun 2026 11:44:53 -0500 Message-ID: <20260602164455.746257-3-jjongsma@redhat.com> In-Reply-To: <20260602164455.746257-1-jjongsma@redhat.com> References: <20260602164455.746257-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: aYp7d09IsD7kGorYkS1bCxGSAJMYOQRm5eBqfIm4d2M_1780418699 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Q3IUT3GY5HWMBNMTVXFZ2ZJP3ADYMFDE X-Message-ID-Hash: Q3IUT3GY5HWMBNMTVXFZ2ZJP3ADYMFDE X-MailFrom: jjongsma@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jonathon Jongsma via Devel Reply-To: Jonathon Jongsma X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1780418878691154100 Content-Type: text/plain; charset="utf-8"; x-default="true" Make the 'name' parameter optional and return all processors from the host if name is not specified. Reviewed-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 1031076a28..7cd83e7565 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -56,15 +56,20 @@ VIR_LOG_INIT("hyperv.hyperv_driver"); */ =20 static int -hypervGetProcessorsByName(hypervPrivate *priv, const char *name, - Win32_Processor **processorList) +hypervGetProcessorList(hypervPrivate *priv, const char *computer_name, + Win32_Processor **processorList) { g_auto(virBuffer) query =3D VIR_BUFFER_INITIALIZER; - virBufferEscapeSQL(&query, - "ASSOCIATORS OF {Win32_ComputerSystem.Name=3D'%s'} " - "WHERE AssocClass =3D Win32_ComputerSystemProcessor= " - "ResultClass =3D Win32_Processor", - name); + if (computer_name) { + virBufferEscapeSQL(&query, + "ASSOCIATORS OF {Win32_ComputerSystem.Name=3D'%= s'} " + "WHERE AssocClass =3D Win32_ComputerSystemProce= ssor " + "ResultClass =3D Win32_Processor", + computer_name); + + } else { + virBufferAddLit(&query, WIN32_PROCESSOR_WQL_SELECT); + } =20 if (hypervGetWmiClass(Win32_Processor, processorList) < 0) return -1; @@ -72,7 +77,7 @@ hypervGetProcessorsByName(hypervPrivate *priv, const char= *name, if (!*processorList) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not look up processor(s) on '%1$s'"), - name); + computer_name); return -1; } =20 @@ -1933,7 +1938,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr = info) if (hypervGetPhysicalSystemList(priv, &computerSystem) < 0) return -1; =20 - if (hypervGetProcessorsByName(priv, computerSystem->data->Name, &proce= ssorList) < 0) { + if (hypervGetProcessorList(priv, computerSystem->data->Name, &processo= rList) < 0) { return -1; } =20 --=20 2.54.0 From nobody Thu Jun 4 20:00:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1780418937; cv=none; d=zohomail.com; s=zohoarc; b=O0b3lZfaXRy3dAt1VyjkMrvNuw/ljk4/btQVeSm3LtCd3LpvLYxG7h89jjMdkUsp3JLsZ+syrgmzpLn1moZRlOslCfOV5IL1TqUoGO2S6LishgYKdcRMypixV+NmXjRNDPvuzemPOTKwmHIOQqqAiI9SS4NnJ/Srfx1BXLg1IjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780418937; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=IPaNZmVGCI2CyW7PMRv+Phm3DvhuGPE7ChuBMdOmqG0=; b=Pwmlz1olnBo6cKASRPSIuS/T76KnTAnFIg/k3fkGepZBp/NfiCCzqdbmlVgMI518b8wmvzLs5PQqOT6wZDTmj9mUE5iZj/IFtQIDJTgwynToCnLdNUMiPAJXQmfmCOl2Z6CF8fyHjboEqFzsiMayEWzjWGjjQS+1dEtHXDGpsLQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 178041893783710.35939565236481; Tue, 2 Jun 2026 09:48:57 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1FA3341A9A; Tue, 2 Jun 2026 12:48:57 -0400 (EDT) Received: from [172.19.199.4] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D91AD41BAA; Tue, 2 Jun 2026 12:45:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 042E4419F5; Tue, 2 Jun 2026 12:45:02 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4A0A541A04 for ; Tue, 2 Jun 2026 12:45:02 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-302-oaGzdNLiOC-AhLpO0M_rhw-1; Tue, 02 Jun 2026 12:45:00 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AEB3D195608D for ; Tue, 2 Jun 2026 16:44:59 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.88.75]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B41430002DC for ; Tue, 2 Jun 2026 16:44:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1780418701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IPaNZmVGCI2CyW7PMRv+Phm3DvhuGPE7ChuBMdOmqG0=; b=VFc/QmKgCP9mdpiPKyuwXUjYDqGvPRviL6fBvE3syOeQscSGxxTVjeDDwmfq+9UIo1re5R sp1yMBPwCIn2+xmHvMmZZdi0QjfF4M16dju78UyGfjsAep2pMJlf2DX6iUo4bMgXDIU3xD r0Nz+9Dm29ATlYwOSX9o4s9dDild+bc= X-MC-Unique: oaGzdNLiOC-AhLpO0M_rhw-1 X-Mimecast-MFC-AGG-ID: oaGzdNLiOC-AhLpO0M_rhw_1780418699 To: devel@lists.libvirt.org Subject: [PATCH 3/3] hyperv: report nested virtualization setting in domain XML Date: Tue, 2 Jun 2026 11:44:54 -0500 Message-ID: <20260602164455.746257-4-jjongsma@redhat.com> In-Reply-To: <20260602164455.746257-1-jjongsma@redhat.com> References: <20260602164455.746257-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ysa5HlBzcbnXDpUwJ2XlKgUWkUYJcZh7mjorrQLAwRg_1780418699 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TDS37FMZQIQT7R7J6M2H2G6W7U7M3USM X-Message-ID-Hash: TDS37FMZQIQT7R7J6M2H2G6W7U7M3USM X-MailFrom: jjongsma@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jonathon Jongsma via Devel Reply-To: Jonathon Jongsma X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1780418939724154100 Content-Type: text/plain; charset="utf-8"; x-default="true" When Hyper-V is configured to expose virtualization extensions to a guest, report this in the domain XML by adding the vendor-appropriate CPU feature flag: - Intel hosts: - AMD hosts: This requires adding ExposeVirtualizationExtensions and several other fields introduced in Windows 10 to the Msvm_ProcessorSettingData WMI class definition. Signed-off-by: Jonathon Jongsma Reviewed-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 23 +++++++++++++++++++++++ src/hyperv/hyperv_wmi_generator.input | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 7cd83e7565..68b2e7fa67 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -44,6 +44,7 @@ #include "snapshot_conf.h" #include "virfdstream.h" #include "virfile.h" +#include "cpu_conf.h" =20 #define VIR_FROM_THIS VIR_FROM_HYPERV =20 @@ -2766,6 +2767,28 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned= int flags) if (virDomainDefSetVcpus(def, processorSettingData->data->VirtualQuant= ity) < 0) return NULL; =20 + if (processorSettingData->data->ExposeVirtualizationExtensions) { + g_autoptr(Win32_Processor) processors =3D NULL; + const char *cpuFeature =3D NULL; + + if (hypervGetProcessorList(priv, NULL, &processors) < 0) + return NULL; + + if (STREQ_NULLABLE(processors->data->Manufacturer, "GenuineIntel")) + cpuFeature =3D "vmx"; + else if (STREQ_NULLABLE(processors->data->Manufacturer, "Authentic= AMD")) + cpuFeature =3D "svm"; + + if (cpuFeature) { + def->cpu =3D virCPUDefNew(); + def->cpu->mode =3D VIR_CPU_MODE_HOST_PASSTHROUGH; + def->cpu->type =3D VIR_CPU_TYPE_GUEST; + + if (virCPUDefAddFeature(def->cpu, cpuFeature, VIR_CPU_FEATURE_= REQUIRE) < 0) + return NULL; + } + } + def->os.type =3D VIR_DOMAIN_OSTYPE_HVM; =20 /* Generation 2 VMs use UEFI firmware */ diff --git a/src/hyperv/hyperv_wmi_generator.input b/src/hyperv/hyperv_wmi_= generator.input index fccbe9009f..94685e4428 100644 --- a/src/hyperv/hyperv_wmi_generator.input +++ b/src/hyperv/hyperv_wmi_generator.input @@ -174,9 +174,14 @@ class Msvm_ProcessorSettingData string AddressOnParent string VirtualQuantityUnits boolean LimitCPUID + uint64 HwThreadsPerCore boolean LimitProcessorFeatures uint64 MaxProcessorsPerNumaNode uint64 MaxNumaNodesPerSocket + boolean EnableHostResourceProtection + string CpuGroupId + boolean HideHypervisorPresent + boolean ExposeVirtualizationExtensions end =20 =20 --=20 2.54.0