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 22C9AC433F5 for ; Fri, 24 Dec 2021 16:59:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2A1BF80F7A; Fri, 24 Dec 2021 17:59:57 +0100 (CET) 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="qlG0od+J"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9CA18069C; Fri, 24 Dec 2021 17:59:55 +0100 (CET) Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (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 3B14F8069C for ; Fri, 24 Dec 2021 17:59:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sughosh.ganu@linaro.org Received: by mail-il1-x132.google.com with SMTP id r2so6929379ilb.10 for ; Fri, 24 Dec 2021 08:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=gtJZDDN2G85citZjs9F4BhLBmYgs9EfDor8yaoReBoU=; b=qlG0od+JNTcf68xV5Su2l83b9oQ500pwT/8A7mat+WkXtmUbaroDIzjn+EEpASXzNL MneFSaUAedI5AVHxN/1FAW0660FkGj3DbJT3yuMCzZwRK8hfAyoSCJttMssUfBWH2Hez wHpIdKQPP9nC92FcnTVZ2sTwG0iiEmRGNYmQJ6tIoCFn6G+FL1aAJZ3MbPj80oarrk9s JLk1Elj8/owz0sXz1T2dicelEUmQA2Rpw0aUquZlRsX+hEwNQObz5f5vlBMwVB9aQ973 /qMbc8NKuOYGSeKMLu3I0BTPT0JdAAQVG/N6/uw/I5slMGKVSTbTJZLIPuTkN0N5o9tw 9mEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=gtJZDDN2G85citZjs9F4BhLBmYgs9EfDor8yaoReBoU=; b=gl75F2l3xcOifis0AV+hVMy9Bku06irbmRvPgAWGmVfDbYYihi9FaIUWA6pKrW7suC mSQT17kgsNyQpqdpe8J17d+3UvUxwAzeUTAio5RiQbyKntHjhm67nZYDbsNivA1RBEYm LIx7B6QR03wZ5IydGljpasQR0taLbydgJDoOsgToI0XXqjni2aRq5FMmQhDshjYFwMn0 jXdEiSdA7FTp+mUsWuWJ+FXharAaNhhfv4Qi/YGkFTZwwJiJc6DWbUWUYgi6MaeA2LIr YF5BoMBPMqHvDcFf5g9VhLJ0fTV/GjsObt6qGsNk8XxQE6rpoj1Mar3W4T28mbhQsAtP UpNg== X-Gm-Message-State: AOAM533VhtrhcNtoYCykGdvo6aSZrT4VL6sg5xd0UPu+IVkIlI4InfTq pdUqVxPs1l/56VoPxSGe44hrhjhSgq3oqrtOcuyVPA== X-Google-Smtp-Source: ABdhPJwAgFBORhYWkZRnETG6wfTl9GdOkdOuA5+Qb3jyyV0EGer1toj1Iew5bTKifYegXToh8lT2CrotPdunjYf9yDA= X-Received: by 2002:a05:6e02:1687:: with SMTP id f7mr3389814ila.65.1640365190681; Fri, 24 Dec 2021 08:59:50 -0800 (PST) MIME-Version: 1.0 References: <20211219070605.14894-1-sughosh.ganu@linaro.org> <20211219070605.14894-4-sughosh.ganu@linaro.org> In-Reply-To: From: Sughosh Ganu Date: Fri, 24 Dec 2021 22:29:39 +0530 Message-ID: Subject: Re: [RFC PATCH v2 3/8] FWU: stm32mp1: Add helper functions for accessing FWU metadata To: Masami Hiramatsu Cc: u-boot@lists.denx.de, Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu , Tom Rini , Etienne Carriere Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 hi Masami, On Fri, 24 Dec 2021 at 15:49, Masami Hiramatsu wrote: > > Hi Sughosh, > > 2021=E5=B9=B412=E6=9C=8824=E6=97=A5(=E9=87=91) 19:08 Sughosh Ganu : > > > > hi Masami, > > > > On Fri, 24 Dec 2021 at 11:19, Masami Hiramatsu > > wrote: > > > > > > () should Hi Sughosh and Ilias, > > > > > > I would like to confirm that what the plat_fill_gpt_partition_guids() > > > should return. > > > > > > 2021=E5=B9=B412=E6=9C=8819=E6=97=A5(=E6=97=A5) 16:07 Sughosh Ganu : > > > > > > > +static int plat_fill_gpt_partition_guids(struct blk_desc *desc, > > > > + efi_guid_t **part_guid_arr= ) > > > > +{ > > > > + int i, ret =3D 0; > > > > + u32 part; > > > > + struct dfu_entity *dfu; > > > > + struct disk_partition info; > > > > + efi_guid_t part_type_guid; > > > > + int alt_num =3D dfu_get_alt_number(); > > > > + > > > > + dfu_init_env_entities(NULL, NULL); > > > > + > > > > + for (i =3D 0, part =3D 1; i < alt_num; i++) { > > > > + dfu =3D dfu_get_entity(i); > > > > + > > > > + if (!dfu) > > > > + continue; > > > > + > > > > + /* > > > > + * Currently, Multi Bank update > > > > + * feature is being supported > > > > + * only on GPT partitioned > > > > + * MMC/SD devices. > > > > + */ > > > > + if (dfu->dev_type !=3D DFU_DEV_MMC) > > > > + continue; > > > > + > > > > + if (part_get_info(desc, part, &info)) { > > > > + part++; > > > > + continue; > > > > + } > > > > + > > > > + uuid_str_to_bin(info.type_guid, part_type_guid.b, > > > > + UUID_STR_FORMAT_GUID); > > > > + guidcpy((*part_guid_arr + i), &part_type_guid); > > > > + part++; > > > > + } > > > > + > > > > + dfu_free_entities(); > > > > + > > > > + return ret; > > > > +} > > > > > > So on this platform which uses GPT partition for each bank, it stores > > > the GUID for each partition. > > > I think this information will be shown in the ESRT, but not used for > > > specifying capsule image_type_uuid. > > > > > > This is strange. > > > Without this FWU multi-bank update, the array will only have the > > > image_type UUID. > > > Thus, user can use ESRT to confirm what UUID should be specified for > > > the capsule file. (it has image-type UUID) > > > (of course that is fixed value on one platform anyway) > > > > > > And when FWU multi-bank update is enabled, that changes to the > > > partition GUIDs. But those GUIDs are NOT used when making the capsule > > > file nor doing the update process, because we should not specify the > > > bank index directly, right? > > > > The partition GUIDs are the same as ImageTypeId field in the > > EFI_FIRMWARE_IMAGE_DESCRIPTOR and the UpdateImageTypeId field in the > > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER. This value is the same > > as the PartitionTypeGUID field in the GPT partition entry. > > > > ImageTypeId =3D UpdateImageTypeId =3D PartitionTypeGUID > > > > This is the GUID value that is used when generating the capsule. > > So you meant the above "plat_fill_gpt_partition_guids()" fills the > array with ImageTypeId? Yes. Please note that the actual api is fwu_plat_fill_partition_guids. For the ST board, fwu_plat_fill_partition_guids calls plat_fill_gpt_partition_guids. > Thus, if we have a single image type, the array will be filled with > that single GUID? That will depend on the dfu_alt_info setting and the platform function fwu_plat_fill_partition_guids defined for the corresponding platform. > > > > > We will set a unique image-type UUID on each image entry, and use it > > > for making a capsule file, > > > > Even with the FWU feature enabled, the PartitionTypeGUID/ImageTypeId > > is used for making the capsule. What changes for the FWU feature is > > that the value of UpdateImageIndex/ImageIndex that is passed to the > > capsule generation tool becomes irrelevant. When the FWU feature is > > not enabled, the ImageIndex value that is passed to the capsule > > generation tool is important, since this is supposed to correspond to > > the DFU alt number -- this ImageIndex value is then used to identify > > the partition/address to which the capsule payload is to be written. > > With the FWU feature enabled, this value is not obtained from the > > capsule, since the partition/address to write the image to is > > identified at runtime based on the value of the update bank. > > OK. > > > > > > but the capsule file itself doesn't specify > > > the banks. And acceptance/revert capsule file also doesn't specify it= . > > > Acceptance file will also uses image_type UUID, but not the partition > > > UUID for the bank. > > > > The image acceptance capsule will also contain the ImageTypeId. The > > Accept bit will be set for the active bank image of the image type > > specified in the acceptance capsule. > > OK, so the Image UUID(image slot for the banks) will not be used in > the process, is that correct? > I would like to confirm this, because this is important for the system > which doesn't use GPT. Yes, only the ImageTypeId will be used. You can check the implementation for the GPT partitioned block devices in fwu_gpt_set_clear_image_accept. -sughosh > > Thank you, > > > > > -sughosh > > > > > > > > Maybe I'm wrong, but I'm confusing. And this is important for the > > > platform which doesn't use GPT. > > > > > > Thank you, > > > > > > > > > -- > > > Masami Hiramatsu > > > > -- > Masami Hiramatsu