From patchwork Mon Mar 10 11:57:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 872201 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp942324wri; Mon, 10 Mar 2025 04:59:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXDqEHudxFHRlRv+vtMxStPWMqmr6SGhkaSO2s4M6fc4/UmCUr3ojriL4SLTNj2LMt1yVuhxQ==@linaro.org X-Google-Smtp-Source: AGHT+IFuI6SPih96m1ViX1m6hIP37MhLanE4DSWq8L8cdALl7jh5GJrfmsLlb+SBVK5PW9Dd/C3M X-Received: by 2002:a05:690c:6112:b0:6fb:1c5a:80f8 with SMTP id 00721157ae682-6febf2b5f5fmr187068257b3.15.1741607952774; Mon, 10 Mar 2025 04:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741607952; cv=none; d=google.com; s=arc-20240605; b=BPuFrO3Q+Mt2u2SeWWItyDYUktEcb5J85QVN2+TNiZGPsa+RrJ+BXEN6dz3ve4C0e5 ToAwPLy/ozI7+2zLJPv2Xf6lcZTctOZE8e3okh48r7XudLRTaGWkAVE9LmYm1j5fQt5G f4+4bIe/QX7K5xz8Cdpop3/ji8pBo0lm7Ct7mFIaIZ1SnejFEgueFcK4X77FR8biswpp MeenxwQUeq5NEJZpwhE/5Lsf7/plQWlBwAHZjNyUpNkky2888ryc+PBUm37tYM4XGhUR aEk3rlDha9MY8bsI65scTp45geZHfs+DHl3LNYUymMtFzrgub2Q0pTBsb0X/ncaEMblJ xIAA== 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=Bzov7iz4gLvezWtOkp/Hj7lYlsUGVtLmyrI94e2cgGI=; fh=WIErNPtEyr4LSk0kn+FyUcnvc47vQRNxykSeJQzwMAA=; b=P4u92bMdTwZ0gKObQzOl1gIM4D93RryBNxR0GA9MHpH1a26enOy8FytsUzOenuvGuo 6/m6CYnZZdLeN7n+t5XGesJeha48uL+Ry/wOTa7Vyud0fuy87SAKkwnFSKf+ljbKWsER 9f8E1f943LhNgtXTe4HHRZk5+nMTtYyfpm8ltNpcpGZKdzwSy5YqfR+vSl2liTKXQxT+ tFIR/4smRIDTn4VD9tvfhyVVZ79cNdKhHJQo+NBoo1KPo3e5jiTkvrRMIK21iw6XOxlJ /HnLUns6ZFFKKLfva3jogKdUoW5mW0jZaKorn0urEBg8WeSCizegRbHb7tHzw3lWQwTM 1hew==; 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 00721157ae682-6feddba6d0csi35272167b3.120.2025.03.10.04.59.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 04:59:12 -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 9E79D816AB; Mon, 10 Mar 2025 12:58:34 +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 627A38129F; Mon, 10 Mar 2025 12:58:34 +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_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_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 2FB43817D8 for ; Mon, 10 Mar 2025 12:58:31 +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 0585E1516; Mon, 10 Mar 2025 04:58:42 -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 A7CE93F5A1; Mon, 10 Mar 2025 04:58:27 -0700 (PDT) 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 v7 7/8] blkmap: add an attribute to preserve the mem mapping Date: Mon, 10 Mar 2025 17:27:49 +0530 Message-Id: <20250310115750.1019051-8-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250310115750.1019051-1-sughosh.ganu@linaro.org> References: <20250310115750.1019051-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 V6: 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