From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AC36C07E99 for ; Mon, 12 Jul 2021 14:03:42 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A52060240 for ; Mon, 12 Jul 2021 14:03:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A52060240 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9E2B582D7E; Mon, 12 Jul 2021 16:03:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="j51U5rli"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AC85982D95; Mon, 12 Jul 2021 16:03:37 +0200 (CEST) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C399082917 for ; Mon, 12 Jul 2021 16:03:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wm1-x336.google.com with SMTP id l4-20020a05600c4f04b0290220f8455631so65699wmq.1 for ; Mon, 12 Jul 2021 07:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pRNw8rnl+qR90SnFpjFzQxEzZxq/YDFCv8pxKkGKNBo=; b=j51U5rlizFpVdy6xcVpurjK9eaSedqMPRnhp1WLpBr2pdNK7ZgoL+a0VmNUcDT5c5W 1aB/CaSjYI26BhHgDLruxzssq9fbh+miPD8pZUQGEfFrW/LlxQnvn6EfZUjhkoHWqbQG QVMXxXOg8LxpOYxoeBcjp+FrRlFh3BRwdkUjpO1KCZyIVaLIWflfIf7i3W8NVfy2uv8A rgQAaXQQza91MzVJUobxe0KNJXJKIC8F/GYWAKCVPcHJ0GmkbYRv00TW0pWqC2cAifHf +ttqgH8qL5yW5Roj+UgBtLi7oMUAY7hdpcKFVv6d9044Szr74n6xGnmz1DF0WC3vrEF5 NPCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pRNw8rnl+qR90SnFpjFzQxEzZxq/YDFCv8pxKkGKNBo=; b=BHnonP9iQbKpKpXfMz+9uV7zF2QWK7Ku1qVfhwXVbCJKp8Jnb+J33vdymIadoGZDLz 3XEYSnNr+IQEjK80jD+9nO6Mv4W0jQFIhTkEXp+zeOvcj5ED5Rg+U/ycuyEemK6QkGSt yVxR84EQHax7Zl580mpAeijaeaOWGeVif1MV5bmxYMFPbIB4itYDt6bPQGkyEhYZjs34 mgzC32I0U7a9j3+LufCWNqE+sUrRuFf0p8zyd48i0qih5jhc1Lb5vxK/JV2scvg2p6BF h9Y4CxRZtvSA5mxflxrLPxML0PLnHGYkwIuXMoRsK7aHR7C45o9QdVOboclNMxIrPxfB KpLQ== X-Gm-Message-State: AOAM53130V9Nq7aaqq85mo+t+3j0uKDrYB9+3h6RFLCTcmHQSrZN5pGC Rgw33JKnUs28O6ik4TeZouqiSw== X-Google-Smtp-Source: ABdhPJwZsGAqErqz+Znj0Z7NtqXiCJpwAeqjViTy04R56AvPV5M2QjsUT8mzvvlgbNSxr3QmQyWEsQ== X-Received: by 2002:a05:600c:4e88:: with SMTP id f8mr55528164wmq.14.1626098614352; Mon, 12 Jul 2021 07:03:34 -0700 (PDT) Received: from enceladus (athedsl-417902.home.otenet.gr. [79.131.184.108]) by smtp.gmail.com with ESMTPSA id s17sm14603610wrv.2.2021.07.12.07.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 07:03:33 -0700 (PDT) Date: Mon, 12 Jul 2021 17:03:31 +0300 From: Ilias Apalodimas To: Simon Glass Cc: Heinrich Schuchardt , Johannes Holland , Masahisa Kojima , Dhananjay Phadke , U-Boot Mailing List Subject: Re: [PATCH 1/2 v2] tpm2: Introduce TIS tpm core Message-ID: References: <20210707162604.84196-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean > > > > TPM_STS_SELF_TEST_DONE = 1 << 2, [...] > > > > TPM_STS_RESPONSE_RETRY = 1 << 1, > > > > + TPM_STS_READ_ZERO = 0x23 > > > > > > Does this below in another patch? > > > > > > > It's a general tpm2 update. I can move it to the driver patch if it makes > > more sense. > > > > > > }; > > > > > > > > enum { > > > > -- > > > > 2.32.0.rc0 > > > > > > > > > > I feel that this API could be useful in reducing code duplication, but > > > in fact it has just created more, so far as I can see from this series > > > :-) So I think you should convert at least one driver to show its > > > value (and not make things any worse). > > > > The mmio tpm driver uses it and instead of ~700 lines (like the tpmv2 spi > > driver) it drops down to ~100. I don't have access to any other TPM > > hardware to rewrite any of those. > > Yes, but I hope you see my point, that you have added a new interface. > It is definitely better than adding a new driver and duplicating all > the code, but it is still one more copy and in fact, the code is > duplicated. > I get the point but I don't exactly agree here. It's not duplicated code. We need to plug in the mmio driver. The original code was just doing what every TPM does. It carried the TIS relevant code in the new driver. The new approach defines an API for everyone to use and the new driver uses it. So I don't see the duplication here. You need the TIS code one way or the other. Now it's on a common interface for everyone to use. > Can you get access to TPM hardware? I see that you have offered to be > the maintainer for this subsystem, so I think that would be useful. > Can sandbox use your new API? It depends, is the sandbox TIS compatible? If it is sure we could use it. I offered to maintain the drivers because I wrote the API and I have an idea of how TPMs should work. If that means I'll have to go and get every hardware we support, I'll just volunteer into maintaining the TIS layer. Moreover I dont see why I should start porting drivers to use that API. People decided to duplicate that code in every driver (in fact multiple times). I am happy to work with you on the cr50 i2c driver if that would help. Regards /Ilias > > Regards, > Simon