From patchwork Wed Mar 12 08:54:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 872817 Delivered-To: patch@linaro.org Received: by 2002:a5d:64e7:0:b0:38f:210b:807b with SMTP id g7csp158472wri; Wed, 12 Mar 2025 01:54:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVwHaDC760a7IUwxFoOHzRzA5rAX/vOStcGJFIls9niOpShxk+dKO89bJX/xKhk8Vu8KGym/w==@linaro.org X-Google-Smtp-Source: AGHT+IHRTZJTVEX3xub0SiOq3Tw0vLuYEruNmbtMpaW4fFgl2i4o5hTTMCxW7FJtMRE0PcA3AEfG X-Received: by 2002:a05:6902:986:b0:e63:ce6e:9ead with SMTP id 3f1490d57ef6-e63ce6ea0fcmr790778276.33.1741769693975; Wed, 12 Mar 2025 01:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741769693; cv=none; d=google.com; s=arc-20240605; b=EBJkDfEJFx5/ZOFSvDQtyLzZZ7TFZp8BGhbB581SEUwUUGLqdlqsz4Ea5XCs44Wmvw b4+vxCz2gFxg1RRT+sdSoKVnCWHFiuuOUnSRel+zzV3V2Ynxprd7zKEgnW2PcFEL7lf/ v9L4D/vKT9cC/CKjrWzDWijmh3VnVhodSuM7lR4Snu1fv2O8iducNLv+agaWEl4K0n3E 2sYDiuGSC2VUnj7WmXC3s1ypoV4606Hca974ckMJecKxywCxL2ojc6vi8OCC8v88y2tx q4BhZOBJMOwlE2+Fs/KauiSV9IsKSXhwrwb86YPt7ShIjEKr2tQ1iojDhcLSaurrmUJ4 v3sw== 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=p9AUSqPGvCYhm17p0OM4l8xLhhAiwXFFi6IOiEL57TM=; fh=bHr605NUXl1F7suejM5+0d5DcANY/0ccb1yuu1CAhjY=; b=NP34r9qoSor3qngGp+m+1gF1yX7MRts4FBnxCD46K81+TRQOd3gDjFM2VQCMkAnLSI h9u7WJAImYeCZwJAzYi1uXA54aX7qgjfp3L7YosvuTVFTqJmtRsiuwB4NzsHFJiVMYZj SX4PYWm87oIm/2bofm82RIcBUSgjA+MHIyBW5Nb0SJRfs9ptOSgusMoT99d0rcFBCC4/ rfnKl4/Fm8Eb4EWagNxFlaE7fpZt3WQsOKd03Kajwi0eFb6f9ynsbDWOrquYBcphvf3O NAKJxy88WMBZVMfMTrueH6YlmrH/1eF9a23w/2wZolfLH5msVT/U/RBerDU+pbk64tPa URDw==; 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 3f1490d57ef6-e634b8f4409si11727100276.522.2025.03.12.01.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 01:54:53 -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 3C7E2807D7; Wed, 12 Mar 2025 09:54:52 +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 F0657807D7; Wed, 12 Mar 2025 09:54: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 2BA6B805D7 for ; Wed, 12 Mar 2025 09:54: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 3FA6A152B; Wed, 12 Mar 2025 01:54:57 -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 255973F5A1; Wed, 12 Mar 2025 01:54:43 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Tom Rini , Heinrich Schuchardt , Anton Antonov , Tobias Waldekranz Subject: [PATCH v8 0/8] Add pmem node for preserving distro ISO's Date: Wed, 12 Mar 2025 14:24:16 +0530 Message-Id: <20250312085424.1201148-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. This version of the patchset is adding two patches to the front of the series, which re-install a device-tree(DT) on the EFI configuration table afresh on every invocation of efi_install_fdt(). This fixes the issue of a stale DT being passed on to a OS in the scenario where the DT was already installed on the configuration table. Changes since V7: * Change the type of fdt_pages to efi_uintn_t (patch 2) * Remove the check for either of fdt_pages or new_fdt_addr being 0 (patch 2) * Change the format specifier for fdt_pages in the debug messages for size_t (patch 2) * Put the assignment of new_fdt_addr and fdt_pages on separate lines to avoid checkpatch error (patch 2) * Fix repeated word in the commit message (patch 7) * Fix checkpatch errors in blkmap.c and efi_helper.c (patch 8) 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 (5): efi_loader: remove unused code from copy_fdt() efi_loader: install device-tree on configuration table on every invocation 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 | 64 +++++++++++++++++++++++++-- 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 | 81 ++++++++++++++++++++++++++--------- lib/efi_loader/efi_memory.c | 56 +++++++++++++++++------- 12 files changed, 297 insertions(+), 51 deletions(-)