21
21
.../arm/boot/compressed/fdt_check_mem_start.c | 48 ++++++++++++++++---
22
22
1 file changed, 42 insertions(+), 6 deletions(-)
23
23
24
- diff --git a/arch/arm/boot/compressed/fdt_check_mem_start.c b/arch/arm/boot/compressed/fdt_check_mem_start.c
25
- index 62450d824c3c..9291a2661bdf 100644
26
24
--- a/arch/arm/boot/compressed/fdt_check_mem_start.c
27
25
+++ b/arch/arm/boot/compressed/fdt_check_mem_start.c
28
- @@ -55,16 +55,17 @@ static uint64_t get_val(const fdt32_t *cells, uint32_t ncells)
26
+ @@ -55,16 +55,17 @@ static uint64_t get_val(const fdt32_t *c
29
27
* DTB, and, if out-of-range, replace it by the real start address.
30
28
* To preserve backwards compatibility (systems reserving a block of memory
31
29
* at the start of physical memory, kdump, ...), the traditional method is
@@ -39,18 +37,18 @@ index 62450d824c3c..9291a2661bdf 100644
39
37
{
40
38
- uint32_t addr_cells, size_cells, base;
41
39
+ uint32_t addr_cells, size_cells, usable_base, base;
42
- uint32_t fdt_mem_start = 0xffffffff;
40
+ uint32_t fdt_mem_start = 0xffffffff;
43
41
- const fdt32_t *reg, *endp;
44
42
- uint64_t size, end;
45
43
+ const fdt32_t *usable, *reg, *endp;
46
44
+ uint64_t size, usable_end, end;
47
- const char *type;
48
- int offset, len;
49
-
50
- @@ -80,6 +81,27 @@ uint32_t fdt_check_mem_start(uint32_t mem_start, const void *fdt)
51
- if (addr_cells > 2 || size_cells > 2)
52
- return mem_start;
53
-
45
+ const char *type;
46
+ int offset, len;
47
+
48
+ @@ -80,6 +81,27 @@ uint32_t fdt_check_mem_start(uint32_t me
49
+ if (addr_cells > 2 || size_cells > 2)
50
+ return mem_start;
51
+
54
52
+ /*
55
53
+ * Usable memory in case of a crash dump kernel
56
54
+ * This property describes a limitation: memory within this range is
@@ -72,13 +70,13 @@ index 62450d824c3c..9291a2661bdf 100644
72
70
+ usable_end = usable_base + size;
73
71
+ }
74
72
+
75
- /* Walk all memory nodes and regions */
76
- for (offset = fdt_next_node(fdt, -1, NULL); offset >= 0;
77
- offset = fdt_next_node(fdt, offset, NULL)) {
78
- @@ -107,7 +129,20 @@ uint32_t fdt_check_mem_start(uint32_t mem_start, const void *fdt)
79
-
80
- base = fdt32_ld(reg + addr_cells - 1);
81
- end = base + size;
73
+ /* Walk all memory nodes and regions */
74
+ for (offset = fdt_next_node(fdt, -1, NULL); offset >= 0;
75
+ offset = fdt_next_node(fdt, offset, NULL)) {
76
+ @@ -107,7 +129,20 @@ uint32_t fdt_check_mem_start(uint32_t me
77
+
78
+ base = fdt32_ld(reg + addr_cells - 1);
79
+ end = base + size;
82
80
- if (mem_start >= base && mem_start < end) {
83
81
+ if (usable) {
84
82
+ /*
@@ -94,18 +92,16 @@ index 62450d824c3c..9291a2661bdf 100644
94
92
+ if (end <= base)
95
93
+ continue;
96
94
+ } else if (mem_start >= base && mem_start < end) {
97
- /* Calculated address is valid, use it */
98
- return mem_start;
99
- }
100
- @@ -123,7 +158,8 @@ uint32_t fdt_check_mem_start(uint32_t mem_start, const void *fdt)
101
- }
102
-
103
- /*
95
+ /* Calculated address is valid, use it */
96
+ return mem_start;
97
+ }
98
+ @@ -123,7 +158,8 @@ uint32_t fdt_check_mem_start(uint32_t me
99
+ }
100
+
101
+ /*
104
102
- * The calculated address is not usable.
105
103
+ * The calculated address is not usable, or was overridden by the
106
104
+ * "linux,usable-memory-range" property.
107
- * Use the lowest usable physical memory address from the DTB instead,
108
- * and make sure this is a multiple of 2 MiB for phys/virt patching.
109
- */
110
- - -
111
- 2.35.1
105
+ * Use the lowest usable physical memory address from the DTB instead,
106
+ * and make sure this is a multiple of 2 MiB for phys/virt patching.
107
+ */
0 commit comments