From nobody Tue Sep 9 19:03:24 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 1752132562504335.7963012956428; Thu, 10 Jul 2025 00:29:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9253B1373; Thu, 10 Jul 2025 03:29:21 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7A7F611DD; Thu, 10 Jul 2025 03:23:23 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 245D51405; Thu, 10 Jul 2025 03:23:18 -0400 (EDT) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 38FD51174 for ; Thu, 10 Jul 2025 03:22:52 -0400 (EDT) Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2025 00:22:37 -0700 Received: from unknown (HELO gnr-sp-2s-612.sh.intel.com) ([10.112.230.229]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2025 00:22: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=-3.0 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=1752132172; x=1783668172; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z13iq6whVG65fVWAHySq58YFEBr6YlRFCZz1u9WXDBA=; b=BkxmzTNil0ByzBT5LA4kGSyGcX7dlLXi/8W+k+PYI7Tjnl0M8thv03zK t/mfrt1fDBohCz/PtpgW0MQx6N8muyB4TDiHF+GJEXS0AWnZJi+gqY8vx z0iwB9mKIFsjgnLY85fHMeIvudq7xMaZXVBvAaksS+Jd9bDD6851gc1nO t4zgiffqwuNPnGCZknir1K13BbDF3kojN0szVuLZF8DnNugpfVBm7gr5A NmmzglVQHg5MOf8JRk1JnFvKK/p6BglXprfMbUe9Ho+FIADujVaZovTS0 Mv/P7YwH/cOV4q+zzBEE7Vpox2wXICL+u9MQM8Ojioa3vdtwa0X4onD8l w==; X-CSE-ConnectionGUID: cvBhEp8GQK2VJlvd+53TZg== X-CSE-MsgGUID: zeVrzxfLQJurVpOpM1193w== X-IronPort-AV: E=McAfee;i="6800,10657,11489"; a="54257136" X-IronPort-AV: E=Sophos;i="6.16,300,1744095600"; d="scan'208";a="54257136" X-CSE-ConnectionGUID: 2llZP/GfRCG+8awEFal81w== X-CSE-MsgGUID: rJzQOdLWRWGSmabi1gMpgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,300,1744095600"; d="scan'208";a="186997208" From: Zhenzhong Duan To: devel@lists.libvirt.org Subject: [PATCH v4 15/23] qemu: Add command line for TDX Quote Generation Service(QGS) Date: Thu, 10 Jul 2025 03:21:17 -0400 Message-ID: <20250710072127.695558-16-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250710072127.695558-1-zhenzhong.duan@intel.com> References: <20250710072127.695558-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: I22HKSLJRVQYSARER6UIQD5N57ZIKLA3 X-Message-ID-Hash: I22HKSLJRVQYSARER6UIQD5N57ZIKLA3 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: 1752132562830116600 Content-Type: text/plain; charset="utf-8" 'tdx-guest' object supports a "quote-generation-socket" property for attestation purpose. When "quote-generation-socket" is configured in guest xml, libvirt generates unix socket format cmdline for QEMU. 'Path' element can be omitted, default path "/var/run/tdx-qgs/qgs.socket" is used in this case. QEMU command line example: qemu-system-x86_64 \ -object '{"qom-type":"tdx-guest","id":"lsec0","mrconfigid":"xxx","mrown= er":"xxx","mrownerconfig":"xxx","quote-generation-socket":{"type":"unix","p= ath":"/var/run/tdx-qgs/qgs.socket"},"attributes":268435457}' \ -machine pc-q35-6.0,confidential-guest-support=3Dlsec0 Signed-off-by: Zhenzhong Duan Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_conf.h | 3 +++ src/qemu/qemu_command.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cf5437f642..b89162df42 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2999,6 +2999,9 @@ struct _virDomainSEVSNPDef { }; =20 =20 +/* Copied from QGS source code */ +#define QGS_UNIX_SOCKET_FILE "/var/run/tdx-qgs/qgs.socket" + struct _virDomainTDXDef { bool havePolicy; unsigned long long policy; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e2a69f34c7..78654c96a8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9949,15 +9949,29 @@ qemuBuildPVCommandLine(virCommand *cmd) static int qemuBuildTDXCommandLine(virCommand *cmd, virDomainTDXDef *tdx) { + g_autoptr(virJSONValue) addr =3D NULL; g_autoptr(virJSONValue) props =3D NULL; + const char *path =3D QGS_UNIX_SOCKET_FILE; =20 if (tdx->havePolicy) VIR_DEBUG("policy=3D0x%llx", tdx->policy); =20 + if (tdx->haveQGS) { + if (tdx->qgs_unix_path) + path =3D tdx->qgs_unix_path; + + if (virJSONValueObjectAdd(&addr, + "s:type", "unix", + "s:path", path, + NULL) < 0) + return -1; + } + if (qemuMonitorCreateObjectProps(&props, "tdx-guest", "lsec0", "S:mrconfigid", tdx->mrconfigid, "S:mrowner", tdx->mrowner, "S:mrownerconfig", tdx->mrownerconfig, + "A:quote-generation-socket", &addr, NULL) < 0) return -1; =20 --=20 2.47.1