From patchwork Fri Feb 28 08:45: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: 869276 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1561:b0:38f:210b:807b with SMTP id 1csp678507wrz; Fri, 28 Feb 2025 00:45:59 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWg6t5OpX/T1s/FTrPbXNtY3g+zSjAiJ24bdkr6+1QRQ0IORV8xnD4Gm7fueBLsl30NVzXrKQ==@linaro.org X-Google-Smtp-Source: AGHT+IHgdNLAX9Xx9+sxlIbVnl2nYKcPTualSkJ/9L9bqFebSdc5l/LseFYmwZE94COVD/kbq/sR X-Received: by 2002:a05:6000:184f:b0:390:ddc5:42b2 with SMTP id ffacd0b85a97d-390eca64d86mr2028529f8f.55.1740732359067; Fri, 28 Feb 2025 00:45:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1740732359; cv=none; d=google.com; s=arc-20240605; b=Jdr7sSRpQqjHTqELzb4qIjXAruPjaFC69HqXOKkXvUPW4npd+WxCut4z8VJT4ECqDY Zpl9o/aDLqp5olSGUEPJ7ECpPCFFUVQM1P7uWTL9apdjG3RWaTsUvvTLLcKY5VsWHECy jUih6ET1P8+QS3Tk+WlKD8wLwMeAasbSa2KEO3zDZWfL9XR1txXvEBRWHnwDy4urY+rG nCz24WEOzd+/L9CQ5fUEhIvT4OQuuNtpcmXbgNMTZISw8H50V5c8qKxkehOXqvjAj727 Wr0Ti2F4VrS6TwekiVFVcmbikT9Z2dfB7p0MGB7PtFGsNzYXyJP22mlA3s+V75dbeXJo nl7w== 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:message-id:date:subject:cc:to:from; bh=SjZRLchZOSDqSZpSkrxEOreMZuQdiSQLFVq6lqo1j1c=; fh=pTYbdHCF368FpDItLosOC8x6rNHg2y0DKbQb5XHCTCY=; b=kqNlVQSWs4ZqqTlSrwnvia32xpBq2mXa0FY3hlTxaFIlnZKw9+Wx0g3RKKf7ITvj0x gCHqsoFpdFMtuyVFQzfjPHtHroxBHiPwPxTb10QXG6HiUIkXrMpsMpD+x+no4FvkkCvq LYuPThlDHvE1QmAP1pVyZ8OViL2KciFsd8wtNpdaDuA2+8LCabDVd0cMPwQDFPesd33h aDTW9EJcM/WPYH522UqGgGNW24XoB6hnFCwu75NPArESZqNpDQh6cY/qzPnm7Fi1odZN YTciwLarouvGCeDTcl0IfltoLfdwC6bBS2fsl0k62tnxZxzeNrTooiLV5EawjtdCdIVV CITA==; 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-43b736f5a88si24469095e9.59.2025.02.28.00.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 00:45:59 -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 CE0A7808B6; Fri, 28 Feb 2025 09:45:57 +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 79107809A5; Fri, 28 Feb 2025 09:45:57 +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 03D74807D7 for ; Fri, 28 Feb 2025 09:45:54 +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 DA04B113E; Fri, 28 Feb 2025 00:46:08 -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 EE5823F673; Fri, 28 Feb 2025 00:45:50 -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 Subject: [PATCH v6 0/6] Add pmem node for preserving distro ISO's Date: Fri, 28 Feb 2025 14:15:23 +0530 Message-Id: <20250228084529.127823-1-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 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 When installing a distro via EFI HTTP boot some OS installers expect the .iso image to be preserved and treat it as a "CDROM" to install packages. This is problematic in EFI, since U-Boot mounts the image, starts the installer, and eventually calls ExitBootServices. At that point the image U-Boot mounted disappears. Some distros don't care and download the missing packages from a web archive, while others halt the installation complaining they can't find certain packages. If the firmware uses ACPI, this is supported by using NFIT which provides NVDIMM ramdisks to the OS and preserves the image. We don't have anything in place for Device Trees though. Since DT supports persistent memory nodes (pmem) use those and preserve the .iso for installers. The issue can be reproduced by attempting an EFI HTTP boot with Ubuntu live server ISO, or a Rocky Linux ISO. The installation would fail with the failure to locate certain packages. The patches are adding support for adding the pmem node to the DT that is being passed to the OS, along with removing the memory region containing the ISO image from the EFI memory map. This is being done through a helper function in the blkmap driver which scans for all blkmap mappings and does the above configurations for the relevant mappings. Changes since V5: * Move the failure message to the callback function instead of printing it in blkmap_get_preserved_pmem_slice() * Move the check for the callback function before entering the loop in blkmap_get_preserved_pmem_slice() * Return the error code returned by the callback function in blkmap_get_preserved_pmem_slice() Ilias Apalodimas (2): efi_loader: add a function to remove memory from the EFI map efi_loader: preserve installer images in pmem Masahisa Kojima (1): fdt: add support for adding pmem nodes Sughosh Ganu (3): blkmap: store type of blkmap slice in corresponding structure blkmap: add an attribute to preserve the mem mapping blkmap: pass information on ISO image to the OS boot/fdt_support.c | 41 +++++++++++++++++++++- boot/image-fdt.c | 7 ++++ cmd/blkmap.c | 9 +++-- drivers/block/blkmap.c | 65 ++++++++++++++++++++++++++++++++--- drivers/block/blkmap_helper.c | 2 +- include/blkmap.h | 21 ++++++++++- include/efi.h | 13 +++++++ include/efi_loader.h | 18 ++++++++++ include/fdt_support.h | 14 ++++++++ lib/efi_loader/efi_bootmgr.c | 22 +++++++++--- lib/efi_loader/efi_helper.c | 40 +++++++++++++++++++++ lib/efi_loader/efi_memory.c | 56 +++++++++++++++++++++--------- 12 files changed, 278 insertions(+), 30 deletions(-)