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 06198C00528 for ; Wed, 2 Aug 2023 10:37:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F10798682A; Wed, 2 Aug 2023 12:37:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9A1FD86842; Wed, 2 Aug 2023 12:37:06 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 136D6867E6 for ; Wed, 2 Aug 2023 12:37:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=abdellatif.elkhlifi@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8816A113E; Wed, 2 Aug 2023 03:37:46 -0700 (PDT) Received: from e130802.arm.com (unknown [10.57.2.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0E7E83F6C4; Wed, 2 Aug 2023 03:37:01 -0700 (PDT) Date: Wed, 2 Aug 2023 11:36:53 +0100 From: Abdellatif El Khlifi To: Jens Wiklander Cc: achin.gupta@arm.com, nd@arm.com, u-boot@lists.denx.de Subject: Re: [PATCH v17 09/10] arm_ffa: efi: introduce FF-A MM communication Message-ID: <20230802103653.GA66786@e130802.arm.com> References: <20230726160635.GS3630934@bill-the-cat> <20230727160712.81477-1-abdellatif.elkhlifi@arm.com> <20230727160712.81477-10-abdellatif.elkhlifi@arm.com> <20230727164345.GH3630934@bill-the-cat> <20230728135415.GU3630934@bill-the-cat> <20230731114628.GA112180@e130802.arm.com> 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.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.8 at phobos.denx.de X-Virus-Status: Clean Hi Jens, On Tue, Aug 01, 2023 at 02:28:34PM +0200, Jens Wiklander wrote: > > > > > > > ... > > > > > > > Changelog: > > > > > > > =============== > > > > > > > > > > > > > > v17: > > > > > > > > > > > > > > * show a debug message rather than an error when FF-A is not detected > > > > > > [snip] > > > > > > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig > > > > > > > index c5835e6ef6..8fbadb9201 100644 > > > > > > > --- a/lib/efi_loader/Kconfig > > > > > > > +++ b/lib/efi_loader/Kconfig > > > > > > > @@ -55,13 +55,53 @@ config EFI_VARIABLE_FILE_STORE > > > > > > > stored as file /ubootefi.var on the EFI system partition. > > > > > > > > > > > > > > config EFI_MM_COMM_TEE > > > > > > > - bool "UEFI variables storage service via OP-TEE" > > > > > > > - depends on OPTEE > > > > > > > + bool "UEFI variables storage service via the trusted world" > > > > > > > + depends on OPTEE && ARM_FFA_TRANSPORT > > > > > > > > > > > > You didn't get my changes in here however. If you can do EFI_MM_COMM_TEE > > > > > > without ARM_FFA_TRANSPORT (as lx2160ardb_tfa_stmm_defconfig does) then > > > > > > you don't make this option depend on . If FF-A is only > > > > > > for use here, you make FF-A depend on this, and the FF-A specific > > > > > > variable depend on ARM_FFA_TRANSPORT. > > > > > > > > > > Abdellatif hinted at what's going on here. When I added this Kconfig > > > > > option to lx2160 FF-A wasn't implemented yet. > > > > > > > > The defconfig has existed since May 2020, which is when you added > > > > EFI_MM_COMM_TEE itself too. So I think it's that no one did the check I > > > > did until now and saw this series was disabling what was on the other > > > > platform. > > > > > > > > > Since FF-A isn't a new > > > > > communication mechanism but builds upon the existing SMCs to build an > > > > > easier API, I asked Abdellatif to hide this complexity. > > > > > We had two options, either make Kconfig options for either FF-A or the > > > > > traditional SMCs and remove the dependencies, or piggyback on FF-As > > > > > discovery mechanism and make the choice at runtime. The latter has a > > > > > small impact on code size, but imho makes developers' life a lot > > > > > easier. > > > > > > > > I'm not sure how much you can do a run-time option here since you're > > > > setting a bunch of default values for FF-A to 0 in Kconfig. If we're > > > > supposed to be able to get them at run time, we shouldn't need a Kconfig > > > > option at all. I'm also not sure how valid a use case it is where we > > > > won't know at build time what the rest of the firmware stack supports > > > > here. > > > > > > > > > > That's a fair point. FF-A in theory has APIs to discover memory. > > > Abdellatif, why do we need the Kconfigs for shared memory on FF-A? > > > > The statically carved out MM shared buffer address, size and offset cannot be discovered by FF-A ABIs. > > The MM communication driver in U-Boot could allocate the buffer and share it with the MM SP but > > we do not implement that support currently in either U-Boot or UEFI. > > > > Simon suggested we use build configs to set the buffer address, size and offset since we don't want > > a DT node for the MM firmware. > > In the OP-TEE driver we're allocating memory to share dynamically > using malloc() or memalign(). Why isn't the same approach possible > here? > FF-A memory sharing can not be used because the MM SP needs to know the layout of the MM communication buffer during initialisation. This happens before the Normal world has got a chance to run. So we have a chicken and egg and Normal World cannot use FF-A ABIs to share the buffer as things stand. Cheers, Abdellatif