From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581524; cv=none; d=zohomail.com; s=zohoarc; b=LmRjoFm0ljmYXnVlrjDR68LEIUeygOWgF6Ge+WQw/YIWkmxX9WoKwuCdSsKc+keWy4tknbGNESAdVAmAmVazforaq/Tzy8Dt7oVY1l51bc5LBpto3VhMLZPvX7pgGBm2WcAYFFF6gHviPUqTu45b6Ye0zHFg/jYKKcC2mxVcdP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581524; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ejQR6GgaCo9vBjKfISLhT3YRO0jX4LKdSEIGf2D39Qg=; b=gYL6iOiHSrs51fhkTCdQlWxjFB6Ve2ijXMHXt7rMAELb6VWEdfxM6/mEG2dzGwErGKd+D0Zz77P4BZrWqQ0Wfb5uuj0t9+xEcFZByGUpS3T/R6tR6EgIf409h9jzS0FXuwjFwU/GzmQCnWqTPtISzosVdm5n9CfavizadN3m9KA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589581524571786.9254037310471; Fri, 15 May 2020 15:25:24 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-2az3kOyEPpWo-6LtmDoZZg-1; Fri, 15 May 2020 18:25:21 -0400 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 C7A6E1005510; Fri, 15 May 2020 22:25:15 +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 3C6445D9C9; Fri, 15 May 2020 22:25:14 +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 11D864E9FE; Fri, 15 May 2020 22:25:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPAB7015250 for ; Fri, 15 May 2020 18:25:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F72FF1C9D; Fri, 15 May 2020 22:25:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B169F1C90 for ; Fri, 15 May 2020 22:25:08 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07C558A19B4 for ; Fri, 15 May 2020 22:25:08 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-94-_eLGIzeWPRKYQ7d9M0jbAg-1; Fri, 15 May 2020 18:25:03 -0400 Received: by mail-qk1-f194.google.com with SMTP id g185so4294739qke.7; Fri, 15 May 2020 15:25:03 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581523; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ejQR6GgaCo9vBjKfISLhT3YRO0jX4LKdSEIGf2D39Qg=; b=DRdb1+kAvAI5RB+y6g2xf3u2ySVPLr48tMcjZQPQcad05fcbBYzSNeYVq+lsB6+HLKGY48 ccH7QRDA19cFLuEQVSP4e89awIv00Lvv4WmmFiSyQCJo3TaFe4JglYh/vfzl6huKqLpqAJ 4RoSoED/OUz1aMTOCLMpHFoMWt007xo= X-MC-Unique: 2az3kOyEPpWo-6LtmDoZZg-1 X-MC-Unique: _eLGIzeWPRKYQ7d9M0jbAg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ejQR6GgaCo9vBjKfISLhT3YRO0jX4LKdSEIGf2D39Qg=; b=JCglDMOU87G3zfq0vePlMIJltVvPGith57j9SGDwtfXRmiOW/jkJ6lJObS0OJCbvqc ak6isv0a9yY+kNcbcLdR+ij8Pbb7bDJJRd3dfhFcjr73niiefVDbGGI2UWzW0GBp15XY /BpGEYm6YkVHqfipkTEmvr52+ZFXwFbf7d5/nqmXzk1KKhA7ZxVoorCf27wkR6uv0DxP I4fDcIW0utkaUztxFQJXxxrbBMwT7fQH3NIuLa+tqV5Yzz0MxFtrREqoQzwU98iSnQVN h+alvh1EOftZqtgkhcLvmXbnNlzNp8lY07ff3ArwateFXGrfiTDVLbd4QteosB2R0v9X F/PA== X-Gm-Message-State: AOAM533Zq1vMvjm1rIy0pZ80YvsGzlXrqRTRSc78Ca4Wc3qnpBhZjjpM d0/HGbPOBVnXR/CfJrPcfOEEAAAu X-Google-Smtp-Source: ABdhPJy5LvcIQmPtLTBXwBtNnD0eNhSpnxcxgXZBXsE3Q34yOkAeiWjzYGMyDYVb0M3K6CTXIr7kDw== X-Received: by 2002:a37:6dc7:: with SMTP id i190mr5453097qkc.135.1589581502793; Fri, 15 May 2020 15:25:02 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 01/10] docs: documentation and schema for the new TPM Proxy model Date: Fri, 15 May 2020 19:24:04 -0300 Message-Id: <20200515222413.1231605-2-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" QEMU 4.1.0 introduced a new device type called TPM Proxy, currently implemented by PPC64 guests via a new virtual device called 'spapr-tpm-proxy' (see QEMU 0fb6bd073230 for more info). The TPM Proxy device interacts with a TPM Resource Manager, a host device capable of multiplexing the host TPM with multiple processes. This allows multiple guests to access some TPM features at the same time. Note that this mode of operation does not provide full TPM features to be available for the guest - for that case the guest still needs to assign a vTPM device (tpm-spapr for PPC64 guests). Although redundant, there is currently no technical limitation for a guest to assign both a vTPM and a TPM Proxy at the same time. This patch adds documentation and schema for a new TPM model type called 'spapr-tpm-proxy' that creates this new TPM Proxy device. This model is valid only for the 'passthrough' backend. An example of a TPM Proxy device connected to a TPM Resource Manager '/dev/tpmrm0' will look like this: Signed-off-by: Daniel Henrique Barboza --- docs/formatdomain.html.in | 19 ++++++++++++++++++- docs/schemas/domaincommon.rng | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 23eb029234..15109e136c 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -8792,6 +8792,18 @@ qemu-kvm -net nic,model=3D? /dev/null backend device is a TPM 2.0. Since 6.1.0, pSeries guests on PPC64 are supported and the default is tpm-spapr. + + Since 6.4.0, a new model called + spapr-tpm-proxy was added for pSeries guests. This = model + only works with the passthrough backend. It creates= a + TPM Proxy device that communicates with an existing TPM Resource= Manager + in the host, for example /dev/tpmrm0, enabling the = guest to + run in secure virtual machine mode with the help of an Ultraviso= r. Adding + a TPM Proxy to a pSeries guest brings no security benefits unles= s the guest + is running on a PPC64 host that has an Ultravisor and a TPM Reso= urce Manager. + Only one TPM Proxy device is allowed per guest, but a TPM Proxy = device can + be added together with + other TPM devices.

backend
@@ -8804,7 +8816,7 @@ qemu-kvm -net nic,model=3D? /dev/null
passthrough

- Use the host's TPM device. + Use the host's TPM or TPM Resource Manager device.

