From nobody Wed Dec 4 18:57:45 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 header.i=@intel.com; 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=intel.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1716532199504862.1775831343263; Thu, 23 May 2024 23:29:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 692011954; Fri, 24 May 2024 02:29:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7B5331B97; Fri, 24 May 2024 02:26:28 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 051DB1C41; Fri, 24 May 2024 02:26:20 -0400 (EDT) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 963141BB2 for ; Fri, 24 May 2024 02:25:38 -0400 (EDT) Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 23:24:36 -0700 Received: from unknown (HELO SPR-S2600BT.bj.intel.com) ([10.240.192.124]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2024 23:24:34 -0700 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716531939; x=1748067939; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+GVi5EAUWbcXrtR71+VocN+i+lLkx4lrTJI4NIFj6sk=; b=Yap1Di0nuIdcM20UpSirnNxsiasoj+nvuwvl/m0rZpSi/IwcvHyJv0mL kkQWNTXXPipC7INt7Oqm5U8m6xGt5vJtnzVz6yXQcphjLL1B9scHHbUsC azq1UJucQWahai72iIg9hMoWsSwwlop9KeVOb8GxqUno9kPtzggELuXM7 RgSn0+94tZt1yVNYupzehgxwhuIGJw3DSPKLOs9xsczgyyuLxdYLR+Wi3 nR7h07n0ueG2114paXJaKutqbn+Mn1kODWMxVOQwSd7PMHmz8vsLxG8nC WtjLYK/lticgHqpr/N/GVGi7Z0Co2LmlKfuGUYCM8ITMeQGIfotoE97iU w==; X-CSE-ConnectionGUID: OYIBTA2bSLCKwMGI8DZQtw== X-CSE-MsgGUID: A/mwIbKBR5uMrRvDRREpMw== X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="13081246" X-IronPort-AV: E=Sophos;i="6.08,184,1712646000"; d="scan'208";a="13081246" X-CSE-ConnectionGUID: PH7R5HGjQw21idLD4CH2gw== X-CSE-MsgGUID: VpiDvI2IRRiqnGAAWrz59Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,184,1712646000"; d="scan'208";a="34033936" From: Zhenzhong Duan To: devel@lists.libvirt.org Subject: [PATCH rfcv4 04/13] conf: expose TDX feature in domain capabilities Date: Fri, 24 May 2024 14:21:19 +0800 Message-Id: <20240524062128.523820-5-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240524062128.523820-1-zhenzhong.duan@intel.com> References: <20240524062128.523820-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IJI2AH6EM6MD5MVRXZ7ASTZKVB5Q2TQL X-Message-ID-Hash: IJI2AH6EM6MD5MVRXZ7ASTZKVB5Q2TQL X-MailFrom: zhenzhong.duan@intel.com X-Mailman-Rule-Hits: nonmember-moderation 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 CC: phrdina@redhat.com, pkrempa@redhat.com, jjongsma@redhat.com, jsuchane@redhat.com, chenyi.qiang@intel.com, isaku.yamahata@intel.com, xiaoyao.li@intel.com, chao.p.peng@intel.com, Zhenzhong Duan 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: 1716532201593100001 Content-Type: text/plain; charset="utf-8" Extend qemu TDX capability to domain capabilities. Signed-off-by: Chenyi Qiang Signed-off-by: Zhenzhong Duan Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/formatdomaincaps.rst | 1 + src/conf/domain_capabilities.c | 1 + src/conf/domain_capabilities.h | 1 + src/conf/schemas/domaincaps.rng | 9 +++++++++ src/qemu/qemu_capabilities.c | 13 +++++++++++++ 5 files changed, 25 insertions(+) diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst index 609a767189..36d56a433c 100644 --- a/docs/formatdomaincaps.rst +++ b/docs/formatdomaincaps.rst @@ -651,6 +651,7 @@ capabilities. All features occur as children of the mai= n ``features`` element. + 47 1 diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 68eb3c9797..8bfe19d774 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -42,6 +42,7 @@ VIR_ENUM_IMPL(virDomainCapsFeature, "backup", "async-teardown", "s390-pv", + "tdx", ); =20 static virClass *virDomainCapsClass; diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index fadc30cdd7..690e2a1f03 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -250,6 +250,7 @@ typedef enum { VIR_DOMAIN_CAPS_FEATURE_BACKUP, VIR_DOMAIN_CAPS_FEATURE_ASYNC_TEARDOWN, VIR_DOMAIN_CAPS_FEATURE_S390_PV, + VIR_DOMAIN_CAPS_FEATURE_TDX, =20 VIR_DOMAIN_CAPS_FEATURE_LAST } virDomainCapsFeature; diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.= rng index e7aa4a1066..a5522b1e67 100644 --- a/src/conf/schemas/domaincaps.rng +++ b/src/conf/schemas/domaincaps.rng @@ -308,6 +308,9 @@ + + + @@ -363,6 +366,12 @@ =20 + + + + + + diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 33d2b5f392..53a773b853 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -6675,6 +6675,18 @@ virQEMUCapsFillDomainFeatureHypervCaps(virQEMUCaps *= qemuCaps, } =20 =20 +static void +virQEMUCapsFillDomainFeatureTDXCaps(virQEMUCaps *qemuCaps, + virDomainCaps *domCaps) +{ + if (domCaps->arch =3D=3D VIR_ARCH_X86_64 && + domCaps->virttype =3D=3D VIR_DOMAIN_VIRT_KVM && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_TDX_GUEST) && + virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps)) + domCaps->features[VIR_DOMAIN_CAPS_FEATURE_TDX] =3D VIR_TRISTAT= E_BOOL_YES; +} + + int virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virArch hostarch, @@ -6734,6 +6746,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virQEMUCapsFillDomainFeatureSGXCaps(qemuCaps, domCaps); virQEMUCapsFillDomainFeatureHypervCaps(qemuCaps, domCaps); virQEMUCapsFillDomainDeviceCryptoCaps(qemuCaps, crypto); + virQEMUCapsFillDomainFeatureTDXCaps(qemuCaps, domCaps); =20 return 0; } --=20 2.34.1