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 E8707C677F1 for ; Tue, 17 Jan 2023 14:04:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 404C48559D; Tue, 17 Jan 2023 15:04:18 +0100 (CET) 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="RRwRJPHl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E5AF98551A; Tue, 17 Jan 2023 15:04:12 +0100 (CET) Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) (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 A0D2584DEB for ; Tue, 17 Jan 2023 15:04:07 +0100 (CET) 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-oa1-x36.google.com with SMTP id 586e51a60fabf-15ed38a9b04so13384689fac.8 for ; Tue, 17 Jan 2023 06:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WB5tNlT+Xw1kspQbCqkUYiLhzdWpjAvxmxriwkWkAi0=; b=RRwRJPHlO7AVdQg8ej38avs+CjwEG87HqHKOXW+SqWY0wDki47b5AC+i2/0wy2cYP2 x/0bawgAQJfx1qLzDzPjibxiUg93SsvvWsGuEd+FW7kkLGrfqrKlHJdTQ2JFvoNkPr21 g/oKyt8G7FjAZ+Xys318swAw0/yCX5GsCB1SQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WB5tNlT+Xw1kspQbCqkUYiLhzdWpjAvxmxriwkWkAi0=; b=N9Ud+blpP2ABF7jAEjssVng4LWxcXuTHxo/Om+smHAOYkytCnJr3QKWVvCLHFSBHL9 OcfqwjVdEhzacPEAbMKqLJBbAwPOATvJZo6WQTlXq+1V/5S/VtjE2os172LjS3+Hfx2z nMRrwFnL+c//mhTBjPcNMpN8bHgSnogU5nzE2na2Vgc8UX/7cFBqFchi6Ui8bqjzmKNf ExPA6wiZFsa78YA+Mpl75uk18IR5bv1vcYzwmlqzysw3pZTyReP0fwcZN6biYMoWG0+7 QdMq0euT5bWAn2hm3/PYYxe0c7ZnpkG4NIg2S4D+mKYU4dG87M1GDeMh9q4VLke7fuCX HZgA== X-Gm-Message-State: AFqh2kq1YeoyyCizYbTW1NtCiVfzzm5XIxEuupeYWvncFaGvlmHMBwfq 93pxj0LJHGuPAyijg5gDme3x0A== X-Google-Smtp-Source: AMrXdXutfTPvePrtYQOYZiCMvvLS1HdbCdUBxkjvt9+uXFlXuypSEMmp/b21pc5pn9hhMq1B58ma9Q== X-Received: by 2002:a05:6871:1c9:b0:15b:96af:50ac with SMTP id q9-20020a05687101c900b0015b96af50acmr1548100oad.29.1673964246161; Tue, 17 Jan 2023 06:04:06 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-3487-94a5-6d7e-19f3.res6.spectrum.com. [2603:6081:7b00:6400:3487:94a5:6d7e:19f3]) by smtp.gmail.com with ESMTPSA id s15-20020a05620a254f00b007056237b41bsm20221100qko.67.2023.01.17.06.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 06:04:05 -0800 (PST) Date: Tue, 17 Jan 2023 09:04:03 -0500 From: Tom Rini To: Abdellatif El Khlifi Cc: u-boot@lists.denx.de, nd@arm.com, ilias.apalodimas@linaro.org, robh@kernel.org, sjg@chromium.org Subject: Re: [PATCH v8 03/10] arm_ffa: introduce Arm FF-A low-level driver Message-ID: <20230117140403.GD3880571@bill-the-cat> References: <20221219111251.GA22370@e121910.cambridge.arm.com> <20230113104415.GA22133@e121910.cambridge.arm.com> <20230116132353.GA21133@e121910.cambridge.arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hW3Q5Oh0pcvvyJMS" Content-Disposition: inline In-Reply-To: <20230116132353.GA21133@e121910.cambridge.arm.com> 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 --hW3Q5Oh0pcvvyJMS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 16, 2023 at 01:23:53PM +0000, Abdellatif El Khlifi wrote: > On Fri, Jan 13, 2023 at 11:00:28AM -0700, Simon Glass wrote: > > Hi Abdellatif, > >=20 > > On Fri, 13 Jan 2023 at 03:44, Abdellatif El Khlifi > > wrote: > > > > > > On Thu, Jan 12, 2023 at 04:43:32PM -0700, Simon Glass wrote: > > > > Hi Rob, > > > > > > > > On Wed, 11 Jan 2023 at 19:10, Rob Herring wrote: > > > > > > > > > > On Mon, Dec 19, 2022 at 1:21 PM Simon Glass wr= ote: > > > > > > > > > > > > Hi Abdellatif, > > > > > > > > > > > > On Mon, 19 Dec 2022 at 04:12, Abdellatif El Khlifi > > > > > > wrote: > > > > > > > > > > > > > > On Mon, Dec 05, 2022 at 09:49:30AM -0600, Rob Herring wrote: > > > > > > > > On Sun, Dec 4, 2022 at 1:22 PM Simon Glass wrote: > > > > > > > > > > > > > > > > > > Hi Rob, > > > > > > > > > > > > > > > > > > On Tue, 29 Nov 2022 at 05:22, Rob Herring wrote: > > > > > > > > > > > > > > > > > > > > On Fri, Nov 25, 2022 at 3:18 PM Simon Glass wrote: > > > > > > > > > > > > > > > > > > > > > > Hi Abdellatif, > > > > > > > > > > > > > > > > > > > > > > On Thu, 24 Nov 2022 at 06:21, Abdellatif El Khlifi wrote: > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Nov 22, 2022 at 07:09:16PM -0700, Simon Gla= ss wrote: > > > > > > > > > > > > > should be called 'priov' and should beHi Abdella= tif, > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > [..] > > > > > > > > > > > > > > > > > > > > > > > > > +/** > > > > > > > > > > > > > > + * ffa_device_get - create, bind and probe the= arm_ffa device > > > > > > > > > > > > > > + * @pdev: the address of a device pointer (to = be filled when the arm_ffa bus device is created > > > > > > > > > > > > > > + * successfully) > > > > > > > > > > > > > > + * > > > > > > > > > > > > > > + * This function makes sure the arm_ffa device= is > > > > > > > > > > > > > > + * created, bound to this driver, probed and r= eady to use. > > > > > > > > > > > > > > + * Arm FF-A transport is implemented through a= single U-Boot > > > > > > > > > > > > > > + * device managing the FF-A bus (arm_ffa). > > > > > > > > > > > > > > + * > > > > > > > > > > > > > > + * Return: > > > > > > > > > > > > > > + * > > > > > > > > > > > > > > + * 0 on success. Otherwise, failure > > > > > > > > > > > > > > + */ > > > > > > > > > > > > > > +int ffa_device_get(struct udevice **pdev) > > > > > > > > > > > > > > +{ > > > > > > > > > > > > > > + int ret; > > > > > > > > > > > > > > + struct udevice *dev =3D NULL; > > > > > > > > > > > > > > + > > > > > > > > > > > > > > + ret =3D device_bind(dm_root(), DM_DRIVE= R_GET(arm_ffa), FFA_DRV_NAME, NULL, ofnode_null(), > > > > > > > > > > > > > > + &dev); > > > > > > > > > > > > > > > > > > > > > > > > > > Please add a DT binding. Even if only temporary, = we need something for this. > > > > > > > > > > > > > > > > > > > > > > > > Thanks for the feedback. I'm happy to address all t= he comments. > > > > > > > > > > > > > > > > > > > > > > > > Regarding DT binding and FF-A discovery. We agreed = with Linaro and Rob Herring > > > > > > > > > > > > about the following: > > > > > > > > > > > > > > > > > > > > > > > > - DT is only for what we failed to make discoverabl= e. For hardware, we're stuck > > > > > > > > > > > > with it. We shouldn't repeat that for software in= terfaces. This approach is > > > > > > > > > > > > already applied in the FF-A kernel driver which c= omes with no DT support and > > > > > > > > > > > > discovers the bus with bus_register() API [1]. > > > > > > > > > > > > > > > > > > > > > > This may be the UEFI view, but it is not how U-Boot w= orks. This is not something we are 'stuck' with. It is how we define what i= s present on a device. This is how the PCI bus works in U-Boot. It is best = practice in U-Boot to use the device tree to make this things visible and c= onfigurable. Unlike with Linux there is no other way to provide configurati= on needed by these devices. > > > > > > > > > > > > > > > > > > > > Where do you get UEFI out of this? > > > > > > > > > > > > > > > > > > I assume it was UEFI as there was no discussion about thi= s in U-Boot. > > > > > > > > > Which firmware project was consulted about this? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > It is the discoverability of hardware that is fixed (an= d we are stuck > > > > > > > > > > with). We can't change hardware. The disoverability may= be PCI > > > > > > > > > > VID/PID, USB device descriptors, or nothing. We only us= e DT when those > > > > > > > > > > are not sufficient. For a software interface, there is = no reason to > > > > > > > > > > make them non-discoverable as the interface can be fixe= d (at least for > > > > > > > > > > new things like FF-A). > > > > > > > > > > > > > > > > > > Here I am talking about the controller itself, the top-le= vel node in > > > > > > > > > the device tree. For PCI this is a device tree node and i= t should be > > > > > > > > > the same here. So I am not saying that the devices on the= bus need to > > > > > > > > > be in the device tree (that can be optional, but may be u= seful in some > > > > > > > > > situations where it is status and known). > > > > > > > > > > > > > > > > Sure, the PCI host bridges are not discoverable, have a bun= ch of > > > > > > > > resources, and do need to be in DT. The downstream devices = only do if > > > > > > > > they have extra resources such as when a device is soldered= down on a > > > > > > > > board rather than a standard slot. > > > > > > > > > > > > > > > > > We need something like: > > > > > > > > > > > > > > > > > > ff-a { > > > > > > > > > compatible =3D "something"; > > > > > > > > > }; > > > > > > > > > > > > > > > > > > I don't know what mechanism is actually used to communica= te with it, > > > > > > > > > but that will be enough to get the top-level driver start= ed. > > > > > > > > > > > > > > > > There's discovery of FF-A itself and then discovery of FF-A= features > > > > > > > > (e.g. partitions). Both of those are discoverable without D= T. The > > > > > > > > first is done by checking the SMCCC version, then checking = for FF-A > > > > > > > > presence and features. Putting this into DT is redundant. W= orse, what > > > > > > > > if they disagree? > > > > > > > > > > > > > > Hi Simon, > > > > > > > > > > > > > > Do you agree with Rob, Ilias and myself that it makes more se= nse > > > > > > > FF-A bus is discovered without a DT node and following the sa= me approach as > > > > > > > Linux ? (FF-A bus doesn't have a HW controller and is a purel= y SW bus, > > > > > > > no configuration/description needed at DT level). > > > > > > > > > > > > > > Your suggestions are always welcome. > > > > > > > > > > > > I'm sorry I don't agree with that. It does need a compatible st= ring, > > > > > > like PCI has. You can just add it in U-Boot if Linux won't acce= pt the > > > > > > binding. > > > > > > > > > > It's not like PCI as the host side of PCI has non-discoverable re= sources. > > > > > > > > OK I see. It is certainly an edge case. > > > > > > > > > > > > > > This all could have been designed better, but hindsight is 20/20 = and > > > > > things evolved step by step. There are a bunch of firmware servic= es > > > > > that are all behind SMCCC. The first (upstream) was PSCI. IIRC, S= MCCC > > > > > was invented a bit after that, but generalized PSCI for other > > > > > services. Since then more have been added. More services get adde= d one > > > > > by one and yes we added bindings for them. Because what's one mor= e... > > > > > But that really needs to stop. We're stuck with h/w that's not > > > > > discoverable, there's zero reason to do that with s/w interfaces.= If > > > > > we could redo everything, we'd have a node for SMCCC and that's it > > > > > unless there's h/w resources provided to the rest of DT. But we c= an't, > > > > > so SMCCC is discovered by the presence of PSCI. > > > > > > > > I understand the background here, but if we don't take a stand on > > > > this, this sort of thing will continue. Just because something works > > > > in Linux does not mean that the binding (or lack of it) is good. > > > > > > > > The reasons to do this are: > > > > - avoids needing to manually call device_bind() > > > > - avoids extra plumbing in U-Boot > > > > - provides visibility into what is in the system, by looking at the > > > > DT, like documentation > > > > - DT is how devices are bound in U-Boot > > > > > > > > You can see the problem if you look at ffa_device_get(). It is call= ed > > > > from ffa_bus_discover() which is a new addition into the board_init > > > > list. We are trying to remove this list and certainly don't want new > > > > things added!! > > > > > > Hi Simon, > > > > > > As stated in the v8 patchset cover letter [1] and readme [2], the FF-= A bus is discoverable on demand at runtime. > > > > > > Clients (such as EFI) can discover the FF-A bus using ffa_bus_discove= r() API which triggers the > > > discovery process. > > > > > > We no longer use the board_init list to discover the FF-A bus. > >=20 > > That's because you have moved it to the command - everything that > > wants to use this has to call ffa_bus_discover()...! > >=20 > > > > > > Please refer to the v8 patchset for the review. > >=20 > > It still needs a DT node and the binding needs to happen with driver > > model. Please put that in. See also how the sandbox emulation is done > > for I2C, SPI, USB, PCI and every other bus, with something in the DT. > >=20 > > We have dm_scan_other() which can pick up other buses but that is just > > one function and we don't support multiple versions of it. We could > > add that I suppose, but as I say, where does it end? > >=20 > > You can create a u-boot-ffa.dtsi file with the appropriate node and > > include that in any board or SoC that uses this feature. Sandbox can > > have its emulation node also. You will know that everything is good > > when you can boot U-Boot, type 'dm tree' and see your device in there > > without running any other commands. >=20 > Hi Tom, >=20 > Any thoughts about this topic ? (discovering FF-A bus manually like done > in Linux without DT node vs using a DT node) Yes, I think Simon's point is right. Without a DT node, it's a bunch of one-off special code to discover something that we could get from just having a node. If you want to avoid doing this, you need to show - the patchset, using a DT node - the patchset, without using a DT node, but instead something that addresses Simon's feedback. And then demonstrate that the 2nd approach is cleaner than the first. --=20 Tom --hW3Q5Oh0pcvvyJMS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmPGqtMACgkQFHw5/5Y0 tyxXGAv+KXXw0/7Xf+a7JCP3AUHQoqYpoKWQbYmKIIWVQ2TzO5FkoqdDyEDMD+AE niRTPYz5cQ1BNzJGrXJfTKYNDN9Iu3BNY0lc6A5RSLUWSA7lFnygeE2tOxvqQBqG sWrBA5NppQ2iZ0aigIdrZwygNsIgIlHHIHVfDsMbSl0B/7EJyQCwWNA+xzy1PlO7 YcWO1Ov/YYNLkT4hhVzZnaZ1cuwUY+H93yRpsSXpt7uQIue5+sOVPLwDiEGgSFJk tGErN+oEvromMKp6KlBWmJy4WRXlJSNRJ1UE2guZ4Vb691E8PrXLW5tdFSvPVBs/ pQALsiFPMExmKoZlo0et6+1IvgXNW03zo/xavJ5rH75D3GHFK5bCAmQ536YibPkP +SqNSjknoDlHRlCSzXcBQOmVFLstCyLDJPvwxzzTT6p/o+wVrd4IDcra2bFTu5MO SUs0bHR+vQO6ouSJF4cqAljjvFiAu8diIbDziP3eCeXPglddatx5+4CyFw+o0C7U ZBn7VJIJ =XCIH -----END PGP SIGNATURE----- --hW3Q5Oh0pcvvyJMS--