From patchwork Thu Feb 27 11:15:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 868951 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1561:b0:38f:210b:807b with SMTP id 1csp207515wrz; Thu, 27 Feb 2025 03:15:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWIomGkkJWKQ28U2enXAUZ+Csf6qF0op0JzZhx05tP4/8g/JTQ6JwGsJmGHytO2digrirU+Cg==@linaro.org X-Google-Smtp-Source: AGHT+IFPCXFtUYDkmuFusgeyMedytvOxMpvsmBeI5bbWY7LfAaVJ7zuCL9HX87Q5pgc8ueqAP+6Q X-Received: by 2002:a17:907:7758:b0:abe:c031:eea2 with SMTP id a640c23a62f3a-abeeee6fe73mr817980966b.24.1740654947546; Thu, 27 Feb 2025 03:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1740654947; cv=none; d=google.com; s=arc-20240605; b=dcClKG2KrSvVR+Lfv0kL7Fr7+tdT35Q7nIdHk0qXBHZv0jZ7XctyTg6gbL/Xjybt08 Lg0w4Ik8sU4wc+T+s5EcFQpGpFEzqmEOdlSW8dc6hn7DHFaCa5U54WTYZA719tR7PSmO iAodSAOPAH93l68dSr86TY035/o+6eQQn4I+TvzcSEp0Z8H2AHE1DcScepqUaV/cUGGy a5lH3xThE4cJJK0CPlLfJ3emoXB3R0rd9Wl5ktUghm7iJU/Xh8epZI54HM72Vz6d66IH FXAypl5ZrjO9kysbXWVdkJRngqtgWBPRArAvezt6e7VDqTbRWH/0gkR6z00U4cGXv9se wiQw== 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=tHnYaNWH4s+m5R0LqqJZb5ChNE3V9WLOorKhsWP65xc=; fh=pTYbdHCF368FpDItLosOC8x6rNHg2y0DKbQb5XHCTCY=; b=OSBsiugr11bHp5ZGWul6Okx76tJTSPO+1Etn44H1Tf7DupjvNNTBQRhl5Ah5Z7qNcK derR/GvQ1oIGXGAoslBelzZhbc018Hhs8YQkTpnQ4ubhXyDa3fVG5WsKEKjTJQHqiSRj d3mmN8xUxib5JcKQD2mvB8w7lN1lAn+t34gOHz6pI0v7uKsWYmd1cVlGy3sxqBLcebIY 7BSgkN0yM+i3b1HuH0h9XEszmKpA3sRz5ob7vgXOthZnYscvZ2xrw/MS7IAfICjAt55T Qa1LTqEcQm43z2TKHJ7jDSbXDjv3+QGDcMvCczG+YpMeEBaZvqOOF5DcHRVjFGYjQUj9 j8iQ==; 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 a640c23a62f3a-abf0c0d84basi141192766b.195.2025.02.27.03.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2025 03:15:47 -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 5001D81100; Thu, 27 Feb 2025 12:15:46 +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 442C981100; Thu, 27 Feb 2025 12:15:45 +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 DDE2E80FF0 for ; Thu, 27 Feb 2025 12:15:42 +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 717BE2BCC; Thu, 27 Feb 2025 03:15:57 -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 4FDC83F6A8; Thu, 27 Feb 2025 03:15:39 -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 v5 0/6] Add pmem node for preserving distro ISO's Date: Thu, 27 Feb 2025 16:45:13 +0530 Message-Id: <20250227111519.45787-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 V4: * Rebase patch(2) changes on top of the next branch * Use BIT() based macros instead of enum * Change the name of the field from type to attr as it would contain attributes other than the type of the slice * Reword the commit message(patch 6) * Add a helper function blkmap_get_preserved_pmem_slice() * Add a function pmem_node_efi_memmap_setup() for pmem node and EFI memmap related setup 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 | 63 ++++++++++++++++++++++++++++++++--- 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 | 37 ++++++++++++++++++++ lib/efi_loader/efi_memory.c | 56 ++++++++++++++++++++++--------- 12 files changed, 273 insertions(+), 30 deletions(-)