From nobody Fri Oct 18 08:48:13 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 17168313212231010.291347998705; Mon, 27 May 2024 10:35:21 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 37E191B86; Mon, 27 May 2024 13:35:20 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 625751BB0; Mon, 27 May 2024 13:31:50 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6CE20196D; Mon, 27 May 2024 13:31:43 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 B8AD1196D for ; Mon, 27 May 2024 13:31:42 -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-82-uNPZWWuyNGiGUz4ECh7EdQ-1; Mon, 27 May 2024 13:31:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 98E37101A525 for ; Mon, 27 May 2024 17:31:40 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B935200A381 for ; Mon, 27 May 2024 17:31:40 +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=1716831102; 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=iTmHJEmcFlom3kg/MihaRiGIiVrBcQvKoY55TX+gBzs=; b=TdpcGaBUlx4cXGVe/jL+4pU2/cQdv2epZS8nRSWm5t3DJtEaii+QVfbf2t+gVXU1G5gzsT KfQi64NIIycY/iW4OdAbfJMrNjaBhxVdEL7cYEi2wi9ngh1sRxthp9a5gxszp7o+Jg62tj njgzalLILgTGAcHMRjiVbcG9KCbWlkU= X-MC-Unique: uNPZWWuyNGiGUz4ECh7EdQ-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [PATCH 3/3] qemu: Only allow TPM 2.0 for RISC-V guests Date: Mon, 27 May 2024 19:31:36 +0200 Message-ID: <20240527173136.184336-4-abologna@redhat.com> In-Reply-To: <20240527173136.184336-1-abologna@redhat.com> References: <20240527173136.184336-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PCSHRAQCOBDCWQZ4VW3EL6CSKPSNVLSU X-Message-ID-Hash: PCSHRAQCOBDCWQZ4VW3EL6CSKPSNVLSU 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: 1716831322828100001 Content-Type: text/plain; charset="utf-8"; x-default="true" We've made similar changes for aarch64 a few years back (see d8a1c059e0ed and previous commits), and the rationale is the same: the architecture is new enough that TPM 2.0 predates it, so TPM 1.2 support was never considered and will just not work. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 1 + src/qemu/qemu_validate.c | 10 ++++++---- .../aarch64-tpm-wrong-model.aarch64-latest.err | 2 +- ...4-virt-default-models.riscv64-latest.abi-update.xml | 2 +- .../riscv64-virt-default-models.riscv64-latest.xml | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bda62f2e5c..6bb18ad5a8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6182,6 +6182,7 @@ qemuDomainTPMDefPostParse(virDomainTPMDef *tpm, 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 || + qemuDomainIsRISCVVirt(def) || qemuDomainIsARMVirt(def)) tpm->data.emulator.version =3D VIR_DOMAIN_TPM_VERSION_2_0; else diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index ac1940cb31..7b871be05f 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4765,10 +4765,12 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm, _("TPM 1.2 is not supported with the SPAPR = device model")); return -1; } - /* TPM 1.2 + ARM does not work */ - if (qemuDomainIsARMVirt(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("TPM 1.2 is not supported on ARM")); + /* TPM 1.2 does not work on certain modern architectures */ + if (qemuDomainIsARMVirt(def) || + qemuDomainIsRISCVVirt(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("TPM 1.2 is not supported on architecture= '%1$s'"), + virArchToString(def->os.arch)); return -1; } break; diff --git a/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.e= rr b/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.err index a3a82fdcf5..44c6e7372b 100644 --- a/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.err +++ b/tests/qemuxmlconfdata/aarch64-tpm-wrong-model.aarch64-latest.err @@ -1 +1 @@ -unsupported configuration: TPM 1.2 is not supported on ARM +unsupported configuration: TPM 1.2 is not supported on architecture 'aarch= 64' 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 @@ - +