This backend type requires exclusive access to a TPM device = on @@ -8812,6 +8824,11 @@ qemu-kvm -net nic,model=3D? /dev/null qualified file name is specified by path attribute of the source element. If no file name is specified th= en /dev/tpm0 is automatically used. + + Since 6.4.0, when choosing the + spapr-tpm-proxy model, the file name specified = is + expected to be a TPM Resource Manager device, e.g. + /dev/tpmrm0.

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 9d60b090f3..50860419c3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4610,6 +4610,7 @@ tpm-tis tpm-crb tpm-spapr + spapr-tpm-proxy --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581525; cv=none; d=zohomail.com; s=zohoarc; b=AM8Ncri5VTkzrBUITs9XxYv77NXlSTgdQIhPZXNrfHngHWq1bL64oDKt84Xd4KNcYN8W5bf4A6+lN9UIklBBliGx7njfG3au2DndnYnaLlQW0/XPnD/J98Dtm/e9yUySAvQ63ACoaMDUk5iMiS+EvVkFoH1he8F+hhztq2bbmCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581525; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=npBK88VokU2T4owAKENHzsL9m8kGSAgzOm1x9QJxZyU=; b=fe0NzKv8frigfnetXDHlDEkiJs73UH/M0TyQYWuPXnZucajOn1npK6H0jmkxPE9YJZtsa/hJw8+neik+T36yXYSZT73A9m7b+vdv0PMlrslR8rs1plBnt3AMYXpCkPGn5AvKz7xzjZGNQA2cRBPl1nxM4UoQjHdW4VZYFmrzl0o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1589581525197927.9477562364256; Fri, 15 May 2020 15:25:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-gA9AH_0pMzaSXVDIWcZ55w-1; Fri, 15 May 2020 18:25:21 -0400 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 5FC40107ACCA; Fri, 15 May 2020 22:25:16 +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 3D32F1C8; Fri, 15 May 2020 22:25:16 +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 064C61809543; Fri, 15 May 2020 22:25:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPCvG015266 for ; Fri, 15 May 2020 18:25:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2272D10913DA; Fri, 15 May 2020 22:25:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D47B100B8A5 for ; Fri, 15 May 2020 22:25:10 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03342101A525 for ; Fri, 15 May 2020 22:25:10 +0000 (UTC) Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-442-sh5WQSXyMiqgDZtbkVm2tw-1; Fri, 15 May 2020 18:25:05 -0400 Received: by mail-qv1-f67.google.com with SMTP id v15so1893952qvr.8; Fri, 15 May 2020 15:25:05 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581523; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=npBK88VokU2T4owAKENHzsL9m8kGSAgzOm1x9QJxZyU=; b=blalPDIyPwHWbZFlqbYEeIV5A6y/XvF5KLbgmDeaGIn/UoXLeKcudEAStP+vnw27N8vdK8 skSHSBVkfSuT4JtpXNpAOYQf0sqhd7iFbjij1pAHwjMGZzSYBO/dsksDQyx3vyTdFn4mRC 7Fxrppr2T/tWxnejFPZ9Ha+yZUCpAeQ= X-MC-Unique: gA9AH_0pMzaSXVDIWcZ55w-1 X-MC-Unique: sh5WQSXyMiqgDZtbkVm2tw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=npBK88VokU2T4owAKENHzsL9m8kGSAgzOm1x9QJxZyU=; b=YX4xeAVNnhWXLNvI7s5JEBmbPuGL6vgdB2bbEcOeV1NY6Q1BhF57DCxqnEScCTpOfB j+EACrZPjC1YEx7KRN5djL3ponTeb4uro+8t6/NLePn4NpeNwZul7KkCrHOlbVckgloG XyH1VD/7lYJfWGzM4qfjMxSAENq8Nkr2ulWg8dfNfiAZpLHMFyPQbURlqsj7E3b2U6Cf W4Oe7Eag0CCRn7xvP7MagMUw4EB6W3z7H4LHYUZzKKs/py3ySq8M+xhPqfBEfIeVpGWw kOgMZJqykVejZ5Zr9ADefyiXX7/3gF8FgHnAJa/nCHgE0hxwlGNpP7/zxjhNqKCHocYw aVCw== X-Gm-Message-State: AOAM532ix1w3ydbfN0JRRXW7QiZZoswoHr+NFUdcqWSQjxEpjwN3hPPM ERiNlDSG6rEcOsEuEDJrki8MFpjW X-Google-Smtp-Source: ABdhPJy8osBhEm+TjLEE/S5cnRbwGcuPbQvcghRK/9yu0LEqaHTZlWWdVqG/D841dKCWhDOjCHrxJQ== X-Received: by 2002:a0c:eb11:: with SMTP id j17mr5712050qvp.197.1589581504665; Fri, 15 May 2020 15:25:04 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 02/10] qemu: Extend QEMU capabilities with 'spapr-tpm-proxy' Date: Fri, 15 May 2020 19:24:05 -0300 Message-Id: <20200515222413.1231605-3-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 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) Expose the TPM Proxy support for PPC64 guests by creating a new cap called QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY. This device is part of the machinery the guest need to orchestrate with the PPC64 Ultravisor the transition to the Secure VM (SVM) mode. Inside QEMU, this device will be used with the H_TPM_COMM hypercall to connect with the TPM Resource Manager, enabling the guest to open and close TPM sessions with the host TPM. Reviewed-by: Stefan Berger Reviewed-by: J=C3=A1n Tomko Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + 4 files changed, 9 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7e711f22f8..d0d8b1ebf5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -582,6 +582,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "tcg", "virtio-blk-pci.scsi.default.disabled", "pvscsi", + + /* 370 */ + "spapr-tpm-proxy", ); =20 =20 @@ -1304,6 +1307,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "vhost-user-fs-device", QEMU_CAPS_DEVICE_VHOST_USER_FS }, { "tcg-accel", QEMU_CAPS_TCG }, { "pvscsi", QEMU_CAPS_SCSI_PVSCSI }, + { "spapr-tpm-proxy", QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY }, }; =20 =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6bfc7386e3..fa22856e12 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -564,6 +564,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_VIRTIO_BLK_SCSI_DEFAULT_DISABLED, /* virtio-blk-pci.scsi dis= abled by default */ QEMU_CAPS_SCSI_PVSCSI, /* -device pvscsi */ =20 + /* 370 */ + QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY, /* -device spapr-tpm-proxy */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.ppc64.xml index a68786ddc8..9df68ebfc1 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -185,6 +185,7 @@ + 4001050 0 42900242 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_5.0.0.ppc64.xml index c8cc07d954..77f51fe4d8 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -201,6 +201,7 @@ + 5000000 0 42900241 --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581531; cv=none; d=zohomail.com; s=zohoarc; b=L05fKot6EvfRAcgYifUNfIfqXEL+UDSRkEuOSdarvR8IPqD8RfP+FAEVJms6dQZUP/k782Iof7N1GkC7aBZ7CDmOHvCcozkbexA+yN8R0zTZTx95L2Crk25PT5VumOE+w9p+vU7cLYjz5bG0Bq9ClH27lKYjtLukvakICG62rfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581531; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xKAUNNl5fYh+r88e6pq34/EZYbR+qlUnC353pALAREo=; b=fq/3XB1VG0m6Sm9Kuyv3nHlB2zBJU11eh/E46oZvmd0K/24KYensdDVIcmQnCcJKq/gbZe2od/a4wctuQm2gOfaS7l85I/3scvtxIlri0VFRNDcgUjBON3BZuUJDbDFa1ErT5IcGlpjy9rbe0VHuamgzZHifqZy7M21Y4urEo98= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589581531465869.3314506199285; Fri, 15 May 2020 15:25:31 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-374-xrwF8_mDPcSZKGxiqWIFIw-1; Fri, 15 May 2020 18:25:26 -0400 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 C29D3107ACF7; Fri, 15 May 2020 22:25:20 +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 A126F3A2; Fri, 15 May 2020 22:25:20 +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 725CB4EA02; Fri, 15 May 2020 22:25:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPCVx015269 for ; Fri, 15 May 2020 18:25:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 58D5F2029F6F; Fri, 15 May 2020 22:25:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4BF882029F62 for ; Fri, 15 May 2020 22:25:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 847EC8007C8 for ; Fri, 15 May 2020 22:25:09 +0000 (UTC) Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-10-t1MCgYK7OCSXTDiXVCe4lA-1; Fri, 15 May 2020 18:25:07 -0400 Received: by mail-qv1-f68.google.com with SMTP id g20so1895309qvb.9; Fri, 15 May 2020 15:25:07 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581530; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xKAUNNl5fYh+r88e6pq34/EZYbR+qlUnC353pALAREo=; b=ORQbNXhtlt5pwDZqW44wlbRt5TVbbY7+fsb7smLIpOuvJaGCZ5+oUDrnV6Ipboq3E9FXJn 42Mql36DtSZ1hctY2nDKlyetsltfsowi3uZMlXleE/kKxG8To8ZQlmSMPPcFs+7z49JjDJ 5Dqkb3u57k3PrIGM2Dk+a6Z7RDIzVUk= X-MC-Unique: xrwF8_mDPcSZKGxiqWIFIw-1 X-MC-Unique: t1MCgYK7OCSXTDiXVCe4lA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xKAUNNl5fYh+r88e6pq34/EZYbR+qlUnC353pALAREo=; b=ZJTh/m/BFZjnlXcqGJYc13e0lKgHAL0bNF0daNYuOz9jEQFhWGAQfTeLcHxqnnvoOH /Wa8oozDPP52nQAq9Fyd+/7yYeVNWmKrjashmVDvWqJ1WxBo0a5LaO769BdSKLZCaofA aGwGqhq30t4sf4WmhMgEuzQb3lUPDTS04n3bJ9ih42cfXEDS5quS4TIbX+SROKf70gNq 8ceP6Zrg5dZJnBixOrN5sbDgaHU+5MmP8BIqU1TWrqKrUIEtJ4CTAo/DkIxVoX+ZKXpy H9RkgXF1gZfgLLNriMyl9CIQATiu5mgUoyyBFaav9Ht0F63KelfQLIrZTLBOLZW8qHGG OSoA== X-Gm-Message-State: AOAM533g0GKprwVNKW8uVrMOYLA4rxWWm2VbD4aOEk8pbKUvfsGt7BgU nnD0GoyqGKfiLD3lY8izUdUHx8Ih X-Google-Smtp-Source: ABdhPJwX9JPd2NxZDyy5bbfKC4UCwta8eSz1b161IgMgvv912JeCiOqLPbaxvh5731MbCLYy6sJ0Ng== X-Received: by 2002:a05:6214:1365:: with SMTP id c5mr5442523qvw.152.1589581506541; Fri, 15 May 2020 15:25:06 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 03/10] qemu_extdevice.c: remove unneeded 'ret' variable Date: Fri, 15 May 2020 19:24:06 -0300 Message-Id: <20200515222413.1231605-4-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" qemuExtDevicesInitPaths() does not need 'ret'. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Stefan Berger --- src/qemu/qemu_extdevice.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 2096272761..2ff3f68f5d 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -73,12 +73,10 @@ static int qemuExtDevicesInitPaths(virQEMUDriverPtr driver, virDomainDefPtr def) { - int ret =3D 0; - if (def->tpm) - ret =3D qemuExtTPMInitPaths(driver, def); + return qemuExtTPMInitPaths(driver, def); =20 - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581528; cv=none; d=zohomail.com; s=zohoarc; b=K5o3eSMjyqmlyCeomKVtRCK6DBLIpX6NA76AJ6qK8H06jdFiPDkpa+i5pbHvy/epoWg/mOP/LZPOGhOCvyemZkEA6xml/OtpkPwEPwqFFAW/NYWWGU9oN0gn6BSLS49o5O8ofarMKS7/nT18ncKSKKjEdhSBgMqUdRzHIWVey8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581528; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CGTjwFRTmpFNGlwvymIb3RC0W9tn6gnLiv5YpHhhznw=; b=BXmLVOMzrOTMtWb2z1m3ob1CAHs09C3WAjBSQWD4KqT8HvGgoiCyQEHSdCOni4m4ub6oGbq9rxF3PsVNLB9SK2dsu+Vu52s2K1K1Vln1tbnGt1QVreE97wXaF1JBn6/fEqmfO3/DQoUC38ep3Q5lGTN0GwSMeGHZJ6VG5OqiuBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1589581528815173.70585765994417; Fri, 15 May 2020 15:25:28 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-57-7OYvaIv7OeyqCPF4fLf7fg-1; Fri, 15 May 2020 18:25:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5C02107B768; Fri, 15 May 2020 22:25:19 +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 C6BEB78379; Fri, 15 May 2020 22:25:19 +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 98BEA4EA01; Fri, 15 May 2020 22:25:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPB3Y015255 for ; Fri, 15 May 2020 18:25:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 60C30F1C90; Fri, 15 May 2020 22:25:11 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C33FF1C9D for ; Fri, 15 May 2020 22:25:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4167E8007A4 for ; Fri, 15 May 2020 22:25:11 +0000 (UTC) Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-HCzRfFGHOt-7B3-sZDLETg-1; Fri, 15 May 2020 18:25:09 -0400 Received: by mail-qv1-f67.google.com with SMTP id fb16so1866415qvb.5; Fri, 15 May 2020 15:25:09 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581527; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CGTjwFRTmpFNGlwvymIb3RC0W9tn6gnLiv5YpHhhznw=; b=BODACeYwtOIAtG32m3dS9riSyfjPaap14uJ5dRPDpcajN8xViwmOBLxABYw2Vg7mnp/8qH nA8oe9KzVADvawDS+2y77X8NQ00slisg4EA+sbJ4Tn97dZNJybO8H2PTIBmAgvRHUb6rVu TPYzYf/NdkuKX6DYxSLDw6+KnLTSzPM= X-MC-Unique: 7OYvaIv7OeyqCPF4fLf7fg-1 X-MC-Unique: HCzRfFGHOt-7B3-sZDLETg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CGTjwFRTmpFNGlwvymIb3RC0W9tn6gnLiv5YpHhhznw=; b=UG+dk4ZFyADvPf7LYODUmT/dsfdErdOHhdFHZZO/qHQQPNTQ8fUpWkNlCEdryBNrGT 5lKsqGvpVTa7ECEF3N9SZxBcncErVNBwkgIe8Hei8yVuXDk7wAchU+1JWikxWjL0gYnH WyElWbYMHxTIT+U49zqqUdUOMSgMltTvt1GuHmnOPabHjCk8t59p4p89G+OdB9jF7eHa EkqIQGpGGh/t+TEQh2OmiWni60dqJGjtEUpCnYVdrvGn7pA3Je634WuK3m/0VZk6pOtA OlUgTn26a2dhXb0MjYtMu/Yt0Stw6CqHPWTCcE+425AYSEkHjSlNwkiiMaIAQFJcKWQd Urdw== X-Gm-Message-State: AOAM530uBZisFDrPK4WePOIKQ6sAwaxI8Da2hJSvrVRdlzd6weGA/eDI pcWETfa5lccEGsh2cVCh/7Uq3NsW X-Google-Smtp-Source: ABdhPJzIWe+WiDCAMk1N8Hax3H7H38mC/u2kXmlO9M4+nmuWv6pgCmypOq6FvpuXeCO5gvdeFZQbKA== X-Received: by 2002:a0c:b524:: with SMTP id d36mr5680181qve.12.1589581508202; Fri, 15 May 2020 15:25:08 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 04/10] qemu_tpm, security, tests: change 'switch' clauses for 'if' Date: Fri, 15 May 2020 19:24:07 -0300 Message-Id: <20200515222413.1231605-5-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This trivial rework is aimed to reduce the amount of line changes made by the next patch, when 'def->tpm' will become a 'def->tpms' array. Instead of using a 'switch' where only the VIR_DOMAIN_TPM_TYPE_EMULATOR label does something, use an 'if' clause instead. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_tpm.c | 44 +++++---------------------------- src/security/security_selinux.c | 16 ++---------- src/security/virt-aa-helper.c | 7 +----- tests/qemuxml2argvtest.c | 7 +----- 4 files changed, 10 insertions(+), 64 deletions(-) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index fe567f440c..afec0e5328 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -680,14 +680,9 @@ qemuExtTPMInitPaths(virQEMUDriverPtr driver, { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); =20 - switch (def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) return qemuTPMEmulatorInitPaths(def->tpm, cfg->swtpmStorageDir, def->uuid); - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; - } =20 return 0; } @@ -700,8 +695,7 @@ qemuExtTPMPrepareHost(virQEMUDriverPtr driver, g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *shortName =3D NULL; =20 - switch (def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { shortName =3D virDomainDefGetShortName(def); if (!shortName) return -1; @@ -711,9 +705,6 @@ qemuExtTPMPrepareHost(virQEMUDriverPtr driver, cfg->swtpm_group, cfg->swtpmStateDir, cfg->user, shortName); - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; } =20 return 0; @@ -723,15 +714,8 @@ qemuExtTPMPrepareHost(virQEMUDriverPtr driver, void qemuExtTPMCleanupHost(virDomainDefPtr def) { - switch (def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) qemuTPMDeleteEmulatorStorage(def->tpm); - break; - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - /* nothing to do */ - break; - } } =20 =20 @@ -825,15 +809,9 @@ qemuExtTPMStart(virQEMUDriverPtr driver, { virDomainTPMDefPtr tpm =3D vm->def->tpm; =20 - switch (tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) return qemuExtTPMStartEmulator(driver, vm, incomingMigration); =20 - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; - } - return 0; } =20 @@ -845,18 +823,13 @@ qemuExtTPMStop(virQEMUDriverPtr driver, g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *shortName =3D NULL; =20 - switch (vm->def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (vm->def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { shortName =3D virDomainDefGetShortName(vm->def); if (!shortName) return; =20 qemuTPMEmulatorStop(cfg->swtpmStateDir, shortName); qemuSecurityCleanupTPMEmulator(driver, vm); - break; - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; } =20 return; @@ -873,8 +846,7 @@ qemuExtTPMSetupCgroup(virQEMUDriverPtr driver, int rc; pid_t pid; =20 - switch (def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { shortName =3D virDomainDefGetShortName(def); if (!shortName) return -1; @@ -886,10 +858,6 @@ qemuExtTPMSetupCgroup(virQEMUDriverPtr driver, } if (virCgroupAddProcess(cgroup, pid) < 0) return -1; - break; - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; } =20 return 0; diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 9a929debe1..914a252df1 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -3493,10 +3493,7 @@ virSecuritySELinuxSetTPMLabels(virSecurityManagerPtr= mgr, if (seclabel =3D=3D NULL) return 0; =20 - switch (def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - break; - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { ret =3D virSecuritySELinuxSetFileLabels( mgr, def->tpm->data.emulator.storagepath, seclabel); @@ -3504,9 +3501,6 @@ virSecuritySELinuxSetTPMLabels(virSecurityManagerPtr = mgr, ret =3D virSecuritySELinuxSetFileLabels( mgr, def->tpm->data.emulator.logfile, seclabel); - break; - case VIR_DOMAIN_TPM_TYPE_LAST: - break; } =20 return ret; @@ -3519,18 +3513,12 @@ virSecuritySELinuxRestoreTPMLabels(virSecurityManag= erPtr mgr, { int ret =3D 0; =20 - switch (def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - break; - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { ret =3D virSecuritySELinuxRestoreFileLabels( mgr, def->tpm->data.emulator.storagepath); if (ret =3D=3D 0 && def->tpm->data.emulator.logfile) ret =3D virSecuritySELinuxRestoreFileLabels( mgr, def->tpm->data.emulator.logfile); - break; - case VIR_DOMAIN_TPM_TYPE_LAST: - break; } =20 return ret; diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 6e6dd1b1db..6e8f77e4dd 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1210,8 +1210,7 @@ get_files(vahControl * ctl) char *shortName =3D NULL; const char *tpmpath =3D NULL; =20 - switch (ctl->def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (ctl->def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { shortName =3D virDomainDefGetShortName(ctl->def); =20 switch (ctl->def->tpm->version) { @@ -1244,10 +1243,6 @@ get_files(vahControl * ctl) RUNSTATEDIR, shortName); =20 VIR_FREE(shortName); - break; - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; } } =20 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 43e76956cc..fd060bec4e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -515,15 +515,10 @@ testCompareXMLToArgv(const void *data) } =20 if (vm->def->tpm) { - switch (vm->def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: + if (vm->def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { VIR_FREE(vm->def->tpm->data.emulator.source.data.file.path); vm->def->tpm->data.emulator.source.data.file.path =3D g_strdup= ("/dev/test"); vm->def->tpm->data.emulator.source.type =3D VIR_DOMAIN_CHR_TYP= E_FILE; - break; - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; } } =20 --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581564; cv=none; d=zohomail.com; s=zohoarc; b=C+Tw5nSY/1FlZfCQMfG6Jx6TAGlSRY2iZYgNW1+TSTIulwEIEiFyM/lMETw3o2m5a9z2NiHV+IVojtvCcqrqGaX1VbmxLAgcGRY/xn9/etXAkInB3xnfj5ni6QJ1helLSzTbhxOV7pfPxJwKNTIklprhcKWRCp3erz2XtcbS8r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581564; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ICwrA2donf5ZtAWVd6CcyrRc7rDs/ShAoM23ofN7CLw=; b=GohAEvlLcZpbJ9EW5SzQaoRVbvc2ZQuM9GrEaM+PiLW0+SAao/TPXEloBLg7S2LW+fBBtCvyE8UtQk3yktTAGhcXcg7dk83iXMpryit1aHE6XfmxxX7iju1cPoBN1KROfHICHFT4a/kqY0joK0/tfi/5g9A/P/BGlr22DZhruEo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589581564297487.2042967062115; Fri, 15 May 2020 15:26:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-204-0vlgxIWyMLeNEdAZMbOtJQ-1; Fri, 15 May 2020 18:25:31 -0400 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 ACBE791140; Fri, 15 May 2020 22:25:23 +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 8AD6B2DE74; Fri, 15 May 2020 22:25:23 +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 5C94A4EA05; Fri, 15 May 2020 22:25:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPGtA015298 for ; Fri, 15 May 2020 18:25:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 305E9200A773; Fri, 15 May 2020 22:25:16 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B44820110C8 for ; Fri, 15 May 2020 22:25:16 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 057BD8A19E1 for ; Fri, 15 May 2020 22:25:16 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-326-FBlzPg9FOQulHZj0d8J-4w-1; Fri, 15 May 2020 18:25:11 -0400 Received: by mail-qk1-f195.google.com with SMTP id b6so4273870qkh.11; Fri, 15 May 2020 15:25:11 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581562; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ICwrA2donf5ZtAWVd6CcyrRc7rDs/ShAoM23ofN7CLw=; b=WqlF7+e9wuH/tjKidYR2S7w2LOB2Yy+mcDfgbLQw4LGKawZHZXsS07ISZxWolM4OzZ+Bgs 8OeBbPezNyDvC8UrI9venIcEwZ63orMuuvXqxgFY2pTkYXLqnbD8x354xJNemEV7HVmBhW Dms1++A9ot02QSXgQ4Gwwk1nV7UTAxU= X-MC-Unique: 0vlgxIWyMLeNEdAZMbOtJQ-1 X-MC-Unique: FBlzPg9FOQulHZj0d8J-4w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ICwrA2donf5ZtAWVd6CcyrRc7rDs/ShAoM23ofN7CLw=; b=lXZK62yCTlwgv1DEddaeFSb1ysaoadqadOUqkeJSIWqemEtJ2g8SUAZSD571PygJB1 2TvLTX9MfjwEHsRb7LK+EPHc79E7ctpZlENJXwJs7adgfoBQ0Q8mh1sOUxynsvj0W8W2 JjV6ULH3v6tGFJ/cM5XulZkemNr/kw5DRukNs2ut+OXfUgfAbBoxDOLdHFgEHNYViabb G+gDBXqk6CtFwHniaYm7B8RVhWAUB/+C1XqxzKFCvlmDygLwr82HV76+WrMY8xNUUJ3C z0J4+vPe+E/F4p76qfG8/MwnHWeKC4P0IgiToO2c6QaqmGRzLQ88Yx8TgTtTq/E/SpK0 Nr0Q== X-Gm-Message-State: AOAM533g0C5/bl1rYC9y76gkMJ7PgwpxPjP1ySCjroZL5gFs/mJAk9RJ jEHssdqceYTB87pIR9eTGL8c9d35 X-Google-Smtp-Source: ABdhPJwnmLEY362WBIjF308QJzbsXK5QLnPCLfOVXsSmDfCPM1Rk9wa3+DMptouKSwLv2CZGamoNMA== X-Received: by 2002:ae9:dcc2:: with SMTP id q185mr5603487qkf.239.1589581510239; Fri, 15 May 2020 15:25:10 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 05/10] conf, qemu, security, tests: introducing 'def->tpms' array Date: Fri, 15 May 2020 19:24:08 -0300 Message-Id: <20200515222413.1231605-6-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" A TPM Proxy device can coexist with a regular TPM, but the current domain definition supports only a single TPM device in the 'tpm' pointer. This patch replaces this existing pointer in the domain definition to an array of TPM devices. All files that references the old pointer were adapted to handle the new array instead. virDomainDefParseXML() TPM related code was adapted to guarantee that the following combinations in the same domain are valid: - a single TPM device - a single TPM Proxy device - a single TPM + single TPM Proxy devices And, these combinations in the same domain are NOT valid: - 2 or more TPM devices - 2 or more TPM Proxy devices Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_audit.c | 4 +- src/conf/domain_conf.c | 72 ++++++++++++++++++++++++--------- src/conf/domain_conf.h | 6 ++- src/qemu/qemu_alias.c | 4 +- src/qemu/qemu_cgroup.c | 10 +++-- src/qemu/qemu_command.c | 34 +++++++++++----- src/qemu/qemu_domain.c | 31 +++++++++----- src/qemu/qemu_domain_address.c | 11 +++-- src/qemu/qemu_extdevice.c | 18 +++++---- src/qemu/qemu_tpm.c | 52 ++++++++++++++++++------ src/security/security_dac.c | 8 ++-- src/security/security_selinux.c | 32 +++++++++------ src/security/virt-aa-helper.c | 9 +++-- tests/qemuxml2argvtest.c | 13 +++--- 14 files changed, 208 insertions(+), 96 deletions(-) diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index 1b0abb21a0..8bc6633af4 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -821,8 +821,8 @@ virDomainAuditStart(virDomainObjPtr vm, const char *rea= son, bool success) for (i =3D 0; i < vm->def->nrngs; i++) virDomainAuditRNG(vm, NULL, vm->def->rngs[i], "start", true); =20 - if (vm->def->tpm) - virDomainAuditTPM(vm, vm->def->tpm, "start", true); + for (i =3D 0; i < vm->def->ntpms; i++) + virDomainAuditTPM(vm, vm->def->tpms[i], "start", true); =20 for (i =3D 0; i < vm->def->nshmems; i++) virDomainAuditShmem(vm, vm->def->shmems[i], "start", true); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c201fc901d..f8fee62c0c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1165,6 +1165,7 @@ VIR_ENUM_IMPL(virDomainTPMModel, "tpm-tis", "tpm-crb", "tpm-spapr", + "spapr-tpm-proxy", ); =20 VIR_ENUM_IMPL(virDomainTPMBackend, @@ -3479,7 +3480,9 @@ void virDomainDefFree(virDomainDefPtr def) virDomainMemoryDefFree(def->mems[i]); VIR_FREE(def->mems); =20 - virDomainTPMDefFree(def->tpm); + for (i =3D 0; i < def->ntpms; i++) + virDomainTPMDefFree(def->tpms[i]); + VIR_FREE(def->tpms); =20 for (i =3D 0; i < def->npanics; i++) virDomainPanicDefFree(def->panics[i]); @@ -4312,10 +4315,10 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr = def, if ((rc =3D cb(def, &device, &def->shmems[i]->info, opaque)) !=3D = 0) return rc; } - if (def->tpm) { - device.type =3D VIR_DOMAIN_DEVICE_TPM; - device.data.tpm =3D def->tpm; - if ((rc =3D cb(def, &device, &def->tpm->info, opaque)) !=3D 0) + device.type =3D VIR_DOMAIN_DEVICE_TPM; + for (i =3D 0; i < def->ntpms; i++) { + device.data.tpm =3D def->tpms[i]; + if ((rc =3D cb(def, &device, &def->tpms[i]->info, opaque)) !=3D 0) return rc; } device.type =3D VIR_DOMAIN_DEVICE_PANIC; @@ -21964,15 +21967,45 @@ virDomainDefParseXML(xmlDocPtr xml, if ((n =3D virXPathNodeSet("./devices/tpm", ctxt, &nodes)) < 0) goto error; =20 - if (n > 1) { + if (n > 2) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("only a single TPM device is supported")); + _("a maximum of two TPM devices is supported, one o= f " + "them being a TPM Proxy device")); goto error; } =20 + if (n && VIR_ALLOC_N(def->tpms, n) < 0) + goto error; + if (n > 0) { - if (!(def->tpm =3D virDomainTPMDefParseXML(xmlopt, nodes[0], ctxt,= flags))) - goto error; + virDomainTPMDefPtr proxyTPM =3D NULL; + virDomainTPMDefPtr regularTPM =3D NULL; + + for (i =3D 0; i < n; i++) { + virDomainTPMDefPtr tpm =3D virDomainTPMDefParseXML(xmlopt, nod= es[i], + ctxt, flags); + + if (!tpm) + goto error; + + if (tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) { + if (proxyTPM) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("only a single TPM Proxy device is sup= ported")); + goto error; + } else { + proxyTPM =3D tpm; + } + } else if (regularTPM) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("only a single TPM non-proxy device is su= pported")); + goto error; + } else { + regularTPM =3D tpm; + } + + def->tpms[def->ntpms++] =3D tpm; + } } VIR_FREE(nodes); =20 @@ -24334,16 +24367,19 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPt= r src, goto error; } =20 - if (src->tpm && dst->tpm) { - if (!virDomainTPMDefCheckABIStability(src->tpm, dst->tpm)) - goto error; - } else if (src->tpm || dst->tpm) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Either both target and source domains or none of= " - "them must have TPM device present")); + if (src->ntpms !=3D dst->ntpms) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain TPM device count %zu " + "does not match source %zu"), + dst->ntpms, src->ntpms); goto error; } =20 + for (i =3D 0; i < src->ntpms; i++) { + if (!virDomainTPMDefCheckABIStability(src->tpms[i], dst->tpms[i])) + goto error; + } + if (src->nmems !=3D dst->nmems) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target domain memory device count %zu " @@ -29784,8 +29820,8 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, goto error; } =20 - if (def->tpm) { - if (virDomainTPMDefFormat(buf, def->tpm, flags) < 0) + for (n =3D 0; n < def->ntpms; n++) { + if (virDomainTPMDefFormat(buf, def->tpms[n], flags) < 0) goto error; } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ddc75d8de2..32ae272cac 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1293,6 +1293,7 @@ typedef enum { VIR_DOMAIN_TPM_MODEL_TIS, VIR_DOMAIN_TPM_MODEL_CRB, VIR_DOMAIN_TPM_MODEL_SPAPR, + VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY, =20 VIR_DOMAIN_TPM_MODEL_LAST } virDomainTPMModel; @@ -2623,11 +2624,14 @@ struct _virDomainDef { size_t npanics; virDomainPanicDefPtr *panics; =20 + /* At maximum 2 TPMs on the domain, if a TPM Proxy is present. */ + size_t ntpms; + virDomainTPMDefPtr *tpms; + /* Only 1 */ virDomainWatchdogDefPtr watchdog; virDomainMemballoonDefPtr memballoon; virDomainNVRAMDefPtr nvram; - virDomainTPMDefPtr tpm; virCPUDefPtr cpu; virSysinfoDefPtr sysinfo; virDomainRedirFilterDefPtr redirfilter; diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index b0ea62af39..9d72391ddb 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -669,8 +669,8 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCap= sPtr qemuCaps) if (qemuAssignDeviceRNGAlias(def, def->rngs[i]) < 0) return -1; } - if (def->tpm) { - if (qemuAssignDeviceTPMAlias(def->tpm, 0) < 0) + for (i =3D 0; i < def->ntpms; i++) { + if (qemuAssignDeviceTPMAlias(def->tpms[i], 0) < 0) return -1; } for (i =3D 0; i < def->nmems; i++) { diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 2e019b64af..647609e12e 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -333,10 +333,10 @@ qemuSetupChardevCgroupCB(virDomainDefPtr def G_GNUC_U= NUSED, =20 =20 static int -qemuSetupTPMCgroup(virDomainObjPtr vm) +qemuSetupTPMCgroup(virDomainObjPtr vm, + virDomainTPMDefPtr dev) { int ret =3D 0; - virDomainTPMDefPtr dev =3D vm->def->tpm; =20 switch (dev->type) { case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: @@ -806,8 +806,10 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm) vm) < 0) return -1; =20 - if (vm->def->tpm && qemuSetupTPMCgroup(vm) < 0) - return -1; + for (i =3D 0; i < vm->def->ntpms; i++) { + if (qemuSetupTPMCgroup(vm, vm->def->tpms[i]) < 0) + return -1; + } =20 for (i =3D 0; i < vm->def->nhostdevs; i++) { /* This may allow /dev/vfio/vfio multiple times, but that diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bfe70ed228..d2ac19a7a8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8830,10 +8830,10 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, =20 static char * qemuBuildTPMDevStr(const virDomainDef *def, + virDomainTPMDefPtr tpm, virQEMUCapsPtr qemuCaps) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - virDomainTPMDef *tpm =3D def->tpm; const char *model =3D virDomainTPMModelTypeToString(tpm->model); =20 virBufferAsprintf(&buf, "%s,tpmdev=3Dtpm-%s,id=3D%s", @@ -8872,13 +8872,12 @@ qemuBuildTPMOpenBackendFDs(const char *tpmdev, =20 =20 static char * -qemuBuildTPMBackendStr(const virDomainDef *def, - virCommandPtr cmd, +qemuBuildTPMBackendStr(virCommandPtr cmd, + virDomainTPMDefPtr tpm, int *tpmfd, int *cancelfd, char **chardev) { - const virDomainTPMDef *tpm =3D def->tpm; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; g_autofree char *cancel_path =3D NULL; g_autofree char *devset =3D NULL; @@ -8932,6 +8931,7 @@ qemuBuildTPMBackendStr(const virDomainDef *def, static int qemuBuildTPMCommandLine(virCommandPtr cmd, const virDomainDef *def, + virDomainTPMDefPtr tpm, virQEMUCapsPtr qemuCaps) { char *optstr; @@ -8940,10 +8940,7 @@ qemuBuildTPMCommandLine(virCommandPtr cmd, int cancelfd =3D -1; char *fdset; =20 - if (!def->tpm) - return 0; - - if (!(optstr =3D qemuBuildTPMBackendStr(def, cmd, + if (!(optstr =3D qemuBuildTPMBackendStr(cmd, tpm, &tpmfd, &cancelfd, &chardev))) return -1; @@ -8972,7 +8969,7 @@ qemuBuildTPMCommandLine(virCommandPtr cmd, VIR_FREE(fdset); } =20 - if (!(optstr =3D qemuBuildTPMDevStr(def, qemuCaps))) + if (!(optstr =3D qemuBuildTPMDevStr(def, tpm, qemuCaps))) return -1; =20 virCommandAddArgList(cmd, "-device", optstr, NULL); @@ -8981,6 +8978,23 @@ qemuBuildTPMCommandLine(virCommandPtr cmd, return 0; } =20 + +static int +qemuBuildTPMsCommandLine(virCommandPtr cmd, + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + size_t i; + + for (i =3D 0; i < def->ntpms; i++) { + if (qemuBuildTPMCommandLine(cmd, def, def->tpms[i], qemuCaps) < 0) + return -1; + } + + return 0; +} + + static int qemuBuildSEVCommandLine(virDomainObjPtr vm, virCommandPtr cmd, virDomainSEVDefPtr sev) @@ -9659,7 +9673,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, chardevStdioLogd) < 0) return NULL; =20 - if (qemuBuildTPMCommandLine(cmd, def, qemuCaps) < 0) + if (qemuBuildTPMsCommandLine(cmd, def, qemuCaps) < 0) return NULL; =20 if (qemuBuildInputCommandLine(cmd, def, qemuCaps) < 0) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d0528dbfe0..2f30633eac 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11575,16 +11575,9 @@ qemuDomainSetupAllChardevs(virQEMUDriverConfigPtr = cfg G_GNUC_UNUSED, =20 static int qemuDomainSetupTPM(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED, - virDomainObjPtr vm, + virDomainTPMDefPtr dev, const struct qemuDomainCreateDeviceData *data) { - virDomainTPMDefPtr dev =3D vm->def->tpm; - - if (!dev) - return 0; - - VIR_DEBUG("Setting up TPM"); - switch (dev->type) { case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: if (qemuDomainCreateDevice(dev->data.passthrough.source.data.file.= path, @@ -11598,7 +11591,25 @@ qemuDomainSetupTPM(virQEMUDriverConfigPtr cfg G_GN= UC_UNUSED, break; } =20 - VIR_DEBUG("Setup TPM"); + return 0; +} + + +static int +qemuDomainSetupAllTPMs(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED, + virDomainObjPtr vm, + const struct qemuDomainCreateDeviceData *data) +{ + size_t i; + + VIR_DEBUG("Setting up TPMs"); + + for (i =3D 0; i < vm->def->ntpms; i++) { + if (qemuDomainSetupTPM(cfg, vm->def->tpms[i], data) < 0) + return -1; + } + + VIR_DEBUG("Setup all TPMs"); return 0; } =20 @@ -11824,7 +11835,7 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg, if (qemuDomainSetupAllChardevs(cfg, vm, &data) < 0) goto cleanup; =20 - if (qemuDomainSetupTPM(cfg, vm, &data) < 0) + if (qemuDomainSetupAllTPMs(cfg, vm, &data) < 0) goto cleanup; =20 if (qemuDomainSetupAllGraphics(cfg, vm, &data) < 0) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 07431343ed..4c26070022 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -268,10 +268,13 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) return -1; } =20 - if (def->tpm) { - if (qemuDomainIsPSeries(def)) - def->tpm->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVI= O; - if (qemuDomainAssignSpaprVIOAddress(def, &def->tpm->info, + for (i =3D 0; i < def->ntpms; i++) { + virDomainTPMDefPtr tpm =3D def->tpms[i]; + + if (tpm->model !=3D VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY && + qemuDomainIsPSeries(def)) + tpm->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; + if (qemuDomainAssignSpaprVIOAddress(def, &tpm->info, VIO_ADDR_TPM) < 0) return -1; } diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 2ff3f68f5d..db18c82640 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -73,7 +73,7 @@ static int qemuExtDevicesInitPaths(virQEMUDriverPtr driver, virDomainDefPtr def) { - if (def->tpm) + if (def->ntpms > 0) return qemuExtTPMInitPaths(driver, def); =20 return 0; @@ -132,7 +132,7 @@ qemuExtDevicesPrepareHost(virQEMUDriverPtr driver, virDomainDefPtr def =3D vm->def; size_t i; =20 - if (def->tpm && + if (def->ntpms > 0 && qemuExtTPMPrepareHost(driver, def) < 0) return -1; =20 @@ -155,7 +155,7 @@ qemuExtDevicesCleanupHost(virQEMUDriverPtr driver, if (qemuExtDevicesInitPaths(driver, def) < 0) return; =20 - if (def->tpm) + if (def->ntpms > 0) qemuExtTPMCleanupHost(def); } =20 @@ -181,7 +181,7 @@ qemuExtDevicesStart(virQEMUDriverPtr driver, } } =20 - if (def->tpm && qemuExtTPMStart(driver, vm, incomingMigration) < 0) + if (def->ntpms > 0 && qemuExtTPMStart(driver, vm, incomingMigration) <= 0) return -1; =20 for (i =3D 0; i < def->nnets; i++) { @@ -223,7 +223,7 @@ qemuExtDevicesStop(virQEMUDriverPtr driver, qemuExtVhostUserGPUStop(driver, vm, video); } =20 - if (def->tpm) + if (def->ntpms > 0) qemuExtTPMStop(driver, vm); =20 for (i =3D 0; i < def->nnets; i++) { @@ -253,8 +253,10 @@ qemuExtDevicesHasDevice(virDomainDefPtr def) return true; } =20 - if (def->tpm && def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) - return true; + for (i =3D 0; i < def->ntpms; i++) { + if (def->tpms[i]->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + return true; + } =20 for (i =3D 0; i < def->nfss; i++) { virDomainFSDefPtr fs =3D def->fss[i]; @@ -294,7 +296,7 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, return -1; } =20 - if (def->tpm && + if (def->ntpms > 0 && qemuExtTPMSetupCgroup(driver, def, cgroup) < 0) return -1; =20 diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index afec0e5328..8adb0e42b8 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -679,10 +679,15 @@ qemuExtTPMInitPaths(virQEMUDriverPtr driver, virDomainDefPtr def) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); + size_t i; =20 - if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) - return qemuTPMEmulatorInitPaths(def->tpm, cfg->swtpmStorageDir, + for (i =3D 0; i < def->ntpms; i++) { + if (def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; + + return qemuTPMEmulatorInitPaths(def->tpms[i], cfg->swtpmStorageDir, def->uuid); + } =20 return 0; } @@ -694,13 +699,17 @@ qemuExtTPMPrepareHost(virQEMUDriverPtr driver, { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *shortName =3D NULL; + size_t i; + + for (i =3D 0; i < def->ntpms; i++) { + if (def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; =20 - if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { shortName =3D virDomainDefGetShortName(def); if (!shortName) return -1; =20 - return qemuTPMEmulatorPrepareHost(def->tpm, cfg->swtpmLogDir, + return qemuTPMEmulatorPrepareHost(def->tpms[i], cfg->swtpmLogDir, def->name, cfg->swtpm_user, cfg->swtpm_group, cfg->swtpmStateDir, cfg->user, @@ -714,8 +723,14 @@ qemuExtTPMPrepareHost(virQEMUDriverPtr driver, void qemuExtTPMCleanupHost(virDomainDefPtr def) { - if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) - qemuTPMDeleteEmulatorStorage(def->tpm); + size_t i; + + for (i =3D 0; i < def->ntpms; i++) { + if (def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; + + qemuTPMDeleteEmulatorStorage(def->tpms[i]); + } } =20 =20 @@ -733,13 +748,13 @@ qemuExtTPMCleanupHost(virDomainDefPtr def) static int qemuExtTPMStartEmulator(virQEMUDriverPtr driver, virDomainObjPtr vm, + virDomainTPMDefPtr tpm, bool incomingMigration) { g_autoptr(virCommand) cmd =3D NULL; int exitstatus =3D 0; g_autofree char *errbuf =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D NULL; - virDomainTPMDefPtr tpm =3D vm->def->tpm; g_autofree char *shortName =3D virDomainDefGetShortName(vm->def); int cmdret =3D 0, timeout, rc; pid_t pid; @@ -807,10 +822,15 @@ qemuExtTPMStart(virQEMUDriverPtr driver, virDomainObjPtr vm, bool incomingMigration) { - virDomainTPMDefPtr tpm =3D vm->def->tpm; + size_t i; + + for (i =3D 0; i < vm->def->ntpms; i++) { + if (vm->def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; =20 - if (tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) - return qemuExtTPMStartEmulator(driver, vm, incomingMigration); + return qemuExtTPMStartEmulator(driver, vm, vm->def->tpms[i], + incomingMigration); + } =20 return 0; } @@ -822,8 +842,12 @@ qemuExtTPMStop(virQEMUDriverPtr driver, { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *shortName =3D NULL; + size_t i; + + for (i =3D 0; i < vm->def->ntpms; i++) { + if (vm->def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; =20 - if (vm->def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { shortName =3D virDomainDefGetShortName(vm->def); if (!shortName) return; @@ -845,8 +869,12 @@ qemuExtTPMSetupCgroup(virQEMUDriverPtr driver, g_autofree char *shortName =3D NULL; int rc; pid_t pid; + size_t i; + + for (i =3D 0; i < def->ntpms; i++) { + if (def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; =20 - if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { shortName =3D virDomainDefGetShortName(def); if (!shortName) return -1; diff --git a/src/security/security_dac.c b/src/security/security_dac.c index bdc2d7edf3..79123f384c 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1973,10 +1973,10 @@ virSecurityDACRestoreAllLabel(virSecurityManagerPtr= mgr, &chardevData) < 0) rc =3D -1; =20 - if (def->tpm) { + for (i =3D 0; i < def->ntpms; i++) { if (virSecurityDACRestoreTPMFileLabel(mgr, def, - def->tpm) < 0) + def->tpms[i]) < 0) rc =3D -1; } =20 @@ -2152,10 +2152,10 @@ virSecurityDACSetAllLabel(virSecurityManagerPtr mgr, &chardevData) < 0) return -1; =20 - if (def->tpm) { + for (i =3D 0; i < def->ntpms; i++) { if (virSecurityDACSetTPMFileLabel(mgr, def, - def->tpm) < 0) + def->tpms[i]) < 0) return -1; } =20 diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 914a252df1..39928aef3e 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -2758,8 +2758,8 @@ virSecuritySELinuxRestoreAllLabel(virSecurityManagerP= tr mgr, return -1; } =20 - if (def->tpm) { - if (virSecuritySELinuxRestoreTPMFileLabelInt(mgr, def, def->tpm) <= 0) + for (i =3D 0; i < def->ntpms; i++) { + if (virSecuritySELinuxRestoreTPMFileLabelInt(mgr, def, def->tpms[i= ]) < 0) rc =3D -1; } =20 @@ -3166,8 +3166,8 @@ virSecuritySELinuxSetAllLabel(virSecurityManagerPtr m= gr, return -1; } =20 - if (def->tpm) { - if (virSecuritySELinuxSetTPMFileLabel(mgr, def, def->tpm) < 0) + for (i =3D 0; i < def->ntpms; i++) { + if (virSecuritySELinuxSetTPMFileLabel(mgr, def, def->tpms[i]) < 0) return -1; } =20 @@ -3487,19 +3487,23 @@ virSecuritySELinuxSetTPMLabels(virSecurityManagerPt= r mgr, virDomainDefPtr def) { int ret =3D 0; + size_t i; virSecurityLabelDefPtr seclabel; =20 seclabel =3D virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAM= E); if (seclabel =3D=3D NULL) return 0; =20 - if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { + for (i =3D 0; i < def->ntpms; i++) { + if (def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; + ret =3D virSecuritySELinuxSetFileLabels( - mgr, def->tpm->data.emulator.storagepath, + mgr, def->tpms[i]->data.emulator.storagepath, seclabel); - if (ret =3D=3D 0 && def->tpm->data.emulator.logfile) + if (ret =3D=3D 0 && def->tpms[i]->data.emulator.logfile) ret =3D virSecuritySELinuxSetFileLabels( - mgr, def->tpm->data.emulator.logfile, + mgr, def->tpms[i]->data.emulator.logfile, seclabel); } =20 @@ -3512,13 +3516,17 @@ virSecuritySELinuxRestoreTPMLabels(virSecurityManag= erPtr mgr, virDomainDefPtr def) { int ret =3D 0; + size_t i; + + for (i =3D 0; i < def->ntpms; i++) { + if (def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; =20 - if (def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { ret =3D virSecuritySELinuxRestoreFileLabels( - mgr, def->tpm->data.emulator.storagepath); - if (ret =3D=3D 0 && def->tpm->data.emulator.logfile) + mgr, def->tpms[i]->data.emulator.storagepath); + if (ret =3D=3D 0 && def->tpms[i]->data.emulator.logfile) ret =3D virSecuritySELinuxRestoreFileLabels( - mgr, def->tpm->data.emulator.logfile); + mgr, def->tpms[i]->data.emulator.logfile); } =20 return ret; diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 6e8f77e4dd..7abb6e70be 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1206,14 +1206,17 @@ get_files(vahControl * ctl) } =20 =20 - if (ctl->def->tpm) { + if (ctl->def->ntpms > 0) { char *shortName =3D NULL; const char *tpmpath =3D NULL; =20 - if (ctl->def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { + for (i =3D 0; i < ctl->def->ntpms; i++) { + if (ctl->def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; + shortName =3D virDomainDefGetShortName(ctl->def); =20 - switch (ctl->def->tpm->version) { + switch (ctl->def->tpms[i]->version) { case VIR_DOMAIN_TPM_VERSION_1_2: tpmpath =3D "tpm1.2"; break; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index fd060bec4e..e5f129ea4c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -514,12 +514,13 @@ testCompareXMLToArgv(const void *data) vsockPriv->vhostfd =3D 6789; } =20 - if (vm->def->tpm) { - if (vm->def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) { - VIR_FREE(vm->def->tpm->data.emulator.source.data.file.path); - vm->def->tpm->data.emulator.source.data.file.path =3D g_strdup= ("/dev/test"); - vm->def->tpm->data.emulator.source.type =3D VIR_DOMAIN_CHR_TYP= E_FILE; - } + for (i =3D 0; i < vm->def->ntpms; i++) { + if (vm->def->tpms[i]->type !=3D VIR_DOMAIN_TPM_TYPE_EMULATOR) + continue; + + VIR_FREE(vm->def->tpms[i]->data.emulator.source.data.file.path); + vm->def->tpms[i]->data.emulator.source.data.file.path =3D g_strdup= ("/dev/test"); + vm->def->tpms[i]->data.emulator.source.type =3D VIR_DOMAIN_CHR_TYP= E_FILE; } =20 for (i =3D 0; i < vm->def->nvideos; i++) { --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581529; cv=none; d=zohomail.com; s=zohoarc; b=iXQ6fjOssp9l/y6ees1RUz+b+723NDrxv2/P3KFFYFazuk7kPN8rhkBQMyknf/UierMJXnZMlDJHaO1jLdaNR3+LkttKPhw/pgtQ10rm0I4giQ9LDRsoesl2P8gyBqRJInXJ29UZBvqhXLEmuOfyfX6la8k+NkXeWENq7j9uZ04= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581529; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eHfpCwHvIWMqTeRNa8MWqlLyY4IaGMB2U2NTgrvnZ98=; b=RorzgDZBzLd830/FDcJPRvG2vjpvJ70aiKrAmejfq9HXXL0EUGcR7TxxJXANy+iewaLGs5SmqRuJiyQjd2C1HjIwV166g93k2Jsap5zUKbF4BXAEymEsHERNyTKl0bFvVIQAps1hOK+/NpUFxA2Hs52fVQPkK84wO9Xyzyvwxb0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1589581529270552.9517708085319; Fri, 15 May 2020 15:25:29 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-4ZfJUx9zPsebIHtbs8EdRQ-1; Fri, 15 May 2020 18:25:25 -0400 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 2A04C189953A; Fri, 15 May 2020 22:25:20 +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 0B3242FC72; Fri, 15 May 2020 22:25:20 +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 CBCC21809554; Fri, 15 May 2020 22:25:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPFwP015286 for ; Fri, 15 May 2020 18:25:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 33D7E100B8A5; Fri, 15 May 2020 22:25:15 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 270C91008B7F for ; Fri, 15 May 2020 22:25:15 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06682101A525 for ; Fri, 15 May 2020 22:25:15 +0000 (UTC) Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-MmYuqYTdM2qSgnMt-eMJIw-1; Fri, 15 May 2020 18:25:12 -0400 Received: by mail-qv1-f67.google.com with SMTP id r3so1927310qve.1; Fri, 15 May 2020 15:25:12 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581527; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eHfpCwHvIWMqTeRNa8MWqlLyY4IaGMB2U2NTgrvnZ98=; b=Gd0nsmQd77p6jr7GBWCUkuhzMHcGJUlJPPLkKgNu27qA5mKnIP3T9BV1NJX0KbPpyC/KHu Cor+mbSN8UN9hFjDThUfYxdJCAyvnn3xms445mdOBhH3IkRRTXCLAUsu1NWhciqRbyeTJ7 aUbb8QptWQH6qfqVKAV+ls0gGsZ4Vnc= X-MC-Unique: 4ZfJUx9zPsebIHtbs8EdRQ-1 X-MC-Unique: MmYuqYTdM2qSgnMt-eMJIw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eHfpCwHvIWMqTeRNa8MWqlLyY4IaGMB2U2NTgrvnZ98=; b=jteWOdda3L2+fhUr8PHpNNbgF8rC+6GB4+fNaqeUrtOra3nvhfOL+CWEiH/jvwcE9m MDpQvxWvUT7WW+5zn5wUJxJE1exV5SxjjQ3ReNXIW1k+YJr+90La9UmcnCQCiGaPLiiK /g279P59hOMOQjohRB8BMvKfk+qTXR3Ym0CgYDIuxQ4jSixg7Si1hjduHoDewAKbFg/A sQBMdaey/W+oged85nDYUUdTOY4TAx6HKivI1k/fzO35QmuvUmOastKKPkJLSbsLfYuj Wjivj9as8kg1Rve1q9M09cCD26I4fCUZbVi21bBz6EJ/AJMZ5aEy4JqLITe12VCGCBS4 OkBA== X-Gm-Message-State: AOAM5334vvOt+3KYX1nDo73H7qah0aqzkxRoSFkEju3gbWKOIBm6hlCS YlrnzTMYlQaQR66/VHifa5taJxN8 X-Google-Smtp-Source: ABdhPJxviEamWXMslnM0BuBL6cuI6b0cjzUoHsHQ/B7puTSrwt6RqRWPfvFUnWxMChYxkwbPs3mTow== X-Received: by 2002:ad4:46e7:: with SMTP id h7mr5709493qvw.221.1589581512033; Fri, 15 May 2020 15:25:12 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 06/10] qemu_validate.c: add validation for TPM Proxy model Date: Fri, 15 May 2020 19:24:09 -0300 Message-Id: <20200515222413.1231605-7-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Previous patch handled the conversion of def->tpm to the array def->tpms. What we're missing now is the validation code to make the VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY model exclusive to PPC64 guests and VIR_DOMAIN_TPM_TYPE_PASSTHROUGH backend. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_validate.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 584d1375b8..28e02ebefc 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3623,6 +3623,25 @@ qemuValidateDomainDeviceDefTPM(virDomainTPMDef *tpm, case VIR_DOMAIN_TPM_MODEL_SPAPR: flag =3D QEMU_CAPS_DEVICE_TPM_SPAPR; break; + case VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY: + if (!ARCH_IS_PPC64(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("TPM Proxy model %s is only available for " + "PPC64 guests"), + virDomainTPMModelTypeToString(tpm->model)); + return -1; + } + + /* TPM Proxy devices have 'passthrough' backend */ + if (tpm->type !=3D VIR_DOMAIN_TPM_TYPE_PASSTHROUGH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("TPM Proxy model %s requires " + "'Passthrough' backend"), + virDomainTPMModelTypeToString(tpm->model)); + } + + flag =3D QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY; + break; case VIR_DOMAIN_TPM_MODEL_LAST: default: virReportEnumRangeError(virDomainTPMModel, tpm->model); --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581538; cv=none; d=zohomail.com; s=zohoarc; b=Aq7CsdgqenX+aH4sXBG1MiV4Q1vy/V5dzTypTqQCtENBSeWvb6p8+d8AOq7ZYXLEaP+7ac44bgEXm1mwS0xvs/yyi7FilqEcLcjnLu7QANEkQjz6ghqNG4/mwMgISG+LwFGl2cNdmcudMLkGfI0VpsVHy9t6MhzMOkff0ZeumUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581538; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UyflT5/PrIrjOcycaGh78gh+aCoVBTCLJjPyc4a4w6o=; b=bueI6QE2YTK9rMKf5690OpwWuHgPTBuQfnJPBx59PHVsyOu7KDft+1RrFY6G3an3aAIKxo4/kQoSd0NOiqH+4fbEQZrn4bb9uYuk1FUTRJTVDFJrdrKaGe0ouLFz748uBaoLXnb1g06uKJBfVV6uJwYkkbDbnWgtpf+DDWISFMY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589581538583894.3607757449469; Fri, 15 May 2020 15:25:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-CLR2aHbgO7Ch556pO84m_Q-1; Fri, 15 May 2020 18:25:34 -0400 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 ED5E21800D4A; Fri, 15 May 2020 22:25:25 +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 CF72D5C1B0; Fri, 15 May 2020 22:25:25 +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 A208F4EA08; Fri, 15 May 2020 22:25:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPKTL015321 for ; Fri, 15 May 2020 18:25:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 32E5FF1C90; Fri, 15 May 2020 22:25:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E337F1C9D for ; Fri, 15 May 2020 22:25:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 10AF2811E77 for ; Fri, 15 May 2020 22:25:20 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-giOrS2d4NvOB3QReOobN4A-1; Fri, 15 May 2020 18:25:14 -0400 Received: by mail-qt1-f193.google.com with SMTP id l1so3381309qtp.6; Fri, 15 May 2020 15:25:14 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581537; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UyflT5/PrIrjOcycaGh78gh+aCoVBTCLJjPyc4a4w6o=; b=DSjhyHgbtKboBFAjiRPBlrvnWsfPeKHobq90Q9BvqD/M1y3hRS+YPW07Uf7O1UkevKlcpL ZJ6UmeZ3JP3vhk0cfluBSveADcvtUctdYyYgPtjpxSbeVWaHec/gaDP5uvd/6oZE6Dz3fg MFGxaDPDE6iJ/7/h+YXCqy22WY5ZfpM= X-MC-Unique: CLR2aHbgO7Ch556pO84m_Q-1 X-MC-Unique: giOrS2d4NvOB3QReOobN4A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UyflT5/PrIrjOcycaGh78gh+aCoVBTCLJjPyc4a4w6o=; b=MX+W5gwK1WBIz0VJbya3JkaHb+hUlkl8QTwpYKjDSU//6jyegTbmlCohAA8FDEdES0 LaZGG554IWd63txKwZ9pY/m32Ex1lS2FoOcG/etFD9VcLZB+vkQKvuQn0tFxIZRRx/PM fpocsaXuzie58sIOFipMtnK9N/7hbBqIgaJLJT9aSZ9pGhdQl7GpSo/MBaTSLJ7vaUQF cz6+79BYdo4+UGq4qhPOLmSbubq0u57BZkIc5myki2wO/SqKIrRqwHpnMfb0rM3dkV97 JU1K/GG8WRtwIipbGc8mCdIjcI1sG9FbzD6qWS/OT1eTPbyavNRrn3JEnYcfgb8SsgKl EPSg== X-Gm-Message-State: AOAM531H1eZoibGoTu8JmthQt55VWfnQ8ypKCpRB5nVdZ79ZrL2aHAPI /VAZ7Gxzh4pox0olvEH8dooKlTd/ X-Google-Smtp-Source: ABdhPJwKAXKk9xlB/18MnUN/LFXxEh/rwqAN23CNlh9X86SaeGzl57QTpaTCjuJkjHzTItzTamks0w== X-Received: by 2002:ac8:2783:: with SMTP id w3mr5756413qtw.265.1589581513989; Fri, 15 May 2020 15:25:13 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 07/10] tests: add XML schema tests for the TPM Proxy device Date: Fri, 15 May 2020 19:24:10 -0300 Message-Id: <20200515222413.1231605-8-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This tests aims to exercise how a TPM Proxy device can be added in the domain, either alone or with a regular TPM device. It also ensures that we do not allow bogus scenarios to slip by. Reviewed-by: Stefan Berger Signed-off-by: Daniel Henrique Barboza --- tests/qemuxml2argvdata/ppc64-tpm-double.xml | 34 ++++++++++++++ .../ppc64-tpmproxy-double.xml | 38 +++++++++++++++ .../ppc64-tpmproxy-single.xml | 33 +++++++++++++ .../ppc64-tpmproxy-with-tpm.xml | 36 +++++++++++++++ tests/qemuxml2argvtest.c | 12 +++++ .../ppc64-tpmproxy-single.ppc64-latest.xml | 42 +++++++++++++++++ .../ppc64-tpmproxy-with-tpm.ppc64-latest.xml | 46 +++++++++++++++++++ tests/qemuxml2xmltest.c | 2 + 8 files changed, 243 insertions(+) create mode 100644 tests/qemuxml2argvdata/ppc64-tpm-double.xml create mode 100644 tests/qemuxml2argvdata/ppc64-tpmproxy-double.xml create mode 100644 tests/qemuxml2argvdata/ppc64-tpmproxy-single.xml create mode 100644 tests/qemuxml2argvdata/ppc64-tpmproxy-with-tpm.xml create mode 100644 tests/qemuxml2xmloutdata/ppc64-tpmproxy-single.ppc64-la= test.xml create mode 100644 tests/qemuxml2xmloutdata/ppc64-tpmproxy-with-tpm.ppc64-= latest.xml diff --git a/tests/qemuxml2argvdata/ppc64-tpm-double.xml b/tests/qemuxml2ar= gvdata/ppc64-tpm-double.xml new file mode 100644 index 0000000000..8730547a4d --- /dev/null +++ b/tests/qemuxml2argvdata/ppc64-tpm-double.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + + +
+ + + diff --git a/tests/qemuxml2argvdata/ppc64-tpmproxy-double.xml b/tests/qemux= ml2argvdata/ppc64-tpmproxy-double.xml new file mode 100644 index 0000000000..12abda509e --- /dev/null +++ b/tests/qemuxml2argvdata/ppc64-tpmproxy-double.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + + + + + + +
+ + + diff --git a/tests/qemuxml2argvdata/ppc64-tpmproxy-single.xml b/tests/qemux= ml2argvdata/ppc64-tpmproxy-single.xml new file mode 100644 index 0000000000..729a2cdf28 --- /dev/null +++ b/tests/qemuxml2argvdata/ppc64-tpmproxy-single.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + +
+ + + diff --git a/tests/qemuxml2argvdata/ppc64-tpmproxy-with-tpm.xml b/tests/qem= uxml2argvdata/ppc64-tpmproxy-with-tpm.xml new file mode 100644 index 0000000000..a61ec9845c --- /dev/null +++ b/tests/qemuxml2argvdata/ppc64-tpmproxy-with-tpm.xml @@ -0,0 +1,36 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + + + + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e5f129ea4c..1ce5e57d84 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2962,6 +2962,18 @@ mymain(void) QEMU_CAPS_NEC_USB_XHCI, QEMU_CAPS_DEVICE_QEMU_XHCI); =20 + DO_TEST_PARSE_ERROR("ppc64-tpmproxy-double", + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, + QEMU_CAPS_PCI_OHCI, + QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, + QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY); + + DO_TEST_PARSE_ERROR("ppc64-tpm-double", + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, + QEMU_CAPS_PCI_OHCI, + QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, + QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY); + DO_TEST("aarch64-usb-controller-qemu-xhci", QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_NEC_USB_XHCI, diff --git a/tests/qemuxml2xmloutdata/ppc64-tpmproxy-single.ppc64-latest.xm= l b/tests/qemuxml2xmloutdata/ppc64-tpmproxy-single.ppc64-latest.xml new file mode 100644 index 0000000000..4e0e5f24b8 --- /dev/null +++ b/tests/qemuxml2xmloutdata/ppc64-tpmproxy-single.ppc64-latest.xml @@ -0,0 +1,42 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + + + POWER9 + + + destroy + restart + restart + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + + + + + +
+ + + + diff --git a/tests/qemuxml2xmloutdata/ppc64-tpmproxy-with-tpm.ppc64-latest.= xml b/tests/qemuxml2xmloutdata/ppc64-tpmproxy-with-tpm.ppc64-latest.xml new file mode 100644 index 0000000000..9b64f914f0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/ppc64-tpmproxy-with-tpm.ppc64-latest.xml @@ -0,0 +1,46 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + + + POWER9 + + + destroy + restart + restart + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + + + + + + +
+ + +
+ + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 033f81013e..8360d5eeca 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -609,6 +609,8 @@ mymain(void) DO_TEST("controller-usb-order", QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4); + DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-single", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-with-tpm", "ppc64"); =20 DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, ARG_QEMU_CAPS, NONE); --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581539; cv=none; d=zohomail.com; s=zohoarc; b=JRdcYL/Hg9/WiU8e+V/8CjryhGIudsTB+0PcNTks/g9utFORoNg47M2pgWFOIObuwEhYS4BXvZVd+54aQWprXgv4XscQk3lUVuiflgv1aGl1VXei90WQohWDRWKtXR8Jh09/220ZUROG8Hj/iE35pmEDOh/ZehQRrtevvUrAFHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581539; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OiA9/Mc8ez/wSfyS79OAwPo72lTlNwQJOScSPsc1BGA=; b=A+X040/zqyVD3Pqrwh5YAO9XFFbHMckEN5qFGx5j/+HOPvxjDwuMRNDC4K4Ye9TtZwU/xJKV6UP538GFE4wRkW4BHabMreqbdtB4uIIUClTdnPeo6jjS0sBu5vou7rOugmx11EzJjSjkQJMDFAltiOJdikaoXZYDabyHJZjikn0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1589581539850953.752913840388; Fri, 15 May 2020 15:25:39 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-4LmZg4slOa22vKKwctvr7Q-1; Fri, 15 May 2020 18:25:36 -0400 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 6A35391164; Fri, 15 May 2020 22:25:30 +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 469F12DE74; Fri, 15 May 2020 22:25:30 +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 17BC31806B0D; Fri, 15 May 2020 22:25:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPOQ6015353 for ; Fri, 15 May 2020 18:25:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 622361009C7F; Fri, 15 May 2020 22:25:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5CE991008B7F for ; Fri, 15 May 2020 22:25:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1143F8007C8 for ; Fri, 15 May 2020 22:25:24 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-208-hd7wREoBPXuNOH_e-u41Og-1; Fri, 15 May 2020 18:25:16 -0400 Received: by mail-qt1-f194.google.com with SMTP id p12so3349912qtn.13; Fri, 15 May 2020 15:25:16 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581538; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OiA9/Mc8ez/wSfyS79OAwPo72lTlNwQJOScSPsc1BGA=; b=X/9qA5dWYtjk+fsW5HbsXDrYfpHL6Xj9910vN3x4DfB3kgchYir3i8YDu/UBVy9/wbemkB HRRIaZ0zI2sAqxaxWtztaA1VEnMyT3YAPiinBbSoaAtTs/1e40AjGBtr3Gx6zCpY0OtV7V G4KijYAunttGzTs5QVeCBVncZY9+kiI= X-MC-Unique: 4LmZg4slOa22vKKwctvr7Q-1 X-MC-Unique: hd7wREoBPXuNOH_e-u41Og-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OiA9/Mc8ez/wSfyS79OAwPo72lTlNwQJOScSPsc1BGA=; b=QuF00YuM/TG6pp/0YKjvo7ZwDM09IMMLWVQGWQgXz1ONtJJXqIuuGA1+sf9ZNskrS3 PZV4ulu4qbdvC7kTnAh9qB2UpJHMX8mIaPG9c3+z1eDSuu1JYL10wbXVCJqe9k1hQ/J9 gIul1ZZC3/L71v1kmAGFoWMmQtNrK2HS6JJLZxQ7G4MLQyuMM9BvPBdKrAjgw8s5vaop nHKJIPgEGYAqpjjb3yrZckVP+QK8b5i4Tp4WWGxrYkOyzx3/UlelwQzIJ/hTBP2JKLNg ZOAP4Y8uQ3ZfW1xhM6Gpxx4pGBwUJW4Em1ivCrFpaF5oiiBL2Ten1g2c+vWZc6l0h+IT xhtA== X-Gm-Message-State: AOAM531r8tjl+xRmPjPRg5XD2RFjDvCpqHnCLaBDjLSOA1dyUryJsrEc uLayxwCS+0BlXEf+SzJ801pSOBsB X-Google-Smtp-Source: ABdhPJzF7y/QlvYK0grTpgJADQvKhih4DxkhABVK8002WcFuX2eYLbVl72OzgVUdCu2JEYuP+n+4iQ== X-Received: by 2002:ac8:66d8:: with SMTP id m24mr5802503qtp.175.1589581515811; Fri, 15 May 2020 15:25:15 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 08/10] qemu: build command line for the TPM Proxy device Date: Fri, 15 May 2020 19:24:11 -0300 Message-Id: <20200515222413.1231605-9-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This patch wraps it up all the wiring done in previous patches, enabling a PPC64 guest to launch a guest using a TPM Proxy device. Note that device validation is already being done in qemu_validate.c, qemuValidateDomainDeviceDefTPM(), on domain define time. We don't need to verify QEMU capabilities for this device again inside qemu_command.c. Reviewed-by: Stefan Berger Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_alias.c | 5 ++++- src/qemu/qemu_command.c | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 9d72391ddb..522426794d 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -408,7 +408,10 @@ qemuAssignDeviceTPMAlias(virDomainTPMDefPtr tpm, if (tpm->info.alias) return 0; =20 - tpm->info.alias =3D g_strdup_printf("tpm%d", idx); + if (tpm->model =3D=3D VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) + tpm->info.alias =3D g_strdup_printf("tpmproxy%d", idx); + else + tpm->info.alias =3D g_strdup_printf("tpm%d", idx); return 0; } =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d2ac19a7a8..1eef79b2a0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8979,6 +8979,26 @@ qemuBuildTPMCommandLine(virCommandPtr cmd, } =20 =20 +static int +qemuBuildTPMProxyCommandLine(virCommandPtr cmd, + virDomainTPMDefPtr tpm) +{ + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + const char *filePath =3D NULL; + + filePath =3D tpm->data.passthrough.source.data.file.path; + + virCommandAddArg(cmd, "-device"); + virBufferAsprintf(&buf, "%s,id=3D%s,host-path=3D", + virDomainTPMModelTypeToString(tpm->model), + tpm->info.alias); + virQEMUBuildBufferEscapeComma(&buf, filePath); + virCommandAddArgBuffer(cmd, &buf); + + return 0; +} + + static int qemuBuildTPMsCommandLine(virCommandPtr cmd, const virDomainDef *def, @@ -8987,8 +9007,13 @@ qemuBuildTPMsCommandLine(virCommandPtr cmd, size_t i; =20 for (i =3D 0; i < def->ntpms; i++) { - if (qemuBuildTPMCommandLine(cmd, def, def->tpms[i], qemuCaps) < 0) + if (def->tpms[i]->model =3D=3D VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) { + if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i]) < 0) + return -1; + } else if (qemuBuildTPMCommandLine(cmd, def, + def->tpms[i], qemuCaps) < 0) { return -1; + } } =20 return 0; --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581538; cv=none; d=zohomail.com; s=zohoarc; b=GcPj3qAPVtK2mJmiBkxv8bjMGEnP+Ub5QVYTbx2zJAmukheVsIEicEfc60t3WAxXXt9O/2SwTe71QOHOsxBR3NcZhf1gq6ICza3rayC8POXHYHsdWUN5SW6BxpOZOmDEFipR1Zm/FpNzKkQYAkNSsirixKHKue/lijkbjeHTMio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581538; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Rv+FHu2HiE5JF/riQ4MWLTy0H37eoFC3fL4L6VYqdx8=; b=gWbiRWz2jnEK2ixSPL5ExUfPu/k3ayBMhKP4sa/WMM8X7gnQXmIeIUOhttTNBwC+yYYgwaaZHwdr24nTg08XRXq83TPCaksJCUEx7vhrdpFoG5kZbHDZ0l0dM5zjihui9RMqTL6vGeZ7z5tZSJOY+vENxAC5bnSnm3Kh1rMXeJA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589581538762887.8187582727729; Fri, 15 May 2020 15:25:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-SKXLqHHyNKqWdrFOiM33sw-1; Fri, 15 May 2020 18:25:35 -0400 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 31ADC107B769; Fri, 15 May 2020 22:25:28 +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 0E72F3A2; Fri, 15 May 2020 22:25:28 +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 D5C364EA0A; Fri, 15 May 2020 22:25:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPLJB015331 for ; Fri, 15 May 2020 18:25:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id F08A52166BA0; Fri, 15 May 2020 22:25:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC16E2166B27 for ; Fri, 15 May 2020 22:25:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CECA01859162 for ; Fri, 15 May 2020 22:25:20 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-nOMGg8BNPfqIXR85rwAxzQ-1; Fri, 15 May 2020 18:25:18 -0400 Received: by mail-qt1-f194.google.com with SMTP id m44so3372659qtm.8; Fri, 15 May 2020 15:25:18 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581537; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Rv+FHu2HiE5JF/riQ4MWLTy0H37eoFC3fL4L6VYqdx8=; b=CXmzO55WTH1ilCpkkli+nmcRe/RzL8beQdkMQsz0ffi8e1JgZOvRJDq6sxjIpzIZWIxFNu XgE/RG93ZX1TeGfsqSaUogQnOEkpoui+bpBPWKld/XV6xNNJi9+HiAIR6JnhHQgJ1ZBcfk bnMkfkNTpiKcOBbWzNiUJts8rShgkxc= X-MC-Unique: SKXLqHHyNKqWdrFOiM33sw-1 X-MC-Unique: nOMGg8BNPfqIXR85rwAxzQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rv+FHu2HiE5JF/riQ4MWLTy0H37eoFC3fL4L6VYqdx8=; b=WvdFErxVgolDhl6cjqZc2r5XwT9fMWV4BG8NYtqEVf9ROtXJ43KeJnpAJziYN64e0X ZL5Hm2xA6XdolYy2CM8IKnZwl7gj3A5mlteqXd7WJMCTpfFq2Bol3UWiAuwEABo+GMd4 2tWRFJHybVdvmMftkTV2/WFArhZkIEiyIhvlDD/9ED1K39p8EOoWA6f/QkTkKhAe5cps ytQunp1/e2j85NqmcyqrNjl+7fkwc1W6SFZS4c8UNYBxpEYrPDuD9swhFreXkBgAMbF4 xHwMmQLLsZ+DSQfCUvC8MWh57wXkJjEaQ2yWA6tsS9w9HMz2ODtF6SeJLpZVDJnF3Wl8 L2vg== X-Gm-Message-State: AOAM5312uQuU5g//YhpmOrBM9R47l+KXiL5I/Y6YqcSEv9jB2YoNgyaj r7XKuEjRQ3oki/alpFjsN4/Fdrit X-Google-Smtp-Source: ABdhPJw1FrvhrHQmreh5WVuOOqqm103K8YrYm4zKny4kmYWwImexw8cv9Eu6qobkmCYMN417Equr8Q== X-Received: by 2002:ac8:4a88:: with SMTP id l8mr5695304qtq.337.1589581517478; Fri, 15 May 2020 15:25:17 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 09/10] tests/qemuxml2argvtest.c: add TPM Proxy command line tests Date: Fri, 15 May 2020 19:24:12 -0300 Message-Id: <20200515222413.1231605-10-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add tests for both supported scenarios: a single TPM Proxy and a TPM Proxy with a regular TPM device in the same domain. Reviewed-by: Stefan Berger Signed-off-by: Daniel Henrique Barboza --- .../ppc64-tpmproxy-single.ppc64-latest.args | 34 +++++++++++++++++ .../ppc64-tpmproxy-with-tpm.ppc64-latest.args | 37 +++++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ 3 files changed, 74 insertions(+) create mode 100644 tests/qemuxml2argvdata/ppc64-tpmproxy-single.ppc64-late= st.args create mode 100644 tests/qemuxml2argvdata/ppc64-tpmproxy-with-tpm.ppc64-la= test.args diff --git a/tests/qemuxml2argvdata/ppc64-tpmproxy-single.ppc64-latest.args= b/tests/qemuxml2argvdata/ppc64-tpmproxy-single.ppc64-latest.args new file mode 100644 index 0000000000..f606cee16b --- /dev/null +++ b/tests/qemuxml2argvdata/ppc64-tpmproxy-single.ppc64-latest.args @@ -0,0 +1,34 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-ppc64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pseries,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu POWER9 \ +-m 256 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device pci-ohci,id=3Dusb,bus=3Dpci.0,addr=3D0x1 \ +-device spapr-tpm-proxy,id=3Dtpmproxy0,host-path=3D/dev/tpmrm0 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x6 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/ppc64-tpmproxy-with-tpm.ppc64-latest.ar= gs b/tests/qemuxml2argvdata/ppc64-tpmproxy-with-tpm.ppc64-latest.args new file mode 100644 index 0000000000..83eb58ae19 --- /dev/null +++ b/tests/qemuxml2argvdata/ppc64-tpmproxy-with-tpm.ppc64-latest.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-ppc64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pseries,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu POWER9 \ +-m 256 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device pci-ohci,id=3Dusb,bus=3Dpci.0,addr=3D0x1 \ +-device spapr-tpm-proxy,id=3Dtpmproxy0,host-path=3D/dev/tpmrm0 \ +-tpmdev emulator,id=3Dtpm-tpm0,chardev=3Dchrtpm \ +-chardev socket,id=3Dchrtpm,path=3D/dev/test \ +-device tpm-spapr,tpmdev=3Dtpm-tpm0,id=3Dtpm0,reg=3D0x00004000 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x6 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1ce5e57d84..55a599c085 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2974,6 +2974,9 @@ mymain(void) QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY); =20 + DO_TEST_CAPS_LATEST_PPC64("ppc64-tpmproxy-single"); + DO_TEST_CAPS_LATEST_PPC64("ppc64-tpmproxy-with-tpm"); + DO_TEST("aarch64-usb-controller-qemu-xhci", QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_NEC_USB_XHCI, --=20 2.26.2 From nobody Mon Nov 25 21:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1589581535; cv=none; d=zohomail.com; s=zohoarc; b=SQgUn/gLyGLw7cI29KiTffmGq+aTNeXDATNwbt3hqR1iQ5K47glIaXlA1LCN5x2eaATA0Mo3s6WhmX4+GiO/sb20g3TgGi3Zyxhl9TJf0KBh5vF+jfjfKqPoDe/UZsOvVe7WS/yYKlfD88hBC8D9xXM0+P7IxY/gctNsaNkp4cg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589581535; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wyDKJGEN6pEEt0exP7NWGgrjegmIHYfoH/W8uOcNhVw=; b=GD1Uu933fcUzZ3zJOG+ZfPYEU++uFwvB86GAi8/pdQl37BtBQy05M7BB/bpCS3Eng+kmT/kXf0v5LeE0o0ItFIPzxMaecV8W1wVz9md5Qt2TaitIswGNo+2uapuE1R13eq4UT7xux3QUp9yoWhR1unfgri6BNz2VvpTLYa602yA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1589581535590781.0676658544453; Fri, 15 May 2020 15:25:35 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-407-PyQapt_uOauP3SbFRInCzA-1; Fri, 15 May 2020 18:25:32 -0400 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 16BA2107ACF4; Fri, 15 May 2020 22:25:26 +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 E5D151024837; Fri, 15 May 2020 22:25:25 +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 B3B5C1806B0A; Fri, 15 May 2020 22:25:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04FMPMg1015339 for ; Fri, 15 May 2020 18:25:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id C405C200A773; Fri, 15 May 2020 22:25:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFAAD2028DCC for ; Fri, 15 May 2020 22:25:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9FC188A19B4 for ; Fri, 15 May 2020 22:25:22 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-478-ICvBghbcNweFoWOuEiiQEw-1; Fri, 15 May 2020 18:25:20 -0400 Received: by mail-qk1-f194.google.com with SMTP id g185so4295338qke.7; Fri, 15 May 2020 15:25:19 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id o18sm3181386qtb.7.2020.05.15.15.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 15:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589581534; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wyDKJGEN6pEEt0exP7NWGgrjegmIHYfoH/W8uOcNhVw=; b=QMvvufujOppJMM4cu4Pd6gF/5JksbEgoIoSLFsh8IuuEpYRBYijAztPTKFQombB6Tnbzrt qcIlC3keEcVacdoccEzRLOb9EJGjf969HXOVjyQDs1FJdyajZdzJhZQE+xSnDNth/D0XFQ GOkMCHEj8NgHoZxiq8o+dHIRFBqVfrM= X-MC-Unique: PyQapt_uOauP3SbFRInCzA-1 X-MC-Unique: ICvBghbcNweFoWOuEiiQEw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wyDKJGEN6pEEt0exP7NWGgrjegmIHYfoH/W8uOcNhVw=; b=iu7q7G0aeTOACIBMraf5xBEzmjcEIA9xMai+G3tu6DAWO/BkTDY7PkPKzX/zznoG8Z LAKvirZF4MXzZOQ33BlVHkB+RP99kN2DfrKE1rRU01skgJgcyakCPpk2voGBGVJjBrQ8 4/gyWrDonnfv86O62h74ON0d7D09sPJPgcixEx6LrwSef0STsV5idtia11zdZJJ4Zc7n rdDLXrJ+s852MeipvslemKa8aWYSw/VJ47HmCO7wC1QfRsP2appvUiljwAb5XqbIFjIU B+lPKH9tAxAzKKcaDJyqXLMM1E7qQqlUc9k4eMUKd9Fpf2YHqsJ+NwyhRmm3aI9zKidw 1i6w== X-Gm-Message-State: AOAM531EbLNBTu2vD391LluehttGGFJagcO36Sm5LCF7FaDreBGyIlPr 9fvHEL8BOt+Cs5EzM227aOyRz6Ur X-Google-Smtp-Source: ABdhPJxqUq2DbYdRLjR5ckRcvQuX0Ef8ID90gyuzo4ZjiXJY3NISmFCPTiKx0vJHVrTcSMNf2ksw1w== X-Received: by 2002:a37:634f:: with SMTP id x76mr5755449qkb.194.1589581519334; Fri, 15 May 2020 15:25:19 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v4 10/10] docs/news.xml: update for the new TPM Proxy device Date: Fri, 15 May 2020 19:24:13 -0300 Message-Id: <20200515222413.1231605-11-danielhb413@gmail.com> In-Reply-To: <20200515222413.1231605-1-danielhb413@gmail.com> References: <20200515222413.1231605-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , stefanb@linux.ibm.com, jtomko@redhat.com, david@gibson.dropbear.id.au 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Reviewed-by: Stefan Berger Signed-off-by: Daniel Henrique Barboza --- docs/news.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 4cef804aac..c22a0f0a18 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -44,6 +44,23 @@
+ + + qemu: add TPM Proxy device support + + + libvirt can now create guests using a new device type called + "TPM Proxy". The TPM Proxy connects to a TPM Resource Manager + present in the host, enabling the guest to run in secure virtual + machine mode with the help of an Ultravisor. Adding a TPM Proxy = to + a pSeries guest brings no security benefits unless the guest is + running on a PPC64 host that has Ultravisor and TPM Resource Man= ager + support. Only one TPM Proxy is allowed per guest. A guest using + a TPM Proxy device can instantiate another TPM device at the same + time. This device is supported only for pSeries guests via the n= ew + 'spapr-tpm-proxy' model of the TPM 'passthrough' backend. + +
--=20 2.26.2