Skip to content
Snippets Groups Projects
Commit 24471f43 authored by Martyn Welch's avatar Martyn Welch
Browse files

d/patches: am62x: Integrate fixes required for am625-sk to boot


Boot it failing due to device tree allocation errors:

  Working FDT set to 88000000
     Loading Ramdisk to 8d70f000, end 8ffff88c ... OK
  ERROR: reserving fdt memory region failed (addr=9e780000 size=80000 flags=4)
  ERROR: reserving fdt memory region failed (addr=9e800000 size=1800000 flags=4)
  ERROR: reserving fdt memory region failed (addr=9db00000 size=c00000 flags=4)
  ERROR: Failed to allocate 0x9560 bytes below 0x90000000.
  device tree - allocation error
  FDT creation failed!

Integrate changes required to fix this.

Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
parent 069395f7
No related branches found
No related tags found
2 merge requests!92Backport Debian Bullseye Security/Updates,!91d/patches: am62x: Additional SoC and dev board support
From: Sjoerd Simons <sjoerd@collabora.com>
Date: Thu, 19 Jan 2023 09:38:17 +0100
Subject: Bump LMB_MAX_REGIONS default to 16
Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.
Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).
As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
---
lib/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Kconfig b/lib/Kconfig
index 3c5a4ab..7d1b886 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -1002,7 +1002,7 @@ config LMB_USE_MAX_REGIONS
config LMB_MAX_REGIONS
int "Number of memory and reserved regions in lmb lib"
depends on LMB && LMB_USE_MAX_REGIONS
- default 8
+ default 16
help
Define the number of supported regions, memory and reserved, in the
library logical memory blocks.
From: Sjoerd Simons <sjoerd@collabora.com>
Date: Thu, 19 Jan 2023 09:38:18 +0100
Subject: lmb: Set correct lmb flags for EFI memory map entries
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 ec79076..f447c63 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);
From: Sjoerd Simons <sjoerd@collabora.com>
Date: Thu, 19 Jan 2023 09:38:19 +0100
Subject: lmb: Treat a region which is a subset as equal
In various cases logical memory blocks are coalesced; As a result doing
a strict check whether memory blocks are the same doesn't necessarily
work as a previous addition of a given block might have been merged into
a bigger block.
Fix this by considering a block is already registered if it's a pure
subset of one of the existing blocks.
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
---
lib/lmb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/lmb.c b/lib/lmb.c
index f447c63..b09a043 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -248,7 +248,7 @@ static long lmb_add_region_flags(struct lmb_region *rgn, phys_addr_t base,
phys_size_t rgnsize = rgn->region[i].size;
phys_size_t rgnflags = rgn->region[i].flags;
- if (rgnbase == base && rgnsize == size) {
+ if (rgnbase <= base && rgnbase + rgnsize >= base + size) {
if (flags == rgnflags)
/* Already have this region, so we're done */
return 0;
......@@ -97,3 +97,6 @@ apertis/am62x/0069-am62-glue-configuration.patch
apertis/am62x/0072-configs-am62-Add-configs-for-enabling-USB-in-U-Boot.patch
apertis/am62x/0071-configs-am62x-Enable-DFU-support.patch
apertis/am62x/0075-configs-am62x_evm_a53-Increase-size-of-decompressabl.patch
apertis/am62x/0077-Bump-LMB_MAX_REGIONS-default-to-16.patch
apertis/am62x/0078-lmb-Set-correct-lmb-flags-for-EFI-memory-map-entries.patch
apertis/am62x/0079-lmb-Treat-a-region-which-is-a-subset-as-equal.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment