From patchwork Wed Mar 12 08:54:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 872824 Delivered-To: patch@linaro.org Received: by 2002:a5d:64e7:0:b0:38f:210b:807b with SMTP id g7csp159881wri; Wed, 12 Mar 2025 01:56:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWLwfPmCS1n3TQeEFKIPe6pHMOOyNmRfII+2DraMruNpiXv0T/C0yk5JfKWreG+Kzkuh1qBcQ==@linaro.org X-Google-Smtp-Source: AGHT+IETMcAlpuqkwMMLS20XmEC2rJmw6UKZiNbnC0pQvq99WumFozwehIrX73J4z2vWDRd1dDfL X-Received: by 2002:a25:21c1:0:b0:e63:c2d2:94f2 with SMTP id 3f1490d57ef6-e63c2d2956emr2773803276.4.1741769760964; Wed, 12 Mar 2025 01:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741769760; cv=none; d=google.com; s=arc-20240605; b=YFlz7D+lh+n8X4KDwUDhBEW40JrT+0axlJwcG4GwSPIiNxX4jSQMMVjS0zAgrJbigG CsyZpZ62LEoGVunbfMP40+4XW79TqvrVVxiaX5GSI7s4wzR1E2evxhjlQA/v42molt4w 9JLDZxUzSUO0MXqj4AAebDWVld9PcUAD/mllIY/R0xDZmAoVtIa3dAL5qJg67i93w2rn SztHFjIm0HMvkNF+ctmwWfRhkDhqG1XoDhPOGYq2T7H8/q5BZat4Oe6mNfeoovhO7rx+ J0cIkO6HlPskIxZ5Xnfoi+cgSTka5Fmx6/QCwt9vkhVB12ZMdzm2/OTFlL/b2qPDcMCe RSCQ== 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=swE3YrBbV3XnlWEav5TBYUHDk6bAn3eEO1kfrlIhJ5w=; fh=Evn5eBx2ytD/hj+tB8Xv1T61prWYrP0E59LRKWAPORI=; b=bIVxFKI4mM9kwgy+UKtyyKRYp8JLRqvYAee36X53gCr37MVBnYHEL3WT098zk2Zznw 5mEiz4CpjhSIGIu/LHfeHEDx+bh0E3NNcwuia//E/eSfx0QZ0yt/J4wbkngThHLTvSe9 ms8FBXIdJACOxjgjaJqqHtUMI7rt/i2NpiAbW1E2mMjhAG1PwsYuw4q4VHMvj+Cmmnb3 DsdeWWFcYH4q2JwG/7rPnx4HFzhtAKG4kaCc8z9fqIp0Chb+WWs83z2GORXqw/I26l3p OsZqaPc6j2qc5HfT+Oo56TzWw0Sym0gHPcIo7W8zotgvi/6nTewIcStonEKmxKKdTzM8 ln8g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 3f1490d57ef6-e634b70f05dsi11867041276.81.2025.03.12.01.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 01:56:00 -0700 (PDT) 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; 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=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 595058193A; Wed, 12 Mar 2025 09:55:14 +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 2E28C818C7; Wed, 12 Mar 2025 09:55:12 +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 2D1DF805D7 for ; Wed, 12 Mar 2025 09:55:09 +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 657DF152B; Wed, 12 Mar 2025 01:55:19 -0700 (PDT) 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 0E57A3F5A1; Wed, 12 Mar 2025 01:55:05 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Tom Rini , Heinrich Schuchardt , Anton Antonov , Tobias Waldekranz , Sughosh Ganu Subject: [PATCH v8 7/8] blkmap: add an attribute to preserve the mem mapping Date: Wed, 12 Mar 2025 14:24:23 +0530 Message-Id: <20250312085424.1201148-8-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250312085424.1201148-1-sughosh.ganu@linaro.org> References: <20250312085424.1201148-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 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 V7: * Fix repeated word in the commit message 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