From nobody Sat Feb 7 03:15:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; 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 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172908739803173.66100972697348; Wed, 16 Oct 2024 07:03:18 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F308712FB; Wed, 16 Oct 2024 10:03:16 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 964701868; Wed, 16 Oct 2024 10:02:42 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E8EF0143E; Wed, 16 Oct 2024 10:02:38 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 685BF1642 for ; Wed, 16 Oct 2024 10:02:30 -0400 (EDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-xRBB62VMMRixJ_U2SpfQ5Q-1; Wed, 16 Oct 2024 10:02:26 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-37d56061a4cso2765878f8f.2 for ; Wed, 16 Oct 2024 07:02:20 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fa7a151sm4350804f8f.10.2024.10.16.07.02.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 07:02:17 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id 39DAD32AFF4A for ; Wed, 16 Oct 2024 16:02:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729087350; 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=Lgfv3NPSMQZ3e+4Qzfr2ffe+AkPaw96oWGHIcjY+fA8=; b=T/21gXEgo/vnUI7NhRm0gmgENfB2yA9yud11qFoGLw6nwu1kyNN0367ucDWmed+XzAhBCu AJoVt9ez05+O1ViY3p3LD5s2vrIqbxHvSH44v3HGd+XA+SI+izAe9/gYPi5AVA5Ygwctiz 4L2mlbvBDA/R5epacc2PwKERUtD1lJE= X-MC-Unique: xRBB62VMMRixJ_U2SpfQ5Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729087339; x=1729692139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lgfv3NPSMQZ3e+4Qzfr2ffe+AkPaw96oWGHIcjY+fA8=; b=Uead+7SOvqVYdOxSUwKHHDRPlY5RZ4ld8EAgjWbwqS12TJ4lHMxFKP+M5Ro3dJK78D fbmNeOvnCmesUq/dZj+QNnes9Bf6q3ESAYF5W9CrAiN+p2OekFJHEC2TAt+eJ/Ohgexf pOQIhoFKRPfG07DRWdnOMdxN02yWlN2vHyPajGW6uaZ+XzYDGMNoeGHkDImDt7trINAv DfDFLoesJmr8O0ZrZlcB7P5XacfhUJsXQnGxCcB0Pw5ort+iSE8pLPkCGJMHs9pyAWI+ xAx7iA/CHiqvmkqSs67ML5CHu6RPCihOtpSY3dxbkRK1eJ83kNDPzBrvZ141t7A/NTgm WcFQ== X-Gm-Message-State: AOJu0Ywttr/QWXARpTNFuxSoxFyqx1yeTCeG2MGGGjWFPnTFv0z/nCOi 2OTJaRuqm5Ely1alYXhhUujjqGGqfp6VVE8rtKQkIouUc9/39nHuZV/SlukAnGVs843IjM05pEY TrSfK/ZbTCH91uM5I4q9hvieWhGKKV8g+U8rY5Nj6nk6H7Jl5r8kEmQ1ogm4k1kBe2EGTOPcYkF 6fz/7ClE1Lj27NQB1Njxx0LOkQ/uhlOA5Asd20lTc= X-Received: by 2002:adf:f84e:0:b0:37d:3735:8fe9 with SMTP id ffacd0b85a97d-37d551d53cfmr13052061f8f.27.1729087338798; Wed, 16 Oct 2024 07:02:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhWAGmEhLY9SV2Mwn0Ibr46RJKT/0nQUnY4vqwUV+zYx4vbxuxYKq64vUPMKg57+CmB0tS/A== X-Received: by 2002:adf:f84e:0:b0:37d:3735:8fe9 with SMTP id ffacd0b85a97d-37d551d53cfmr13051989f8f.27.1729087337801; Wed, 16 Oct 2024 07:02:17 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 2/2] qemu: Do not hardcode Hyper-V feature names on command line Date: Wed, 16 Oct 2024 16:02:10 +0200 Message-ID: <771b6d855388c23b34f4acfbc408b4ebaef07285.1729087292.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NK4HMQTIRJOB5ICAZS322FD5EGS45K4J X-Message-ID-Hash: NK4HMQTIRJOB5ICAZS322FD5EGS45K4J X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1729087399553116600 Content-Type: text/plain; charset="utf-8"; x-default="true" When constructing the command line for QEMU, some Hyper-V features were hardcoded, probably due to the fact that they could not have been automatically translated from the libvirt feature name to QEMU CPU feature name. Well now they can be, thanks to their additions to the virQEMUCapsCPUFeaturesX86 translation table. Translate all such features the same way when constructing the command line. This way any future feature that is not translated will be caught by tests (if a test is added for it) which was not the case when it was just hardcoded. Hopefully this avoids at least some possible future issues. Signed-off-by: Martin Kletzander --- src/qemu/qemu_command.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c7055ef196f0..a5ff7695c375 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6315,9 +6315,15 @@ qemuBuildCpuCommandLine(virCommand *cmd, case VIR_DOMAIN_HYPERV_IPI: case VIR_DOMAIN_HYPERV_EVMCS: case VIR_DOMAIN_HYPERV_AVIC: - if (def->hyperv_features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) - virBufferAsprintf(&buf, ",hv-%s=3Don", - virDomainHypervTypeToString(i)); + case VIR_DOMAIN_HYPERV_EMSR_BITMAP: + case VIR_DOMAIN_HYPERV_XMM_INPUT: + if (def->hyperv_features[i] =3D=3D VIR_TRISTATE_SWITCH_ON)= { + const char *name =3D virDomainHypervTypeToString(i); + g_autofree char *full_name =3D g_strdup_printf("hv-%s"= , name); + const char *qemu_name =3D virQEMUCapsCPUFeatureToQEMU(= def->os.arch, + fu= ll_name); + virBufferAsprintf(&buf, ",%s=3Don", qemu_name); + } if ((i =3D=3D VIR_DOMAIN_HYPERV_STIMER) && (def->hyperv_stimer_direct =3D=3D VIR_TRISTATE_SWITCH_= ON)) virBufferAsprintf(&buf, ",%s=3Don", VIR_CPU_x86_HV_STI= MER_DIRECT); @@ -6336,16 +6342,6 @@ qemuBuildCpuCommandLine(virCommand *cmd, def->hyperv_vendor_id); break; =20 - case VIR_DOMAIN_HYPERV_EMSR_BITMAP: - if (def->hyperv_features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) - virBufferAsprintf(&buf, ",%s=3Don", "hv-emsr-bitmap"); - break; - - case VIR_DOMAIN_HYPERV_XMM_INPUT: - if (def->hyperv_features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) - virBufferAsprintf(&buf, ",%s=3Don", "hv-xmm-input"); - break; - case VIR_DOMAIN_HYPERV_LAST: break; } --=20 2.47.0