From nobody Wed Dec 4 18:59:30 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 1716532379941273.9420566733976; Thu, 23 May 2024 23:32:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F0A3D197E; Fri, 24 May 2024 02:32:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8E4BC1BB6; Fri, 24 May 2024 02:26:41 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B39701B10; Fri, 24 May 2024 02:26:25 -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 9EFE91BCD for ; Fri, 24 May 2024 02:25:48 -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:46 -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:44 -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=1716531949; x=1748067949; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oms/ssk2MELwdOXzVP4xLiBt19zxrvopzzk9nVCUhow=; b=H5ulDorWsi1R5UPMoXZGkafKFB+A3vGlQyTZqxHWC02OCMiEIzxAUhzs Z83Smcl6RAsQahKBeg8WUKIKQ7wiBJzrUTEm/ZyVye29Cp1Rak4I0qicS gVgKL9GJIVwefDihR6dqjLSUKW9zjy6zu7LBA5yo+wfmXt+CO0LLqshlE 8NWXS4bQBboud1BEppU2+lZtghewzMLGRT5URSe2i32Dl7TQwGXO3JLgM 0Wcf4J1G9WmFqU4CHOdq2DdH09csU8gwVXsAGTLee5W3+vuq2t/+m/aws PCY1FAnvGh16gtOcbgmskAR29mfr1l6CUUL+zgE7iaMM4r20U15fA/SsN w==; X-CSE-ConnectionGUID: xSKK5ds1SUm02OBewAlpew== X-CSE-MsgGUID: TS04tzMmTJK21Gb9i3EH9A== X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="13081258" X-IronPort-AV: E=Sophos;i="6.08,184,1712646000"; d="scan'208";a="13081258" X-CSE-ConnectionGUID: K7U6HYDeSSCY19XCZCyaLA== X-CSE-MsgGUID: 2Ft6uDSOQKCmzDclX4gopQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,184,1712646000"; d="scan'208";a="34033976" From: Zhenzhong Duan To: devel@lists.libvirt.org Subject: [PATCH rfcv4 07/13] qemu: force special parameters enabled for TDX guest Date: Fri, 24 May 2024 14:21:22 +0800 Message-Id: <20240524062128.523820-8-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: 2RQWSFKY53CGM5ZLGCSVYECEUQIMVOIC X-Message-ID-Hash: 2RQWSFKY53CGM5ZLGCSVYECEUQIMVOIC 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: 1716532380401100001 Content-Type: text/plain; charset="utf-8" TDX guest requires some special parameters to boot, currently: "kernel_irqchip=3Dsplit" "pmu!=3Don" "smm!=3Don" "-bios" If not specified explicitly, QEMU should configure this option implicitly when start a TDX guest. Signed-off-by: Zhenzhong Duan Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_validate.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index db8493be68..8a3a64227e 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1333,6 +1333,38 @@ qemuValidateDomainDef(const virDomainDef *def, _("Only bit0(debug) and bit28(sept-ve-disab= le) are supported intel TDX launch security policy")); return -1; } + if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] =3D=3D VIR_DOMAIN= _IOAPIC_KVM) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Intel TDX launch security needs split ke= rnel irqchip")); + return -1; + } + /* Current KVM doesn't support PMU for TD guest. It returns + * error if TD is created with PMU bit being set in attributes. + * By default, QEMU disable PMU for TD guest. + */ + if (def->features[VIR_DOMAIN_FEATURE_PMU] =3D=3D VIR_TRISTATE_= SWITCH_ON) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Intel TDX launch security is not support= ed with PMU enabled")); + return -1; + } + /* TDX doesn't support SMM and VMM cannot emulate SMM for TDX = VMs + * because VMM cannot manipulate TDX VM's memory. + * By default, QEMU disable SMM for TD guest. + */ + if (def->features[VIR_DOMAIN_FEATURE_SMM] =3D=3D VIR_TRISTATE_= SWITCH_ON) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Intel TDX launch security is not support= ed with SMM enabled")); + return -1; + } + /* TDVF(OVMF) needs to run at private memory for TD guest. TDX= cannot + * support pflash device since it doesn't support read-only pr= ivate memory. + * Thus load TDVF(OVMF) with -bios option for TDs. + */ + if (def->os.loader && def->os.loader->type =3D=3D VIR_DOMAIN_L= OADER_TYPE_PFLASH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Intel TDX launch security is not support= ed with pflash loader")); + return -1; + } break; case VIR_DOMAIN_LAUNCH_SECURITY_NONE: case VIR_DOMAIN_LAUNCH_SECURITY_LAST: --=20 2.34.1