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=-4.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MISSING_HEADERS,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 0EB5DC07E99 for ; Mon, 5 Jul 2021 16:57:08 +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 5197161964 for ; Mon, 5 Jul 2021 16:57:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5197161964 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 48D4A82BE7; Mon, 5 Jul 2021 18:57:05 +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="MvI46LwG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 23DD082BE8; Mon, 5 Jul 2021 18:57:04 +0200 (CEST) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 28D8282BAA for ; Mon, 5 Jul 2021 18:57:01 +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-wr1-x42f.google.com with SMTP id f14so22467772wrs.6 for ; Mon, 05 Jul 2021 09:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=bZMU3dCqfaC0iYUy2COXChk466W36hHxB+g1cMwQYxs=; b=MvI46LwGM9cg4RLi8JeiqXjiRjGxtGt4tD6WN/fkosDK+zcQj8vthtryATXYS9kLzg TlfHwyOLQxXRtWb60GX66vzrPJMqBlu7ttonMnE+AXAveaNWDpZMUgBhuVicqFQgXUvW cYz6gSKah6hTumR4iKfCOCeqcV1nu3OFlMVU3LhdmoH6EZMJEAvu3RJSmv+ayJZ1fqLI SMNtEJaRw0eEUNNVM4aUhlenxDBbn5srax5NaGRl/2yRoIssmbCjklhLNwnStBMf9HkW K+N3J4PF3HIXfd5ResG3glzjGFVurfoSyOcAXbe5iJtrDfizdRZDeiG5Or4FytNHkGk6 VXvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bZMU3dCqfaC0iYUy2COXChk466W36hHxB+g1cMwQYxs=; b=ebhMNexyfMP/D6G9z621gJEWKETITqBZMC5V73KifkpxW3GOZxc32YqUvDm6V25JD5 oOBByNaPaf8vZXy0UCq58yd1NEaXmHVpE3Nvme31rwZOwI7YhY8mRpNBszPF4lWg78s0 U/kiYi7NQA9QtFXiMfXMx0qV8deVACHURvNqb70fJV72S5lN4uFcVMYUWuOAtOZwWqeV VmYF+w4jwohhnhfaUhOw+nRiE/EJOg+fif4t5jgm7ow9xsp30N1nqvRs/Eb5YyZs0biA VCqiyc1IIcwvgCxR3b5m/nZTYf/Kj/QZOdKQ+krC8C6ESXQnUlwDbLGJFxjbhFjzga7A UBgg== X-Gm-Message-State: AOAM532ZvGjlwa58dSv3GH5LFrNG9aqHQvfZC7k8B5WUGGbXcp5a+kSg US7FDpRzDhDBn9rm/tA+B52YOQ== X-Google-Smtp-Source: ABdhPJziXPGxkkhwm0ASnad7urpZEbLppMC9d+GOyI4yP6O/1a/kQKT9/0BK/Gy+o6qohqAS4BB6KA== X-Received: by 2002:adf:eccf:: with SMTP id s15mr16411816wro.176.1625504220682; Mon, 05 Jul 2021 09:57:00 -0700 (PDT) Received: from enceladus (ppp-94-66-242-227.home.otenet.gr. [94.66.242.227]) by smtp.gmail.com with ESMTPSA id k14sm13012497wmr.29.2021.07.05.09.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 09:57:00 -0700 (PDT) Date: Mon, 5 Jul 2021 19:56:57 +0300 From: Ilias Apalodimas Cc: Heinrich Schuchardt , Johannes Holland , Dhananjay Phadke , U-Boot Mailing List Subject: Re: [PATCH 1/1] tpm2: Add a TPMv2 MMIO TIS driver Message-ID: References: <20210702125234.19145-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 > > > [...] > > > These definitions match Linux' tpm_tis_core.h. > > > > > > Should they be moved to an include of the same name in U-Boot? > > > > I got a tpm_tis.h in this series, so I might as well move those there > > > > > > > > > [...] > > > > > I would prefer if you would add these functions to a structure struct > > > tpm_tis_phy_ops which you can use to pull out the core driver. > > > > Me too :). In fact that matches the design I proposed over IRC. I just > > didn't have too much free time to fix it, so I went ahead and posted the > > driver matching what's already in U-Boot. That being said, what's proposed > > here is the right was forward. Basically if we do it like this then any > > future TPM TIS driver will only have to define the read/write ops for the > > underlyng bus. > > I'm not sure about the irc side, but it is best to do things on the > mailing list so people can see it. > > There seems to be quite a bit of duplicated code in this new driver. I > think it would be better to come up with the interface first, as > Heinrich suggests. Would something like regmap be good enough? > There's duplicated code in *every* TPM driver we have right now. That.. includes the cr50 and the TPM2 spi implementation we have. That's why I posted it as is. The interface you are looking for is the TIS described one from TCG. I am not sure if regmap is a good idea in that regard, but since I agree with both of you that having an abstracted TIS core makes sense in general, I'll go ahead and split my code. Then we can take a step back and port the remaining drivers to that. Cheers /Ilias > Regards, > Simon