From nobody Sat Feb 7 12:11:34 2026 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=1591812768; cv=none; d=zohomail.com; s=zohoarc; b=Y8Ooo4XseQMDuLymMC6vDCchVL8EkekYfqMeZaBrgdTNJHXvEoZ0CTPQjEQG1Zv6BnLoSZYXanApzri0osOiUAfzoN8CgwlcKSWY7SQQ5Sxp369HwPIzTbgydzYcJmuKSPrY8huRpjN9wKdCOh8pCxLR+dxUs1TloH5yJP2Yl+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591812768; 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=KKkTYu+3oC3qF8YQVAlKv5OZLzuAqM0xLKvawLh8bbw=; b=az+9X9Yq+0jzbyDnMzbvdpPnd6lRpW7yGQ2EZhO0oL5fsWflc2z/SeMVzjauk2zxCfzZv3+PDahgKJehCmkCd1t3Il1q7y/iL6k5yAkcoG5VnkmI8W4O08CQLDI9rdJueH3gUSgHb4Ba1lvLQmyUfz6BN04sEY7s0BA6+Wd1SpA= 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 1591812768651567.2726988419012; Wed, 10 Jun 2020 11:12:48 -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-51-EW4gycAcNmSeAxLzHDywpg-1; Wed, 10 Jun 2020 14:12:42 -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 1C362108BD0D; Wed, 10 Jun 2020 18:12:37 +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 EDD11100EBDB; Wed, 10 Jun 2020 18:12:36 +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 BF2BF180043A; Wed, 10 Jun 2020 18:12:36 +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 05AICNWt020180 for ; Wed, 10 Jun 2020 14:12:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 234431007A2B; Wed, 10 Jun 2020 18:12:23 +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 1E9F310073DE for ; Wed, 10 Jun 2020 18:12:23 +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 043D0858EE0 for ; Wed, 10 Jun 2020 18:12:23 +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-218-bzLax9AXPYy0ZCyA3ZGW9w-1; Wed, 10 Jun 2020 14:12:19 -0400 Received: by mail-qt1-f193.google.com with SMTP id d27so2536306qtg.4 for ; Wed, 10 Jun 2020 11:12:19 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:b081:e954:9388:2ec6:d6f4]) by smtp.gmail.com with ESMTPSA id z4sm569415qtu.33.2020.06.10.11.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 11:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591812767; 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=KKkTYu+3oC3qF8YQVAlKv5OZLzuAqM0xLKvawLh8bbw=; b=bPs7GtCSNPWsLcff5lTzFAhygtUPFwmWMgx2LKhNuqUX9wztrPioA2yT661Tl5G7qB4JGh fOvdeSO4VoTti9yti9MUo2ztVm2AgpjgC5G0Zzht6RbHyAASf5qp8jwRlKePQv9k9UsIAn RHAo7zQqRo/KPhdgXl+on3d8hCM/y4A= X-MC-Unique: EW4gycAcNmSeAxLzHDywpg-1 X-MC-Unique: bzLax9AXPYy0ZCyA3ZGW9w-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=KKkTYu+3oC3qF8YQVAlKv5OZLzuAqM0xLKvawLh8bbw=; b=coAjfV6c9cMSMW8YoRrNWB3zxxLFY7EXJv2SqnjqT1YsBPyliF4cq6AvB47ZZ4DvnG +y5TtYJUrBcUNvQtrxxxK8UhUDjIqMDCVMlIrhP0JU6U7/Q3ojAnbCNqf3eSvmn8PctH xo9H12pJ8IKL+SbUR1ERLq0gV6AS3z9qsBsLJoJkxoxOQoJe6x5UDOcF/2EQqejhm++X kKxbuu9ttUq9LF2k0m/6sHF8JyhS6GjtA8wF8LXkaS9lhC+r9DO/dr6I2FZlrV/woX+A 0e7adiTXfCpo6jFwhWCPVlczujtI1SHoCfRYICjFjq7qVTC0ckk/uOUF4CW2maNakmaX ruNw== X-Gm-Message-State: AOAM5327xFinpPZrSG/57L2M1xJymv867n2q0az0sCQ+iSdEMpcE80hA swLIBPYhO4YvFa3MdFHY+2v8/6Ld X-Google-Smtp-Source: ABdhPJxKrwC96QkdUNr4imBryjoK7GO9jyAmwBxWdbUgrZJMDeDpQXSe5eBE/9oKN5EuQLqgNp+M5g== X-Received: by 2002:aed:24ce:: with SMTP id u14mr4504518qtc.31.1591812738969; Wed, 10 Jun 2020 11:12:18 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v7 08/10] qemu: build command line for the TPM Proxy device Date: Wed, 10 Jun 2020 15:11:50 -0300 Message-Id: <20200610181152.374479-9-danielhb413@gmail.com> In-Reply-To: <20200610181152.374479-1-danielhb413@gmail.com> References: <20200610181152.374479-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, sathnaga@linux.vnet.ibm.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" 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. Tested-by: Satheesh Rajendran Reviewed-by: Stefan Berger Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- 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 85fdb85940..bb7145d630 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 7ccf71e9ea..b16a128124 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9101,6 +9101,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, @@ -9109,8 +9129,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