linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] efi/libstub: DRAM base calculation
@ 2020-09-04 15:50 Heinrich Schuchardt
  2020-09-07  7:00 ` Maxim Uvarov
  2020-09-09  8:17 ` Ard Biesheuvel
  0 siblings, 2 replies; 11+ messages in thread
From: Heinrich Schuchardt @ 2020-09-04 15:50 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Ingo Molnar, Arvind Sankar, linux-efi, linux-kernel,
	Maxim Uvarov, Jens Wiklander, Heinrich Schuchardt

In the memory map the regions with the lowest addresses may be of type
EFI_RESERVED_TYPE. The reserved areas may be discontinuous relative to the
rest of the memory. So for calculating the maximum loading address for the
device tree and the initial ramdisk image these reserved areas should not
be taken into account.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/firmware/efi/libstub/efi-stub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
index c2484bf75c5d..13058ac75765 100644
--- a/drivers/firmware/efi/libstub/efi-stub.c
+++ b/drivers/firmware/efi/libstub/efi-stub.c
@@ -106,7 +106,8 @@ static unsigned long get_dram_base(void)
 	map.map_end = map.map + map_size;

 	for_each_efi_memory_desc_in_map(&map, md) {
-		if (md->attribute & EFI_MEMORY_WB) {
+		if (md->attribute & EFI_MEMORY_WB &&
+		    md->type != EFI_RESERVED_TYPE) {
 			if (membase > md->phys_addr)
 				membase = md->phys_addr;
 		}
--
2.28.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-09-10 10:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 15:50 [PATCH 1/1] efi/libstub: DRAM base calculation Heinrich Schuchardt
2020-09-07  7:00 ` Maxim Uvarov
2020-09-07  8:30   ` Heinrich Schuchardt
2020-09-07 10:21     ` Maxim Uvarov
2020-09-07 15:42       ` Maxim Uvarov
2020-09-09  8:17 ` Ard Biesheuvel
2020-09-09 10:43   ` Maxim Uvarov
2020-09-09 10:46     ` Ard Biesheuvel
2020-09-09 11:04       ` Maxim Uvarov
2020-09-09 20:36   ` Atish Patra
2020-09-10 10:03     ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).