From nobody Fri Oct 18 08:44:45 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; 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=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1717520715574588.8363735418644; Tue, 4 Jun 2024 10:05:15 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8B85B1EB0; Tue, 4 Jun 2024 13:05:14 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CEA921DDA; Tue, 4 Jun 2024 13:02:18 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2C3631DCF; Tue, 4 Jun 2024 13:02:10 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 5D9391DB4 for ; Tue, 4 Jun 2024 13:02:09 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-669-xjNgRzClOnWwpJj-YRoj4Q-1; Tue, 04 Jun 2024 13:02:07 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3AFE48007A1 for ; Tue, 4 Jun 2024 17:02:07 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C08771C060D9 for ; Tue, 4 Jun 2024 17:02:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717520529; h=from:from: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; bh=GTi7QV6QH0YT1zm8sW7GzAT4/ndSOVTNF/l25qS+Yaw=; b=FKo4F1YgMaupH0p9j7H67zy2xAEMFcR2UjoQZw1p/zj6D79Y52DrR4iUVO0G7dGzcZit12 WWYb3EFPG8Q1fxUs8WuqsaUeHn9eTcNOEOMk56hBPzwXbzkIti4/jYsc9jDtNqNabzG04x iFVzLQHADovwt91sGkWQaQ+d1uwBUUk= X-MC-Unique: xjNgRzClOnWwpJj-YRoj4Q-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [PATCH v2 3/4] qemu: Default to TPM 2.0 in most scenarios Date: Tue, 4 Jun 2024 19:02:01 +0200 Message-ID: <20240604170202.18982-4-abologna@redhat.com> In-Reply-To: <20240604170202.18982-1-abologna@redhat.com> References: <20240604170202.18982-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WCV4IJFAL3PNXO6W337VISWVLMVAJVGL X-Message-ID-Hash: WCV4IJFAL3PNXO6W337VISWVLMVAJVGL X-MailFrom: abologna@redhat.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header 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: 1717520717362100001 Content-Type: text/plain; charset="utf-8"; x-default="true" TPM 1.2 is a pretty bad default these days, especially for architectures which were introduced when TPM 2.0 already existed. We're already carving out exceptions for several scenarios, but that's basically backwards: at this point, using TPM 1.2 is the exception. Restructure the code so that it reflects reality and we don't have to remember to update it every time a new architecture is introduced. Signed-off-by: Andrea Bolognani Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 13 ++++++++----- ...irt-default-models.riscv64-latest.abi-update.xml | 2 +- .../riscv64-virt-default-models.riscv64-latest.xml | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bda62f2e5c..7ba2ea4a5e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6180,12 +6180,15 @@ qemuDomainTPMDefPostParse(virDomainTPMDef *tpm, /* TPM 1.2 and 2 are not compatible, so we choose a specific version h= ere */ if (tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR && tpm->data.emulator.version =3D=3D VIR_DOMAIN_TPM_VERSION_DEFAULT) { - if (tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_SPAPR || - tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_CRB || - qemuDomainIsARMVirt(def)) - tpm->data.emulator.version =3D VIR_DOMAIN_TPM_VERSION_2_0; - else + /* tpm-tis on x86 defaults to TPM 1.2 to preserve the + * historical behavior, but in all other scenarios we want + * TPM 2.0 instead */ + if (tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_TIS && + ARCH_IS_X86(def->os.arch)) { tpm->data.emulator.version =3D VIR_DOMAIN_TPM_VERSION_1_2; + } else { + tpm->data.emulator.version =3D VIR_DOMAIN_TPM_VERSION_2_0; + } } =20 return 0; diff --git a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-late= st.abi-update.xml b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv= 64-latest.abi-update.xml index a3a701b8e4..6712c2d831 100644 --- a/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-= update.xml +++ b/tests/qemuxmlconfdata/riscv64-virt-default-models.riscv64-latest.abi-= update.xml @@ -59,7 +59,7 @@ - +