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=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 7D4DBC433EF for ; Fri, 3 Sep 2021 15:32:34 +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 69F5461059 for ; Fri, 3 Sep 2021 15:32:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 69F5461059 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ECB7783569; Fri, 3 Sep 2021 17:32:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1630683149; bh=P2ISB1NrXaMR73cf37qzTkYRjsyZup4irNPhENeLRRY=; h=From:Subject:To:Cc:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=puKvuaQZzCLIAh++JYUXCxMACqyBx5eXPTZq2rReV79EUxuaxGCkXWA12VHUkqndk xgzV4Zns2//mcIzYFPzgO+5emked6sspvry7op/xUUTrZpDdWzps3U7J8VrKS3zj7y luKaKjfHywQ3j6roNQSs7ZMduUTOvd1zDmxFt0ZBjpfBftu63Igv2REuT6ucz9ksy2 WeDIUbfPjvCdxWWB+F2IvzSTUnsLQ4Z/nnboQgQQQlEM2XLiIUawgnoWII8Ni/lqGe hysYzRFrtImNX2TcAEW2VIpeKA2eEU87xgaaqAqisEdIfENdrfVyL0W43Qvk5olk9i qZpb57clG4dnw== Received: from [IPv6:::1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 2BE2A83314; Fri, 3 Sep 2021 17:32:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1630683146; bh=P2ISB1NrXaMR73cf37qzTkYRjsyZup4irNPhENeLRRY=; h=From:Subject:To:Cc:References:Date:In-Reply-To:From; b=noJqOyeGMwSY+1KEIMdc17StNYzphjnOZcm/Iq9/Nbi63K0mj8H6y3ETShCgf+hgD yp78XoMa3J3Twg4MUg36YlGZ78C+5ufhxLGJtsthIBEJrQVa72OFQsx63+0glKWdG7 fRHi6EbK0rG0ajuxYObAEGFjXqxB9UHMSKlye187978/Y6dU3dqdloPWc9tkfh8xRN 9bcHwf4n75IDQ18rwr8qPbG/Vnfp4XZgiAQhHpXd6PN0yMsMaPVJqVcaOPLZW5XdsB hf4B4u8VzFDxhwjERuI9ityagt8BGeRbBrd43z0Tc6N3ZZgk73yXCAfsiwjk1L+YVl X9WRiQQn1VeSg== From: Marek Vasut Subject: Re: [RFC PATCH] stm32mp1: Replace STM32IMAGE config with TFABOOT_FIP To: Patrick DELAUNAY , Alexandru Gagniuc , u-boot@lists.denx.de, bernard.puel@st.com Cc: Etienne Carriere , Patrice CHOTARD , Tom Rini , Lionel DEBIEVE References: <966fc974-8331-aeac-ba15-5b2ab19c0eaf@gmail.com> <20210826214705.255294-1-mr.nuke.me@gmail.com> <5dce263b-7325-9119-cb2b-74a9f397b970@denx.de> Message-ID: <13b65ac5-306f-1265-34d6-e0ffbd761e5b@denx.de> Date: Fri, 3 Sep 2021 17:32:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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 On 9/1/21 11:07 AM, Patrick DELAUNAY wrote: > Hi Marek, Hi, > On 8/31/21 6:42 PM, Marek Vasut wrote: >> On 8/31/21 4:54 PM, Patrick DELAUNAY wrote: >>> Hi Alexandru, >> >> Hi, >> >>> On 8/26/21 11:47 PM, Alexandru Gagniuc wrote: >>>> Hi Patrick, >>>> >>>> I proposing a better fix fir the issues I outlined earlier, I made a >>>> classification of the currently supported boot modes. >>>> >>>>     1) BL1 -> SPL -> U-Boot >>>>     2) BL1 -> SPL -> OP-TEE >>>> --------------------------------------------------------------------- >>>> |  3) BL1 -> TF-A -> U-Boot                                         | >>>> |  4) BL1 -> TF-A -> OP-TEE                                         | >>>> | _________________________________________________________________ | >>>> || 5) BL1 -> TF-A -> FIP container                                 || >>>> || CONFIG_TFABOOT_FIP || >>>> ||_________________________________________________________________|| >>>> |                                                                   | >>>> | CONFIG_TFABOOT | >>>> --------------------------------------------------------------------- >>>> >>>> Here, I'm looking at FIP as a new boot mode. In order to avoid >>>> breakage, any changes to support FIP it should naturally be done only >>>> to this new path. >>>> >>>> This proposal contains several changes, but I've squashed them into >>>> one for ease of discussion. >>>> >>>> This better matches the boot mode classification above. >>> >>> 1) is supported but with many constraint for security part and low >>> power management >>> >>>      it is not recommended for real product / it will be not >>> supported by STMicroelectronics >> >> Does this mean ST will be cutting off their own customers who use this >> boot mode because they do not need/want additional complex >> problematically licensed components in their boot chain and/or ST will >> be forcing those customers into adding such unneeded/unwanted >> components unconditionally ? >> >> I am strongly opposed to that. >> > > Our concerns is not a licensing issue (BSD vs GPL) but firmware > complexity to manage Cortex A (Linux) + Cortex M (RTOS) and shared > ressources. By adding adding another component into the boot chain, the complexity increases. > To guarantee the Cortex M security, the shared resource (as root clock > or regulator for example) need to be managed by a centralized element. How come Linux cannot manage those resources, like on other vendors' SoCs, where Linux can do that just fine (namely e.g. iMX6SX, which is very similar to the MP1) ? > It is the same for low power mode = to manage each possible step for > Cortex M + Cortex A and PMIC security, the low power sequence are > executed in secure side. Linux is capable of managing both the PMIC and the CM4, what exactly is the problem ? > => it is done in our ecosystem for STM32MP15x platform in secure monitor > (OP-TEE - the preferred one - or SPMin) based on SCMI and PSCI api > called by Linux kernel generic driver. Neither of these APIs are mandatory on ARMv7a , so why force them onto users if Linux kernel can do the same without this extra complexity and extra code ? > These API are NOT supported by SPL / U-Boot, it is the reason of the > restrictions = I have only implement a limited PSCI support to start the > kernel U-Boot does have PSCI support, so why not just extend that code which you already have as part of the boot chain if you have to have PSCI support (which is optional on armv7a and definitely not needed to boot the kernel on armv7a) ? If you were to do the above, you would have one bootloader code base under one license, not two disparate code bases with separate set of bugs and disparate licenses. > You can continue to use SPL on STM32MP15 (at the current upstream level) > but with limited features. > but only the boot with TF-A is supported / promoted by What exactly would I be missing that cannot be done with U-Boot / SPL ? This statement above is extremely vague and makes it look as if adding extra complexity was the only way, however so far I do not see anything that I would be missing on the MP1 with SPL. > STMicroelectronics on the STM32MP family. > > > These restriction are already announced to STMicroelectronics customers > since OpenSTLinux v1.2 I think. > > > For example in > https://wiki.st.com/stm32mpu-ecosystem-v2/wiki/STM32MP15_ecosystem_release_note_-_v2.1.0 > > >      Basic boot has been removed since STM32MP15-ecosystem-v2.0.0, > >      if you were using basic boot with U-BOOT-SPL to load U-BOOT and > the Kernel, > >      then you need to use now the ST reference boot scheme in replacing > U-BOOT-SPL by TF-A > >      as FSBL as explained in Boot chain overview. This is not relevant here, this is downstream vendor BSP which is easy to ignore, including whatever policy it tries to enforce onto its consumers. However, if this is a policy that ST is trying to enforce outside of the BSP and even on upstream users, then there has to be a justification for it, with clear pros and cons. So far, I only see the cons -- complexity, maintenance burden, duplication of effort, increased boot time, need to rework boot chain on existing systems, and I can go on -- I do not see any benefit this change would bring me, sorry. >> I would argue that the U-Boot crypto code went through multiple >> independent security reviews, personally I trust that more than code >> fully controlled and maintained by any one single company, so I am not >> buying the security constraint argument here. > > > When I talk about security, it is not crypto code, but some security > features as isolation between cortex A and Cortex M, key infractructure, > trusted environment execution, secure update. I'll offload this answer to Alexandru, however as far as I can tell, SPL is perfectly capable of starting the TEE and setting up the correct execution levels etc. too. >> Regarding power management and low power modes, there is literally >> nothing preventing Linux from implementing those low power modes, so >> there is no reason to hide all that code in firmware, so I am not >> buying the low power argument either. > > > Some part is already done in Linux with call SCMI / PSCI api. > > Some part is done in secured firmware: DDR self refresh entry sequence / > root clock deactivation / PMIC access on secured I2C. All of this can be done perfectly well in Linux as well, so why hide this into difficult to inspect firmware ? >> Finally, the argument that the component that is being forced upon >> everyone is "open source" is really turning any design with such a SoC >> into a huge risk. >> >> There have been SoCs where the vendor took "open source" bootloader >> code, compiled a blob, released a blob and never gave out the sources, >> because it is "open source" and not "free software", the BSD license >> permits such practice, GPL does not. Whoever wanted to design a board >> or SoM with such a SoC, had to adjust their design to match that one >> blob. Of course, that also implies that any security problems were not >> fixable in that blob. >> > > TF-A in OpenSTLinux is delivered as source, you can recompile it => no > blob delivery for STMicroelectronics Yes, it is open source software that is _currently_ released also in source form. However, that also means that if someone gives me a pre-compiled blob of this software at any time, I have no legal way of getting the matching sources, they can just tell me off, because that is exactly what the permissive license allows them to do. And it also means that if sometimes in the future this will no longer be released in source form, I have a maintenance problem with my existing systems. There is zero guarantee that neither of these scenarios will happen, and I cannot just hope it won't happen. With U-Boot, which is GPLv2, I do have that guarantee -- if I have a blob, I have legal right to matching sources. > https://github.com/STMicroelectronics/arm-trusted-firmware > > And we upstream all the TF-A developments (work in progress). > > > For us, OpenSTLinux is not only "open source" but "free software".... These two terms mean two very different things, please do not conflate them. > and customers (SoM maker or other) manage their distribution. I hope we can keep it that way, esp. in terms of not making optional software components look mandatory. [...]