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 C3D9AC433EF for ; Wed, 20 Jul 2022 07:36:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 38FCC84053; Wed, 20 Jul 2022 09:36:24 +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="G8LPvm2v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BFE848405E; Wed, 20 Jul 2022 09:36:22 +0200 (CEST) Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) (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 2FD9983FEE for ; Wed, 20 Jul 2022 09:36:20 +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-yb1-xb2a.google.com with SMTP id f73so30493590yba.10 for ; Wed, 20 Jul 2022 00:36:20 -0700 (PDT) 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; bh=YL+Q0WldV6Sr+89J8idI8CK3r7OGcCHQLxIBdilOydM=; b=G8LPvm2vYg1xXuKZsucATje2IV0j3FmcELnxWvMsNj/SQTXAoygGjpALf6EtYIFWbK vL1/8QaHMsOPs3gaRYRLJe1aCZdZ0BflkqwhfTPJlS0PhAJVgck1ZUfrB0Ug1hPPJt69 Yz3pfsy1lDDpwRwa4wreZM6VgZb8Z6xfMBbjGwIsBDx91ykBdrBC0Q/RWdw6bVe28IAn jzg0Uw0OA9zV077GV0ezf3bm3lS2KIx7Tft6KH//c57DKbxOGqu4P+7veUs8jfWIA66f 0lEyE/5O6Z6U5MoDvD95Lt3Udllbeg//3bnq3Cs2DRfWNuS5OrxPanP2A/gQtukQpbL7 hyDQ== 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; bh=YL+Q0WldV6Sr+89J8idI8CK3r7OGcCHQLxIBdilOydM=; b=a9v1HZRdVYK5X/E7UkECmyUh3twBRUnEmH4lH50pWR4GHHzJ2/45W0lM8IwnpDIanG abPjjhba1SSszc2seUIWAhh6fDmK7OhEKMx0AQiDoaEIefb0bBZhKMsznwIygx8ofq8k H3j3O1H+z8wq9t3GenjGOu26CRkHla/hMg7auk8LEzqZmh+D3ruc5L6VSwC7hU2wR2xe Q3nNtRk7eSO2vwnPlLl4tDGtkn1pQyX+xzM0il4SA5PZy6q+e7S+7ES9lfLZojvqBVCD YSuQDCmTDe+7i5R7y84iP7ewg+zFd71HpbAkAlNyWyqqEAuNcemMrq451t0mAzBTl26H FEgw== X-Gm-Message-State: AJIora98XnqaLiYLucJFlNj1NdIzTGD9C30XULf3UWGoeW9JAkjpN7y8 lIW5ez6qiUVD2EDLZb+qpEZq868hI15K0TkkpuVE2A== X-Google-Smtp-Source: AGRyM1vEWAme0ozc+GqRf3vLK1CM05xKgg5gNrN5nbGAhRul+nhb5umpU6m9zMQffsTgqYH6ww8bzvVxvcNp2s0mpzU= X-Received: by 2002:a25:6f83:0:b0:668:b531:cefd with SMTP id k125-20020a256f83000000b00668b531cefdmr35117925ybc.495.1658302578937; Wed, 20 Jul 2022 00:36:18 -0700 (PDT) MIME-Version: 1.0 References: <20220714183913.118505-1-sughosh.ganu@linaro.org> <20220714183913.118505-9-sughosh.ganu@linaro.org> In-Reply-To: From: Ilias Apalodimas Date: Wed, 20 Jul 2022 10:35:43 +0300 Message-ID: Subject: Re: [PATCH v7 08/13] FWU: Add boot time checks as highlighted by the FWU specification To: Sughosh Ganu Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Takahiro Akashi , Patrick Delaunay , Patrice Chotard , Simon Glass , Bin Meng , Tom Rini , Etienne Carriere , Michal Simek , Jassi Brar Content-Type: text/plain; charset="UTF-8" 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 Sughosh, > > > + nimages = CONFIG_FWU_NUM_IMAGES_PER_BANK; > > + active_bank = mdata->active_index; > > + img_entry = &mdata->img_entry[0]; > > + for (i = 0; i < nimages; i++) { > > + img_bank_info = &img_entry[i].img_bank_info[active_bank]; > > + if (!img_bank_info->accepted) { > > + trial_state = 1; > > + break; > > + } > > + } > > Is this used elsewhere in the patchset? The function is starting to > be big, so perhaps moving this in a static bool "in_trial_state()" or > similar would make it more readable. > There was a discussion about this on the synquacer thread for A/B updates. Once you split those in a function, it's better to extend the bootcount API with an EFI backed storage. The reasoning that a user might disable editing env variables for security reasons and that device might not be able to preserve RAM or store the counter in CPU registers across reboots. If we extend the bootcount API with this code we can plug in the functionality seamlessly based on the hardware capabilities. [...] Regards /Ilias