From nobody Fri Dec 19 00:03:58 2025 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 1751264844367934.5262070970155; Sun, 29 Jun 2025 23:27:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 54AFA13B4; Mon, 30 Jun 2025 02:27:23 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5592A1531; Mon, 30 Jun 2025 02:22:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4A127151E; Mon, 30 Jun 2025 02:22:33 -0400 (EDT) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 DEE9F14C2 for ; Mon, 30 Jun 2025 02:22:08 -0400 (EDT) Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2025 23:22:09 -0700 Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2025 23:22:06 -0700 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, 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/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1751264529; x=1782800529; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z9LKcB6kQscvfMLwFKcU97nVpuEdAdAehC4vCPmxIA4=; b=bFeosC07n8V/yk5n1iCR5bg74XDPHj/VcmFtUUg8cRGenx5mBx/y3ixP 1wfeH5rd3DqWWioIlW4h/qCKZg89M+12da4cqj9vVKly9KK4u/4s09TXa aZ5XAvDGbQnhs27DshOZ40bAnIOIfATD69C5wqHYiJEnQivuGhjii3wbU lpDOoEUwrxKkr8toJUZm5Qhlak/943oB7NRe+iqDA57j9/tR50yqC8msa o7Mg6IZRXthhtvPkm/+kKrt29f2vcA+zrSY2o0chqMS7SntBxlsvLfhBY XdUX0yVWQWgRGUVWxdGW/hz61/OPdxKKaQi49X6J2ZjKEhTciE+sd1X1O g==; X-CSE-ConnectionGUID: msmbKxfAQhyXoZVemCf8RA== X-CSE-MsgGUID: xhX+3fAJTu+TbKS582Sv7Q== X-IronPort-AV: E=McAfee;i="6800,10657,11479"; a="70912544" X-IronPort-AV: E=Sophos;i="6.16,277,1744095600"; d="scan'208";a="70912544" X-CSE-ConnectionGUID: QB2ABO7NRU+AyZj3366D6g== X-CSE-MsgGUID: 1RF6q3GrShK/l4oZqFJ8qw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,277,1744095600"; d="scan'208";a="153549365" From: Zhenzhong Duan To: devel@lists.libvirt.org Subject: [PATCH v3 12/21] conf: Add Intel TDX Quote Generation Service(QGS) support Date: Mon, 30 Jun 2025 14:17:23 +0800 Message-Id: <20250630061732.303374-13-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250630061732.303374-1-zhenzhong.duan@intel.com> References: <20250630061732.303374-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IRRT37QXCJ6ZWNFJQYGRD4BJ6SWCFIEL X-Message-ID-Hash: IRRT37QXCJ6ZWNFJQYGRD4BJ6SWCFIEL 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: 1751264846833116600 Content-Type: text/plain; charset="utf-8" Add element "quoteGenerationSocket" to tdx launch security type. It contains only an optional unix socket address attribute, when omitted, libvirt will use default QGS server address "/var/run/tdx-qgs/qgs.socket". UNIX sockets offer the required functionality with greater security than vsock, so libvirt only provides support for unix socket. XML example: 0x0 xxx xxx xxx Signed-off-by: Zhenzhong Duan --- src/conf/domain_conf.c | 35 ++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 2 ++ src/conf/schemas/domaincommon.rng | 9 ++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d2f01a9397..8e36ea60fe 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3963,6 +3963,7 @@ virDomainSecDefFree(virDomainSecDef *def) g_free(def->data.tdx.mrconfigid); g_free(def->data.tdx.mrowner); g_free(def->data.tdx.mrownerconfig); + g_free(def->data.tdx.qgs_unix_path); break; case VIR_DOMAIN_LAUNCH_SECURITY_PV: case VIR_DOMAIN_LAUNCH_SECURITY_NONE: @@ -14210,6 +14211,33 @@ virDomainSEVSNPDefParseXML(virDomainSEVSNPDef *def, } =20 =20 +static int +virDomainTDXQGSDefParseXML(virDomainTDXDef *def, xmlXPathContextPtr ctxt) +{ + g_autofree xmlNodePtr *nodes =3D NULL; + xmlNodePtr node; + int n; + + if ((n =3D virXPathNodeSet("./quoteGenerationSocket", ctxt, &nodes)) <= 0) + return -1; + + if (!n) + return 0; + + if (n > 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("only a single QGS element is supported")); + return -1; + } + node =3D nodes[0]; + + def->haveQGS =3D true; + def->qgs_unix_path =3D virXMLPropString(node, "path"); + + return 0; +} + + static int virDomainTDXDefParseXML(virDomainTDXDef *def, xmlXPathContextPtr ctxt) @@ -14229,7 +14257,7 @@ virDomainTDXDefParseXML(virDomainTDXDef *def, def->mrowner =3D virXPathString("string(./mrOwner)", ctxt); def->mrownerconfig =3D virXPathString("string(./mrOwnerConfig)", ctxt); =20 - return 0; + return virDomainTDXQGSDefParseXML(def, ctxt); } =20 =20 @@ -27746,6 +27774,11 @@ virDomainTDXDefFormat(virBuffer *childBuf, virDoma= inTDXDef *def) virBufferEscapeString(childBuf, "%s\n", def->= mrconfigid); virBufferEscapeString(childBuf, "%s\n", def->mrowne= r); virBufferEscapeString(childBuf, "%s\n",= def->mrownerconfig); + if (def->haveQGS) { + virBufferAddLit(childBuf, "qgs_unix_path= ); + virBufferAddLit(childBuf, "/>\n"); + } } =20 =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 51c05a3f18..cf5437f642 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3005,6 +3005,8 @@ struct _virDomainTDXDef { char *mrconfigid; char *mrowner; char *mrownerconfig; + bool haveQGS; + char *qgs_unix_path; }; =20 =20 diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 56dbddcb43..3f5cc9ca05 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -673,6 +673,15 @@ + + + + + + + + + =20 --=20 2.34.1