Message ID | 20221203031557.579632-1-jassisinghbrar@gmail.com |
---|---|
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1309085pvb; Fri, 2 Dec 2022 19:16:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf69rjxaSRC1EUGXC/6Ov2FtjWq4J6GfBEV3HI7Wd+3BfIln+YaK4EEf21x9TCVwohyUYfP4 X-Received: by 2002:a5d:8149:0:b0:6de:bd34:9787 with SMTP id f9-20020a5d8149000000b006debd349787mr28068181ioo.171.1670037374977; Fri, 02 Dec 2022 19:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670037374; cv=none; d=google.com; s=arc-20160816; b=xDLIw/AAeKBMkJXZ+lfvJuLVIytG5+B0E4JpoKIdnrOCXEZE32dlhoAvsaMo0RN4jV 5HX0sYvzO0GkUKfpQdvWDSeYbwNnMoXr8ebVNjOeolGJ+Lz/dG/zuCws+r8iWFZ7lECZ 340RHQ+wQbAG77jivUFDiuyI9rcTQsDa7VJ+IJO45AYNXKccvGXIq0dfLsQf+aiIwogZ qRmhKHOjm3gBGEA47EHKqi0styw5FOcHX22F2sV0POaeVmDCFFSL1Xx9z/9VTFmzD+0O 3hEhhcsOKcx+iuLqKp9JtVI1/AetqD5simYeaA+q4wxa13isg8IQvpF980QWgSF6y8vp BTkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Zc/GfUtepKNm/Q7VWwjOsnTgRM1bgOuh3qSY6ulMdGk=; b=bgRAq6YtGmS2jypTNhhvoYigd5NyyotSd33j4zu1nZ2ReTpAaHjVN0DDvmPjtx++GG wBY1lWMcJMzroAcs7ExadbJUJSTfMOyLaBalCNeqd0fT/RbIfFp1HXIJ9+8jVL9KLMlU lF4qUwkFtw1tg4c5m2wOc32Z3+RKqg/foKBTOJEusWlMteqt44lQ4c3ucMA11D8KoKBJ okRohN3MjlQ6GbkYC0LGcp5fnkA3P4H0WS44wlylYKBcB6MehKEd5go2J0fuhabfGzmf waywI39sNTlJRC7uCBsYqWfmDQyr+XXSsbiYAz0zDcfJVd9IlS3rLiPjIEn9ye/y8NVC JOLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=o5zVFKD+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: <u-boot-bounces@lists.denx.de> Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id s17-20020a02ad11000000b0038a338a303bsi341106jan.78.2022.12.02.19.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 19:16:14 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=o5zVFKD+; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 117CA85023; Sat, 3 Dec 2022 04:16:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="o5zVFKD+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7096685035; Sat, 3 Dec 2022 04:16:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (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 AA5C984FF0 for <u-boot@lists.denx.de>; Sat, 3 Dec 2022 04:16:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jassisinghbrar@gmail.com Received: by mail-io1-xd2e.google.com with SMTP id z144so7045iof.3 for <u-boot@lists.denx.de>; Fri, 02 Dec 2022 19:16:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Zc/GfUtepKNm/Q7VWwjOsnTgRM1bgOuh3qSY6ulMdGk=; b=o5zVFKD+l8dWqqPvDhTm/GHzOuhkXWxYhm/2l7Fnt5CqGT01njDI0eF5IY5FpUaxda iooRyv3+GA76bd4lM1mkyISChVAvbziF5KR1PwPsPj0LRBm1l6CS5VwwAuPyL/neUCEJ ymAPacy2jychT5VnSgrR5ZgMEhJNPlqRtORurXXFQb9EfZLqsknsusQtCu3KgF+xC/VI giohGnfKByN4lFYRg9yeT+et6rVYVIo3Xz1EqSNYun1D4fD/crE4luJFRs/antkmQJsx fSNkc45A1BUlcVMpFoZ6y8621Phj8arrto9ClsivPcFOBytTI0ezd/C7pRkQQLSMML4z iXhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Zc/GfUtepKNm/Q7VWwjOsnTgRM1bgOuh3qSY6ulMdGk=; b=OOOPrJIe9dS7ZsM1hzdYSfeIaROrJVxEg1V6dZtvmNC9oEoY+qY5gP1etygri5Hf+V 64NP7QCjwbxb4SaW4mGiEyvuQToOHDya0fYkKxtWoXqQ4zM7MI3+5M9iTwl+7mAwC/nw zqgZbqt7s21kyJB3TmpyDSBOLDVVjrY8mBg6TbiUXYBcbMvUa4ogUVP1oPSAeWMsluhn p5vG6j+BZEnHwHgmZSGtrqYD5WZEasTK8XrlZl/bAouUbSO0hwx0jfVBJogdFsX9YnJY cxQ7pWJAAzRHv/1oolg27xOXlhYcLsGblW6nUay/OnIPyUx6CPhe2PFMBE91Hj6GJJVq GuTA== X-Gm-Message-State: ANoB5pluLZKIcu86JVH9WMqdgZUC3k7XOMaAugZljhqkM5tECKg0jZYI qfMIYPWFK/wGQVLtHN0h677K5p9jSzc= X-Received: by 2002:a05:6638:263:b0:376:26c3:fcd7 with SMTP id x3-20020a056638026300b0037626c3fcd7mr25111898jaq.280.1670037362791; Fri, 02 Dec 2022 19:16:02 -0800 (PST) Received: from jassi-desktop.. (wnpgmb0311w-ds01-45-179-115.dynamic.bellmts.net. [206.45.179.115]) by smtp.gmail.com with ESMTPSA id l19-20020a6b7513000000b006bb5af55ddfsm3248203ioh.19.2022.12.02.19.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 19:16:02 -0800 (PST) From: jassisinghbrar@gmail.com To: u-boot@lists.denx.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, etienne.carriere@linaro.org, trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, patrick.delaunay@foss.st.com, patrice.chotard@foss.st.com, Jassi Brar <jaswinder.singh@linaro.org> Subject: [PATCHv2 0/4] FWU: Handle meta-data in common code Date: Fri, 2 Dec 2022 21:15:57 -0600 Message-Id: <20221203031557.579632-1-jassisinghbrar@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean |
Series |
FWU: Handle meta-data in common code
|
expand
|
From: Jassi Brar <jaswinder.singh@linaro.org> The patchset reduces ~400 lines of code, while keeping the functionality same and making meta-data operations much faster (by using cached structures). Issue: meta-data copies (primary and secondary) are being handled by the backend/storage layer instead of the common core in fwu.c (as also noted by Ilias) that is, gpt_blk.c manages meta-data and similarly raw_mtd.c will have to do the same when it arrives. The code could by make smaller, cleaner and optimised. Basic idea: Introduce .read_mdata() and .write_mdata() in fwu_mdata_ops that simply read/write meta-data copy. The core code takes care of integrity and redundancy of the meta-data, as a result we can get rid of every other callback .get_mdata() .update_mdata() .get_mdata_part_num() .read_mdata_partition() .write_mdata_partition() and the corresponding wrapper functions thereby making the code 100s of LOC smaller. Get rid of fwu_check_mdata_validity() and fwu_mdata_check() which expected underlying layer to manage and verify mdata copies. Implement fwu_get_verified_mdata(struct fwu_mdata *mdata) public function that reads, verifies and, if needed, fixes the meta-data copies. Verified copy of meta-data is now cached as 'g_mdata' in fwu.c, which avoids multiple low-level expensive read and parse calls. gpt meta-data partition numbers are now cached in gpt_blk.c, so that we don't have to do expensive part_get_info() and uid ops. Changes since v1: * Fix typos and misc cosmetic changes * Catch error returns Jassi Brar (4): fwu: gpt: use cached meta-data partition numbers fwu: move meta-data management in core fwu: gpt: implement read_mdata and write_mdata callbacks fwu: meta-data: switch to management by common code cmd/fwu_mdata.c | 17 +- drivers/fwu-mdata/fwu-mdata-uclass.c | 151 +------------- drivers/fwu-mdata/gpt_blk.c | 175 +++++----------- include/fwu.h | 198 ++---------------- lib/fwu_updates/fwu.c | 300 ++++++++++++--------------- 5 files changed, 214 insertions(+), 627 deletions(-)