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 E2709EB64D7 for ; Tue, 20 Jun 2023 10:05:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 05DA28474B; Tue, 20 Jun 2023 12:05:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="amqLHTeT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E543986240; Tue, 20 Jun 2023 12:05:53 +0200 (CEST) Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (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 1A99C84706 for ; Tue, 20 Jun 2023 12:05:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9875c2d949eso550266566b.0 for ; Tue, 20 Jun 2023 03:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687255550; x=1689847550; 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=J27XyhkF6Ar0rayRs/QVW0JtMGw1gsen0J8xNbmgep8=; b=amqLHTeTE7Y2HZW6BJMRabtHylTJ7FnbVPloCEXcLZ9Wp1ZIKqpgf+LjpO43YxLXmj 1jizRLtn6ql5W2wGMrVAvhS1He7/Dg3PGm7GRkU5fpGzfuYstXBfZgM6Tamd2BTmX5yS T4EFsAr5BP4qlpfMAKvSGSLgw/WSBnlYeXUTp0EKas/SFv34sa70SKwOtreSEA3cVxyc xWjJ1VpzllfcIeUzaNCfuCmFOyoUO78bo7dx8aHxInKk2mWcd+YpZyiNpF34WaId99jp GwhiZIFrClPEn0oVUUH5/f6o5pZyqzxr/qa6t7YVFAwJzVXiHehyXPFK9lykH1w0445H fasw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687255550; x=1689847550; 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=J27XyhkF6Ar0rayRs/QVW0JtMGw1gsen0J8xNbmgep8=; b=K9w4lkoVqVHkeY76U493/DG0/JkbMzH4kLJ888jliw25Musjv4MPXzNQa/EHSq5Mbm M3Xg/EUxzleIrytuzmPWX3UEbxSbFtgcMUs5b9AMYjUgAo8UDnxjJsutKmt+0Vjcb90T Ie0hUKQfwT42Cna9hOGBr1t+oW9KthVuza56RL8xuYMH/JLvIIoHVuGhDfkxatHyUveB NFQhi3emfhQ0KoIXq9TluZp7Z5IPzewjZ3beKY0HXmVrbxUmyhdpeBxnP4kxTzFTZFGK /ugtfFXnnIW31NNrimrQH+I/OhEmnE9GIrU5lHNTqXR8RlJ5qA9/eLpCK3WDM4Awl9hJ 3FUg== X-Gm-Message-State: AC+VfDx4BgVksCCmz3SG7H1V8/YOjdTrCUPdXOwL4oZNoKxm00kCXIq4 imx5xh8XBP4r0jj8GyhOZRDUAA== X-Google-Smtp-Source: ACHHUZ6LOaWrO7hsxhhwvAGSjA2ykimgNagums2jTL2MPEbP1ENldLIwjZfyUsvNvPqiyFTHSMrmBQ== X-Received: by 2002:a17:907:a412:b0:988:6e18:3f83 with SMTP id sg18-20020a170907a41200b009886e183f83mr6090527ejc.5.1687255550564; Tue, 20 Jun 2023 03:05:50 -0700 (PDT) Received: from hera (ppp089210114029.access.hol.gr. [89.210.114.29]) by smtp.gmail.com with ESMTPSA id u9-20020a170906068900b00988ca8b175dsm1088389ejb.119.2023.06.20.03.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 03:05:50 -0700 (PDT) Date: Tue, 20 Jun 2023 13:05:47 +0300 From: Ilias Apalodimas To: Jassi Brar , Jose.Marinho@arm.com Cc: Michal Simek , u-boot@lists.denx.de, etienne.carriere@linaro.org, trini@konsulko.com, sjg@chromium.org, sughosh.ganu@linaro.org, xypron.glpk@gmx.de, takahiro.akashi@linaro.org Subject: Re: [PATCH v6 0/6] FWU: Add support for mtd backed feature on DeveloperBox Message-ID: References: <20230531052804.21871-1-jaswinder.singh@linaro.org> <02a6c970-9b1b-6361-f5e9-cf908cef19d1@amd.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 Sorry for being late to the party, +cc Jose who maintains DEN0118 On Mon, Jun 19, 2023 at 11:16:53AM -0500, Jassi Brar wrote: > Hi Michal, > > On Mon, 19 Jun 2023 at 10:02, Michal Simek wrote: > > > > Hi Jassi, > > > > On 5/31/23 07:28, jaswinder.singh@linaro.org wrote: > > > From: Jassi Brar > > > > > > Introduce support for mtd backed storage for FWU feature and enable it on > > > Synquacer platform based DeveloperBox. > > > > > > This revision is rebased onto patchset that trims the FWU api > > > https://lore.kernel.org/u-boot/20230306231747.1888513-1-jassisinghbrar@gmail.com/ > > > > ..... > > > Firstly I can generate 2 images per one bank which should be pretty much regular > > capsule update for 2 images. I would expect this should still work. > > > > And then I tried 2 banks with 2 images and fwu_gen_alt_info_from_mtd() generated > > this description for DFU > > > > mtd nor0=bank0 raw 2320000 80000;bank1 raw 27a0000 8000&mtd nor0=bank0 raw > > 23a0000 4000000;bank1 raw 2820000 4000000 > > > > If you look at size in second entry you will see that it is 8000 instead of > > 80000 because it is the same image. That's why curious if you have tested any > > scenario like this. > > > I had, and have, strong doubts about the practicality of 2 > images/bank. There aren't enough specification details to explain how > only 1-out-of-N images could be updated. And if we always update all > images in a bank together, we might as well have them as one composite > image. I never got satisfactory clarification from designers and > implementers. So, sorry, I can't defend that scenario with my limited > knowledge. This is intentionally left out, as we consider it a platform policy. For example you could update a single bank and copy over the remaining firmware images from a different ban. There's nothing on the spec that prohibits you from doing so, but I personally think it's a bad idea. Keep in mind there's a document hosted here[0] which explains the update flow and documents what we have as code in U-Boot. As far as individual firmware components go now, do you have any useful usecase? The general guidance of [0] is construct a firmware image, only update the components you want while leaving the rest on the same revisions and update the entire firmware. The reason is that firmware Updating a single image of another bank is not as easy as it sounds. Firmware components nowadays, whether we like it or not, depend on each other. Since firmware updates are not so often and fast, we didn't see any gains from over complicating the spec and explicitly describe that case, while dealing with firmware component compatibility at the same time. > > > Next part which I want to take a look is practicality of CONFIG_FWU_NUM_BANKS > > and CONFIG_FWU_NUM_IMAGES_PER_BANK because it pretty much enforcing number of > > banks and images for every platform and prevent creating one u-boot which works > > on different boards and just use information from mdata. > > DEN0118 doesn't show any field with this information but do you think that would > > be possible to extract that information from there based on for example reserved > > or accepted field? > > > Unfortunately the DEN0118 spec doesn't leave any 'don't care' bits in > 'accepted' or 'reserved' fields, all unused bits Must-Be-Zero. If we > use any bit, we'll be in violation of the spec. Yes this is unfortunate. We did have similar concerns on when drafting the spec, however we never had a solid usecase to justify this. Arm and Linaro and working on a v2 (which we try to make compatible with v1) which addresses this shortcoming. Maybe Jose can chime in. > > However, we can do CRC32 calculations by varying NUM_IMAGES_PER_BANK > and NUM_BANKS and find the value pair for which the crc32 field > matches! > For limiting check-loops and finding corrupted metadata, the .config > can carry upper limits on both the options, say > MAX_NUM_IMAGES_PER_BANK=5 and MAX_NUM_BANKS=10 for the most special > scenario. If we find the approach acceptable, I can cook a patch as > proof-of-concept. > > cheers. [0] https://gitlab.com/Linaro/trustedsubstrate/mbfw/uploads/3d0d7d11ca9874dc9115616b418aa330/mbfw.pdf Thanks /Ilias