From nobody Sat Feb 7 18:52:26 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=1655577259; cv=none; d=zohomail.com; s=zohoarc; b=OftileiWVOQcyjkfdeIJO2OEjiAr19AnXBdHbwxJRn7kpfkgtXSvXa2pbvsVH6guFcCHbcTgWRZ+NuSh5JUdDrCOdmditsRMBwUM4umdHmuwm2/zxIh2xO8vaVVpdZhNSQ/gnjglqeIinGU1ghCuVsy0USKagNGkTwiOEwA0xJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655577259; h=Content-Type:Content-Transfer-Encoding:Cc: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=i07BEx6Kjp2KJskwg9mTAS7dVamoedZ4W9B1XyoFCLs=; b=j1rTTYey12CfWFr6Nh7+JSwg51nYskUPXasEP89iASFhqrngNDCMCDUt75K4eWoQITinquRNaqXxn6dtQH6OnUuW2xFKARDmMyLEOvYyqrPK9C6Lnj3In6TW2dOFRaIJwsk9rjJX9P7B+FlD/i5b3fau06qDaKMYiFpCwzZ5TEk= 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 1655577259647997.9026853370029; Sat, 18 Jun 2022 11:34:19 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-173-itpX0RWwNiGegtOtQBdO6w-1; Sat, 18 Jun 2022 14:32:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E2E4380670D; Sat, 18 Jun 2022 18:32:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09CFA18EAD; Sat, 18 Jun 2022 18:32:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 43A811947066; Sat, 18 Jun 2022 18:32:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0DDE21947064 for ; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E12E92166B2A; Sat, 18 Jun 2022 18:32:44 +0000 (UTC) Received: from colepc.home (unknown [10.22.8.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCDA02166B29; Sat, 18 Jun 2022 18:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655577258; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=i07BEx6Kjp2KJskwg9mTAS7dVamoedZ4W9B1XyoFCLs=; b=FlOo2PByzOCteHhY3rkiGSOD24FG/VsTIud0egzREiFshddQNeppgtf+MmT82Ex8+hRsMy q6Z7+FUNn/Wms8lt3aOTdV9uF2bM0I49ywKhb8zE73qdMWm1lOkTlmcwOFQslO8v2WAzzg 9kNj5UTtn5D/JvO85BtCzfzJh6AbQ5A= X-MC-Unique: itpX0RWwNiGegtOtQBdO6w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Cole Robinson To: libvir-list@redhat.com Subject: [PATCH 1/4] qemu: validate: Drop tpm-tis arch validation Date: Sat, 18 Jun 2022 14:32:31 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cole Robinson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 1655577261255100001 Content-Type: text/plain; charset="utf-8" Checking against qemu capabilities should be enough here Resolves: https://gitlab.com/libvirt/libvirt/-/issues/321 Signed-off-by: Cole Robinson Reviewed-by: Michal Privoznik --- src/qemu/qemu_validate.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f8aa83c1cb..db47fcaa9c 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4798,12 +4798,6 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm, =20 switch (tpm->model) { case VIR_DOMAIN_TPM_MODEL_TIS: - if (!ARCH_IS_X86(def->os.arch) && (def->os.arch !=3D VIR_ARCH_AARC= H64)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("TPM model '%s' is only available for x86 and= aarch64 guests"), - virDomainTPMModelTypeToString(tpm->model)); - return -1; - } flag =3D QEMU_CAPS_DEVICE_TPM_TIS; break; case VIR_DOMAIN_TPM_MODEL_CRB: --=20 2.36.1 From nobody Sat Feb 7 18:52:26 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=1655577176; cv=none; d=zohomail.com; s=zohoarc; b=l21gRw8ynuEC3kgrWGTgdDML1cejyvB0k9HwrHEVCdPR11xqlux5+9jKUfdE+8zWx/dfDsGRdAJsjp3OfmY+DqR4Ar6VJoIQHmwInL3gbmW4qXPfg3mdYNjcDavd4F0I6lJ1BO/g6tBru3R1prSE30YLMhf4umLIno5gMcmjYR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655577176; h=Content-Type:Content-Transfer-Encoding:Cc: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=Zbz4mP9sr22LT2ZC5Q4eN8uMitW5X9bSbPaTDVaLDx0=; b=mXKbLUeJVTsKqqMNAUmHeyLVgIK37e0X6uxV7wTa83BUu7n4bYWsybX0AflA87i6upgtJH7JdagzLJDoJkp732NiRFOXlmEaMmcDGplgs7SJ7X+UPfqgkCAjvzaJLS0Zu3K6UVSNVjIGml3sWoGNxN6lY3Jdi02M+C9kbeSDUKM= 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 1655577176871834.9601320668118; Sat, 18 Jun 2022 11:32:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-257-yyYGt0QUM2GNvaoCQxrDbw-1; Sat, 18 Jun 2022 14:32:52 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E8941881431; Sat, 18 Jun 2022 18:32:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 869C2141510A; Sat, 18 Jun 2022 18:32:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 05DE51947070; Sat, 18 Jun 2022 18:32:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 398241947064 for ; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1D64C2166B2B; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) Received: from colepc.home (unknown [10.22.8.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id F11742166B29; Sat, 18 Jun 2022 18:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655577175; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Zbz4mP9sr22LT2ZC5Q4eN8uMitW5X9bSbPaTDVaLDx0=; b=JzGlNNUodKS3Zk/skSw/GBhMif1yUQEvszx9ji643ImsOVm4E3x/L3NeBCvydug+rQKXjk sN9B8upko/aC6wWASrVOFraZPzvESZOAUNNzRagUVO5TvCLF6PoXP92DWvSfnYLUlGkD8w 63eUDkqrGnxEAgSkidOIETohO3d/zGs= X-MC-Unique: yyYGt0QUM2GNvaoCQxrDbw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Cole Robinson To: libvir-list@redhat.com Subject: [PATCH 2/4] qemu: command: Use correct tpm device for all non-x86 Date: Sat, 18 Jun 2022 14:32:32 -0400 Message-Id: <7f2aa8463030e61d7e7666ba5473321b7f0449fc.1655577023.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cole Robinson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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: 1655577179008100001 Content-Type: text/plain; charset="utf-8" The qemu `tpm-tis` device is an ISA device, so only really applicable to x86 archs. For all non-x86 archs we should use `tpm-tis-device` This fixes tpm-tis usage on armv7l and riscv Signed-off-by: Cole Robinson Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 57334ab246..b307d3139c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9731,7 +9731,7 @@ qemuBuildTPMDevCmd(virCommand *cmd, const char *model =3D virDomainTPMModelTypeToString(tpm->model); g_autofree char *tpmdev =3D g_strdup_printf("tpm-%s", tpm->info.alias); =20 - if (tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_TIS && def->os.arch =3D=3D = VIR_ARCH_AARCH64) + if (tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_TIS && !ARCH_IS_X86(def->os= .arch)) model =3D "tpm-tis-device"; =20 if (virJSONValueObjectAdd(&props, --=20 2.36.1 From nobody Sat Feb 7 18:52:26 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=1655577183; cv=none; d=zohomail.com; s=zohoarc; b=i6gAg/PJxkyr43cLY6syOJ+S2jTjDJ40JPkQR0gLoXxhoTx7p5OUpdBhq8AdW/PmJWYBVZICEdsrIvMr4B5g5FmoWXW+6sj1ylxT82S0MQP0u6z9QWh9ua2yRZrr7R2qmrXvWxUev9I/jtfq5R8v4kTK/azOeOIEQ1ew0rO15w4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655577183; h=Content-Type:Content-Transfer-Encoding:Cc: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=jThey0pyQywKagsgU4RWtYiqp3JKf722weokA3bIN38=; b=MlfohmzIFrN4FBJn1l0jEjQUNd/wjdmsDxX7YYXyA2RZXutXKvI/INdwlvUB9ioszOwr3aSdNGhOAh8snLGr3zYF/bGWJET/iCo9mgWTO+Kxf7iaqfBX2uZ/CaB0KGH/EnaBwRXoPbuDbpBFytfoeisDnT0EILf5VmMMBal+eBg= 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 1655577183546914.2236461225112; Sat, 18 Jun 2022 11:33:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-mpn9Oc5YMhiVf91vKVFqVA-1; Sat, 18 Jun 2022 14:32:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 070DC3C0E202; Sat, 18 Jun 2022 18:32:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E878F112131E; Sat, 18 Jun 2022 18:32:50 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AE9CE1947065; Sat, 18 Jun 2022 18:32:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 79C511947064 for ; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4D2912166B2A; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) Received: from colepc.home (unknown [10.22.8.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D2D02166B29; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655577182; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=jThey0pyQywKagsgU4RWtYiqp3JKf722weokA3bIN38=; b=COmhdOyyPhp/ujVck4UktCllrNI/mQ372wHtJWu8Q6q1i8qs6RJVPLVVoZ3DmxKW+z4iSd NVgPVJJivJyyO5w6FUzLbmaYtpzDGbMkDs8LTy4DtqPQjpDzxO/Ax2yFij0oz6WTwB8ppR DiUxQj4KOs7Ld8ipAj/gkUu4nifv3kQ= X-MC-Unique: mpn9Oc5YMhiVf91vKVFqVA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Cole Robinson To: libvir-list@redhat.com Subject: [PATCH 3/4] tests: mock swtpm initialization for all qemu tests Date: Sat, 18 Jun 2022 14:32:33 -0400 Message-Id: <2d0ada015c891c52c2b415123c580ac2e15c392d.1655577023.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cole Robinson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 1655577184898100001 Content-Type: text/plain; charset="utf-8" Don't restrict this to domcaps testing only, we will soon need it for qemu command line validation Signed-off-by: Cole Robinson Reviewed-by: Michal Privoznik --- tests/domaincapstest.c | 7 ------- tests/testutilsqemu.c | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index da5c629fd4..3b8216a8f6 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -22,7 +22,6 @@ #include "domain_capabilities.h" #include "virfilewrapper.h" #include "configmake.h" -#include "virtpm.h" =20 =20 #define VIR_FROM_THIS VIR_FROM_NONE @@ -129,12 +128,6 @@ fillQemuCaps(virDomainCaps *domCaps, } =20 =20 -/* Enough to tell capabilities code that swtpm is usable */ -bool virTPMHasSwtpm(void) -{ - return true; -} - #endif /* WITH_QEMU */ =20 =20 diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index d26caba5fb..6dabbaf36a 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -11,6 +11,7 @@ # include "qemu/qemu_capspriv.h" # include "virstring.h" # include "virfilecache.h" +# include "virtpm.h" =20 # include # include @@ -138,6 +139,13 @@ virFindFileInPath(const char *file) } =20 =20 +/* Enough to tell capabilities code that swtpm is usable */ +bool virTPMHasSwtpm(void) +{ + return true; +} + + virCapsHostNUMA * virCapabilitiesHostNUMANewHost(void) { --=20 2.36.1 From nobody Sat Feb 7 18:52:26 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=1655577180; cv=none; d=zohomail.com; s=zohoarc; b=hYdnYcdESzgK3Odd40g1gom2tVRJ8FIPPQjmDwogOsR/yZTR+rpuDM5vLrNZ45iljBfb0cZmKJ3sAw0t5kO8k8hq5dPmYG3NARdMu31LtRiAR7bn96sDVUUoptrIJHv0HwgoLZgIpYX5abLa//9VNODXz9ZKVqtl5HYoPGQb21s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655577180; h=Content-Type:Content-Transfer-Encoding:Cc: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=m6FtOsu+L0qGuKveCSEqCcB1ZHAtU9cBfkuHdWCS5eY=; b=FTK7USpMgE2KNM6auNi2otFhQFS23N0DfwDLEblSOYuM8moHIRbA9oPa/iPEWHitcbOgLkZPTxR4shqaJl/gY9R2LXbci9fiA7fEAlBWcl5QG/Iqm3F4MKwuO91YMlghOMDJEvm5nn48Bbrzk5VcRKbROYgfa69xJ/Z3IRbXp+s= 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 1655577180395622.7745589008723; Sat, 18 Jun 2022 11:33:00 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-173--MHLsNzHNqaSwEFTZ3T_pA-1; Sat, 18 Jun 2022 14:32:52 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C1CE1881430; Sat, 18 Jun 2022 18:32:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E808141510D; Sat, 18 Jun 2022 18:32:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5E9E81947B85; Sat, 18 Jun 2022 18:32:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9CA9E1947064 for ; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7D06A2166B2C; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) Received: from colepc.home (unknown [10.22.8.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CDD82166B29; Sat, 18 Jun 2022 18:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655577179; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=m6FtOsu+L0qGuKveCSEqCcB1ZHAtU9cBfkuHdWCS5eY=; b=Cv6T6UEnwRa9ZpBV+cBV++T/eVNpnYRghZCImZMNJdqtcBhrM78K8/I4pl8QIqFgGAHYNC yl/Q0Lpcv3yuEQpE3d4CW50ZxJIbEUxLxba1uaT8StwfXANdBCIkfxVzwk72buaBN2wsMB 72Xpz9hO0nMpXsHhnUjvJgeffJmhbIo= X-MC-Unique: -MHLsNzHNqaSwEFTZ3T_pA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Cole Robinson To: libvir-list@redhat.com Subject: [PATCH 4/4] qemu: validate: use domcaps for tpm validation Date: Sat, 18 Jun 2022 14:32:34 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cole Robinson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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: 1655577180866100003 Content-Type: text/plain; charset="utf-8" Replace tpm->type and tpm->model qemuCaps validation with the similar logic in domcaps. Signed-off-by: Cole Robinson Reviewed-by: Michal Privoznik --- src/qemu/qemu_validate.c | 71 ++++++++++------------------------------ 1 file changed, 17 insertions(+), 54 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index db47fcaa9c..39210ba65b 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4750,7 +4750,7 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm, const virDomainDef *def, virQEMUCaps *qemuCaps) { - virQEMUCapsFlags flag; + virDomainCapsDeviceTPM tpmCaps =3D { 0 }; =20 switch (tpm->version) { case VIR_DOMAIN_TPM_VERSION_1_2: @@ -4781,57 +4781,28 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm, break; } =20 - switch (tpm->type) { - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH)) - goto no_support; - break; - - case VIR_DOMAIN_TPM_TYPE_EMULATOR: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR)) - goto no_support; + virQEMUCapsFillDomainDeviceTPMCaps(qemuCaps, &tpmCaps); =20 - break; - case VIR_DOMAIN_TPM_TYPE_LAST: - break; + if (!VIR_DOMAIN_CAPS_ENUM_IS_SET(tpmCaps.backendModel, tpm->type)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The QEMU executable %s does not support TPM " + "backend type %s"), + def->emulator, + virDomainTPMBackendTypeToString(tpm->type)); + return -1; } =20 - switch (tpm->model) { - case VIR_DOMAIN_TPM_MODEL_TIS: - flag =3D QEMU_CAPS_DEVICE_TPM_TIS; - break; - case VIR_DOMAIN_TPM_MODEL_CRB: - flag =3D QEMU_CAPS_DEVICE_TPM_CRB; - break; - case VIR_DOMAIN_TPM_MODEL_SPAPR: - flag =3D QEMU_CAPS_DEVICE_TPM_SPAPR; - break; - case VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY: - if (!ARCH_IS_PPC64(def->os.arch)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("TPM Proxy model %s is only available for " - "PPC64 guests"), - virDomainTPMModelTypeToString(tpm->model)); - return -1; - } - - /* TPM Proxy devices have 'passthrough' backend */ - if (tpm->type !=3D VIR_DOMAIN_TPM_TYPE_PASSTHROUGH) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("TPM Proxy model %s requires " - "'Passthrough' backend"), - virDomainTPMModelTypeToString(tpm->model)); - } - - flag =3D QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY; - break; - case VIR_DOMAIN_TPM_MODEL_LAST: - default: - virReportEnumRangeError(virDomainTPMModel, tpm->model); + if (ARCH_IS_PPC64(def->os.arch) && + tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY && + tpm->type !=3D VIR_DOMAIN_TPM_TYPE_PASSTHROUGH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("TPM Proxy model %s requires " + "'Passthrough' backend"), + virDomainTPMModelTypeToString(tpm->model)); return -1; } =20 - if (!virQEMUCapsGet(qemuCaps, flag)) { + if (!VIR_DOMAIN_CAPS_ENUM_IS_SET(tpmCaps.model, tpm->model)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("The QEMU executable %s does not support TPM " "model %s"), @@ -4841,14 +4812,6 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm, } =20 return 0; - - no_support: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The QEMU executable %s does not support TPM " - "backend type %s"), - def->emulator, - virDomainTPMBackendTypeToString(tpm->type)); - return -1; } =20 =20 --=20 2.36.1