mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-17 09:21:35 +00:00
44 lines
1.3 KiB
Diff
44 lines
1.3 KiB
Diff
From 0fa9bf583ed7ba8ad360072380e2b9b7b9d4ab62 Mon Sep 17 00:00:00 2001
|
|
From: Poovendhan Selvaraj <quic_poovendh@quicinc.com>
|
|
Date: Thu, 4 May 2023 17:15:10 +0530
|
|
Subject: [PATCH] of: Truncate the memory sizes on 32-bit platforms if exceeds
|
|
0xFFFFFFFF
|
|
|
|
The memory outside 32-bit address range is not being dropped.
|
|
Added fix to Truncating memory to fit in 32-bit physical address space.
|
|
|
|
Change-Id: Ic16c86afe2c5bfdeb1bd606bbad2fbd674996dda
|
|
Signed-off-by: Poovendhan Selvaraj <quic_poovendh@quicinc.com>
|
|
---
|
|
drivers/of/fdt.c | 14 ++++++++++++++
|
|
1 file changed, 14 insertions(+)
|
|
|
|
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
|
|
index 814908667248..4b153fecb5cd 100644
|
|
--- a/drivers/of/fdt.c
|
|
+++ b/drivers/of/fdt.c
|
|
@@ -1232,6 +1232,20 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
|
|
size -= PAGE_SIZE - (base & ~PAGE_MASK);
|
|
base = PAGE_ALIGN(base);
|
|
}
|
|
+
|
|
+
|
|
+#ifndef CONFIG_PHYS_ADDR_T_64BIT
|
|
+ if (base + size > ULONG_MAX) {
|
|
+ pr_crit("Truncating memory at 0x%08llx to fit in 32-bit physical address space\n",
|
|
+ (long long)base);
|
|
+ /*
|
|
+ * To ensure bank->start + bank->size is representable in
|
|
+ * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB.
|
|
+ * This means we lose a page after masking.
|
|
+ */
|
|
+ size = ULONG_MAX - base;
|
|
+ }
|
|
+#endif
|
|
size &= PAGE_MASK;
|
|
|
|
if (base > MAX_MEMBLOCK_ADDR) {
|
|
--
|
|
2.34.1
|
|
|