mach-k3: common_fdt: create a reserved memory node
Subsystems (2)
PATCH 1/1 mach-k3: common_fdt: create a reserved memory node
Some device trees may not have a reserved-memory node. Rather than exiting early we should create a new reserved-memory node along with the memory carveout for the firmware we (U-Boot) have placed.
--- arch/arm/mach-k3/common_fdt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-k3/common_fdt.c +3 -4
@@ -122,10 +122,8 @@ int fdt_fixup_reserved(void *blob, const char *name,/* Find reserved-memory */ nodeoffset =fdt_subnode_offset (blob,0 ,"reserved-memory" ); -if (nodeoffset <0 ) { -debug ("Could not find reserved-memory node\n" ); -return 0 ; - } +if (nodeoffset <0 ) + goto add_carveout;/* Find existing matching subnode and remove it */ fdt_for_each_subnode (subnode, blob, nodeoffset) {
@@ -154,6 +152,7 @@ int fdt_fixup_reserved(void *blob, const char *name, } } +add_carveout:struct fdt_memory carveout = { .start = new_address, .end = new_address + new_size -1 ,
---
base-commit: b78f8677cde8b1dde31b66f5b780f2e9b62fba7f
change-id: 20250227-reserved-memory-85f5d409e6a7
Best regards,
Signature · 1 line
Bryan Brattlof <[email protected]>
Quoted 14 lines · Bryan Brattlof
Some device trees may not have a reserved-memory node. Rather than exiting early we should create a new reserved-memory node along with the memory carveout for the firmware we (U-Boot) have placed.
Signed-off-by Bryan Brattlof <[email protected]>--- arch/arm/mach-k3/common_fdt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)arch/arm/mach-k3/common_fdt.c +0
-0
arch/arm/mach-k3/common_fdt.c int fdt_fixup_reserved(void *blob, const char *name, · line 125
Quoted 8 lines
arch/arm/mach-k3/common_fdt.c +1
-4@@ -122,10 +122,8 @@ int fdt_fixup_reserved(void *blob, const char *name,/* Find reserved-memory */ nodeoffset =fdt_subnode_offset (blob,0 ,"reserved-memory" ); -if (nodeoffset <0 ) { -debug ("Could not find reserved-memory node\n" ); -return 0 ; - } +if (nodeoffset <0 )
We could also reverse this check and put the node deleting logic below inside this block. Same effect but removes the need for a goto for flow control here (goto considered harmful etc..)
if (nodeoffset >= 0) {
/* Find existing matching subnode and remove it */
...
}Might make the intention a bit much, so either way is fine with me,
Quoted 18 lines
arch/arm/mach-k3/common_fdt.c +2
-1+ goto add_carveout;/* Find existing matching subnode and remove it */ fdt_for_each_subnode (subnode, blob, nodeoffset) {@@ -154,6 +152,7 @@ int fdt_fixup_reserved(void *blob, const char *name, } } +add_carveout:struct fdt_memory carveout = { .start = new_address, .end = new_address + new_size -1 , ---base-commit:
b78f8677cde8b1dde31b66f5b780f2e9b62fba7f
change-id: 20250227-reserved-memory-85f5d409e6a7Best regards,
On February 27, 2025 thus sayeth Andrew Davis:
Quoted 27 lines · Bryan Brattlof
Quoted 14 lines
Some device trees may not have a reserved-memory node. Rather than exiting early we should create a new reserved-memory node along with the memory carveout for the firmware we (U-Boot) have placed.
Signed-off-by Bryan Brattlof <[email protected]>--- arch/arm/mach-k3/common_fdt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)arch/arm/mach-k3/common_fdt.c +0
-0arch/arm/mach-k3/common_fdt.c int fdt_fixup_reserved(void *blob, const char *name, · line 124
Quoted 7 lines
arch/arm/mach-k3/common_fdt.c +1
-4@@ -122,10 +122,8 @@ int fdt_fixup_reserved(void *blob, const char *name,/* Find reserved-memory */ nodeoffset =fdt_subnode_offset (blob,0 ,"reserved-memory" ); -if (nodeoffset <0 ) { -debug ("Could not find reserved-memory node\n" ); -return 0 ; - } +if (nodeoffset <0 )We could also reverse this check and put the node deleting logic below inside this block. Same effect but removes the need for a goto for flow control here (goto considered harmful etc..)
Quoted 7 lines
if (nodeoffset >= 0) { /* Find existing matching subnode and remove it */ ... }Might make the intention a bit much, so either way is fine with me,
Ha it's funny you mentioned this. I had a previous version where I did just that but wasn't sure how people felt about adding another tab to such a large section. Then started looking at adding a fdt_* function before landing on seeing what people thought about a goto label.
I guess I should take votes :)
~Bryan
Quoted 18 lines
Acked-by Andrew Davis <[email protected]>Quoted 16 lines
arch/arm/mach-k3/common_fdt.c +2
-1+ goto add_carveout;/* Find existing matching subnode and remove it */ fdt_for_each_subnode (subnode, blob, nodeoffset) {@@ -154,6 +152,7 @@ int fdt_fixup_reserved(void *blob, const char *name, } } +add_carveout:struct fdt_memory carveout = { .start = new_address, .end = new_address + new_size -1 , ---base-commit:
b78f8677cde8b1dde31b66f5b780f2e9b62fba7f
change-id: 20250227-reserved-memory-85f5d409e6a7Best regards,
Quoted 5 lines · Bryan Brattlof
Some device trees may not have a reserved-memory node. Rather than exiting early we should create a new reserved-memory node along with the memory carveout for the firmware we (U-Boot) have placed.
Applied to u-boot/next, thanks!
[1/1] mach-k3: common_fdt: create a reserved memory node
commit: 096aa229a9e5909e40865454208a6a009dc0c02b
Signature · 1 line
Tom