From nobody Tue Feb 10 15:01:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638435280; cv=none; d=zohomail.com; s=zohoarc; b=WZaVCBM45wuSsbZPf0GyWVMgLiM8mKl7vUCCfSuAJYAO9lhvD8MvC5BSdu/gt3YWED4zjyK5xl92H9UbWIeMJpPD+XU1XmlRnXmECVrWxoC1jBt3+bdmO8R02OZxEulJpGRBXRLL3EwAXMuVGObOKU6xznhxWbtnStNJtTaZfkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638435280; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2Ck09t0on11oW/k9mDuu92aYSjY1h3/ZsQRC80ZCM1s=; b=QXyQ1B+4PsgOeG3mPxNXjhFPdWHgGN29YgXccO9hpqth5qyX4jtOHmP3LRThpl5LWbM1cc94rxsB+vzrrUa+tV7WJJFSyeTc5Ay9FbqBxv12hme+odVxXFNkyrmFhPFUbCde4KVAkAvURE/99kX3TMPotSdZYHtZeDwu2opalvw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 163843528031247.67277204501386; Thu, 2 Dec 2021 00:54:40 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-195-IJBO5Z2uPAyZXNChpKq43w-1; Thu, 02 Dec 2021 03:54:36 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35DB61006AA0; Thu, 2 Dec 2021 08:54:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 175C5100EBAD; Thu, 2 Dec 2021 08:54:31 +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 CE9EC4A7C8; Thu, 2 Dec 2021 08:54:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B28sS0U029539 for ; Thu, 2 Dec 2021 03:54:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D4BB100EBBF; Thu, 2 Dec 2021 08:54:28 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id E254F100AE22; Thu, 2 Dec 2021 08:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638435279; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2Ck09t0on11oW/k9mDuu92aYSjY1h3/ZsQRC80ZCM1s=; b=Ow9UklL3x8XvKsHbRaIi5SJjaqM8mmCs5pOENpSovuoBs2QciOb1fsGljb8myVeokl1qrt as389asTGiyECHFFXOxrP41DCh/oAvDnxaBxNbkh/nMc0RjdfcHj9kuExz/qEDH12PVLqK cF3QL8N/u58gqoEDsdyeb3gHFCr1wNY= X-MC-Unique: IJBO5Z2uPAyZXNChpKq43w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v3 2/4] qemu: Validate TCG feature is enabled only for TCG domains Date: Thu, 2 Dec 2021 09:53:34 +0100 Message-Id: <06c3d6be8db7d19bfdf5c0d5c4359429fe82b434.1638434885.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.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.22 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 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638436182146100001 Content-Type: text/plain; charset="utf-8" After previous commit it's possible for domains to fine tune TCG features (well, just one - tb-cache). Check that domain has TCG enabled, otherwise the feature makes no sense. Signed-off-by: Michal Privoznik --- docs/formatdomain.rst | 2 +- src/qemu/qemu_validate.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 041dfc699d..98eb7b7481 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2074,7 +2074,7 @@ are: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D Feature Description Value = Since =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D - tb-cache The size of translation block cache size an integer = :since:`8.0.0` + tb-cache The size of translation block cache size an integer (= a multiple of MiB) :since:`8.0.0` =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =20 :anchor:`` diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a7c89f27cf..3a1c279e63 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -295,6 +295,22 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, break; =20 case VIR_DOMAIN_FEATURE_TCG: + if (def->features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) { + if (def->virtType !=3D VIR_DOMAIN_VIRT_QEMU) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("TCG features are incompatible with d= omain type '%s'"), + virDomainVirtTypeToString(def->virtType= )); + return -1; + } + + if (def->tcg_features->tb_cache & 0xff) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("tb-cache size must be an integer mul= tiple of MiB")); + return -1; + } + } + break; + case VIR_DOMAIN_FEATURE_SMM: case VIR_DOMAIN_FEATURE_KVM: case VIR_DOMAIN_FEATURE_XEN: --=20 2.32.0