From nobody Mon Feb 9 06:00:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1641913139; cv=none; d=zohomail.com; s=zohoarc; b=b58VzchNK12EYA1lW8ah4Xvlf8Yo5kLDpF9dvCTza3TNJzVQRFGehdGi9CM+w7LX/ZqwRwYav01FUzG8PR0Lfb/0ECt1B5W1Iu9bqkJRID4Xen0NviEr1Ill7bbut6OLqOUBUGllaW6Y5x7/y7M6JLSkc3hLWujQjcEyTMdh9Zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641913139; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Kc8vjPoaiZBPWJd7bC9/lWlsrU4qpi/hgSPUhZ8Wm48=; b=gUc4H/cqVpQGd8I4UvBGvE9SW7ivEKpXxo1H9Yjvvtxwwl/IYDb6zRRL6ubCpBvK94r2t1CF+xY18F6YWWKQlJ1IGnfLCGMFVF8L/Qyc2AjDm4WY9coh8wJQlRYHKa4pauQUK6mfyOFaI1DOjfXV1WzhL2SKYSoHaG0VMoMx9uE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1641913139435122.1706816308639; Tue, 11 Jan 2022 06:58:59 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.255772.438438 (Exim 4.92) (envelope-from ) id 1n7IbX-0003hB-0J; Tue, 11 Jan 2022 14:58:31 +0000 Received: by outflank-mailman (output) from mailman id 255772.438438; Tue, 11 Jan 2022 14:58:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n7IbW-0003gs-Qi; Tue, 11 Jan 2022 14:58:30 +0000 Received: by outflank-mailman (input) for mailman id 255772; Tue, 11 Jan 2022 14:58:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n7IbU-0002OZ-Cx for xen-devel@lists.xenproject.org; Tue, 11 Jan 2022 14:58:28 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id eb953028-72ee-11ec-81c1-a30af7de8005; Tue, 11 Jan 2022 15:58:22 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 242F7212CB; Tue, 11 Jan 2022 14:58:22 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EF06413DDD; Tue, 11 Jan 2022 14:58:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gEULOQ2b3WH9eQAAMHmgww (envelope-from ); Tue, 11 Jan 2022 14:58:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: eb953028-72ee-11ec-81c1-a30af7de8005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1641913102; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kc8vjPoaiZBPWJd7bC9/lWlsrU4qpi/hgSPUhZ8Wm48=; b=LQxJ7OH+F7Zw7qdHdMyNJ2UZp9vmF7os301Zp+Ys8Ek/bMu0+EImR1SRe2hGXSSHeMo/QX xQUrY5LeQ8sRz0L1Ngdk93hAUn4RUUO17NZL8C36p2AKFBD8060iTmEiJtqjFrJOoZ/txp JkeH5ZgZyrLtps8OYkxDA+zWq5ReSdI= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH v2 11/18] mini-os: move tpm respgot member of struct file to device specific data Date: Tue, 11 Jan 2022 15:58:10 +0100 Message-Id: <20220111145817.22170-12-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220111145817.22170-1-jgross@suse.com> References: <20220111145817.22170-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1641913141323100001 Content-Type: text/plain; charset="utf-8" Tpmfront has a "respgot" flag in struct file, which can be moved to the device specific data. While at it make it a bool. The respgot flag of the tpm_tis member of struct file can be removed, as it is never read. Signed-off-by: Juergen Gross Reviewed-by: Samuel Thibault --- include/lib.h | 2 -- include/tpmfront.h | 2 ++ tpm_tis.c | 2 -- tpmfront.c | 10 +++++----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/lib.h b/include/lib.h index f2a124e..d740065 100644 --- a/include/lib.h +++ b/include/lib.h @@ -196,13 +196,11 @@ struct file { #ifdef CONFIG_TPMFRONT struct { struct tpmfront_dev *dev; - int respgot; } tpmfront; #endif #ifdef CONFIG_TPM_TIS struct { struct tpm_chip *dev; - int respgot; } tpm_tis; #endif #ifdef CONFIG_XENBUS diff --git a/include/tpmfront.h b/include/tpmfront.h index c489fae..b7da50e 100644 --- a/include/tpmfront.h +++ b/include/tpmfront.h @@ -25,6 +25,7 @@ #ifndef TPMFRONT_H #define TPMFRONT_H =20 +#include #include #include #include @@ -53,6 +54,7 @@ struct tpmfront_dev { =20 #ifdef HAVE_LIBC int fd; + bool respgot; #endif =20 }; diff --git a/tpm_tis.c b/tpm_tis.c index 8a632b1..4127118 100644 --- a/tpm_tis.c +++ b/tpm_tis.c @@ -846,7 +846,6 @@ int tpm_tis_send(struct tpm_chip* tpm, uint8_t* buf, si= ze_t len) { #ifdef HAVE_LIBC if(tpm->fd >=3D 0) { files[tpm->fd].read =3D false; - files[tpm->fd].tpm_tis.respgot =3D 0; files[tpm->fd].offset =3D 0; } #endif @@ -1290,7 +1289,6 @@ int tpm_tis_open(struct tpm_chip* tpm) tpm->fd =3D alloc_fd(FTYPE_TPM_TIS); printk("tpm_tis_open() -> %d\n", tpm->fd); files[tpm->fd].tpm_tis.dev =3D tpm; - files[tpm->fd].tpm_tis.respgot =3D 0; return tpm->fd; } =20 diff --git a/tpmfront.c b/tpmfront.c index 8b2a910..be671c2 100644 --- a/tpmfront.c +++ b/tpmfront.c @@ -439,8 +439,8 @@ int tpmfront_send(struct tpmfront_dev* dev, const uint8= _t* msg, size_t length) #ifdef HAVE_LIBC if(dev->fd >=3D 0) { files[dev->fd].read =3D false; - files[dev->fd].tpmfront.respgot =3D 0; files[dev->fd].offset =3D 0; + dev->respgot =3D false; } #endif wmb(); @@ -499,7 +499,7 @@ int i; #endif #ifdef HAVE_LIBC if(dev->fd >=3D 0) { - files[dev->fd].tpmfront.respgot =3D 1; + dev->respgot =3D true; } #endif quit: @@ -539,7 +539,7 @@ int tpmfront_open(struct tpmfront_dev* dev) dev->fd =3D alloc_fd(FTYPE_TPMFRONT); printk("tpmfront_open(%s) -> %d\n", dev->nodename, dev->fd); files[dev->fd].tpmfront.dev =3D dev; - files[dev->fd].tpmfront.respgot =3D 0; + dev->respgot =3D false; return dev->fd; } =20 @@ -580,7 +580,7 @@ int tpmfront_posix_read(int fd, uint8_t* buf, size_t co= unt) } =20 /* get the response if we haven't already */ - if(files[dev->fd].tpmfront.respgot =3D=3D 0) { + if (!dev->respgot) { if ((rc =3D tpmfront_recv(dev, &dummybuf, &dummysz)) !=3D 0) { errno =3D EIO; return -1; @@ -610,7 +610,7 @@ int tpmfront_posix_fstat(int fd, struct stat* buf) =20 /* If we have a response waiting, then read it now from the backend * so we can get its length*/ - if(dev->waiting || (files[dev->fd].read && !files[dev->fd].tpmfront.res= pgot)) { + if(dev->waiting || (files[dev->fd].read && !dev->respgot)) { if ((rc =3D tpmfront_recv(dev, &dummybuf, &dummysz)) !=3D 0) { errno =3D EIO; return -1; --=20 2.26.2