From nobody Tue Feb 10 23:00:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1624006499650781.7659713083302; Fri, 18 Jun 2021 01:54:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-493-yCZ6ZOFRPhK8nRvkDCfKmg-1; Fri, 18 Jun 2021 04:54:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF1D2100C66A; Fri, 18 Jun 2021 08:54:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89D5319726; Fri, 18 Jun 2021 08:54:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 54DF61800CAF; Fri, 18 Jun 2021 08:54:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15I8r4oP010585 for ; Fri, 18 Jun 2021 04:53:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7C83410C7339; Fri, 18 Jun 2021 08:53:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7894510C732B for ; Fri, 18 Jun 2021 08:53:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 61FFD101D228 for ; Fri, 18 Jun 2021 08:53:04 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-vNjJMZVmNj6ev5W6EzbUrg-1; Fri, 18 Jun 2021 04:53:01 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2021 01:51:58 -0700 Received: from duan-client-optiplex-7080.bj.intel.com ([10.238.156.114]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2021 01:51:57 -0700 X-MC-Unique: yCZ6ZOFRPhK8nRvkDCfKmg-1 X-MC-Unique: vNjJMZVmNj6ev5W6EzbUrg-1 IronPort-SDR: VSZ3pEPfQMn+3oPthuEGe2GDPVIcdaai2oYPAs7C8TgJzvNF6TrRcGT52Kr+ivCx1Xc1/wl0CS N0u5fxRLMj9Q== X-IronPort-AV: E=McAfee;i="6200,9189,10018"; a="267665953" X-IronPort-AV: E=Sophos;i="5.83,283,1616482800"; d="scan'208";a="267665953" IronPort-SDR: 5aQJub8HFeIz9HrSRAi+BEf8iOskXyK3gFj3Ag9/Kefs5Ggu2UWwMjoSYRW88IprITgwqk5vQF LMgyxJACNziQ== X-IronPort-AV: E=Sophos;i="5.83,283,1616482800"; d="scan'208";a="485611663" From: Zhenzhong Duan To: libvir-list@redhat.com Subject: [RFC PATCH 6/7] qemu: force special features enabled for TDX guest Date: Fri, 18 Jun 2021 16:50:51 +0800 Message-Id: <20210618085052.564315-7-zhenzhong.duan@intel.com> In-Reply-To: <20210618085052.564315-1-zhenzhong.duan@intel.com> References: <20210618085052.564315-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 18 Jun 2021 04:54:23 -0400 Cc: isaku.yamahata@intel.com, jun.j.tian@intel.com, chenyi.qiang@intel.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" TDX guest requires some special parameters in qemu command line. They are "pic=3Dno,kernel_irqchip=3Dsplit" without which guest fails to bootup. PMU has a big impact to the performance of TDX guest. So always disable PMU except it's forcely enabled. Signed-off-by: Zhenzhong Duan --- src/qemu/qemu_command.c | 6 +++++- src/qemu/qemu_validate.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 891d795b02..bffa3fdf10 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6599,6 +6599,10 @@ qemuBuildCpuCommandLine(virCommand *cmd, virTristateSwitch pmu =3D def->features[VIR_DOMAIN_FEATURE_PMU]; virBufferAsprintf(&buf, ",pmu=3D%s", virTristateSwitchTypeToString(pmu)); + } else if (!def->features[VIR_DOMAIN_FEATURE_PMU] && def->tdx) { + /* PMU lead to performance drop if TDX enabled, disable PMU by def= ault */ + virBufferAsprintf(&buf, ",pmu=3D%s", + virTristateSwitchTypeToString(VIR_TRISTATE_SWITC= H_OFF)); } =20 if (def->cpu && def->cpu->cache) { @@ -6975,7 +6979,7 @@ qemuBuildMachineCommandLine(virCommand *cmd, } =20 if (def->tdx) - virBufferAddLit(&buf, ",confidential-guest-support=3Dtdx0,kvm-type= =3Dtdx"); + virBufferAddLit(&buf, ",confidential-guest-support=3Dtdx0,kvm-type= =3Dtdx,pic=3Dno"); =20 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { if (priv->pflash0) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 2efd011cc0..3c3a00c7e8 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -202,6 +202,12 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, return -1; } } + if (def->tdx && (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_K= ERNEL_IRQCHIP) + || def->features[i] !=3D VIR_DOMAIN_IOAPIC_QE= MU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("TDX guest needs split kernel irqchip")); + return -1; + } break; =20 case VIR_DOMAIN_FEATURE_HPT: --=20 2.25.1