From patchwork Thu Feb 27 11:15:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 868956 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1561:b0:38f:210b:807b with SMTP id 1csp207763wrz; Thu, 27 Feb 2025 03:16:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUw174pNugNF1cbsFOq4Zry5oA85UVpCW2KhWG/zUiSWwZgBlKg43u162E+bI79nvpXtMdi2Q==@linaro.org X-Google-Smtp-Source: AGHT+IGvsEsLn+i/AFg1vFwd+D1rTVWYyAPmkoy5nAdEgB+0Klds/y1zUhey+3p3IYmQFkLlZ5fP X-Received: by 2002:a05:6402:50d3:b0:5e0:87eb:956b with SMTP id 4fb4d7f45d1cf-5e0b722348bmr27896084a12.22.1740654988182; Thu, 27 Feb 2025 03:16:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1740654988; cv=none; d=google.com; s=arc-20240605; b=WI3hihnoK6y/GbVxjhNKEfl+f0jJf1XnTgDRM2MEwGKG8ENb7FVpp0oPgJM3O6EsNg vDwHImK1vcu54WZgalnP+PmDp8GDonXU1MVkP5QoTx+56DcbqKo4hm1w1RbFON0dLkX7 Sw/LFPmn3xkvjKg0JsXL9GFgTJ4Lvlk07oWRyEAGmU2BqtJE0a85nLd9IOPUmzjjIY5y jJOk/KfSLgXAxor6W1C5SAJ5XomTqu/Km/Ku43/23mjJUsYx1tyU4r2KYFDW5lKyWhF6 5M+Ywk5Ziigf1vOyovVI8Oz75pUpJ2kvNf7TqE/FlKLLA+kUJup+NOG2Mc+6nKvqDM58 B0qA== 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=eMOT2IP72xyM7JWSbZc669glo5+4hA0Dj3xxorM8ks4=; fh=WIErNPtEyr4LSk0kn+FyUcnvc47vQRNxykSeJQzwMAA=; b=iS5aEgDPLGWSkmutHCZPnVw6MGCrhqgaNpaG7hN4XWJ2IOfEDXz0/h5pMl4HieKoG0 mCfG/rJpjRht/nVl8TrMoqYLqEHL8Xi7bmUtVtaCUYD9qhiYd+ju0IGaW7Le+Bv+QwTt 2oTNOHLvqVpPEmOk8IAPaC9FrKXumnRUooB9+fsFFc7XZSiKyz3MWxpHT04WFjNbJdwd rIVpXOiSLFbIuIjCJn5kgiKRIye9cxnnkkRAiiV9XIxrCBojQJcQ6ZMKiyrNRbY391Pl b6C8s0BSrDNte6B7xAuTMF7Yyub37yUwRrhOqN7tGQNYWy8FVFjKkrFHOqeOu2QTOVIA gZXQ==; 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 4fb4d7f45d1cf-5e4c3b6130fsi1436552a12.32.2025.02.27.03.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 03:16:28 -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; 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 F087F8128D; Thu, 27 Feb 2025 12:16:03 +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 DDA56811E0; Thu, 27 Feb 2025 12:16:01 +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 88CCC812C0 for ; Thu, 27 Feb 2025 12:15:59 +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 97FE42BCC; Thu, 27 Feb 2025 03:16:14 -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 3932C3F6A8; Thu, 27 Feb 2025 03:15:55 -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 v5 5/6] blkmap: add an attribute to preserve the mem mapping Date: Thu, 27 Feb 2025 16:45:18 +0530 Message-Id: <20250227111519.45787-6-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250227111519.45787-1-sughosh.ganu@linaro.org> References: <20250227111519.45787-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 --- Changes since V4: New patch 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