From nobody Sun Dec 14 12:22:45 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 17512648641604.924208955371114; Sun, 29 Jun 2025 23:27:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3A8FD1383; Mon, 30 Jun 2025 02:27:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 7B8B3136E; Mon, 30 Jun 2025 02:22:41 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8195D152E; 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 1FBA714E2 for ; Mon, 30 Jun 2025 02:22:12 -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:12 -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:09 -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=1751264532; x=1782800532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VD+8wP2y5N3IX51kWIZXq4sn/UxaeZnGgKlg/4kgt2Y=; b=YTSmcN89qPw7tVAkZpiitErhshY1VVSy6yGm1WZL95LzhHn46APOcp1a FK7PjUNQmZiICp5Bg7iwbIKzhViDKsXhx2+LgC283ZkVIgyduzcrepao9 f0BGqqsOnLacmCn1mZLQ0l46tJ7u+iZ+3y7DO2TraZadKAsnafWBMNdxB 1i4R3CCxYSoEaNFcP6xn2ABvsTnngWW9z9LHdLezluKP29s3pw5N31IiW +aUl3jR6xcCqDIPBmMr5/+4gvYlFv6NCMA5yp081x0RZljcQpYAG+6r0u BzZEc7uhtnx+4pERJzIz2bqeW9mncO9VNCUSOlKattFTr0hcjk9iviUA/ Q==; X-CSE-ConnectionGUID: SgeWB2YXQBKg5yNfZL5JLg== X-CSE-MsgGUID: BMV7zXY+RYSuDioVSPllww== X-IronPort-AV: E=McAfee;i="6800,10657,11479"; a="70912548" X-IronPort-AV: E=Sophos;i="6.16,277,1744095600"; d="scan'208";a="70912548" X-CSE-ConnectionGUID: gIQE70MqRLi50fXvYTmCQA== X-CSE-MsgGUID: FTyj4VCjRdyBJEe7mP00PQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,277,1744095600"; d="scan'208";a="153549368" From: Zhenzhong Duan To: devel@lists.libvirt.org Subject: [PATCH v3 13/21] qemu: Add command line for TDX Quote Generation Service(QGS) Date: Mon, 30 Jun 2025 14:17:24 +0800 Message-Id: <20250630061732.303374-14-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: SU5JXTRZCXYQZ3OIKW7WF7CLHBGQO6OS X-Message-ID-Hash: SU5JXTRZCXYQZ3OIKW7WF7CLHBGQO6OS 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: 1751264864814116600 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 3081636c24..dc1b9c0029 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9948,15 +9948,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.34.1