From nobody Tue Feb 10 17:31:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507590846662622.5445570879532; Mon, 9 Oct 2017 16:14:06 -0700 (PDT) Received: from localhost ([::1]:60201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1hFH-00031A-NI for importer@patchew.org; Mon, 09 Oct 2017 19:13:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1gzo-0006Ws-AP for qemu-devel@nongnu.org; Mon, 09 Oct 2017 18:58:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1gzn-0005NV-Bt for qemu-devel@nongnu.org; Mon, 09 Oct 2017 18:58:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50142) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1gzn-0005Mx-2z for qemu-devel@nongnu.org; Mon, 09 Oct 2017 18:57:59 -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 mx1.redhat.com (Postfix) with ESMTPS id E855381DEE; Mon, 9 Oct 2017 22:57:57 +0000 (UTC) Received: from localhost (unknown [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5395618796; Mon, 9 Oct 2017 22:57:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E855381DEE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=marcandre.lureau@redhat.com From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 10 Oct 2017 00:56:07 +0200 Message-Id: <20171009225623.29232-27-marcandre.lureau@redhat.com> In-Reply-To: <20171009225623.29232-1-marcandre.lureau@redhat.com> References: <20171009225623.29232-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 09 Oct 2017 22:57:58 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 26/42] tpm-be: ask model to the TPM interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , amarnath.valluri@intel.com, stefanb@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" No need to store the mode in the backend, or to let the frontend set it itself. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Stefan Berger --- hw/tpm/tpm_int.h | 1 + include/sysemu/tpm_backend.h | 1 - backends/tpm.c | 4 ++-- hw/tpm/tpm_tis.c | 3 +-- tpm.c | 3 ++- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h index 9c49325f03..90e97b9170 100644 --- a/hw/tpm/tpm_int.h +++ b/hw/tpm/tpm_int.h @@ -30,6 +30,7 @@ typedef struct TPMIf { typedef struct TPMIfClass { InterfaceClass parent_class; =20 + enum TpmModel model; void (*request_completed)(TPMIf *obj); } TPMIfClass; =20 diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h index 51dfc0de9c..b12ae5b625 100644 --- a/include/sysemu/tpm_backend.h +++ b/include/sysemu/tpm_backend.h @@ -52,7 +52,6 @@ struct TPMBackend { =20 /* */ char *id; - enum TpmModel fe_model; =20 QLIST_ENTRY(TPMBackend) list; }; diff --git a/backends/tpm.c b/backends/tpm.c index 7b108bd5d8..0c48d18775 100644 --- a/backends/tpm.c +++ b/backends/tpm.c @@ -148,9 +148,10 @@ TPMInfo *tpm_backend_query_tpm(TPMBackend *s) { TPMInfo *info =3D g_new0(TPMInfo, 1); TPMBackendClass *k =3D TPM_BACKEND_GET_CLASS(s); + TPMIfClass *tic =3D TPM_IF_GET_CLASS(s->tpmif); =20 info->id =3D g_strdup(s->id); - info->model =3D s->fe_model; + info->model =3D tic->model; if (k->get_tpm_options) { info->options =3D k->get_tpm_options(s); } @@ -204,7 +205,6 @@ static void tpm_backend_instance_init(Object *obj) tpm_backend_prop_get_opened, tpm_backend_prop_set_opened, NULL); - s->fe_model =3D -1; s->bh =3D qemu_bh_new(tpm_backend_request_completed_bh, s); } =20 diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 2fbc760730..3c8d246ac8 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -1067,8 +1067,6 @@ static void tpm_tis_realizefn(DeviceState *dev, Error= **errp) return; } =20 - s->be_driver->fe_model =3D TPM_MODEL_TPM_TIS; - if (tpm_backend_init(s->be_driver, TPM_IF(s), errp)) { return; } @@ -1103,6 +1101,7 @@ static void tpm_tis_class_init(ObjectClass *klass, vo= id *data) dc->props =3D tpm_tis_properties; dc->reset =3D tpm_tis_reset; dc->vmsd =3D &vmstate_tpm_tis; + tc->model =3D TPM_MODEL_TPM_TIS; tc->request_completed =3D tpm_tis_request_completed; } =20 diff --git a/tpm.c b/tpm.c index 45520f555d..ce1543fcb4 100644 --- a/tpm.c +++ b/tpm.c @@ -204,9 +204,10 @@ TPMInfoList *qmp_query_tpm(Error **errp) TPMInfoList *info, *head =3D NULL, *cur_item =3D NULL; =20 QLIST_FOREACH(drv, &tpm_backends, list) { - if (!tpm_models[drv->fe_model]) { + if (!drv->tpmif) { continue; } + info =3D g_new0(TPMInfoList, 1); info->value =3D tpm_backend_query_tpm(drv); =20 --=20 2.14.1.146.gd35faa819