From nobody Sun Dec 22 08:11:13 2024 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 1734694505961917.1494722705164; Fri, 20 Dec 2024 03:35:05 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 04C151825; Fri, 20 Dec 2024 06:35:04 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 44D7A17C6; Fri, 20 Dec 2024 06:34:26 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7536814E7; Fri, 20 Dec 2024 06:34:22 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 ED3EA14C8 for ; Fri, 20 Dec 2024 06:34:21 -0500 (EST) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-E9-Xu-VWNYSzMICxkGoJ7A-1; Fri, 20 Dec 2024 06:34:20 -0500 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4361eb83f46so14158365e9.3 for ; Fri, 20 Dec 2024 03:34:20 -0800 (PST) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4366128a3c9sm43455615e9.40.2024.12.20.03.34.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 03:34:18 -0800 (PST) Received: from wheatley.pinto-pinecone.ts.net (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id E937F7760C01 for ; Fri, 20 Dec 2024 12:34:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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=1734694461; 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=tW+Ud56lVgrjHvyRc+B5tiQ8QXbcRoY+s0kXY4ac8h0=; b=F/dgYOk72YNp3jfAWAUB+HsDIXxcmNHvgXoDnRMUI5dS2MQYxd+auKheCI+VVaBSJUInQp GQ+N6nPIuz5He6C+nFbS/2SXZsh1KhMI9sLljz4zLaLIxDzdUNTbE/3KCJPn2n85/5xAr5 Rkqs2HTCquymZzzWHcL1OXh6nzJnxZs= X-MC-Unique: E9-Xu-VWNYSzMICxkGoJ7A-1 X-Mimecast-MFC-AGG-ID: E9-Xu-VWNYSzMICxkGoJ7A X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734694459; x=1735299259; 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=tW+Ud56lVgrjHvyRc+B5tiQ8QXbcRoY+s0kXY4ac8h0=; b=PVFqJiyHw/o52ntnxVgEdQsE52iDtk2FJZNOqRdPNO1zKATMnWCWvqZHmy61WNqNFa fiJKg6HSpGSqj97SWHMjSAtV4s3Y9hAj9EI8j+nsV++RR3CGUx0bx62mJ4K89kG7QDOD AgsowFowwSNPoQuHN5ybNLX3+Py35oryo8zJMPY3sfsEuKXU9XsVlHVvlETJh4YUpVHp bl473Mrn9rohHc+70u8BgEWRe66z9t/WRI4G2yEg9JfjwMQVkgWeKNHCwnJkqt0vsfAO 2hmchBh0F9lqx1x4xIn1JY1JK9Rr9vTKCUnlVJF+q/gNLSfF+VPlvrdFzONfBmWOL7Wd M2nQ== X-Gm-Message-State: AOJu0Yz7vmuHFji0MaS4/gyodyXql8xGnKlEc9O0V623PsIubUubgV1R exMV7l5N2ig4Njdd1Z1diH5E99HUhMwB5ZdwoaI54HpEncImwux0TBV8UYLz/jQOlJnNzq5szdr +pyYgOmRCPCyPjnZoUiqEPHkRwpLzvDJlWJvWLd8gGEEG3m7Tdh23W/aZYNGsVLVGAHPfbF2ovq ikdHVKcGnZfBjtKgaXuy0b1h4IFhbL7un+92plJ4Y= X-Gm-Gg: ASbGnct6BUZj8LeYYrJV71ofxVXAvs4lXC8s/Bh5f/HMZ6rG9wZDPi5D5YsBwzvhVFs OZD5J5P6OXyutAF7m2i6Fi6hIaQkVw2j4PgcmWizXOZuH0afk8L4iXPQn/IS5dO6kqw48B0qofa piQI371iaPPpbF3ujpZAF39yFn/IEtg6AeuLiyATF6NbNRiA4UQ6eNt3b1eRntSSYf6KQFLk6ZR AOEPNbs8HN5vKo3kA2siaK102Qy/8PiicmHrWFhZbcPvTLQCHlWoa0W6KD/pfdYPIhhBGWeQYKl 5ncb4TUWs5/atalY X-Received: by 2002:a05:600c:198c:b0:434:a19a:5965 with SMTP id 5b1f17b1804b1-43668548ad7mr20303965e9.6.1734694459445; Fri, 20 Dec 2024 03:34:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvSD6p8l2LlC5bd3Fr7Y5idCRYSpVeg+qbjhhOg1GxFUZ3BeDdB5X7qMSWOSRkNAfiGwH0OQ== X-Received: by 2002:a05:600c:198c:b0:434:a19a:5965 with SMTP id 5b1f17b1804b1-43668548ad7mr20303735e9.6.1734694459026; Fri, 20 Dec 2024 03:34:19 -0800 (PST) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 2/2] qemu: Add support for direct and extended tlbflush features Date: Fri, 20 Dec 2024 12:34:14 +0100 Message-ID: <639187dc2077723986fa1d3d0094239d6dedcdc1.1734694421.git.mkletzan@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gUNpV0H7xT8-ZisAJXZG9NZ5DSb8grveGWgELQ4o1fE_1734694459 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4F2FYC7OHS74EHXT6NIHIXU4K7LL5GGB X-Message-ID-Hash: 4F2FYC7OHS74EHXT6NIHIXU4K7LL5GGB 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: 1734694507134116600 Content-Type: text/plain; charset="utf-8"; x-default="true" They require special handling since they are dependent on the basic tlbflush feature itself and therefore are not handled automatically as part of virDomainHyperv enum, just like the stimer-direct feature. Resolves: https://issues.redhat.com/browse/RHEL-7122 Signed-off-by: Martin Kletzander --- src/qemu/qemu_command.c | 6 +++++ src/qemu/qemu_process.c | 24 +++++++++++++++++++ .../qemuxmlconfdata/hyperv.x86_64-latest.args | 2 +- tests/qemuxmlconfdata/hyperv.xml | 5 +++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dcb9c4934ec6..1f28de619432 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6350,6 +6350,12 @@ qemuBuildCpuCommandLine(virCommand *cmd, 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); + if (i =3D=3D VIR_DOMAIN_HYPERV_TLBFLUSH) { + if (def->hyperv_tlbflush_direct =3D=3D VIR_TRISTATE_SW= ITCH_ON) + virBufferAsprintf(&buf, ",%s=3Don", VIR_CPU_x86_HV= _TLBFLUSH_DIRECT); + if (def->hyperv_tlbflush_extended =3D=3D VIR_TRISTATE_= SWITCH_ON) + virBufferAsprintf(&buf, ",%s=3Don", VIR_CPU_x86_HV= _TLBFLUSH_EXT); + } break; =20 case VIR_DOMAIN_HYPERV_SPINLOCKS: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ba581cf05af9..ea8da5828cb7 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4281,6 +4281,30 @@ qemuProcessVerifyHypervFeatures(virDomainDef *def, "direct"); return -1; } + if (i =3D=3D VIR_DOMAIN_HYPERV_TLBFLUSH) { + if (def->hyperv_tlbflush_direct =3D=3D VIR_TRISTATE_SWITCH= _ON) { + rc =3D virCPUDataCheckFeature(cpu, VIR_CPU_x86_HV_TLBF= LUSH_DIRECT); + if (rc < 0) + return -1; + if (rc =3D=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("host doesn't support hyperv tlbf= lush '%1$s' feature"), + "direct"); + return -1; + } + } + if (def->hyperv_tlbflush_extended =3D=3D VIR_TRISTATE_SWIT= CH_ON) { + rc =3D virCPUDataCheckFeature(cpu, VIR_CPU_x86_HV_TLBF= LUSH_EXT); + if (rc < 0) + return -1; + if (rc =3D=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("host doesn't support hyperv tlbf= lush '%1$s' feature"), + "extended"); + return -1; + } + } + } continue; } =20 diff --git a/tests/qemuxmlconfdata/hyperv.x86_64-latest.args b/tests/qemuxm= lconfdata/hyperv.x86_64-latest.args index 2aafafb340a6..5a32b80e717f 100644 --- a/tests/qemuxmlconfdata/hyperv.x86_64-latest.args +++ b/tests/qemuxmlconfdata/hyperv.x86_64-latest.args @@ -12,7 +12,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ -machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,acpi= =3Don \ -accel tcg \ --cpu 'qemu64,hv-relaxed=3Don,hv-vapic=3Don,hv-spinlocks=3D0x2fff,hv-vpinde= x=3Don,hv-runtime=3Don,hv-synic=3Don,hv-stimer=3Don,hv-reset=3Don,hv-vendor= -id=3DKVM Hv,hv-frequencies=3Don,hv-reenlightenment=3Don,hv-tlbflush=3Don,h= v-ipi=3Don,hv-evmcs=3Don,hv-avic=3Don,hv-emsr-bitmap=3Don,hv-xmm-input=3Don= ' \ +-cpu 'qemu64,hv-relaxed=3Don,hv-vapic=3Don,hv-spinlocks=3D0x2fff,hv-vpinde= x=3Don,hv-runtime=3Don,hv-synic=3Don,hv-stimer=3Don,hv-reset=3Don,hv-vendor= -id=3DKVM Hv,hv-frequencies=3Don,hv-reenlightenment=3Don,hv-tlbflush=3Don,h= v-tlbflush-direct=3Don,hv-tlbflush-ext=3Don,hv-ipi=3Don,hv-evmcs=3Don,hv-av= ic=3Don,hv-emsr-bitmap=3Don,hv-xmm-input=3Don' \ -m size=3D219136k \ -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ -overcommit mem-lock=3Doff \ diff --git a/tests/qemuxmlconfdata/hyperv.xml b/tests/qemuxmlconfdata/hyper= v.xml index a1e3cbbdf842..8c323f657851 100644 --- a/tests/qemuxmlconfdata/hyperv.xml +++ b/tests/qemuxmlconfdata/hyperv.xml @@ -22,7 +22,10 @@ - + + + + --=20 2.47.1