From patchwork Mon Mar 17 08:34:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 874153 Delivered-To: patch@linaro.org Received: by 2002:a5d:4308:0:b0:38f:210b:807b with SMTP id h8csp1869994wrq; Mon, 17 Mar 2025 01:35:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIjBJBzA08UCXUt4WcjUcDi1N0LEYsjys9XkmvSxbbNIZ0Ywxuw4/Hvw6bD8toA8tU4B1dKA==@linaro.org X-Google-Smtp-Source: AGHT+IFT1AIs4UIKBn8qpCmWtbQa6ZywNSMX8lAF7d99g0qfE+9w5evFRhSUyWDYccoI1hGU07Os X-Received: by 2002:a17:906:c147:b0:ac1:791c:1532 with SMTP id a640c23a62f3a-ac330450945mr1290934266b.51.1742200534433; Mon, 17 Mar 2025 01:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742200534; cv=none; d=google.com; s=arc-20240605; b=Td6QvJ/98u3vuTd8oBcyQ9u2X/F9t8gTsbLKP9PFka7w8VRNP5fcQKhiJvvyYh5mWi u5MyzpfdqersANjMSiDmpMhJ4tk7tFyOgUIMKUG0p9Y3He3eCsFkfKoSYuNqFZVSueUu ch8yOpPqi7AvOCBDUHbXpmToFS7qtqEei7wbIPBqWPLvPch17EN85mYzCTlYF5xxRE5+ k4fVYnB7sv6mNLmpV/eUCvdWmPRUqK37lR0u0QM3DNB/+IbZMRr1k6TuOqfQcaANrLy+ cviFgICJK506nWBgkhOZRvdhv4iofiWLZ479yhzICPYYAKji8GX2qfTV0tbOJ/ZlDJh9 XpDQ== 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=luUkqL9+JF0SqDT9+6Jhnm1+6M2GEK8KBkSpVOhiGN0=; fh=Evn5eBx2ytD/hj+tB8Xv1T61prWYrP0E59LRKWAPORI=; b=jcxyj9MvkDnmOpYLcRQdpj+/XWcUvX9a/cS4UcaY0uXGqIxTcGCsy/efHr37q9lXrU 8xdZSNCjqcvNsnddX1/iBjIg5BC1R6hpqSdjeH6ThX/XvX+CFa++bs0lMgNjanqarC9a kXe4P96UINH2hNQnx59e3YerXDeAl7LhmTCbLolpkqWFFDwxnCfj2wuu6lMoS7RASD1b wQP6J4LXDoa3tyyDgv7rm61ScnrIBe2lcLW5c6csShwgM2SWIUxFHxBbjBAqzhmYhh+6 X54XmiNlV0GoSQCebsi7/9epVti0NwJLSOhjuQFYI4WxbSCHzRK4zKr1nn/z4Xr/mYnu sxiw==; 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 a640c23a62f3a-ac314aab644si706431566b.568.2025.03.17.01.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Mar 2025 01:35:34 -0700 (PDT) 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 2F6D5811B2; Mon, 17 Mar 2025 09:34:51 +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 3100881A04; Mon, 17 Mar 2025 09:34:50 +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 E31D1811B2 for ; Mon, 17 Mar 2025 09:34:47 +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 5753813D5; Mon, 17 Mar 2025 01:34:56 -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 E888D3F673; Mon, 17 Mar 2025 01:34:44 -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 v9 7/8] blkmap: add an attribute to preserve the mem mapping Date: Mon, 17 Mar 2025 14:04:01 +0530 Message-Id: <20250317083402.412310-8-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250317083402.412310-1-sughosh.ganu@linaro.org> References: <20250317083402.412310-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 V8: * Add comments to the macro added in the patch cmd/blkmap.c | 9 +++++++-- drivers/block/blkmap.c | 19 +++++++++++++++---- drivers/block/blkmap_helper.c | 2 +- include/blkmap.h | 4 +++- 4 files changed, 26 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