From: Vitor Soares <ivitro@gmail.com>
To: Tom Rini <trini@konsulko.com>
Cc: Vitor Soares <vitor.soares@toradex.com>,
u-boot@lists.denx.de,
Patrice Chotard <patrice.chotard@foss.st.com>,
Alexander Graf <agraf@csgraf.de>
Subject: [PATCH v1] arm: mach-k3: common: EFI loader map memory below ram top
Date: Thu, 28 Mar 2024 10:05:48 +0000 [thread overview]
Message-ID: <20240328100548.321634-1-ivitro@gmail.com> (raw)
From: Vitor Soares <vitor.soares@toradex.com>
During the boot, the EFI loader maps the memory from ram_top to ram_end
as EFI_BOOT_SERVICES_DATA. When LMB does boot_fdt_add_mem_rsv_regions()
to OPTEE, TFA, R5, and M4F DMA/memory "no-map" for the kernel it produces
the following error message:
ERROR: reserving fdt memory region failed (addr=9cb00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9cc00000 size=e00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9da00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9db00000 size=c00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e780000 size=80000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e800000 size=1800000 flags=4)
To avoid this, don't flag with EFI_BOOT_SERVICES_DATA the memory from
ram_top to ram_end by the EFI loader.
Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
---
Similar fix for the same issue can be found at
https://lore.kernel.org/all/20240308101230.2595220-1-patrice.chotard@foss.st.com/
arch/arm/mach-k3/common.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index b54f2ddc47..80e89b2a16 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -24,6 +24,7 @@
#include <asm/io.h>
#include <fs_loader.h>
#include <fs.h>
+#include <efi_loader.h>
#include <env.h>
#include <elf.h>
#include <soc.h>
@@ -607,3 +608,14 @@ void setup_qos(void)
writel(qos_data[i].val, (uintptr_t)qos_data[i].reg);
}
#endif
+
+void efi_add_known_memory(void)
+{
+ if (IS_ENABLED(CONFIG_EFI_LOADER))
+ /*
+ * Memory over ram_top can be used by various firmware
+ * Declare to EFI only memory area below ram_top
+ */
+ efi_add_memory_map(gd->ram_base, gd->ram_top - gd->ram_base,
+ EFI_CONVENTIONAL_MEMORY);
+}
--
2.34.1
next reply other threads:[~2024-03-28 11:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 10:05 Vitor Soares [this message]
2024-04-12 2:12 ` [PATCH v1] arm: mach-k3: common: EFI loader map memory below ram top 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=20240328100548.321634-1-ivitro@gmail.com \
--to=ivitro@gmail.com \
--cc=agraf@csgraf.de \
--cc=patrice.chotard@foss.st.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=vitor.soares@toradex.com \
/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