From nobody Fri Apr 19 14:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637768682; cv=none; d=zohomail.com; s=zohoarc; b=IjuzRLG6X/z4uG1CGDiP92IXsLyey/RMftc5pyxR4FamtMSu9JnwNVE43pWgeoGhcm5xXAKkJDo9W+jdm/WkyduFHagA130mAWNwHEV06uFRKIWsWeo2qMZUzkrJBlItqfY7PoDOeKPwcoEv4vVwobLuOdNJXctyo1dfzCeYIaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768682; 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=JwO88BBICkFYKynQLV/NsKqgsQApFHv75oHZ87RZMb8=; b=cEWSFvaekGGPIffudGN3df0KTyx3OLeoP6IMDJIOT9F2MVNhq9dr80vV0CyEmx4YMD7iBRmaJzmJ+OtWyukmwIN1Cs01wHyW/OAGV02yfswE06qJclxaKKYZuLDg2xrmahyQ4lH4ZPexZGjQQe4VOD1OlWMkp0B/Oum+yVokCf0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1637768682548638.7622280599866; Wed, 24 Nov 2021 07:44:42 -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-36-f3EoHP0TNvSun6lAv9h_3A-1; Wed, 24 Nov 2021 10:44:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D528100D682; Wed, 24 Nov 2021 15:44:32 +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 11FD65D6B1; Wed, 24 Nov 2021 15:44:32 +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 EDE521809C89; Wed, 24 Nov 2021 15:44:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFiSo9027876 for ; Wed, 24 Nov 2021 10:44:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1685879455; Wed, 24 Nov 2021 15:44:28 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79C3C79454; Wed, 24 Nov 2021 15:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768681; 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=JwO88BBICkFYKynQLV/NsKqgsQApFHv75oHZ87RZMb8=; b=UZ7CI4uuJI86RswJIinP+9gJ0SCQk+44XouMhYU2U8uCTHa9P6L1VHP0iKFEl71B/ZWIxY OXwFq8iMz8VivgiVv/exJbmdSsIpRNUoa0DuTBUc550fIWsrRVOr/zdnhGgEMexlNUY1Rw z7yLX25CloXtqeYElSaIMDX0yzxhcbQ= X-MC-Unique: f3EoHP0TNvSun6lAv9h_3A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 01/12] util: use consistent naming for swtpm global variables Date: Wed, 24 Nov 2021 15:44:05 +0000 Message-Id: <20211124154416.369770-2-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768683757100002 Use a '_path' suffix on all vars which are paths. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virtpm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 2c0dd707b0..d5d80aa9dc 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -100,11 +100,11 @@ static char *swtpm_path; static struct stat swtpm_stat; static virBitmap *swtpm_caps; =20 -static char *swtpm_setup; +static char *swtpm_setup_path; static struct stat swtpm_setup_stat; static virBitmap *swtpm_setup_caps; =20 -static char *swtpm_ioctl; +static char *swtpm_ioctl_path; static struct stat swtpm_ioctl_stat; =20 typedef int (*TypeFromStringFn)(const char *); @@ -129,11 +129,11 @@ virTPMGetSwtpmSetup(void) { char *s; =20 - if (!swtpm_setup && virTPMEmulatorInit() < 0) + if (!swtpm_setup_path && virTPMEmulatorInit() < 0) return NULL; =20 virMutexLock(&swtpm_tools_lock); - s =3D g_strdup(swtpm_setup); + s =3D g_strdup(swtpm_setup_path); virMutexUnlock(&swtpm_tools_lock); =20 return s; @@ -144,11 +144,11 @@ virTPMGetSwtpmIoctl(void) { char *s; =20 - if (!swtpm_ioctl && virTPMEmulatorInit() < 0) + if (!swtpm_ioctl_path && virTPMEmulatorInit() < 0) return NULL; =20 virMutexLock(&swtpm_tools_lock); - s =3D g_strdup(swtpm_ioctl); + s =3D g_strdup(swtpm_ioctl_path); virMutexUnlock(&swtpm_tools_lock); =20 return s; @@ -275,14 +275,14 @@ virTPMEmulatorInit(void) }, { .name =3D "swtpm_setup", - .path =3D &swtpm_setup, + .path =3D &swtpm_setup_path, .stat =3D &swtpm_setup_stat, .caps =3D &swtpm_setup_caps, .typeFromStringFn =3D virTPMSwtpmSetupFeatureTypeFromString, }, { .name =3D "swtpm_ioctl", - .path =3D &swtpm_ioctl, + .path =3D &swtpm_ioctl_path, .stat =3D &swtpm_ioctl_stat, } }; --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637768683; cv=none; d=zohomail.com; s=zohoarc; b=VJBdVRj1xPyXYjw0DXxgnKH2ICUrfzZRccqIlFfoV36BaL/YV4YXd/y3nycZHw1gNSHFRawZrYKU5XhJ9YdiTO39bLIK3/JQWfRLc1pRkM2dyR3kNxh/dh/d8yX1vTXhL754nFtnIgnjy8kiqDvLrIFtnV7NocZk3Jxp2rRAk9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768683; 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=OreqFbjB09MCUSxwHuZqp7MbLcA4sDZWuW3TR22gLSY=; b=gasIBSMOwdV4LZzRVlOJoyuY05HB8DYm8o8Ml9WnA59IjytjeFJZpr513UaAcGaqnghYKzDja4o2bkG9hFNphwZynYvQUPsXbsabXZHKaUWw64yiO5mIeqwI4URnn+AwDMuPAPrTQ8PFqNjDFDa7AK16JdpV3iVTvZczYQC7exk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 16377686830731001.6049838017524; Wed, 24 Nov 2021 07:44:43 -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-212-cGIsbLuHO0uaqd7jYQ0qfA-1; Wed, 24 Nov 2021 10:44:37 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 189731853026; Wed, 24 Nov 2021 15:44:33 +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 ECC885D9C0; Wed, 24 Nov 2021 15:44:32 +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 246151809C8A; Wed, 24 Nov 2021 15:44:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFiSq2027884 for ; Wed, 24 Nov 2021 10:44:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id EE22279455; Wed, 24 Nov 2021 15:44:28 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CF0379454; Wed, 24 Nov 2021 15:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768681; 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=OreqFbjB09MCUSxwHuZqp7MbLcA4sDZWuW3TR22gLSY=; b=KHsSSmPDcwKh8nKLX99XYjY9XZW1BzqTIWb2V8TYWwBd/cjsrxZRNvksSwNP0cadK74eac xGvK50SwsBvY3C+HLiIxfYxNBBOfrHr+XbEkNJ8fIOl3JXWXY+oY3cT5n7z3H0OC0t/Qqc xoPkg/lP/hoINLyirVivTlh3PAHRbtw= X-MC-Unique: cGIsbLuHO0uaqd7jYQ0qfA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 02/12] util: rename typedef for parsing swtpm capabilities Date: Wed, 24 Nov 2021 15:44:06 +0000 Message-Id: <20211124154416.369770-3-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768683751100001 Best practice is to have all types use a naming convention based on the filename. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virtpm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index d5d80aa9dc..1a34f8ce56 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -107,7 +107,7 @@ static virBitmap *swtpm_setup_caps; static char *swtpm_ioctl_path; static struct stat swtpm_ioctl_stat; =20 -typedef int (*TypeFromStringFn)(const char *); +typedef int (*virTPMBinaryCapsParse)(const char *); =20 char * virTPMGetSwtpm(void) @@ -171,7 +171,7 @@ virTPMGetSwtpmIoctl(void) */ static virBitmap * virTPMExecGetCaps(virCommand *cmd, - TypeFromStringFn typeFromStringFn) + virTPMBinaryCapsParse capsParse) { int exitstatus; virBitmap *bitmap; @@ -214,7 +214,7 @@ virTPMExecGetCaps(virCommand *cmd, str =3D virJSONValueGetString(item); if (!str) goto error_bad_json; - typ =3D typeFromStringFn(str); + typ =3D capsParse(str); if (typ < 0) continue; =20 @@ -231,8 +231,8 @@ virTPMExecGetCaps(virCommand *cmd, } =20 static virBitmap * -virTPMGetCaps(TypeFromStringFn typeFromStringFn, - const char *exec, const char *param1) +virTPMGetCaps(virTPMBinaryCapsParse capsParse, + const char *exec, const char *param1) { g_autoptr(virCommand) cmd =3D NULL; =20 @@ -244,7 +244,7 @@ virTPMGetCaps(TypeFromStringFn typeFromStringFn, virCommandAddArg(cmd, "--print-capabilities"); virCommandClearCaps(cmd); =20 - return virTPMExecGetCaps(cmd, typeFromStringFn); + return virTPMExecGetCaps(cmd, capsParse); } =20 /* @@ -263,7 +263,7 @@ virTPMEmulatorInit(void) struct stat *stat; const char *parm; virBitmap **caps; - TypeFromStringFn typeFromStringFn; + virTPMBinaryCapsParse capsParse; } prgs[] =3D { { .name =3D "swtpm", @@ -271,14 +271,14 @@ virTPMEmulatorInit(void) .stat =3D &swtpm_stat, .parm =3D "socket", .caps =3D &swtpm_caps, - .typeFromStringFn =3D virTPMSwtpmFeatureTypeFromString, + .capsParse =3D virTPMSwtpmFeatureTypeFromString, }, { .name =3D "swtpm_setup", .path =3D &swtpm_setup_path, .stat =3D &swtpm_setup_stat, .caps =3D &swtpm_setup_caps, - .typeFromStringFn =3D virTPMSwtpmSetupFeatureTypeFromString, + .capsParse =3D virTPMSwtpmSetupFeatureTypeFromString, }, { .name =3D "swtpm_ioctl", @@ -329,7 +329,7 @@ virTPMEmulatorInit(void) *prgs[i].path =3D g_steal_pointer(&path); =20 if (prgs[i].caps) { - *prgs[i].caps =3D virTPMGetCaps(prgs[i].typeFromStringFn, + *prgs[i].caps =3D virTPMGetCaps(prgs[i].capsParse, *prgs[i].path, prgs[i].parm); if (!*prgs[i].caps) goto cleanup; --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637768695; cv=none; d=zohomail.com; s=zohoarc; b=JwLqpUKYroWHmYGkxWbTRTGXWX82qt82hQTf6yMOXhgTO/8LjutleooC2oJM2+hEYQIRRgzFqdYTxa5xirA4c4NcmBejz6gJjcmYm9mkvO1kH3k3DXjh0OpRuczS5qIKYdA022SQDbryvelCK0Gu3suFiO6tkIh1ip3D0dZiOC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768695; 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=Us2cR0riIBn9nv1MrpOwKDupdQu+s3VT6dsVqPudIos=; b=kenZ9XgMEo7rBy2iXfofC+d8lDpnzNrohPC+FvKIGAiW7xh8hIyFmzVlg/i5yMnrIwqVLjGctiZ0W1FDdNxCV3aff1F8Hw4hF73lcA1a0T+fx3Gi88dtohL42DmmOu526bkEhoTzhlov/cX3fw3EkzE4qnrYBQPjl5wENAt0QUw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1637768695685339.68878662565373; Wed, 24 Nov 2021 07:44:55 -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-272-lg1NPKu-OdGqdC8LNjexNg-1; Wed, 24 Nov 2021 10:44:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFD3110144F6; Wed, 24 Nov 2021 15:44:45 +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 B207A5D9C0; Wed, 24 Nov 2021 15:44:45 +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 84F4D1809CB8; Wed, 24 Nov 2021 15:44:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFiT5S027891 for ; Wed, 24 Nov 2021 10:44:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id D393F79455; Wed, 24 Nov 2021 15:44:29 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4097B79458; Wed, 24 Nov 2021 15:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768694; 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=Us2cR0riIBn9nv1MrpOwKDupdQu+s3VT6dsVqPudIos=; b=XAQhGvasJqa/3rIbNQjrTfXjqfUagYEuOiHIZM2V9kdfwK1YgC/gIl309i/UAiZZvAo5qK CYkjR40bNGQYcUswlmbL53YDUQ3D24YtkwEJB5TxSc58UMUPPUXsD8CzsCb+87/eW3qEQX /sJFQXXsW64tOddt5VuKsZLyGVwzCtY= X-MC-Unique: lg1NPKu-OdGqdC8LNjexNg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 03/12] util: refactor TPM helper methods to reduce duplicationm Date: Wed, 24 Nov 2021 15:44:07 +0000 Message-Id: <20211124154416.369770-4-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768696828100001 The TPM helper methods for querying the binary path and capabilities have the same patterns across all swtpm binaries. This code duplication can be reduced by introducing helper methods. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virtpm.c | 53 ++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 1a34f8ce56..cc9173cecd 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -109,49 +109,37 @@ static struct stat swtpm_ioctl_stat; =20 typedef int (*virTPMBinaryCapsParse)(const char *); =20 -char * -virTPMGetSwtpm(void) +static char * +virTPMBinaryGetPath(char **path_var) { char *s; =20 - if (!swtpm_path && virTPMEmulatorInit() < 0) + if (!*path_var && virTPMEmulatorInit() < 0) return NULL; =20 virMutexLock(&swtpm_tools_lock); - s =3D g_strdup(swtpm_path); + s =3D g_strdup(*path_var); virMutexUnlock(&swtpm_tools_lock); =20 return s; } =20 char * -virTPMGetSwtpmSetup(void) +virTPMGetSwtpm(void) { - char *s; - - if (!swtpm_setup_path && virTPMEmulatorInit() < 0) - return NULL; - - virMutexLock(&swtpm_tools_lock); - s =3D g_strdup(swtpm_setup_path); - virMutexUnlock(&swtpm_tools_lock); + return virTPMBinaryGetPath(&swtpm_path); +} =20 - return s; +char * +virTPMGetSwtpmSetup(void) +{ + return virTPMBinaryGetPath(&swtpm_setup_path); } =20 char * virTPMGetSwtpmIoctl(void) { - char *s; - - if (!swtpm_ioctl_path && virTPMEmulatorInit() < 0) - return NULL; - - virMutexLock(&swtpm_tools_lock); - s =3D g_strdup(swtpm_ioctl_path); - virMutexUnlock(&swtpm_tools_lock); - - return s; + return virTPMBinaryGetPath(&swtpm_ioctl_path); } =20 /* virTPMExecGetCaps @@ -345,18 +333,23 @@ virTPMEmulatorInit(void) return ret; } =20 -bool -virTPMSwtpmCapsGet(unsigned int cap) +static bool +virTPMBinaryGetCaps(virBitmap **caps_var, + unsigned int cap) { if (virTPMEmulatorInit() < 0) return false; - return virBitmapIsBitSet(swtpm_caps, cap); + return virBitmapIsBitSet(*caps_var, cap); +} + +bool +virTPMSwtpmCapsGet(unsigned int cap) +{ + return virTPMBinaryGetCaps(&swtpm_caps, cap); } =20 bool virTPMSwtpmSetupCapsGet(unsigned int cap) { - if (virTPMEmulatorInit() < 0) - return false; - return virBitmapIsBitSet(swtpm_setup_caps, cap); + return virTPMBinaryGetCaps(&swtpm_setup_caps, cap); } --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 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=1637768703; cv=none; d=zohomail.com; s=zohoarc; b=e4YUULZiyDLNCn0rFiRQFAzVjyYLVju1j/NEKa8J9Vix4ym502Flm36HTi2oGvdY/nXPYjfc4a1ldEfku7ml8rZL2ZvhgtD4CtVS51kpy8DW9vL+c+PH2OlzTNg8/flDIu70AVOt+6RMDD34D7Tst2BS7s6P30Hw9JpO6chABto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768703; 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=7RSckSr0HRFLS40t0485VKwI3axUhvxpGevW0hMB3H8=; b=PKXfPzRsQJ8h8LbiaqniC1PPAgSgpTncE1lZoG9N2qmcDSUbrQeyVFMtP+Or/17JbpAzOfXag+E6I+UboefPIUOlY9GAL+RWcX9De7Ev53Wm8LIb7EUDYQDv1jroGqjoAHKHUldFO7z7BzML6fxnkWzbmwwnYXGA17ywhjstZEA= 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 1637768703307457.07541836951236; Wed, 24 Nov 2021 07:45:03 -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-221-FQxvT6slOSCan1ofIpo3jA-1; Wed, 24 Nov 2021 10:44:58 -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 2C69581EE6C; Wed, 24 Nov 2021 15:44:48 +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 0EB5710246E8; Wed, 24 Nov 2021 15:44:48 +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 D3D071809CB7; Wed, 24 Nov 2021 15:44:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFiUgA027902 for ; Wed, 24 Nov 2021 10:44:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id B600079454; Wed, 24 Nov 2021 15:44:30 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 250B07945A; Wed, 24 Nov 2021 15:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768702; 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=7RSckSr0HRFLS40t0485VKwI3axUhvxpGevW0hMB3H8=; b=UfeRnRf+4H7kpnWhXBRJlTs7BwudsxzDeLSMFVbtHxKjH3ddTMjlOBKCzhyXt4pqYeU5EE Ozea1zFBN2TharYAGrPVZjg4CJM12dZdVhdm+uE+2cZUxgb+bpuWbk4zweLcqjChjayUS1 7eM2XtcPUFmHfqgdN9Tm0UbIl4n84nk= X-MC-Unique: FQxvT6slOSCan1ofIpo3jA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 04/12] util: replace TPM global variables with a struct array Date: Wed, 24 Nov 2021 15:44:08 +0000 Message-Id: <20211124154416.369770-5-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768705081100001 The virTPMEmulatorInit function defines a struct that gets filled with pointers to global variables. It will be simpler to just use the struct for the global variables directly. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virtpm.c | 121 ++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 63 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index cc9173cecd..2539ea9275 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -96,29 +96,52 @@ virTPMCreateCancelPath(const char *devpath) * capabilities bitmap */ static virMutex swtpm_tools_lock =3D VIR_MUTEX_INITIALIZER; -static char *swtpm_path; -static struct stat swtpm_stat; -static virBitmap *swtpm_caps; - -static char *swtpm_setup_path; -static struct stat swtpm_setup_stat; -static virBitmap *swtpm_setup_caps; - -static char *swtpm_ioctl_path; -static struct stat swtpm_ioctl_stat; =20 typedef int (*virTPMBinaryCapsParse)(const char *); =20 +typedef enum _virTPMBinary { + VIR_TPM_BINARY_SWTPM, + VIR_TPM_BINARY_SWTPM_SETUP, + VIR_TPM_BINARY_SWTPM_IOCTL, + + VIR_TPM_BINARY_LAST +} virTPMBinary; + +VIR_ENUM_DECL(virTPMBinary); +VIR_ENUM_IMPL(virTPMBinary, + VIR_TPM_BINARY_LAST, + "swtpm", "swtpm_setup", "swtpm_ioctl"); + +typedef struct _virTPMBinaryInfo { + char *path; + struct stat stat; + const char *parm; + virBitmap *caps; + virTPMBinaryCapsParse capsParse; +} virTPMBinaryInfo; + +static virTPMBinaryInfo swtpmBinaries[VIR_TPM_BINARY_LAST] =3D { + [VIR_TPM_BINARY_SWTPM] =3D { + .parm =3D "socket", + .capsParse =3D virTPMSwtpmFeatureTypeFromString, + }, + [VIR_TPM_BINARY_SWTPM_SETUP] =3D { + .capsParse =3D virTPMSwtpmSetupFeatureTypeFromString, + }, + [VIR_TPM_BINARY_SWTPM_IOCTL] =3D { + }, +}; + static char * -virTPMBinaryGetPath(char **path_var) +virTPMBinaryGetPath(virTPMBinary binary) { char *s; =20 - if (!*path_var && virTPMEmulatorInit() < 0) + if (!swtpmBinaries[binary].path && virTPMEmulatorInit() < 0) return NULL; =20 virMutexLock(&swtpm_tools_lock); - s =3D g_strdup(*path_var); + s =3D g_strdup(swtpmBinaries[binary].path); virMutexUnlock(&swtpm_tools_lock); =20 return s; @@ -127,19 +150,19 @@ virTPMBinaryGetPath(char **path_var) char * virTPMGetSwtpm(void) { - return virTPMBinaryGetPath(&swtpm_path); + return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM); } =20 char * virTPMGetSwtpmSetup(void) { - return virTPMBinaryGetPath(&swtpm_setup_path); + return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM_SETUP); } =20 char * virTPMGetSwtpmIoctl(void) { - return virTPMBinaryGetPath(&swtpm_ioctl_path); + return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM_IOCTL); } =20 /* virTPMExecGetCaps @@ -245,62 +268,33 @@ int virTPMEmulatorInit(void) { int ret =3D -1; - static const struct { - const char *name; - char **path; - struct stat *stat; - const char *parm; - virBitmap **caps; - virTPMBinaryCapsParse capsParse; - } prgs[] =3D { - { - .name =3D "swtpm", - .path =3D &swtpm_path, - .stat =3D &swtpm_stat, - .parm =3D "socket", - .caps =3D &swtpm_caps, - .capsParse =3D virTPMSwtpmFeatureTypeFromString, - }, - { - .name =3D "swtpm_setup", - .path =3D &swtpm_setup_path, - .stat =3D &swtpm_setup_stat, - .caps =3D &swtpm_setup_caps, - .capsParse =3D virTPMSwtpmSetupFeatureTypeFromString, - }, - { - .name =3D "swtpm_ioctl", - .path =3D &swtpm_ioctl_path, - .stat =3D &swtpm_ioctl_stat, - } - }; size_t i; =20 virMutexLock(&swtpm_tools_lock); =20 - for (i =3D 0; i < G_N_ELEMENTS(prgs); i++) { + for (i =3D 0; i < VIR_TPM_BINARY_LAST; i++) { g_autofree char *path =3D NULL; - bool findit =3D *prgs[i].path =3D=3D NULL; + bool findit =3D swtpmBinaries[i].path =3D=3D NULL; struct stat statbuf; =20 if (!findit) { /* has executables changed? */ - if (stat(*prgs[i].path, &statbuf) < 0) + if (stat(swtpmBinaries[i].path, &statbuf) < 0) findit =3D true; =20 if (!findit && - statbuf.st_mtime !=3D prgs[i].stat->st_mtime) + statbuf.st_mtime !=3D swtpmBinaries[i].stat.st_mtime) findit =3D true; } =20 if (findit) { - VIR_FREE(*prgs[i].path); + VIR_FREE(swtpmBinaries[i].path); =20 - path =3D virFindFileInPath(prgs[i].name); + path =3D virFindFileInPath(virTPMBinaryTypeToString(i)); if (!path) { virReportSystemError(ENOENT, - _("Unable to find '%s' binary in $PATH"), - prgs[i].name); + _("Unable to find '%s' binary in $PAT= H"), + virTPMBinaryTypeToString(i)); goto cleanup; } if (!virFileIsExecutable(path)) { @@ -309,17 +303,18 @@ virTPMEmulatorInit(void) path); goto cleanup; } - if (stat(path, prgs[i].stat) < 0) { + if (stat(path, &swtpmBinaries[i].stat) < 0) { virReportSystemError(errno, _("Could not stat %s"), path); goto cleanup; } - *prgs[i].path =3D g_steal_pointer(&path); + swtpmBinaries[i].path =3D g_steal_pointer(&path); =20 - if (prgs[i].caps) { - *prgs[i].caps =3D virTPMGetCaps(prgs[i].capsParse, - *prgs[i].path, prgs[i].parm); - if (!*prgs[i].caps) + if (swtpmBinaries[i].capsParse) { + swtpmBinaries[i].caps =3D virTPMGetCaps(swtpmBinaries[i].c= apsParse, + swtpmBinaries[i].pat= h, + swtpmBinaries[i].par= m); + if (!swtpmBinaries[i].caps) goto cleanup; } } @@ -334,22 +329,22 @@ virTPMEmulatorInit(void) } =20 static bool -virTPMBinaryGetCaps(virBitmap **caps_var, +virTPMBinaryGetCaps(virTPMBinary binary, unsigned int cap) { if (virTPMEmulatorInit() < 0) return false; - return virBitmapIsBitSet(*caps_var, cap); + return virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); } =20 bool virTPMSwtpmCapsGet(unsigned int cap) { - return virTPMBinaryGetCaps(&swtpm_caps, cap); + return virTPMBinaryGetCaps(VIR_TPM_BINARY_SWTPM, cap); } =20 bool virTPMSwtpmSetupCapsGet(unsigned int cap) { - return virTPMBinaryGetCaps(&swtpm_setup_caps, cap); + return virTPMBinaryGetCaps(VIR_TPM_BINARY_SWTPM_SETUP, cap); } --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 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=1637768705; cv=none; d=zohomail.com; s=zohoarc; b=RVWnL+ki4DBRg8dllafrE18k717B8MFnXlqh3rah/+kt90POBAAZhcT5XfxcMHQcVDbGEFmDofmv8QhiaE9ELAiZ4GhQFABZ7zePjUh2zeMCdzvp9M8LescntDn9xeWTWWcJScZ9xsi3RGSrkkNLRa7elXFclmTPJmTGu3LbXkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768705; 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=CYJWG6poZYY0gkqaDhq1f6haHMfg2dcFlLq11wAh2Ow=; b=i17kMvI12zl+S3EZKyXH8ZiXQRAiLAiCJK2ebsUglDz8wE7SwjgzOEzCk0PAMY/yfIJ3DpFOn1mE26A94FxdxLJxutiLbmBVwKtf+sNHpRuu92k7bFohTtufXHUgoXmCzHWeyrxpE/rIiJBsKnnApMdKYHm9jAju6ytRbhWyPOg= 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 1637768705346395.409326110042; Wed, 24 Nov 2021 07:45:05 -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-333--K1yYmxvNLe6aAJHXIS22g-1; Wed, 24 Nov 2021 10:45:02 -0500 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 99BD381EE76; Wed, 24 Nov 2021 15:44: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 17C4D196E5; Wed, 24 Nov 2021 15:44: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 CFC2A1809CBA; Wed, 24 Nov 2021 15:44:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFiVU4027911 for ; Wed, 24 Nov 2021 10:44:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 97DD979457; Wed, 24 Nov 2021 15:44:31 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0827879454; Wed, 24 Nov 2021 15:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768704; 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=CYJWG6poZYY0gkqaDhq1f6haHMfg2dcFlLq11wAh2Ow=; b=CgaWJK2vWCU+8u0+Wdu7AY+WHl2zpNhApzBdPZpsSr0VIAOq8MWTHDoYnJS9dPEpHLfwEW +Mwx5qgM8uYHn4275FUSLmrpbR1qrps6VFfKz+tbBwijXvkGBQdjmSmBXugkW50G8AOxop 9eWc+AzEFreyEvzM73+KOImUH4guhW0= X-MC-Unique: -K1yYmxvNLe6aAJHXIS22g-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 05/12] util: don't export virTPMEmulatorInit method Date: Wed, 24 Nov 2021 15:44:09 +0000 Message-Id: <20211124154416.369770-6-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768707558100001 Every other exportd API from virtpm.h will internally call virTPMEmulatorInit, so there is no reason for this initializer to be exported on its own. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 - src/qemu/qemu_tpm.c | 6 ------ src/util/virtpm.c | 4 +++- src/util/virtpm.h | 1 - 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b98cb0f66d..6b179a61b9 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3447,7 +3447,6 @@ virTimeStringThenRaw; =20 # util/virtpm.h virTPMCreateCancelPath; -virTPMEmulatorInit; virTPMGetSwtpm; virTPMGetSwtpmIoctl; virTPMGetSwtpmSetup; diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 62f54f56ab..1b923fd68e 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -295,9 +295,6 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDef *tpm, uid_t qemu_user, const char *shortName) { - if (virTPMEmulatorInit() < 0) - return -1; - /* create log dir ... allow 'tss' user to cd into it */ if (g_mkdir_with_parents(logDir, 0711) < 0) return -1; @@ -804,9 +801,6 @@ qemuTPMEmulatorStop(const char *swtpmStateDir, if (!swtpm_ioctl) return; =20 - if (virTPMEmulatorInit() < 0) - return; - if (!(pathname =3D qemuTPMCreateEmulatorSocket(swtpmStateDir, shortNam= e))) return; =20 diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 2539ea9275..3ea3b668e2 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -132,6 +132,8 @@ static virTPMBinaryInfo swtpmBinaries[VIR_TPM_BINARY_LA= ST] =3D { }, }; =20 +static int virTPMEmulatorInit(void); + static char * virTPMBinaryGetPath(virTPMBinary binary) { @@ -264,7 +266,7 @@ virTPMGetCaps(virTPMBinaryCapsParse capsParse, * Initialize the Emulator functions by searching for necessary * executables that we will use to start and setup the swtpm */ -int +static int virTPMEmulatorInit(void) { int ret =3D -1; diff --git a/src/util/virtpm.h b/src/util/virtpm.h index defea6c106..4c16332f9b 100644 --- a/src/util/virtpm.h +++ b/src/util/virtpm.h @@ -25,7 +25,6 @@ char *virTPMCreateCancelPath(const char *devpath) G_GNUC_= NO_INLINE; char *virTPMGetSwtpm(void); char *virTPMGetSwtpmSetup(void); char *virTPMGetSwtpmIoctl(void); -int virTPMEmulatorInit(void); =20 bool virTPMSwtpmCapsGet(unsigned int cap); bool virTPMSwtpmSetupCapsGet(unsigned int cap); --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 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=1637768693; cv=none; d=zohomail.com; s=zohoarc; b=jeU1PBdkNR3lUUkwVDkU+ol7kx0VMvi/r+CQMCsvKqs4n5ry5gsa1HeKU2uzW6b4JOm+WOaGUVP5GmIq/IGiGhyk4844hiiQP7lYv7URLTdQHzbUMW8z7Mg2SGn7Odg2rs2KsNQgt8VOXR4zPxV7Q/8Fa78JDSxz8eXJxP6+hdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768693; 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=GDTO65siKuNayXPFlHctHyoESk9lqDoyPFC7UYDI/cc=; b=h6/Pay++1X3oxol4adIiye3nl9X1S2QXdcFj5rX01Q0O793G4w7rCsPEAbsBmUQdLIHSohq1RdO4Zpqk000492MztUO4Ar4fNVPUr9rIYIdsNSw9pbiIkInQnW1Wg5LBIrAtVSTYxUKk5PCr1yUu6NBxUBuO36nfzafzv/Q9XS4= 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 1637768693370617.471514289132; Wed, 24 Nov 2021 07:44:53 -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-303-W9jmG_iAM8CG58wDKlNXbA-1; Wed, 24 Nov 2021 10:44:50 -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 B0A671018731; Wed, 24 Nov 2021 15:44:45 +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 902841017CE5; Wed, 24 Nov 2021 15:44:45 +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 60E5B4CA9B; Wed, 24 Nov 2021 15:44:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFiWbU027919 for ; Wed, 24 Nov 2021 10:44:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7C42C79454; Wed, 24 Nov 2021 15:44:32 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDFDA7945A; Wed, 24 Nov 2021 15:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768692; 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=GDTO65siKuNayXPFlHctHyoESk9lqDoyPFC7UYDI/cc=; b=GOnuCgctlh3igMP+8OdUsZUbaQrNqq2pXpfHbZIfJgTHZyhz5tqD/1Awy+mP+w3/cR0WS5 zvPZBNYZ5RzmRCFxNsEvojTZea+lVv4JysrsHi/7qXGcpOyGyE+8ddUrQ4ZNkMdT7VSLJ0 WOJZaEVhAosdbNcsh57MkZzUagrlAlU= X-MC-Unique: W9jmG_iAM8CG58wDKlNXbA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 06/12] util: ensure all TPM global vars access is protected by lock Date: Wed, 24 Nov 2021 15:44:10 +0000 Message-Id: <20211124154416.369770-7-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768694182100001 The virTPMEmulatorInit method updates various global variables and holds a lock while doing so. Other methods which access these variables, however, don't reliably hold locks over all of their accesses. Since virTPMEmulatorInit is no longer exported, we can push the locking up into all the callers and achieve proper safety for concurrent usage. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virtpm.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 3ea3b668e2..7e75c74d67 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -137,15 +137,17 @@ static int virTPMEmulatorInit(void); static char * virTPMBinaryGetPath(virTPMBinary binary) { - char *s; - - if (!swtpmBinaries[binary].path && virTPMEmulatorInit() < 0) - return NULL; + char *s =3D NULL; =20 virMutexLock(&swtpm_tools_lock); + + if (virTPMEmulatorInit() < 0) + goto cleanup; + s =3D g_strdup(swtpmBinaries[binary].path); - virMutexUnlock(&swtpm_tools_lock); =20 + cleanup: + virMutexUnlock(&swtpm_tools_lock); return s; } =20 @@ -269,11 +271,8 @@ virTPMGetCaps(virTPMBinaryCapsParse capsParse, static int virTPMEmulatorInit(void) { - int ret =3D -1; size_t i; =20 - virMutexLock(&swtpm_tools_lock); - for (i =3D 0; i < VIR_TPM_BINARY_LAST; i++) { g_autofree char *path =3D NULL; bool findit =3D swtpmBinaries[i].path =3D=3D NULL; @@ -297,18 +296,18 @@ virTPMEmulatorInit(void) virReportSystemError(ENOENT, _("Unable to find '%s' binary in $PAT= H"), virTPMBinaryTypeToString(i)); - goto cleanup; + return -1; } if (!virFileIsExecutable(path)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s is not an executable"), path); - goto cleanup; + return -1; } if (stat(path, &swtpmBinaries[i].stat) < 0) { virReportSystemError(errno, _("Could not stat %s"), path); - goto cleanup; + return -1; } swtpmBinaries[i].path =3D g_steal_pointer(&path); =20 @@ -317,26 +316,29 @@ virTPMEmulatorInit(void) swtpmBinaries[i].pat= h, swtpmBinaries[i].par= m); if (!swtpmBinaries[i].caps) - goto cleanup; + return -1; } } } =20 - ret =3D 0; - - cleanup: - virMutexUnlock(&swtpm_tools_lock); - - return ret; + return 0; } =20 static bool virTPMBinaryGetCaps(virTPMBinary binary, unsigned int cap) { + bool ret =3D false; + + virMutexLock(&swtpm_tools_lock); + if (virTPMEmulatorInit() < 0) - return false; - return virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); + goto cleanup; + ret =3D virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); + + cleanup: + virMutexUnlock(&swtpm_tools_lock); + return ret; } =20 bool --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637768709; cv=none; d=zohomail.com; s=zohoarc; b=Hsi5NmE/2KQCwKMBzcSXQkHM3mDEsjDUnWiobLLQGftCgsC3ZOSF8hABIAEeE29SzSNB6c9X/BMWpsYEz8RCC/mtMjGNvu5UnX6+T/KFvGQjeYX6m/tYUSYBTJFS7fCbg7UIlZWIUTiek4AfwZzj4d87WS8J9SVhSglxUbPMF9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768709; 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=CzT2XtC++funigQ3wE24QQ1tL6kpXt3d1Q7VQYrqEh8=; b=A/C9GXuQLEk1uheGoheFKBvAocv+U0zFUIE6VH7dKQcskoVU7M89tPTv57RBAD9t1Fzv0h5mAn5Uym2dlhDLnqVmQw3SaJwK8CIWHKw5Vkh+eC3EjGfzIHCdRyJ+kRnEdB38ejrHqxO/pgTDltSl9fTnw+i7nzPIrwnMy9Tderg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1637768709705296.34231051410063; Wed, 24 Nov 2021 07:45:09 -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-314-jQE4D__aNvicxdoHD4_L3w-1; Wed, 24 Nov 2021 10:45:04 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B82AA81EE70; Wed, 24 Nov 2021 15:44:53 +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 9A88A4ABA4; Wed, 24 Nov 2021 15:44:53 +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 679944A709; Wed, 24 Nov 2021 15:44:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFiXhN027929 for ; Wed, 24 Nov 2021 10:44:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5E72479457; Wed, 24 Nov 2021 15:44:33 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id C17D279454; Wed, 24 Nov 2021 15:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768708; 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=CzT2XtC++funigQ3wE24QQ1tL6kpXt3d1Q7VQYrqEh8=; b=SrvYfDJ1NoddoY2ZrgHRsp6x44qLrA78x0JleC/DCFj1R5j6L/f8JQcNNoQsW5R3nf8anh WYMnMjqa7IR3JKTvk51xOCnwjTzH2pc2iLcsm3aavE318sL0/en4b9GybJ9KfXq8Opn+lI 7OC00t8C2WU3uzgD6ZgakmUARgNC+Ng= X-MC-Unique: jQE4D__aNvicxdoHD4_L3w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 07/12] util: pull TPM capabilities probing out of main init method Date: Wed, 24 Nov 2021 15:44:11 +0000 Message-Id: <20211124154416.369770-8-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768710884100001 Many methods merely want to know that the swtpm binaries have been found, and don't care about probing for capabilities. Even when starting a guest, the QEMU driver may not need the capabilities. Skipping probing ensures the VM startup path is as fast as possible when capabilities are not required. It also removes various error scenarios from the main init method. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virtpm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 7e75c74d67..ec51c0efb3 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -310,14 +310,8 @@ virTPMEmulatorInit(void) return -1; } swtpmBinaries[i].path =3D g_steal_pointer(&path); - - if (swtpmBinaries[i].capsParse) { - swtpmBinaries[i].caps =3D virTPMGetCaps(swtpmBinaries[i].c= apsParse, - swtpmBinaries[i].pat= h, - swtpmBinaries[i].par= m); - if (!swtpmBinaries[i].caps) - return -1; - } + virBitmapFree(swtpmBinaries[i].caps); + swtpmBinaries[i].caps =3D NULL; } } =20 @@ -334,7 +328,16 @@ virTPMBinaryGetCaps(virTPMBinary binary, =20 if (virTPMEmulatorInit() < 0) goto cleanup; - ret =3D virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); + + if (!swtpmBinaries[binary].caps && + swtpmBinaries[binary].capsParse) { + swtpmBinaries[binary].caps =3D virTPMGetCaps( + swtpmBinaries[binary].capsParse, + swtpmBinaries[binary].path, + swtpmBinaries[binary].parm); + } + if (swtpmBinaries[binary].caps) + ret =3D virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); =20 cleanup: virMutexUnlock(&swtpm_tools_lock); --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 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=1637768698; cv=none; d=zohomail.com; s=zohoarc; b=blCTa/Sny4D/wjlnP4tSagobCJPda+FwDZr4lPmlfWzGYE8H/mfzqttocqxM+KvSwqhB3DEnedZkRE6KVU8dpBVwcbi9Fcz0pbGHc0RVz3sZU48y1BtAKU9wV5RmgWHB8eD39w3tAu1ip1oFt/JPEbqMRJPmx6qCGh7LMzSXgxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768698; 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=O4JID6HEM4LwSZ/brJEpgpJfMycxLkbGELCadWU7g4c=; b=kHizyrMDY1nY5FXigp9HqaNKyI+fB2c5e5cPFmVasD0672SM2NoI5Sxg09IeLaZbE7rqOrZVQ2GERitix5vJiAFJY32taSnQie2M/LLnRVkNldnCHKPxvZBHsrM4TXfHKad/nODg2LFG/nYt1kjIqNtamqHpBOLoiirEOExKz/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 1637768698107987.4064387569654; Wed, 24 Nov 2021 07:44:58 -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-201-nJRcktxmNOm4xw3rdeBfpw-1; Wed, 24 Nov 2021 10:44:52 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF3B184BA53; Wed, 24 Nov 2021 15:44:47 +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 CED9B794A4; Wed, 24 Nov 2021 15:44:47 +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 A14E04A7CB; Wed, 24 Nov 2021 15:44:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFid6O027952 for ; Wed, 24 Nov 2021 10:44:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7435271C80; Wed, 24 Nov 2021 15:44:39 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id D761E7945B; Wed, 24 Nov 2021 15:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768696; 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=O4JID6HEM4LwSZ/brJEpgpJfMycxLkbGELCadWU7g4c=; b=FiurajA10r0UR32bNnYMUPn4moQrUrdEcNLIqW/hppYvMjWoI1bR0E47jmKEs3sieomMYD 76cNGO5XfrwBOivS/JcT+bd5WdT1sbDMzetCNhM3jtxluf0XSv9E0j1H9FocIWbSAiAl/E hMVIHI1WxXqQeLoUcwVsMvNXdztm5MI= X-MC-Unique: nJRcktxmNOm4xw3rdeBfpw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 08/12] util: add a method for checking if swtpm is available Date: Wed, 24 Nov 2021 15:44:12 +0000 Message-Id: <20211124154416.369770-9-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768699493100001 The QEMU domain capabilities code wants to quietly know whether swtpm is available on the host. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/util/virtpm.c | 45 +++++++++++++++++++++++++++++----------- src/util/virtpm.h | 2 ++ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6b179a61b9..6aa57abad4 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3450,6 +3450,7 @@ virTPMCreateCancelPath; virTPMGetSwtpm; virTPMGetSwtpmIoctl; virTPMGetSwtpmSetup; +virTPMHasSwtpm; virTPMSwtpmCapsGet; virTPMSwtpmFeatureTypeFromString; virTPMSwtpmSetupCapsGet; diff --git a/src/util/virtpm.c b/src/util/virtpm.c index ec51c0efb3..63579b8e69 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -132,7 +132,7 @@ static virTPMBinaryInfo swtpmBinaries[VIR_TPM_BINARY_LA= ST] =3D { }, }; =20 -static int virTPMEmulatorInit(void); +static int virTPMEmulatorInit(bool quiet); =20 static char * virTPMBinaryGetPath(virTPMBinary binary) @@ -141,7 +141,7 @@ virTPMBinaryGetPath(virTPMBinary binary) =20 virMutexLock(&swtpm_tools_lock); =20 - if (virTPMEmulatorInit() < 0) + if (virTPMEmulatorInit(false) < 0) goto cleanup; =20 s =3D g_strdup(swtpmBinaries[binary].path); @@ -169,6 +169,24 @@ virTPMGetSwtpmIoctl(void) return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM_IOCTL); } =20 +bool virTPMHasSwtpm(void) +{ + bool ret =3D false; + + virMutexLock(&swtpm_tools_lock); + + if (virTPMEmulatorInit(true) < 0) + goto cleanup; + + ret =3D swtpmBinaries[VIR_TPM_BINARY_SWTPM].path !=3D NULL && + swtpmBinaries[VIR_TPM_BINARY_SWTPM_SETUP].path !=3D NULL && + swtpmBinaries[VIR_TPM_BINARY_SWTPM_IOCTL].path !=3D NULL; + + cleanup: + virMutexUnlock(&swtpm_tools_lock); + return ret; +} + /* virTPMExecGetCaps * * Execute the prepared command and parse the returned JSON object @@ -269,7 +287,7 @@ virTPMGetCaps(virTPMBinaryCapsParse capsParse, * executables that we will use to start and setup the swtpm */ static int -virTPMEmulatorInit(void) +virTPMEmulatorInit(bool quiet) { size_t i; =20 @@ -293,20 +311,23 @@ virTPMEmulatorInit(void) =20 path =3D virFindFileInPath(virTPMBinaryTypeToString(i)); if (!path) { - virReportSystemError(ENOENT, - _("Unable to find '%s' binary in $PAT= H"), - virTPMBinaryTypeToString(i)); + if (!quiet) + virReportSystemError(ENOENT, + _("Unable to find '%s' binary in = $PATH"), + virTPMBinaryTypeToString(i)); return -1; } if (!virFileIsExecutable(path)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s is not an executable"), - path); + if (!quiet) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s is not an executable"), + path); return -1; } if (stat(path, &swtpmBinaries[i].stat) < 0) { - virReportSystemError(errno, - _("Could not stat %s"), path); + if (!quiet) + virReportSystemError(errno, + _("Could not stat %s"), path); return -1; } swtpmBinaries[i].path =3D g_steal_pointer(&path); @@ -326,7 +347,7 @@ virTPMBinaryGetCaps(virTPMBinary binary, =20 virMutexLock(&swtpm_tools_lock); =20 - if (virTPMEmulatorInit() < 0) + if (virTPMEmulatorInit(false) < 0) goto cleanup; =20 if (!swtpmBinaries[binary].caps && diff --git a/src/util/virtpm.h b/src/util/virtpm.h index 4c16332f9b..0a82a03b69 100644 --- a/src/util/virtpm.h +++ b/src/util/virtpm.h @@ -26,6 +26,8 @@ char *virTPMGetSwtpm(void); char *virTPMGetSwtpmSetup(void); char *virTPMGetSwtpmIoctl(void); =20 +bool virTPMHasSwtpm(void); + bool virTPMSwtpmCapsGet(unsigned int cap); bool virTPMSwtpmSetupCapsGet(unsigned int cap); =20 --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637768701; cv=none; d=zohomail.com; s=zohoarc; b=M7MzMlra1MVdso8ONj2zUnP0cW/kUAxgfLxfjRlIF0uZeZ7m1/e3BeqZeAfjeJERUyKfXcAvwgGbMSDXcRDYqt68QyAQKtScB3dVOTptQ7/AIBCDh9RQBQMmChrWrrUsy0fT8FOow3EAlKHXhc6TECo3LO56FUn6HNd0lzTAK3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768701; 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=r49ot8BJYuokleG0RC0NuU+Ny49qtR7pXj0YA2INqc4=; b=aGOckK+ghdLCERdqWIQdKtmtel86lZ5HiZtLImeOF9TJOmdTmCz+11MWkOf0ncQFicNGVLp2MV06tAyAPxKSVmvE/B1qLm7+gTVXSXTZeWAMP+tbsvRDGAocOJonHdBM1k+ICxedQH7S2S5OZy85K/s8l3TX1NszGB7OoVZc1JM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1637768701462330.2480482749635; Wed, 24 Nov 2021 07:45:01 -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-142-VTKCYVzGPE-ZGyypuCWtIw-1; Wed, 24 Nov 2021 10:44:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1741A1018737; Wed, 24 Nov 2021 15:44:49 +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 EC84C7945C; Wed, 24 Nov 2021 15:44:48 +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 C06864A700; Wed, 24 Nov 2021 15:44:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFieTY027958 for ; Wed, 24 Nov 2021 10:44:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 589F679454; Wed, 24 Nov 2021 15:44:40 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA49D7945C; Wed, 24 Nov 2021 15:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768700; 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=r49ot8BJYuokleG0RC0NuU+Ny49qtR7pXj0YA2INqc4=; b=BLOgXxwnnGDyX6Va3kj2ItfwzOv/FQko5lvb89vRSIKoUIqd+DHXr7iI/Hrb7F7MOhzgFJ tcgArw6L7orOOMCZ63gZeE7CVgwUeS8EEdTcQmsBQPNgmEWpaJIWmbfA+3k5QpcSJZJzhC tmCTDMxpfBpq+e1DyGzz1h8IMdJxKg0= X-MC-Unique: VTKCYVzGPE-ZGyypuCWtIw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 09/12] conf: add TPM devices to domain capabilities Date: Wed, 24 Nov 2021 15:44:13 +0000 Message-Id: <20211124154416.369770-10-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768702425100001 This adds reporting of available TPM models and backends to the domain capabilities schema Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- docs/schemas/domaincaps.rng | 10 ++++++++++ src/conf/domain_capabilities.c | 14 ++++++++++++++ src/conf/domain_capabilities.h | 10 ++++++++++ 3 files changed, 34 insertions(+) diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index 8b5267f741..1b6122507f 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -195,6 +195,9 @@ + + + =20 @@ -240,6 +243,13 @@ =20 + + + + + + + diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 1766129092..fef1326190 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -533,6 +533,19 @@ virDomainCapsDeviceRNGFormat(virBuffer *buf, } =20 =20 +static void +virDomainCapsDeviceTPMFormat(virBuffer *buf, + const virDomainCapsDeviceTPM *tpm) +{ + FORMAT_PROLOGUE(tpm); + + ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString); + ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString); + + FORMAT_EPILOGUE(tpm); +} + + static void virDomainCapsDeviceFilesystemFormat(virBuffer *buf, const virDomainCapsDeviceFilesystem *f= ilesystem) @@ -652,6 +665,7 @@ virDomainCapsFormat(const virDomainCaps *caps) virDomainCapsDeviceHostdevFormat(&buf, &caps->hostdev); virDomainCapsDeviceRNGFormat(&buf, &caps->rng); virDomainCapsDeviceFilesystemFormat(&buf, &caps->filesystem); + virDomainCapsDeviceTPMFormat(&buf, &caps->tpm); =20 virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index d44acdcd01..2fcad87fd8 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -120,6 +120,15 @@ struct _virDomainCapsDeviceRNG { virDomainCapsEnum backendModel; /* virDomainRNGBackend */ }; =20 +STATIC_ASSERT_ENUM(VIR_DOMAIN_TPM_MODEL_LAST); +STATIC_ASSERT_ENUM(VIR_DOMAIN_TPM_TYPE_LAST); +typedef struct _virDomainCapsDeviceTPM virDomainCapsDeviceTPM; +struct _virDomainCapsDeviceTPM { + virTristateBool supported; + virDomainCapsEnum model; /* virDomainTPMModel */ + virDomainCapsEnum backendModel; /* virDomainTPMBackendType */ +}; + STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST); typedef struct _virDomainCapsDeviceFilesystem virDomainCapsDeviceFilesyste= m; struct _virDomainCapsDeviceFilesystem { @@ -211,6 +220,7 @@ struct _virDomainCaps { virDomainCapsDeviceHostdev hostdev; virDomainCapsDeviceRNG rng; virDomainCapsDeviceFilesystem filesystem; + virDomainCapsDeviceTPM tpm; /* add new domain devices here */ =20 virDomainCapsFeatureGIC gic; --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 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=1637768776; cv=none; d=zohomail.com; s=zohoarc; b=YFJbDplx4b1UHUCsEc8/o1lSqZj3shz8TRUNK2kkLAwQ+aSGboubfMVJJr8COTOxgJQpqqinjnGGguY1m9zRCrCAl1LpzVLzGcTKDx1Yy+4kft03qBsp+J4L68YfNEb4yI7zBe7XltGn5U21pM+hwkMR5vjgw4OIVSnMFiFk4CY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768776; 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=gqSc6Jpd/XWtMUdYDYHJidsI9i+02VCOU3ZKFwNwiF0=; b=lXYvtBkQYHc68DXHHMynxNwjOHlRBUKmi8qoUtHup2CN1uzGFQrmEHhnw1gQegk8klBwJIqMTCgWHuGWszMsWSadiyyLpMTS1SPrSiEly+HWAKVMzULt9b3NrOtb3YMdMZvDwvDfW3C6ulHk9Qyj4Dn4eKX/f5mb6NWXewypdqo= 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 1637768776344302.57805288928205; Wed, 24 Nov 2021 07:46:16 -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-291-wJ73yjd_NqWruKonAKMjHg-1; Wed, 24 Nov 2021 10:45:01 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2A25884BA50; Wed, 24 Nov 2021 15:44: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 0CDEE5D9C0; Wed, 24 Nov 2021 15:44: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 D268A1809CBF; Wed, 24 Nov 2021 15:44:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFifNu027975 for ; Wed, 24 Nov 2021 10:44:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 828F6794A1; Wed, 24 Nov 2021 15:44:41 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id A148C71C80; Wed, 24 Nov 2021 15:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768775; 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=gqSc6Jpd/XWtMUdYDYHJidsI9i+02VCOU3ZKFwNwiF0=; b=PQqaEwpmXUb2OshtetIg55UYQy0gGctB49/K7U9zgur/uvPMZj9nKMmhnnl6eYf57hal9y 0uclNUqxoL4lygIZ3DjZT0tMRC3dzDgx5UgvFTY3FNIb8jDcYkq9dmSxu3iEQuAEI97pU0 KceLkqEwl2qzJJUVqZymnKHB4KJ8aaY= X-MC-Unique: wJ73yjd_NqWruKonAKMjHg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 10/12] qemu: fill in domain capabilities for TPMs Date: Wed, 24 Nov 2021 15:44:14 +0000 Message-Id: <20211124154416.369770-11-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768778619100001 This reports what TPM features QEMU supports, provided that swtpm is installed in the host. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_capabilities.c | 34 +++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 ++ .../domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 8 +++++ .../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 8 +++++ tests/domaincapsdata/qemu_2.11.0.s390x.xml | 1 + tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 8 +++++ .../domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 9 +++++ .../qemu_2.12.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_2.12.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_2.12.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsdata/qemu_2.12.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_3.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_3.0.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_3.0.0.s390x.xml | 1 + tests/domaincapsdata/qemu_3.0.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_3.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_3.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_3.1.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_3.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.0.0-tcg.x86_64.xml | 9 +++++ .../qemu_4.0.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_4.0.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_4.0.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_4.0.0.s390x.xml | 1 + tests/domaincapsdata/qemu_4.0.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 9 +++++ .../qemu_4.2.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 6 ++++ tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 + tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 9 +++++ .../qemu_5.0.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 9 +++++ tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_5.1.0.sparc.xml | 1 + tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 9 +++++ .../qemu_5.2.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 9 +++++ tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 + tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 9 +++++ .../qemu_6.0.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 + tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 9 +++++ .../qemu_6.2.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 9 +++++ tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 9 +++++ 71 files changed, 500 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 33797469a6..b2d320e67a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -49,6 +49,7 @@ #include "qemu_process.h" #include "qemu_firmware.h" #include "virutil.h" +#include "virtpm.h" =20 #include #include @@ -6201,6 +6202,37 @@ virQEMUCapsFillDomainDeviceFSCaps(virQEMUCaps *qemuC= aps, } =20 =20 +void +virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps, + virDomainCapsDeviceTPM *tpm) +{ + tpm->supported =3D VIR_TRISTATE_BOOL_YES; + tpm->model.report =3D true; + tpm->backendModel.report =3D true; + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_TIS)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_TIS); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_CRB)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_CRB); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_SPAPR)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_SPAPR); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_SPAPR_PR= OXY); + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_PA= SSTHROUGH); + if (virTPMHasSwtpm() && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EM= ULATOR); + + /* + * Need at least one frontend if it is to be usable by applications + */ + if (!tpm->model.values) + tpm->supported =3D VIR_TRISTATE_BOOL_NO; +} + + /** * virQEMUCapsSupportsGICVersion: * @qemuCaps: QEMU capabilities @@ -6345,6 +6377,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virDomainCapsDeviceVideo *video =3D &domCaps->video; virDomainCapsDeviceRNG *rng =3D &domCaps->rng; virDomainCapsDeviceFilesystem *filesystem =3D &domCaps->filesystem; + virDomainCapsDeviceTPM *tpm =3D &domCaps->tpm; virDomainCapsMemoryBacking *memoryBacking =3D &domCaps->memoryBacking; =20 virQEMUCapsFillDomainFeaturesFromQEMUCaps(qemuCaps, domCaps); @@ -6376,6 +6409,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev); virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng); virQEMUCapsFillDomainDeviceFSCaps(qemuCaps, filesystem); + virQEMUCapsFillDomainDeviceTPMCaps(qemuCaps, tpm); virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps); virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps); virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 61bdbdb2ac..716e09123c 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -803,6 +803,9 @@ void virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCaps *qe= muCaps, void virQEMUCapsFillDomainDeviceFSCaps(virQEMUCaps *qemuCaps, virDomainCapsDeviceFilesystem *file= system); =20 +void virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps, + virDomainCapsDeviceTPM *tpm); + bool virQEMUCapsGuestIsNative(virArch host, virArch guest); =20 diff --git a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml b/tests/domain= capsdata/qemu_2.11.0-q35.x86_64.xml index e18b33e044..79d14234fe 100644 --- a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml @@ -170,6 +170,14 @@ handle + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml b/tests/domain= capsdata/qemu_2.11.0-tcg.x86_64.xml index 97402b1d4c..fc71f9cc7c 100644 --- a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml @@ -183,6 +183,14 @@ handle + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_2.11.0.s390x.xml b/tests/domaincapsd= ata/qemu_2.11.0.s390x.xml index a52e436538..804bf8020e 100644 --- a/tests/domaincapsdata/qemu_2.11.0.s390x.xml +++ b/tests/domaincapsdata/qemu_2.11.0.s390x.xml @@ -205,6 +205,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml b/tests/domaincaps= data/qemu_2.11.0.x86_64.xml index 83ebb741cc..44d57900e2 100644 --- a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0.x86_64.xml @@ -170,6 +170,14 @@ handle + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml b/tests/domain= capsdata/qemu_2.12.0-q35.x86_64.xml index eb876a3748..e9082540b7 100644 --- a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml @@ -185,6 +185,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml b/tests/domain= capsdata/qemu_2.12.0-tcg.x86_64.xml index 2c9a7a1c22..1c91661942 100644 --- a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml @@ -195,6 +195,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml b/tests/doma= incapsdata/qemu_2.12.0-virt.aarch64.xml index 6407b7ca36..2074c89875 100644 --- a/tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml @@ -155,6 +155,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_2.12.0.aarch64.xml b/tests/domaincap= sdata/qemu_2.12.0.aarch64.xml index 27b717318a..a93313f980 100644 --- a/tests/domaincapsdata/qemu_2.12.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.aarch64.xml @@ -153,6 +153,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_2.12.0.ppc64.xml b/tests/domaincapsd= ata/qemu_2.12.0.ppc64.xml index 26006d2c08..cb3edcbd56 100644 --- a/tests/domaincapsdata/qemu_2.12.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.ppc64.xml @@ -123,6 +123,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_2.12.0.s390x.xml b/tests/domaincapsd= ata/qemu_2.12.0.s390x.xml index f289a4893c..5c3d9ce7db 100644 --- a/tests/domaincapsdata/qemu_2.12.0.s390x.xml +++ b/tests/domaincapsdata/qemu_2.12.0.s390x.xml @@ -205,6 +205,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml b/tests/domaincaps= data/qemu_2.12.0.x86_64.xml index 8d9cebe20c..2e5e63308d 100644 --- a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.x86_64.xml @@ -185,6 +185,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_3.0.0-q35.x86_64.xml index 20b30564f4..ab63745e97 100644 --- a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml @@ -186,6 +186,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_3.0.0-tcg.x86_64.xml index 45f578183e..119b7020a7 100644 --- a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml @@ -198,6 +198,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_3.0.0.ppc64.xml b/tests/domaincapsda= ta/qemu_3.0.0.ppc64.xml index 36fc07f20c..8605db5cc8 100644 --- a/tests/domaincapsdata/qemu_3.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_3.0.0.ppc64.xml @@ -125,6 +125,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_3.0.0.s390x.xml b/tests/domaincapsda= ta/qemu_3.0.0.s390x.xml index 2aa34677c0..f49b6907ff 100644 --- a/tests/domaincapsdata/qemu_3.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_3.0.0.s390x.xml @@ -212,6 +212,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_3.0.0.x86_64.xml index 19595be2b4..087f3608b2 100644 --- a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0.x86_64.xml @@ -186,6 +186,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_3.1.0-q35.x86_64.xml index 62fbd05ccc..5c0cf79efd 100644 --- a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml @@ -189,6 +189,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_3.1.0-tcg.x86_64.xml index 092a8db6b3..e51dc28f79 100644 --- a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml @@ -201,6 +201,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_3.1.0.ppc64.xml b/tests/domaincapsda= ta/qemu_3.1.0.ppc64.xml index a45bbc7fe5..8035f7230a 100644 --- a/tests/domaincapsdata/qemu_3.1.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_3.1.0.ppc64.xml @@ -125,6 +125,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_3.1.0.x86_64.xml index 3c4b6d9e00..5b42add078 100644 --- a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0.x86_64.xml @@ -189,6 +189,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_4.0.0-q35.x86_64.xml index ba406ef7fd..5e20814beb 100644 --- a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml @@ -189,6 +189,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_4.0.0-tcg.x86_64.xml index 72b5c236d2..fa41ed288b 100644 --- a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml @@ -202,6 +202,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.0.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_4.0.0-virt.aarch64.xml index 5dd21b50dc..7108efe3b4 100644 --- a/tests/domaincapsdata/qemu_4.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-virt.aarch64.xml @@ -162,6 +162,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_4.0.0.aarch64.xml b/tests/domaincaps= data/qemu_4.0.0.aarch64.xml index fd0543974d..1e7db635d0 100644 --- a/tests/domaincapsdata/qemu_4.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.aarch64.xml @@ -160,6 +160,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_4.0.0.ppc64.xml b/tests/domaincapsda= ta/qemu_4.0.0.ppc64.xml index ad1a1a399a..f109d36266 100644 --- a/tests/domaincapsdata/qemu_4.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.ppc64.xml @@ -126,6 +126,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_4.0.0.s390x.xml b/tests/domaincapsda= ta/qemu_4.0.0.s390x.xml index ede04824e9..b810ad737a 100644 --- a/tests/domaincapsdata/qemu_4.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_4.0.0.s390x.xml @@ -222,6 +222,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_4.0.0.x86_64.xml index cd086b7e3a..14f0062817 100644 --- a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.x86_64.xml @@ -189,6 +189,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_4.1.0-q35.x86_64.xml index 233f49a21b..f1446f8655 100644 --- a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml @@ -195,6 +195,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_4.1.0-tcg.x86_64.xml index 03ebf381d0..77aca157b1 100644 --- a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml @@ -204,6 +204,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_4.1.0.x86_64.xml index 8806f2d8d6..854d62b89e 100644 --- a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml @@ -195,6 +195,15 @@ handle + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_4.2.0-q35.x86_64.xml index 5df0f5f488..739e0c6a13 100644 --- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml @@ -203,6 +203,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_4.2.0-tcg.x86_64.xml index 2b306b27f3..30de3cede7 100644 --- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml @@ -211,6 +211,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_4.2.0-virt.aarch64.xml index 792bac1298..05d606967b 100644 --- a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml @@ -164,6 +164,7 @@ virtiofs + diff --git a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml b/tests/domaincaps= data/qemu_4.2.0.aarch64.xml index 7b6f3a851a..f19ad5e6db 100644 --- a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml @@ -162,6 +162,7 @@ virtiofs + diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_4.2.0.ppc64.xml index 728f4e87fc..4c3a2c6d98 100644 --- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml @@ -127,6 +127,12 @@ handle + + + spapr-tpm-proxy + + + diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsda= ta/qemu_4.2.0.s390x.xml index f344b289b2..fb162ea578 100644 --- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml @@ -237,6 +237,7 @@ virtiofs + diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsd= ata/qemu_4.2.0.x86_64.xml index fd8d3a8656..6b8e895ff6 100644 --- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml @@ -203,6 +203,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_5.0.0-q35.x86_64.xml index 941d65431e..b0eba3550a 100644 --- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml @@ -205,6 +205,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_5.0.0-tcg.x86_64.xml index 98511dffd7..fdce0eaaad 100644 --- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml @@ -212,6 +212,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_5.0.0-virt.aarch64.xml index d673ddfaad..f926e025aa 100644 --- a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml @@ -165,6 +165,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml b/tests/domaincaps= data/qemu_5.0.0.aarch64.xml index b879287180..3c842d3642 100644 --- a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml @@ -163,6 +163,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsda= ta/qemu_5.0.0.ppc64.xml index 14d0bc3eaf..f85f4e6268 100644 --- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml @@ -128,6 +128,15 @@ virtiofs + + + tpm-spapr + spapr-tpm-proxy + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_5.0.0.x86_64.xml index 6bab719f7e..4a4893c030 100644 --- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml @@ -205,6 +205,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_5.1.0-q35.x86_64.xml index addffcd080..5b4bb4246e 100644 --- a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml @@ -206,6 +206,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_5.1.0-tcg.x86_64.xml index 5a094acbdb..b28f7dd549 100644 --- a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml @@ -212,6 +212,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.1.0.sparc.xml b/tests/domaincapsda= ta/qemu_5.1.0.sparc.xml index ddcffd9d44..5c1c0c4680 100644 --- a/tests/domaincapsdata/qemu_5.1.0.sparc.xml +++ b/tests/domaincapsdata/qemu_5.1.0.sparc.xml @@ -104,6 +104,7 @@ handle + diff --git a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_5.1.0.x86_64.xml index 428c6e30e8..1eabdf1a6d 100644 --- a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml @@ -206,6 +206,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_5.2.0-q35.x86_64.xml index db262241c7..794e1d7b22 100644 --- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml @@ -206,6 +206,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_5.2.0-tcg.x86_64.xml index 4538cf0dc8..e8ec912cee 100644 --- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml @@ -212,6 +212,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_5.2.0-virt.aarch64.xml index fb1118e33e..14d93448e9 100644 --- a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml @@ -165,6 +165,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml b/tests/domaincaps= data/qemu_5.2.0.aarch64.xml index b879287180..3c842d3642 100644 --- a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml @@ -163,6 +163,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_5.2.0.ppc64.xml index 094295ff29..7691d1d762 100644 --- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml @@ -128,6 +128,15 @@ virtiofs + + + tpm-spapr + spapr-tpm-proxy + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsda= ta/qemu_5.2.0.s390x.xml index c30de65f88..2a2ca8abcf 100644 --- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml @@ -239,6 +239,7 @@ virtiofs + diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsd= ata/qemu_5.2.0.x86_64.xml index a6a8f0ab43..f6911b06b3 100644 --- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml @@ -206,6 +206,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_6.0.0-q35.x86_64.xml index b7ac45c731..d59772cbf6 100644 --- a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml @@ -207,6 +207,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_6.0.0-tcg.x86_64.xml index 6f53b3ea0f..7a0ee26854 100644 --- a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml @@ -213,6 +213,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_6.0.0-virt.aarch64.xml index 7a52cce114..ca66634456 100644 --- a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml @@ -166,6 +166,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml b/tests/domaincaps= data/qemu_6.0.0.aarch64.xml index c51e361c7f..7c2d0c6120 100644 --- a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml @@ -164,6 +164,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsda= ta/qemu_6.0.0.s390x.xml index d6d8262a34..13fa3a637e 100644 --- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml @@ -240,6 +240,7 @@ virtiofs + diff --git a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_6.0.0.x86_64.xml index 71aefb5bff..3255765c75 100644 --- a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml @@ -207,6 +207,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_6.1.0-q35.x86_64.xml index bae2187aa2..86fdf9b884 100644 --- a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml @@ -208,6 +208,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_6.1.0-tcg.x86_64.xml index a9b4011557..034273c847 100644 --- a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml @@ -213,6 +213,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_6.1.0.x86_64.xml index 5a261f2d0e..4a943c4f36 100644 --- a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml @@ -208,6 +208,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_6.2.0-q35.x86_64.xml index df8bdae102..52819a9532 100644 --- a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml @@ -208,6 +208,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_6.2.0-tcg.x86_64.xml index 4d12105659..7d14e53255 100644 --- a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml @@ -214,6 +214,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_6.2.0-virt.aarch64.xml index 8b590fd40d..665f7e568f 100644 --- a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml @@ -168,6 +168,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml b/tests/domaincaps= data/qemu_6.2.0.aarch64.xml index 496b910336..e1005392e1 100644 --- a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml @@ -166,6 +166,14 @@ virtiofs + + + tpm-tis + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_6.2.0.ppc64.xml index 93c901816e..720d6ad885 100644 --- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml @@ -126,6 +126,15 @@ virtiofs + + + tpm-spapr + spapr-tpm-proxy + + + passthrough + + diff --git a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml b/tests/domaincapsd= ata/qemu_6.2.0.x86_64.xml index c382ec462c..beb473cd73 100644 --- a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml @@ -208,6 +208,15 @@ virtiofs + + + tpm-tis + tpm-crb + + + passthrough + + --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637768702; cv=none; d=zohomail.com; s=zohoarc; b=AYfq6f86hnRvq+6Qg2lzqwkmeJGXdu453pLcZQCj48vVfZesWAnPPtIFlMOgM3MfJh/sPd9u619YW9CY0e3D2DhrTIvwqGCIgYjEhwkoipSQUb53mdrwjC3ulWlbaLdo6S1rzCFoeLjvKQN6fzazyP1x1iI9hvOh31zM1Zi9Q2w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768702; 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=e/PMtjsihVn7mGf0h9ICXJ7ZrTsyEuIcg2oRj3Tbn8c=; b=h4w0fwNeQ6nYATq46piHIwMQXwQ7RtCKcUDQwZv14hjUDYqW3eviOwMmWS25FDAawpQPD7sXwmPUs4RoC2IH+b72upzBiRdQkl8i4Xncawj7kqK8EvCSx1EcQI+/kWsPLhnEHgRba5s01YekOti4ww+P+TqCzH0vs6CbuOqPceU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1637768702038762.0656044948439; Wed, 24 Nov 2021 07:45:02 -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-234-0kQZewvsMoCSmw5UDBnP2Q-1; Wed, 24 Nov 2021 10:44:58 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C3B356B36; Wed, 24 Nov 2021 15:44:51 +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 82B786060F; Wed, 24 Nov 2021 15:44: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 581954A707; Wed, 24 Nov 2021 15:44:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFig8s027980 for ; Wed, 24 Nov 2021 10:44:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 75563794A1; Wed, 24 Nov 2021 15:44:42 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA14B71C80; Wed, 24 Nov 2021 15:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768700; 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=e/PMtjsihVn7mGf0h9ICXJ7ZrTsyEuIcg2oRj3Tbn8c=; b=HQBX2Owpm9G08OfbSjvKjrGDFgcxVNJr++dbbGk8ovHYHwB7uQTHyMQ1bfUp1Nf0D0AcVB zp0a+Z4wmuI2IGN7uU/5qLcXOlOBmYBUJ6HJDE8m9n3+FUrcF5a6jkpjrD0BjcwIKcGKKR HQBTl2ImI5eBXkwzGK8gvjjH6tyWb/c= X-MC-Unique: 0kQZewvsMoCSmw5UDBnP2Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 11/12] qemu: mock swtpm initialization in tests Date: Wed, 24 Nov 2021 15:44:15 +0000 Message-Id: <20211124154416.369770-12-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768702603100002 The domain capabilities won't report TPM support unless SWTPM can be initialized. To avoid relying on the swtpm install in the host, mock the entire initialization method, since all it needs todo is return a non-error value. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.12.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 1 + tests/domaincapstest.c | 9 +++++++++ 51 files changed, 59 insertions(+) diff --git a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml b/tests/domain= capsdata/qemu_2.11.0-q35.x86_64.xml index 79d14234fe..ea9737d9ce 100644 --- a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml @@ -176,6 +176,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml b/tests/domain= capsdata/qemu_2.11.0-tcg.x86_64.xml index fc71f9cc7c..cccc6830f9 100644 --- a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml @@ -189,6 +189,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml b/tests/domaincaps= data/qemu_2.11.0.x86_64.xml index 44d57900e2..3a8aa2ab71 100644 --- a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0.x86_64.xml @@ -176,6 +176,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml b/tests/domain= capsdata/qemu_2.12.0-q35.x86_64.xml index e9082540b7..9f41dfaf2b 100644 --- a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml @@ -192,6 +192,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml b/tests/domain= capsdata/qemu_2.12.0-tcg.x86_64.xml index 1c91661942..d5f9d8ebe3 100644 --- a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml @@ -202,6 +202,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml b/tests/domaincaps= data/qemu_2.12.0.x86_64.xml index 2e5e63308d..dc2c3ec4dd 100644 --- a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.x86_64.xml @@ -192,6 +192,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_3.0.0-q35.x86_64.xml index ab63745e97..4f80439eb4 100644 --- a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml @@ -193,6 +193,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_3.0.0-tcg.x86_64.xml index 119b7020a7..301101095c 100644 --- a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml @@ -205,6 +205,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_3.0.0.x86_64.xml index 087f3608b2..650728566e 100644 --- a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0.x86_64.xml @@ -193,6 +193,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_3.1.0-q35.x86_64.xml index 5c0cf79efd..c4277c53a1 100644 --- a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml @@ -196,6 +196,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_3.1.0-tcg.x86_64.xml index e51dc28f79..1a5bc25b99 100644 --- a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml @@ -208,6 +208,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_3.1.0.x86_64.xml index 5b42add078..6e3ddda356 100644 --- a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0.x86_64.xml @@ -196,6 +196,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_4.0.0-q35.x86_64.xml index 5e20814beb..8f3911b4b3 100644 --- a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml @@ -196,6 +196,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_4.0.0-tcg.x86_64.xml index fa41ed288b..e744ac27ac 100644 --- a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml @@ -209,6 +209,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_4.0.0.x86_64.xml index 14f0062817..24e732d9c3 100644 --- a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.x86_64.xml @@ -196,6 +196,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_4.1.0-q35.x86_64.xml index f1446f8655..3ee7feea48 100644 --- a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml @@ -202,6 +202,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_4.1.0-tcg.x86_64.xml index 77aca157b1..80b1ce8ef9 100644 --- a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml @@ -211,6 +211,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_4.1.0.x86_64.xml index 854d62b89e..0f1d398e2c 100644 --- a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml @@ -202,6 +202,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_4.2.0-q35.x86_64.xml index 739e0c6a13..c8a77cdd41 100644 --- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml @@ -210,6 +210,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_4.2.0-tcg.x86_64.xml index 30de3cede7..91b3ed6f80 100644 --- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml @@ -218,6 +218,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsd= ata/qemu_4.2.0.x86_64.xml index 6b8e895ff6..6578fd04b6 100644 --- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml @@ -210,6 +210,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_5.0.0-q35.x86_64.xml index b0eba3550a..8a6797c2f1 100644 --- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml @@ -212,6 +212,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_5.0.0-tcg.x86_64.xml index fdce0eaaad..b8737613e9 100644 --- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml @@ -219,6 +219,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_5.0.0-virt.aarch64.xml index f926e025aa..f8cea230d9 100644 --- a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml @@ -171,6 +171,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml b/tests/domaincaps= data/qemu_5.0.0.aarch64.xml index 3c842d3642..ab72b7ffeb 100644 --- a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml @@ -169,6 +169,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsda= ta/qemu_5.0.0.ppc64.xml index f85f4e6268..5772045e35 100644 --- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml @@ -135,6 +135,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_5.0.0.x86_64.xml index 4a4893c030..51ca1d98e0 100644 --- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml @@ -212,6 +212,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_5.1.0-q35.x86_64.xml index 5b4bb4246e..3468fb2e72 100644 --- a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml @@ -213,6 +213,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_5.1.0-tcg.x86_64.xml index b28f7dd549..034036ca96 100644 --- a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml @@ -219,6 +219,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_5.1.0.x86_64.xml index 1eabdf1a6d..8ff49c7899 100644 --- a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml @@ -213,6 +213,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_5.2.0-q35.x86_64.xml index 794e1d7b22..2301a475eb 100644 --- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml @@ -213,6 +213,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_5.2.0-tcg.x86_64.xml index e8ec912cee..d3a4b01234 100644 --- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml @@ -219,6 +219,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_5.2.0-virt.aarch64.xml index 14d93448e9..a863a6052d 100644 --- a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml @@ -171,6 +171,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml b/tests/domaincaps= data/qemu_5.2.0.aarch64.xml index 3c842d3642..ab72b7ffeb 100644 --- a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml @@ -169,6 +169,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_5.2.0.ppc64.xml index 7691d1d762..051b7d43a8 100644 --- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml @@ -135,6 +135,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsd= ata/qemu_5.2.0.x86_64.xml index f6911b06b3..41a54985d7 100644 --- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml @@ -213,6 +213,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_6.0.0-q35.x86_64.xml index d59772cbf6..90acb29775 100644 --- a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml @@ -214,6 +214,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_6.0.0-tcg.x86_64.xml index 7a0ee26854..768cba5a41 100644 --- a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml @@ -220,6 +220,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_6.0.0-virt.aarch64.xml index ca66634456..61eab9de0e 100644 --- a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml @@ -172,6 +172,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml b/tests/domaincaps= data/qemu_6.0.0.aarch64.xml index 7c2d0c6120..fa722b5fd3 100644 --- a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml @@ -170,6 +170,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml b/tests/domaincapsd= ata/qemu_6.0.0.x86_64.xml index 3255765c75..7a95c530f9 100644 --- a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml @@ -214,6 +214,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_6.1.0-q35.x86_64.xml index 86fdf9b884..f4d0fcf673 100644 --- a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml @@ -215,6 +215,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_6.1.0-tcg.x86_64.xml index 034273c847..2c761fc1af 100644 --- a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml @@ -220,6 +220,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml b/tests/domaincapsd= ata/qemu_6.1.0.x86_64.xml index 4a943c4f36..67fc449f5d 100644 --- a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml @@ -215,6 +215,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_6.2.0-q35.x86_64.xml index 52819a9532..9d68c0a404 100644 --- a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml @@ -215,6 +215,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_6.2.0-tcg.x86_64.xml index 7d14e53255..8db840faac 100644 --- a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml @@ -221,6 +221,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml b/tests/domai= ncapsdata/qemu_6.2.0-virt.aarch64.xml index 665f7e568f..f6045623f5 100644 --- a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml @@ -174,6 +174,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml b/tests/domaincaps= data/qemu_6.2.0.aarch64.xml index e1005392e1..35e18adcd5 100644 --- a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml @@ -172,6 +172,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsda= ta/qemu_6.2.0.ppc64.xml index 720d6ad885..8fed9d30b7 100644 --- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml @@ -133,6 +133,7 @@ passthrough + emulator diff --git a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml b/tests/domaincapsd= ata/qemu_6.2.0.x86_64.xml index beb473cd73..0f89790b60 100644 --- a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml @@ -215,6 +215,7 @@ passthrough + emulator diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 4a46acb9ad..479bcb1c35 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -22,6 +22,7 @@ #include "domain_capabilities.h" #include "virfilewrapper.h" #include "configmake.h" +#include "virtpm.h" =20 =20 #define VIR_FROM_THIS VIR_FROM_NONE @@ -126,6 +127,14 @@ fillQemuCaps(virDomainCaps *domCaps, =20 return 0; } + + +/* Enough to tell capabilities code that swtpm is usable */ +bool virTPMHasSwtpm(void) +{ + return true; +} + #endif /* WITH_QEMU */ =20 =20 --=20 2.33.1 From nobody Fri Apr 19 14:36:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637768729; cv=none; d=zohomail.com; s=zohoarc; b=JFWTpilCON3M/omWc/PtYFxqdJnrwx3Vr87wpJZL+BgU27JHudXnvHiuksiUADzEaC1Mq5dJ1bnkA3L9lRYWdIUPTgMVIlOlnRHFNe0sDSjBQ7e7JfnJFhhHYa2zED88CwuG/wIMMw4Lsw1sfMQKEUbGDTEkKoh2Udn9E5IuGoc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637768729; 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=PqfDiTDMZbl7oYlDImroCZNMow4ErrtM0/Az0MukeRI=; b=ZLuavEWiSG7uQ0K4vDs/13fQ0qNtao6aa9IGOvxdXcle78o76w5gpLIRERh3fUn0K6QCjHRNiYfUWYE2yn2YaDknQsRv7XDQwDVAqMBakAJTL0DuP5rdhG5B60hXIjMKPcnBRQNz/REpGfgMZv8YNdaP7P1BENuzPYjjWQgIsoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1637768729517124.96111280110927; Wed, 24 Nov 2021 07:45:29 -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-464-GeFgz45fPCeL76OZSTmX9Q-1; Wed, 24 Nov 2021 10:45:24 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1ADD81EE9A; Wed, 24 Nov 2021 15:45:18 +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 25BC8794B1; Wed, 24 Nov 2021 15:45:18 +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 E48164A705; Wed, 24 Nov 2021 15:45:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AOFjGms028531 for ; Wed, 24 Nov 2021 10:45:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3CE08794A9; Wed, 24 Nov 2021 15:45:16 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 741E879454; Wed, 24 Nov 2021 15:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637768728; 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=PqfDiTDMZbl7oYlDImroCZNMow4ErrtM0/Az0MukeRI=; b=eQN7nEXxaOToMCylJwqsK2f0GS5zQ3MxKd5dgr/C1pAdAPmm/6W4i2ypgM42rI4oV2i+g2 s+9T1MV2OGQWBfgqND5RAYuXzVuqMyRBKaYY2ncYXZeMdstRYiXgwpBswGHpFz15h0ju/K jH1vrtUPrljTvjYRPXI8Ipp5h3YMBgY= X-MC-Unique: GeFgz45fPCeL76OZSTmX9Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 12/12] run: detect daemons when run via wrapper commands Date: Wed, 24 Nov 2021 15:44:16 +0000 Message-Id: <20211124154416.369770-13-berrange@redhat.com> In-Reply-To: <20211124154416.369770-1-berrange@redhat.com> References: <20211124154416.369770-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637768730910100003 The run script tries to detect when a daemon is being run in order to shutdown other systemd unit files that clash. As implemented this only works if the daemon name is the first argument. This won't be the case if running via GDB or strace eg ./run strace -e trace=3Dopenat ./build/src/virtqemud We need to check all argv to find which might be a daemon path/name. Signed-off-by: Daniel P. Berrang=C3=A9 --- run.in | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/run.in b/run.in index 64f99751fe..174b191675 100644 --- a/run.in +++ b/run.in @@ -130,18 +130,18 @@ def change_unit(name, action): =20 try_stop_units =3D [] if is_systemd_host(): - name =3D os.path.basename(prog) - maybe_stopped_units =3D [] - if is_modular_daemon(name): - # Only need to stop libvirtd or this specific modular unit - maybe_stopped_units +=3D daemon_units("libvirtd") - maybe_stopped_units +=3D daemon_units(name) - elif is_monolithic_daemon(name): - # Need to stop libvirtd and/or all modular units - maybe_stopped_units +=3D daemon_units("libvirtd") - for entry in modular_daemons: - maybe_stopped_units +=3D daemon_units(entry) + for arg in sys.argv: + name =3D os.path.basename(arg) + if is_modular_daemon(name): + # Only need to stop libvirtd or this specific modular unit + maybe_stopped_units +=3D daemon_units("libvirtd") + maybe_stopped_units +=3D daemon_units(name) + elif is_monolithic_daemon(name): + # Need to stop libvirtd and/or all modular units + maybe_stopped_units +=3D daemon_units("libvirtd") + for entry in modular_daemons: + maybe_stopped_units +=3D daemon_units(entry) =20 for unit in maybe_stopped_units: if is_unit_active(unit): --=20 2.33.1