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 EA5D4C4332F for ; Fri, 25 Nov 2022 21:18:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32F8C85144; Fri, 25 Nov 2022 22:18:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CzbTd1E0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0A44585149; Fri, 25 Nov 2022 22:18:16 +0100 (CET) Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) (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 1FF878500E for ; Fri, 25 Nov 2022 22:18:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ej1-x62f.google.com with SMTP id i10so12785369ejg.6 for ; Fri, 25 Nov 2022 13:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=G7jJy8wqlCSDcZj10ijVGF8sL0sVU50LufX8fsmXkMo=; b=CzbTd1E07I7ifadvruc5ha8d8hqC/Yhv89WLoPHMvXmFHsFHP/Sk41iHaYO73vydVJ 93MR4QI0qS/86It2YxhUUXw8oKXyzhEb08b0UJap1CGqYS6vyXMPfLTlUwzgW9zXr+go TKyF+eAI/kBZpMOTKEaDs5/RjvqI0T39+ceIE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=G7jJy8wqlCSDcZj10ijVGF8sL0sVU50LufX8fsmXkMo=; b=vRmrwAKcuFfEZt2VeXutKTjlQ0dU4+UJjigu50ACG+2W4fIMV5ONy6DzaqRaTHjbxn ooibX0h1buZVYyDHFaglsuoYYXyjsSKaGzN3NZjDegZ1wDB0MF/o7zcWEk8VA00Lht1q jqzndQHVTYA35QjVpq2w0QCdvOVsy/HRXtFXPfKr3ABCiEo/uboum+cQVEmTjA8cn+vf jzbfUlQlGtEp/3WZQWd40egFMx13MIOkgmHnkdYbLPyl9x8ReNkCxzESWkx0msBCjw2/ Myp4LNwIVpXXdb9+O4DP+ObMW92+88yAUAZ85JfrOXk5x1fKcC2deyXI/GXG1AYScqGg ftoA== X-Gm-Message-State: ANoB5plcMBhB/pg3Qkfel02L9ssey5K5TyMFr5IzyiYWT9ixjZcmKlB9 oPqvNrtrVfaoeZcdc5iBdw68UDmJRKuSlTXTzBTvyA== X-Google-Smtp-Source: AA0mqf6GtAbzd8wNDMiyGQz+6+qO87d2SzheI6KOI3lSRJqyFZZHRi3HXksWiJ+Ygo2S3K4AjJyc4T9lV9TcjUXLQyw= X-Received: by 2002:a17:906:a2da:b0:7ad:84d1:5b56 with SMTP id by26-20020a170906a2da00b007ad84d15b56mr35008369ejb.205.1669411092246; Fri, 25 Nov 2022 13:18:12 -0800 (PST) MIME-Version: 1.0 References: <20221107192055.21669-1-abdellatif.elkhlifi@arm.com> <20221122131751.22747-1-abdellatif.elkhlifi@arm.com> <20221122131751.22747-4-abdellatif.elkhlifi@arm.com> <20221124132115.GA393@e121910.cambridge.arm.com> In-Reply-To: <20221124132115.GA393@e121910.cambridge.arm.com> From: Simon Glass Date: Fri, 25 Nov 2022 14:17:59 -0700 Message-ID: Subject: Re: [PATCH v8 03/10] arm_ffa: introduce Arm FF-A low-level driver To: Abdellatif El Khlifi Cc: U-Boot Mailing List , nd , Ilias Apalodimas , Rob Herring Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.39 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 Hi Abdellatif, On Thu, 24 Nov 2022 at 06:21, Abdellatif El Khlifi < abdellatif.elkhlifi@arm.com> wrote: > > On Tue, Nov 22, 2022 at 07:09:16PM -0700, Simon Glass wrote: > > should be called 'priov' and should beHi Abdellatif, > > [..] > > > +/** > > > + * 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 ready 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 = NULL; > > > + > > > + ret = device_bind(dm_root(), DM_DRIVER_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 the 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 discoverable. For hardware, we're stuck > with it. We shouldn't repeat that for software interfaces. This approach is > already applied in the FF-A kernel driver which comes 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 works. This is not something we are 'stuck' with. It is how we define what is 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 configurable. Unlike with Linux there is no other way to provide configuration needed by these devices. > > - FF-A bus in U-Boot is used on demand by clients. We don't want to set it up > if no client is using it. For example, the EFI MM client tries to discover the > FF-A bus, if it succeeds it uses it. Otherwise, it uses OP-TEE protocol [2]. > EFI MM client tries to discover the FF-A bus by calling ffa_bus_discover() > which is a discovery API provided by the FF-A core driver. You are talking about probing, I think. Lazy init is build into U-Boot and works fine. We don't need to invent another way to do it. Probe the device if it is needed, but bind it always. > > Here is an overview about what ffa_bus_discover() does : > > client -> ffa_bus_discover() -> ffa_device_get() -> { device_bind() , device_probe() } > > device_probe() -> ffa_probe() -> { at this stage the FF-A driver tries to discover the bus by executing FF-A discovery ABIs } Yes it needs a bit of clean-up, to be honest. You need to add a device pointer to the calls as well. > > Let's see what Ilias and Rob think about FF-A discovery and DT support. > > Cheers > Abdellatif > > [1]: https://elixir.bootlin.com/linux/v6.1-rc4/source/drivers/firmware/arm_ffa/bus.c#L213 > [2]: https://lore.kernel.org/all/20221122131751.22747-10-abdellatif.elkhlifi@arm.com/ > Regards, SImon