From patchwork Tue Oct 8 18:14:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 833585 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp435259wrv; Tue, 8 Oct 2024 11:14:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUBMyJQAgGKfIXhfOb9jKmMBPwdvJRHMj0+4pQodD4Womf3zn8/XDyexGkH8HNbYtG7z45SyQ==@linaro.org X-Google-Smtp-Source: AGHT+IFHu4p8YttfTYsOxDEbdUk4XVKLodF/b2+QbSEuHvzUQiL/pUClMSuH3uN/7oZmaLQBFQOu X-Received: by 2002:a05:6602:1653:b0:832:13ce:1fad with SMTP id ca18e2360f4ac-834f7d0140cmr1133227939f.8.1728411293355; Tue, 08 Oct 2024 11:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728411293; cv=none; d=google.com; s=arc-20240605; b=TFTzJQ/WvSCNgEL4sUSjS91JE0l9NJjuwHGf1/AXI3w2gW/kdiOdKnkTNQ4/8u9s/y AzTGeC5rS/R0mz87k7jhEnJGvWIOhdTwSh1RiRQ1B3H5fxHxbkAFu4eT3Hke3CJ0CNHN 3kX6PokJn1JtuqEHpPP28mbYUHdvY7UGVKg741U1oKKAuWMn54W2b27/qAhgjBsA/kNu 8qdF3MJtvXjK2LnyIFEiofs/ch59IU6T4hnAusqpVJyLvMux5kd3qmQcp1+ufo+/tMg5 rzYtiuGpcuSws7jSRB4U/CbFj7Yx3xA9lLEPlzzZvXGTnFWx2w851LurlPx7v5CMjjDC 3WMw== 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=JU5bbDWaN/gL/ApaNkNYw50Ly6IQGnsnV9Ye4EYylj8=; fh=LWW0zT9ImG8weo6Y5DL8tURCwykDfkMMrUaCdjJ8Jp0=; b=dv4Itqj93oMxXnx+ceyRSd+GhcOvWhYmCwaaVNZT1/f8qq8gcWXwpTCyAJRv2QWHzn VyE4/3bkqw7CPYEQFR2E2k8PicnnvUwo9XLU94unvGGcYJQptz74S23pgJ0/1GH2AiQg AY4S1TxupOPQk1YJs8KBKwbW5juRpVQ3CttucDUOyKtfmrmKHvCfqAYoV7hbhUvmCuIW 1DPgzaLULuukbzbwjs7FOzLMVdanBW5o1FUizFC/eZVOIJ8cPw6obh2tfKD3jSKKbrkA Sl1QS8Mt1Qx0LpcMN+1r9REV5A3UxrSm5GmBkbLwalw9tEyfnqVRLjoSDnT6q/koknSm lD9Q==; 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 ca18e2360f4ac-83503b1f01esi385416039f.114.2024.10.08.11.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 11:14: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 33DD788D27; Tue, 8 Oct 2024 20:14:51 +0200 (CEST) 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 3576288C78; Tue, 8 Oct 2024 20:14:49 +0200 (CEST) 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 171C388B63 for ; Tue, 8 Oct 2024 20:14:47 +0200 (CEST) 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 EF4F9DA7; Tue, 8 Oct 2024 11:15:15 -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 C4C773F64C; Tue, 8 Oct 2024 11:14:43 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Tom Rini , Bin Meng , Caleb Connolly , Jonas Karlman Subject: [PATCH v2 00/14] Make EFI memory allocations synchronous with LMB Date: Tue, 8 Oct 2024 23:44:21 +0530 Message-Id: <20241008181435.1753814-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 This is part two of the series to have the EFI and LMB modules have a coherent view of memory. Part one of this goal was to change the LMB module to have a global and persistent memory map. Those patches have now been applied to the next branch. These patches are changing the EFI memory allocation API's such that they rely on the LMB module to allocate RAM memory. This fixes the current scenario where the EFI memory module has no visibility of the allocations/reservations made by the LMB module. One thing to note here is that this is limited to the RAM memory region, i.e. the EFI_CONVENTIONAL_MEMORY type. Any other memory type that is to be added to the EFI memory map, still gets handled by the EFI memory module. Changes since V1: * Add comments for the API's added * Add a config for SPL stage * Call the efi_add_memory_map_pg() function directly from the lmb_map_update_notify() instead of doing it through the event framework. * Call the efi_add_memory_map_pg() with overlap_only_ram argument set to false, to allow for overlapping allocation design of LMB. * Use the return value of lmb_map_update_notify() at it's call sites * Do not remove the inclusion of efi_loader.h as it is now needed for the lmb_map_update_notify() Sughosh Ganu (14): lmb: add versions of the lmb API with flags lmb: add a flag to allow suppressing memory map change notification efi: memory: use the lmb API's for allocating and freeing memory lib: Kconfig: add a config symbol for getting lmb memory map updates add a function to check if an address is in RAM memory lmb: notify of any changes to the LMB memory map ti: k3: remove efi_add_known_memory() function definition stm32mp: remove efi_add_known_memory() function definition lmb: allow for boards to specify memory map layerscape: use the lmb API's to add RAM memory x86: e820: use the lmb API for adding RAM memory efi_memory: do not add RAM memory to the memory map lmb: remove call to efi_lmb_reserve() efi_memory: rename variable to highlight overlap with free memory arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 8 +- arch/arm/mach-k3/common.c | 11 -- arch/arm/mach-stm32mp/dram_init.c | 11 -- arch/x86/lib/e820.c | 47 +++-- common/board_r.c | 5 + include/efi_loader.h | 27 ++- include/lmb.h | 61 +++++++ lib/Kconfig | 36 ++++ lib/efi_loader/Kconfig | 2 + lib/efi_loader/efi_memory.c | 202 ++++++---------------- lib/lmb.c | 220 +++++++++++++++++++----- 11 files changed, 398 insertions(+), 232 deletions(-)