public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sjoerd Simons <sjoerd@collabora.com>
To: u-boot@lists.denx.de
Cc: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Michal Simek <michal.simek@amd.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>
Subject: [PATCH 2/3] lmb: Set correct lmb flags for EFI memory map entries
Date: Thu, 19 Jan 2023 09:38:18 +0100	[thread overview]
Message-ID: <20230119083820.2656710-3-sjoerd@collabora.com> (raw)
In-Reply-To: <20230119083820.2656710-1-sjoerd@collabora.com>

When adding reserved memory areas from the EFI memory map set the NOMAP
flag when applicable. When this isn't done adding "no-map" flagged entries
from the fdt after receiving the same from the EFI memory map fails due
to non-matching flags.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
---

 lib/lmb.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index ec790760db6..f447c639a60 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -175,11 +175,14 @@ static __maybe_unused int efi_lmb_reserve(struct lmb *lmb)
 		return 1;
 
 	for (i = 0, map = memmap; i < map_size / sizeof(*map); ++map, ++i) {
-		if (map->type != EFI_CONVENTIONAL_MEMORY)
-			lmb_reserve(lmb,
-				    map_to_sysmem((void *)(uintptr_t)
-						  map->physical_start),
-				    map->num_pages * EFI_PAGE_SIZE);
+		if (map->type != EFI_CONVENTIONAL_MEMORY) {
+			lmb_reserve_flags(lmb,
+					  map_to_sysmem((void *)(uintptr_t)
+							map->physical_start),
+					  map->num_pages * EFI_PAGE_SIZE,
+					  map->type == EFI_RESERVED_MEMORY_TYPE
+					      ? LMB_NOMAP : LMB_NONE);
+		}
 	}
 	efi_free_pool(memmap);
 
-- 
2.39.0


  parent reply	other threads:[~2023-01-19  8:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  8:38 [PATCH 0/3] Fix boot regressions on at least TI am62x Sjoerd Simons
2023-01-19  8:38 ` [PATCH 1/3] Bump LMB_MAX_REGIONS default to 16 Sjoerd Simons
2023-01-26 18:28   ` Tom Rini
2023-01-27  7:55     ` Sjoerd Simons
2023-01-27 13:22       ` Tom Rini
2023-02-08 20:00   ` Tom Rini
2023-01-19  8:38 ` Sjoerd Simons [this message]
2023-02-07 16:49   ` [PATCH 2/3] lmb: Set correct lmb flags for EFI memory map entries Tom Rini
2023-01-19  8:38 ` [PATCH 3/3] lmb: Treat a region which is a subset as equal Sjoerd Simons
2023-02-06 18:04   ` Tom Rini
2023-02-08  7:37     ` Sjoerd Simons
2023-02-08 14:55       ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230119083820.2656710-3-sjoerd@collabora.com \
    --to=sjoerd@collabora.com \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=michal.simek@amd.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox