From nobody Sun Dec 22 02:06:06 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 1734694533369284.4557187031256; Fri, 20 Dec 2024 03:35:33 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 663081505; Fri, 20 Dec 2024 06:35:32 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EAE42181A; Fri, 20 Dec 2024 06:34:28 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A16D014BC; 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.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 EFB8F14D1 for ; Fri, 20 Dec 2024 06:34:21 -0500 (EST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-jLqNUV83ONSVClAa5JMexw-1; Fri, 20 Dec 2024 06:34:20 -0500 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-385e00ebb16so850903f8f.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 ffacd0b85a97d-38a1c8bb4bcsm3834612f8f.111.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 DD1897760C00 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=gqB2UxfNUv1j891WPHa/01cutwXaFkVuiMsPUYJkfB0=; b=TE00Ae2sLNwqkUMsBK4DOIVEqWjEIAvM+eIACFB2aW45Rp3qUQhXrC1qdptWbIX8/smJ6g IgNfwQCXRXOvG8ILfpRjNReqUF7B3D1l7tyHaqMChC8U4ySXY9nMtxpy5ZVnZURqnVjiVn UVmxC1/4SIht+Ui9lM9MmclQZdzHtTs= X-MC-Unique: jLqNUV83ONSVClAa5JMexw-1 X-Mimecast-MFC-AGG-ID: jLqNUV83ONSVClAa5JMexw 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=gqB2UxfNUv1j891WPHa/01cutwXaFkVuiMsPUYJkfB0=; b=U8VR5ccpWp6VOnDJMpVTYNeH3xYUPnBffeGXU/6xnvpZFtaBC0qag8lE0ZwrNXov+g 0A1jBEBo/Rv7Ts6z25bPfmQwxCqJfHLLd4jC6PgRNuWUV5+UMPYmx/r6PUKspOGnxcpx ZNo1zVFEGwjrL1dqpp8cbig9NWR9ibB7WiXlt3A6xuP8q0BzH5uogSp5bEEVfIrlqjFz 7wiiWGqtzoUI3QCb7w54WYyzu/EgXxcTluNvRUBRgiyxdBBb2JgxYjAaGngsTy/uynGB jXN2x4zRXJ4+i2eHvwG44Q/lMe9weEX+rj20JQBHcgoS2U1OQI7/QPEk2mNMBNVwEwmD Rrzg== X-Gm-Message-State: AOJu0YzxjD9CqFXqReKVPs9LdwQ7E7Yx+bYVQ/qCuvVix98v0wVYh8Si nryIUNO2uWP7NDY3/huyhpC2BbB6TjJIge8KQX6JRlQMAs4DoEys5VuDYu4ZxG03Y4CzstwQ4X0 CMrnNfP4Qy9ifE/lLPTaNUn48+CrfdRaFNMrRjjyEBI0yrjzf/ArnWuJZG3QLxS0W9QJ1qiDfsr HtF5+oF0WP2rYPE9FqRgPKSnmn4ctcVX/BKSS8H88= X-Gm-Gg: ASbGncskGSFid7M4rAifMPyxPKpUD3ss4flgwznYAaLcn2G30V/NXMYYqEgkpp5/E/X Wk8dYYsXG5G1TKNkGFQw+EZrowV7CnXROWtoXu4Z8WMIGQeT0t5etGdD4JHVGBnUXDFmWNc3eFi Sw3TCDypEOQs3gc6FyXQexsh6pIr2A4EmecP6gHex1WUVmrxwwV/jNskcZbEgML5Io6ncH6JSMk liiJsQRcz//pS5OR14/TApA7fZQZ9ZpKpIV8cEPOo2kjZyV5rZ7S/98ZmFuMC8k8aI+WpeGd0lc yIjnWJcrEAbz7on+ X-Received: by 2002:a05:6000:4614:b0:386:2e8c:e277 with SMTP id ffacd0b85a97d-38a22408c81mr2568261f8f.55.1734694459404; Fri, 20 Dec 2024 03:34:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFv0C4YitQogx/YjDf+io73JSi/AFNQwYFQj7KsnjQcAkuM37WCuQLUCf2ZwIkCW4t/bOLayw== X-Received: by 2002:a05:6000:4614:b0:386:2e8c:e277 with SMTP id ffacd0b85a97d-38a22408c81mr2568226f8f.55.1734694458840; Fri, 20 Dec 2024 03:34:18 -0800 (PST) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 1/2] conf, docs: Add support for direct and extended tlbflush features Date: Fri, 20 Dec 2024 12:34:13 +0100 Message-ID: <035f8148e65525cd1edbaed514bcadb62ecc0005.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: hy6KpxkuPIJh3VjGVk1zTWgP9u1TR8ijJYUEX_jv_GE_1734694459 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: J4QG7M4ZLPPH5JHVR6DWFV6BAEI2IJF2 X-Message-ID-Hash: J4QG7M4ZLPPH5JHVR6DWFV6BAEI2IJF2 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: 1734694535177116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Similarly to stimer-direct these are subelements of in the domain XML. Signed-off-by: Martin Kletzander Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 13 ++++++++----- src/conf/domain_conf.c | 26 +++++++++++++++++++++++++- src/conf/domain_conf.h | 2 ++ src/conf/schemas/domaincommon.rng | 21 ++++++++++++++++++++- src/cpu/cpu_x86.c | 7 +++++++ src/cpu/cpu_x86_data.h | 2 ++ 6 files changed, 64 insertions(+), 7 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 60bee8bd4fed..8d787ef59aac 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1993,7 +1993,10 @@ Hypervisors may allow certain CPU / machine features= to be toggled on/off. - + + + + @@ -2068,9 +2071,9 @@ are: Enable various features improving behavior of guests running Microsoft Windows. =20 - =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Feature Description = Value Since - =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D relaxed Relax constraints on timers = on, off :since:`1.0.0 = (QEMU 2.0)` vapic Enable virtual APIC = on, off :since:`1.1.0 = (QEMU 2.0)` spinlocks Enable spinlock support = on, off; retries - at least 4095 :since:`1.1.0 = (QEMU 2.0)` @@ -2082,13 +2085,13 @@ are: vendor_id Set hypervisor vendor id = on, off; value - string, up to 12 characters :since:`1.3.3 = (QEMU 2.5)` frequencies Expose frequency MSRs = on, off :since:`4.7.0 = (QEMU 2.12)` reenlightenment Enable re-enlightenment notification on migration = on, off :since:`4.7.0 = (QEMU 3.0)` - tlbflush Enable PV TLB flush support = on, off :since:`4.7.0 = (QEMU 3.0)` + tlbflush Enable PV TLB flush support = on, off; direct - on,off; extended - on,off :since:`4.7.0 = (QEMU 3.0), direct and extended modes 11.0.0 (QEMU 7.1.0)` ipi Enable PV IPI support = on, off :since:`4.10.0= (QEMU 3.1)` evmcs Enable Enlightened VMCS = on, off :since:`4.10.0= (QEMU 3.1)` avic Enable use Hyper-V SynIC with hardware APICv/AVIC = on, off :since:`8.10.0= (QEMU 6.2)` emsr_bitmap Avoid unnecessary updates to L2 MSR Bitmap upon vmexits= . on, off :since:`10.7.0= (QEMU 7.1)` xmm_input Enable XMM Fast Hypercall Input = on, off :since:`10.7.0= (QEMU 7.1)` - =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =20 :since:`Since 8.0.0`, the hypervisor can be configured further by setti= ng the ``mode`` attribute to one of the following values: diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3c19c89af916..785eb0e539b4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16672,7 +16672,6 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def, case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: - case VIR_DOMAIN_HYPERV_TLBFLUSH: case VIR_DOMAIN_HYPERV_IPI: case VIR_DOMAIN_HYPERV_EVMCS: case VIR_DOMAIN_HYPERV_AVIC: @@ -16680,6 +16679,31 @@ virDomainFeaturesHyperVDefParse(virDomainDef *def, case VIR_DOMAIN_HYPERV_XMM_INPUT: break; =20 + case VIR_DOMAIN_HYPERV_TLBFLUSH: + if (value !=3D VIR_TRISTATE_SWITCH_ON) + break; + + child =3D xmlFirstElementChild(node); + while (child) { + if (STREQ((const char *)child->name, "direct")) { + if (virXMLPropTristateSwitch(child, "state", VIR_XML_P= ROP_REQUIRED, + &def->hyperv_tlbflush_dir= ect) < 0) + return -1; + } else if (STREQ((const char *)child->name, "extended")) { + if (virXMLPropTristateSwitch(child, "state", VIR_XML_P= ROP_REQUIRED, + &def->hyperv_tlbflush_ext= ended) < 0) + return -1; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported Hyper-V tlbflush feature= : %1$s"), + child->name); + return -1; + } + + child =3D xmlNextElementSibling(child); + } + break; + case VIR_DOMAIN_HYPERV_STIMER: if (value !=3D VIR_TRISTATE_SWITCH_ON) break; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a187ab40833f..9f7c28343fa6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3101,6 +3101,8 @@ struct _virDomainDef { virDomainXenPassthroughMode xen_passthrough_mode; unsigned int hyperv_spinlocks; virTristateSwitch hyperv_stimer_direct; + virTristateSwitch hyperv_tlbflush_direct; + virTristateSwitch hyperv_tlbflush_extended; virGICVersion gic_version; virDomainHPTResizing hpt_resizing; unsigned long long hpt_maxpagesize; /* Stored in KiB */ diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index b3fdbf7ffb77..7121519ca33e 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -8027,7 +8027,7 @@ - + @@ -8075,6 +8075,25 @@ =20 + + + + + + + + + + + + + + + + + + + diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 13695802da02..6d72d446c9fe 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -99,6 +99,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_REENLIGHTENMENT, =20 KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER_DIRECT, 0x40000003, 0x0, 0x00080000); +KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH_DIRECT, + 0x40000003, 0x0, 0x00004000); =20 KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH, 0x40000004, 0x00000004, 0x0); @@ -109,6 +111,9 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_IPI, KVM_FEATURE_DEF(VIR_CPU_x86_HV_EVMCS, 0x40000004, 0x00004000, 0x0); =20 +KVM_FEATURE_DEF(VIR_CPU_x86_HV_TLBFLUSH_EXT, + 0x40000004, 0x0, 0x00004000); + KVM_FEATURE_DEF(VIR_CPU_x86_HV_EMSR_BITMAP, 0x4000000A, 0x00080000, 0x0); static virCPUx86Feature x86_kvm_features[] =3D @@ -130,6 +135,8 @@ static virCPUx86Feature x86_kvm_features[] =3D KVM_FEATURE(VIR_CPU_x86_HV_EVMCS), KVM_FEATURE(VIR_CPU_x86_HV_STIMER_DIRECT), KVM_FEATURE(VIR_CPU_x86_HV_EMSR_BITMAP), + KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH_DIRECT), + KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH_EXT), }; =20 typedef struct _virCPUx86Signature virCPUx86Signature; diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h index 43ad2faeb162..448acbbeb2fe 100644 --- a/src/cpu/cpu_x86_data.h +++ b/src/cpu/cpu_x86_data.h @@ -60,6 +60,8 @@ struct _virCPUx86MSR { #define VIR_CPU_x86_HV_FREQUENCIES "hv-frequencies" #define VIR_CPU_x86_HV_REENLIGHTENMENT "hv-reenlightenment" #define VIR_CPU_x86_HV_TLBFLUSH "hv-tlbflush" +#define VIR_CPU_x86_HV_TLBFLUSH_EXT "hv-tlbflush-ext" +#define VIR_CPU_x86_HV_TLBFLUSH_DIRECT "hv-tlbflush-direct" #define VIR_CPU_x86_HV_IPI "hv-ipi" #define VIR_CPU_x86_HV_EVMCS "hv-evmcs" #define VIR_CPU_x86_HV_AVIC "hv-avic" --=20 2.47.1 From nobody Sun Dec 22 02:06:06 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 Reviewed-by: Michal Privoznik --- 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