From patchwork Fri Feb 28 08:45:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 869281 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1561:b0:38f:210b:807b with SMTP id 1csp678780wrz; Fri, 28 Feb 2025 00:46:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUJMiFHE5rkYW0owp7DE03iX+I3vk/YmzPy0gD5Lfkx3dmvbp1SFGDjHo53rMvPhc5eoLBshA==@linaro.org X-Google-Smtp-Source: AGHT+IEqe0ixojjNEYSZTTVaefbAYlG26/6Qb0iaZueN0Fope8up1DnJcz72AUyBeQW85++KI0UC X-Received: by 2002:a05:600c:3b9a:b0:439:8e95:795b with SMTP id 5b1f17b1804b1-43ba6a77357mr19468445e9.31.1740732406664; Fri, 28 Feb 2025 00:46:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1740732406; cv=none; d=google.com; s=arc-20240605; b=BeNGFe69q5+V2nUZTihUfVsjf3gfTZCtRDmAf9zJz6pj9orTO8bdv9MkwPuAR1KzEa Gmb7z3Q+NP5+VKxBsXMh4VotpvlCkn0+8ogvelNJ8xpaRAIlA0YF8HRGj0xbgfQhgVcz K2I7uk3ndGOaNd/KQuAQkbK9TYp3sohYEQ7Y95fOWvN8qLC/7FxOoEvV3SEOdk8wYD5t WySzk72eHG9AuxGJ1V6C3vqDim5X06p8SIZQgVgX41qCjlk/x5t7PkUtIAZHw2JaGbSM KmfjCmF4zUtyJFJShZGIvG2HmlC9AXUNQGQiLK//fz49fKl5MHPJxbzIqT7tLESha5pv dDpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=on00XAHZRUX8Jvi8Grm89vWsHof+ohi0idcCud9XdwI=; fh=WIErNPtEyr4LSk0kn+FyUcnvc47vQRNxykSeJQzwMAA=; b=Uz13zlXP38AuVBklvPlASh2P6PRhjgfqw1jchIWLG6fQt3oIiXWsyNN9n3WlNnWgvl 1gNtjAGYs/d/7VbDMxJE4R2Cft3JLrOzBDXLdcRypouzhQzQE+43n9tlqi1fRqjcSEbi TIpgyJR1RTcUV9peVCwMgegN8h2DU5fe82VlATbqjbqdBe8/s9C/keEsp8E9fyIfQou/ 5VQSTlxUh77sAxgh2yFoe6rj1Ng9UDYnuP0O72Db/OAfr1XNXG9rSPdHOTzEf4bejv0J 7mtU5luj3EmjlqktdlX6zmiZo2C/yah+nZGxd8BoRBv2StvyccazqqACdSSb9tcVL8Hu J/Fw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 5b1f17b1804b1-43b736f5ba1si24296335e9.60.2025.02.28.00.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 00:46:46 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1822281111; Fri, 28 Feb 2025 09:46:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A6651807D7; Fri, 28 Feb 2025 09:46:14 +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=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 7B487811C5 for ; Fri, 28 Feb 2025 09:46:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B092113E; Fri, 28 Feb 2025 00:46:27 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 103233F673; Fri, 28 Feb 2025 00:46:08 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Tom Rini , Heinrich Schuchardt , Anton Antonov , Tobias Waldekranz , Bin Meng , Sughosh Ganu Subject: [PATCH v6 5/6] blkmap: add an attribute to preserve the mem mapping Date: Fri, 28 Feb 2025 14:15:28 +0530 Message-Id: <20250228084529.127823-6-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250228084529.127823-1-sughosh.ganu@linaro.org> References: <20250228084529.127823-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 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 Some blkmap memory mapped devices might have to be be relevant even after U-Boot passes control to the next image as part of the platform boot. An example of such a mapping would be an OS installer ISO image, information for which has to be provided to the OS kernel. Use the 'preserve' attribute for such mappings. The code for adding a pmem node to the device-tree then checks if this attribute is set, and adds a node only for mappings which have this attribute. Signed-off-by: Sughosh Ganu Reviewed-by: Tobias Waldekranz Reviewed-by: Ilias Apalodimas --- Changes since V5: None cmd/blkmap.c | 9 +++++++-- drivers/block/blkmap.c | 12 ++++++++---- drivers/block/blkmap_helper.c | 2 +- include/blkmap.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/cmd/blkmap.c b/cmd/blkmap.c index 164f80f1387..86a123b1cd3 100644 --- a/cmd/blkmap.c +++ b/cmd/blkmap.c @@ -62,13 +62,18 @@ static int do_blkmap_map_mem(struct map_ctx *ctx, int argc, char *const argv[]) { phys_addr_t addr; int err; + bool preserve = false; if (argc < 2) return CMD_RET_USAGE; addr = hextoul(argv[1], NULL); - err = blkmap_map_pmem(ctx->dev, ctx->blknr, ctx->blkcnt, addr); + if (argc == 3 && !strcmp(argv[2], "preserve")) + preserve = true; + + err = blkmap_map_pmem(ctx->dev, ctx->blknr, ctx->blkcnt, addr, + preserve); if (err) { printf("Unable to map %#llx at block 0x" LBAF ": %d\n", (unsigned long long)addr, ctx->blknr, err); @@ -221,7 +226,7 @@ U_BOOT_CMD_WITH_SUBCMDS( "blkmap create