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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2D213C433EF for ; Thu, 14 Jul 2022 11:19:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B18B58406A; Thu, 14 Jul 2022 13:19:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="gQ4s+vkN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 750BD8402C; Thu, 14 Jul 2022 13:19:54 +0200 (CEST) Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) (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 19F478407C for ; Thu, 14 Jul 2022 13:19:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf29.google.com with SMTP id l15so1163531qvo.11 for ; Thu, 14 Jul 2022 04:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vOUapTOYmToGTRZfbCB2UvwMMrwzmzUUqW4izx/KGzo=; b=gQ4s+vkNm5m9SWZ0YPqB6O++p/WMR7o3BKXWaLix6QqMC2aM4+w9N5ooyE7RWol/+n W+cpqeP4Byi3dsULLdvajsV4gFNfK/jX7GbbWwh5WXwcjSnGrUZ+vA3OkxaM35tYXe1a 5g3fThjb5bLRSuqkUe3SdSH9Dqp9iudKcd+3c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vOUapTOYmToGTRZfbCB2UvwMMrwzmzUUqW4izx/KGzo=; b=KQZY5h88m4/C9ZsHtI5GOPq3IjK64J0st3w03qmzwS6ta+J6UyH6b3xeSxq0M83nt3 FzR3c9bkbdyNyE8sZbrQE3zy3CGUCe6pF2utfhkrk0T6Qf812AxLya5wO2USDe0Jl/Yq GKE+bjLMgktF0XswkoQTp/D082zxMi5WocBvz69xwfJJJ7JrHC7M7qi/JB27l/ICCaQm NWnAGunTGFxScgvXG/Jpn0cM5+sSa4AS9kj/jTg27TznTzcGlyliLf2ne0RjfYAiC+sR wmgb/ZTRMeAsZqlnvkmzepRS099g7+VBmgGc89g1F8jYhINyTTJ0iqwTxQsdj2VGCa1V affA== X-Gm-Message-State: AJIora+nAZDMaZFEK1G3ENVMhykvmCaDuhTL06q1OjrKMhn/qV2/gl2y CvSR+xidRYlc8eI6mamFaeRQ+sR3auPF8A== X-Google-Smtp-Source: AGRyM1v/8QRBNMCObz29jHMXx5bRpMJ/qI5g1Tgxj1I+xEx6V6iwt+wmGkosQLRKbE0NsNVcPgp8mQ== X-Received: by 2002:a0c:dd11:0:b0:473:34ad:8e06 with SMTP id u17-20020a0cdd11000000b0047334ad8e06mr7003426qvk.4.1657797589488; Thu, 14 Jul 2022 04:19:49 -0700 (PDT) Received: from bill-the-cat (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id h24-20020ac85158000000b003051ea4e7f6sm1240640qtn.48.2022.07.14.04.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 04:19:48 -0700 (PDT) Date: Thu, 14 Jul 2022 07:19:46 -0400 From: Tom Rini To: Simon Glass Cc: Rob Herring , Ilias Apalodimas , Sughosh Ganu , U-Boot Mailing List , Heinrich Schuchardt Subject: Re: [PATCH v6 3/7] tpm: Add the RNG child device Message-ID: <20220714111946.GV1146598@bill-the-cat> References: <20220704133444.1110715-1-sughosh.ganu@linaro.org> <20220704133444.1110715-4-sughosh.ganu@linaro.org> <20220713180946.GN1146598@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xm1n32eGFXmRUoyy" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean --xm1n32eGFXmRUoyy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 14, 2022 at 04:21:58AM -0600, Simon Glass wrote: > Hi Tom, >=20 > On Wed, 13 Jul 2022 at 12:09, Tom Rini wrote: > > > > On Wed, Jul 13, 2022 at 09:28:16AM -0600, Simon Glass wrote: > > > Hi Rob, > > > > > > On Tue, 12 Jul 2022 at 08:11, Rob Herring wrote: > > > > > > > > On Tue, Jul 12, 2022 at 5:04 AM Simon Glass wrot= e: > > > > > > > > > > Hi Ilias, > > > > > > > > > > On Fri, 8 Jul 2022 at 02:24, Ilias Apalodimas > > > > > wrote: > > > > > > > > > > > > Hi Simon, > > > > > > > > > > > > [...] > > > > > > > > > > > > > > + > > > > > > > > UCLASS_DRIVER(tpm) =3D { > > > > > > > > - .id =3D UCLASS_TPM, > > > > > > > > - .name =3D "tpm", > > > > > > > > - .flags =3D DM_UC_FLAG_SEQ_ALIAS, > > > > > > > > + .id =3D UCLASS_TPM, > > > > > > > > + .name =3D "tpm", > > > > > > > > + .flags =3D DM_UC_FLAG_SEQ_ALIAS, > > > > > > > > #if CONFIG_IS_ENABLED(OF_REAL) > > > > > > > > - .post_bind =3D dm_scan_fdt_dev, > > > > > > > > + .post_bind =3D dm_scan_fdt_dev, > > > > > > > > #endif > > > > > > > > + .post_probe =3D tpm_uclass_post_probe, > > > > > > > > .per_device_auto =3D sizeof(struct tpm_chip_= priv), > > > > > > > > }; > > > > > > > > -- > > > > > > > > 2.25.1 > > > > > > > > > > > > > > > > > > > > > > The driver needs a compatible string so it can be in the devi= ce tree. > > > > > > > > > > > > Why? I've tried to hint this on the previous iteration of the = patch. > > > > > > The RNG here is not a *device*. The TPM is the device and you = are > > > > > > guaranteed to have an RNG. The way to get a random number is s= end a > > > > > > special command to the TPM. So all that we should do here is le= verage > > > > > > the fact that the TPM is already in the device tree. > > > > > > > > > > > > And fwiw we should stick to try to stick to what the DT spec de= fines > > > > > > as much as possible. I personally don't see this as a special = usecase > > > > > > were deviating from the spec is justified. > > > > > > > > > > This is not a deviation from a spec. What spec? Also, I don't wan= t to > > > > > get into another discussion about what a device is. We can disagr= ee on > > > > > that if you like. > > > > > > > > > > One reason is that U-Boot generally requires compatible strings, = e.g. > > > > > with of-platdata. But also we can refer to the rand device from > > > > > elsewhere in the tree. I know that Linux does lots of ad-hoc devi= ce > > > > > creation and doesn't really have the concept of a uclass consiste= ntly > > > > > applied, but this is U-Boot. > > > > > > > > You are letting client/OS details define your binding. Doing so > > > > doesn't result in OS agnostic bindings. Sure, it would be nice if DT > > > > nodes and drivers were always a nice clean 1:1 ratio, but h/w is me= ssy > > > > sometimes and DT is not an abstraction layer. The general guidance = on > > > > whether there are child nodes for sub-blocks is do they have their = own > > > > resources in DT or are the sub-blocks reusable on multiple devices. > > > > Neither of those are the case here. > > > > > > > > Besides, we already have TPM device bindings defined. Requiring > > > > binding changes when adding a new client/OS feature is not good > > > > practice either. > > > > > > I'm not sure what to do with this, but in general the practice of > > > implied subnodes is not friendly to U-Boot. Yet it seems like a common > > > feature of the bindings at present, for example GPIOs. > > > > > > The device tree is how U-Boot determines which random-number generator > > > to use for a particular function. For example, for VBE, if we need to > > > generate some random numbers we'd like to specify which device creates > > > them. It can't just be 'use the TPM if you find one'. I'm not sure how > > > that works in Linux? > > > > Why can't it be "use the TPM if you find one" since a TPM is a superset > > of an RNG? >=20 > You mean look through the available rand devices and choose the one > whose parent is a TPM? >=20 > Sure. There are lots of things you can do. But device tree is supposed > to provide the tree of devices and allow such things to be configured > deterministically. No, I mean pick the TPM device because by definition it is an RNG. --=20 Tom --xm1n32eGFXmRUoyy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmLP+9IACgkQFHw5/5Y0 tyy/TQwAk225RdMMB9g1a5PMMNm7bCcbI+jL8SUNPEqzO6yRH3vdYEwBlVaEpjG8 9ePwNHmkusEVyhe6l4B5hXLua994bkeaYpZg/1kNCAbJ4FSYnMQNlIEUJ1gEle9P ulAWalOnZojIPUvwmLeLQVwI9L/gC4WrNNZSUmaOVBOoaF64wT9vkV2hDZowfUQj /LCCg3VxYCalu0aMJyxxMzdlGsiWIv1GwZ+iZh2AdcbrkOWLoqbHF8ZbkkYYnFSx fywrcEPXIRI3XmsnGi/6RI/0JmZiVpjQkNwUuSfF2cpyvDLUmBSRWMtZJSCsnaW7 n+AgwdWgoaeZXxilrU8i14ce9YvldKzFhl7zL/PTif9Vw2kyQdA1vZTx0qv2N1tG Jhx56nRaXaDZvQAJTBnANGE1j1JeU+tugi0Yh6sG1jhY9bHANc76mwR4C2a8lQJu 04fxrpDNVWpEaXbRRE7VAQ9VVQIls/cc2AQ8tuz3Iw1LRmVlX0G0ENw9EgHHej3+ eV2xqYO6 =er/4 -----END PGP SIGNATURE----- --xm1n32eGFXmRUoyy--