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,URIBL_BLOCKED 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 EC8BCC07E9A for ; Wed, 14 Jul 2021 05:23:34 +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 4086B61370 for ; Wed, 14 Jul 2021 05:23:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4086B61370 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 CD63A82BEE; Wed, 14 Jul 2021 07:23:31 +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="YKWvMof+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8485482BFA; Wed, 14 Jul 2021 07:23:30 +0200 (CEST) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 A7D7482BDD for ; Wed, 14 Jul 2021 07:23:27 +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-ed1-x529.google.com with SMTP id l1so1365681edr.11 for ; Tue, 13 Jul 2021 22:23:27 -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=04x9mtzCd+1ea0K/KiCibnqZW6ibZMTD+kzuRxtxlrU=; b=YKWvMof+AEwJBoqNCPCgdXZC0fZt/+I+vM/qjIU9Mcibplm5p2bcu9fZR2ExrPl2SO cOlgXXmsSvL7xvKPLkvEGxEYtJZRWyoNyv91YU/uhJn3UpwKmbZaYXSPDuj4wFTNZd+d ahC7fKO9FXfG+WvPrF68wB/uYWwONIBnzfs5vb70QFQBpg4eScIc8A3QkQTuxSUOMrzw JL/wbHzZ11IYJIP+mWKSLtWZwGvACDCWnSt8I7/ci5zlKB5+Zd2CuRDulc2EVeAlrUcj t0AgN2gDn23mokHtMgyE80kJklHApbPsrQsD8xwJ6vyCVyxyR9QqFa7LPwYK0c+PVNdw r+nw== 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=04x9mtzCd+1ea0K/KiCibnqZW6ibZMTD+kzuRxtxlrU=; b=SfjUIulEDLjhtpl+7PeXRVr+6jyh0FHi5TyAFYMYvBL6JgV6Pz5bGzu2LJHlMpNswl DE00wMNcjBojEnfljgcP9TT8qQYND9Gr3p7w7pLXI8ae0qPm9Eza2X6f4slmt9vxO2ic Hv0dgucv14PDuVQHqaatOVNX+rjGId4ohjd2ChN/92rj/dIKoy25po4z4CfhSokzclWw 1fo7ZlGRyg1Ecfl+Sc2cdIAo2VDmYkXJOuS5WmJ5W9Cnu+cePST0HR8xREHWlhE7dTdv KgBJ+xye8tdqbhw9siUUqnhqS9FHNtvj+4g5XVVjDzi68NgUAHSCqCejgINnEmHv0nC/ hVfA== X-Gm-Message-State: AOAM531YXyFXuUQRJfsLCkAJfIcsxB3bKYlW7TRtnMI6SVGsUL4cqalN eZnLqomPtXcGHSnNDu4EmcHqcg== X-Google-Smtp-Source: ABdhPJxpSTpVvQKgWY0KKfE0km1HU392V26T2q5q0otIawe2CNH29IRjdBsoOLv0Skj8qUnGzdYhHg== X-Received: by 2002:aa7:dd8d:: with SMTP id g13mr10900725edv.336.1626240207169; Tue, 13 Jul 2021 22:23:27 -0700 (PDT) Received: from enceladus (athedsl-417902.home.otenet.gr. [79.131.184.108]) by smtp.gmail.com with ESMTPSA id cr9sm426271edb.17.2021.07.13.22.23.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 22:23:26 -0700 (PDT) Date: Wed, 14 Jul 2021 08:23:24 +0300 From: Ilias Apalodimas To: Simon Glass Cc: Heinrich Schuchardt , Johannes Holland , Masahisa Kojima , Dhananjay Phadke , U-Boot Mailing List Subject: Re: [PATCH 2/2] tpm2: Add a TPMv2 MMIO TIS driver Message-ID: References: <20210707162604.84196-1-ilias.apalodimas@linaro.org> <20210707162604.84196-2-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 On Tue, Jul 13, 2021 at 08:49:21PM -0600, Simon Glass wrote: > Hi Ilias, > > On Tue, 13 Jul 2021 at 14:11, Ilias Apalodimas > wrote: > > > > > > [...] > > > > > Should be a uclass interface. > > > > > > > > > > > > > Why? A uclass is supposed to describe and abstract hardware. This is just > > > > a specific implementation of a TPM, not all TPMs are TIS compliant. We already > > > > have a uclass for those. > > > > > > Who told you that a uclass is supposed to describe and abstract hardware? :-) > > > > > > > That's what I've mostly seen it used for, maybe i got the idea wrong. > > A uclass is basically a software construct. It is an interface between > clients and the driver, typically. Quite often the uclass is an > interface on top of the hardware (actually the driver). But quite > often it is not. For example, we use an GPIO uclass to access a pmic's > GPIOs, we use an I2C uclass to access the cros_ec I2C tunnel. Anywhere > where it makes sense to have an abstraction, we use a uclass. > > > > > > The uclass is how driver model does APIs, so normally a uclass would > > > be used for any API. There are exceptions, but this one actually looks > > > like a useful interface we should have. > > > > > > > the point is we already have a uclass for tpm devices. So why should the > > we add another one that just describes the TIS interface? > > You have already added another API, right? All we are discussing is > whether it should be a uclass or not. Unless there is a very good > reason, we should avoid creating custom interfaces that don't use > driver model. I actually think the interface you've created (MMIO) > will be very useful as a uclass. > So you are basically looking into adding something similar to dm_i2c_read/dm_i2c_write etc? I assume this is gong to be the default read method passed on the TIS API when we want to support i2c TPMs. For the MMIO case that would essentially mean, move the functions on a different file, add them on a header and define a UCLASS_DRIVER with only the .id and .name defined? Thanks /Ilias > [..] > > Regards, > Simon