From patchwork Mon Mar 10 11:57:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 872194 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp941964wri; Mon, 10 Mar 2025 04:58:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW+czkLUftL9iGfnkOAQMvZKJ1LjRob4uJYDlo1p0CD9Epz5EFAhMNb1IBRl3mESWKKJbzaFQ==@linaro.org X-Google-Smtp-Source: AGHT+IGdEo2FVyCs2NGIA+pamAyT5KqMi/moFkuejY7R6XWhww6omuYjvsJl63B+ico4Tl4fNRNU X-Received: by 2002:a05:690c:c01:b0:6fe:abff:cb17 with SMTP id 00721157ae682-6febf383ea4mr195539747b3.26.1741607891543; Mon, 10 Mar 2025 04:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741607891; cv=none; d=google.com; s=arc-20240605; b=dfX0oLkubdCRa4ojz5tWE6Dnqs+gV+WowpqWcEeX+3pITN4HuS0iGwhwyJt6DBLtOY x1nzXq7DwnbLL/LNgjtUmJPV2NQ3mrN1OVUTkjTE6s0X9JzA30kxMU/EDLmCNe06GSQr vnZCRgDlTA6f0E+VzcrK10+MadJrDdWTDyd673cvRa7zEggSeZRPyiuJ3LMaMQVdm9UI OucZYRKm09CmwCZgsxT31jGgHGnv9c6ka4UbvibhfFcVNOvvpEHxBEgxcK4yhDG7pKu1 4Ob6i5dt5GGDfYZcNHw8+fdC1lJ6eVbr2bE9MvX2EdJvcjsqsU44lQsj5E35Eunyrkme y6NA== 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=bjCfOXfxiBEYV2sbhhIcTj4RRpGY7fc2f8CgPdm2CG4=; fh=pTYbdHCF368FpDItLosOC8x6rNHg2y0DKbQb5XHCTCY=; b=MUcGoJCW116ds2MaO5+0pGHUrK0iFRW3/xtG8uPx+Win4cix1UAsBZcuvMMspgUb8P H/pne+58XCgtuNXETzzb4PWSbvGJu3FatfiC/GcMIi+WmjjqEepyRrPs2fEVDd6x4e8K 9MupLRGm+2ryvaKYIomKf76jyIeZyiPb4h1lMJhG2SA5qWkxDQw247Vpe4k86xlJQOKH 8WqDbGWQKFtCRlm+3lA1poIEIEVBSYqHGPC1zApg3hyBMipz/g7s030Y8PLxdliteZ8Y wu+Qw4FCl3RdTTuGJAaBE4NGmqzMhgBuZzq5VxPQKVUp926Ww3+rQ6ymOd3WujOLoiNt msJQ==; 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 00721157ae682-6fee1f1b489si31430297b3.461.2025.03.10.04.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 04:58:11 -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 99F578129F; Mon, 10 Mar 2025 12:58:09 +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 16C54812C8; Mon, 10 Mar 2025 12:58:09 +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_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_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 E8650811DF for ; Mon, 10 Mar 2025 12:58:06 +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 BE3501516; Mon, 10 Mar 2025 04:58:17 -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 A9DC23F5A1; Mon, 10 Mar 2025 04:58:03 -0700 (PDT) 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 v7 0/8] Add pmem node for preserving distro ISO's Date: Mon, 10 Mar 2025 17:27:42 +0530 Message-Id: <20250310115750.1019051-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 V6: * Clean-up the copy_fdt() function in efi_helper.c - patch 1 * Re-install a new DT on every invocation of efi_install_fdt() - patch 2 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 | 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 | 83 +++++++++++++++++++++++++++-------- lib/efi_loader/efi_memory.c | 56 ++++++++++++++++------- 12 files changed, 302 insertions(+), 49 deletions(-)