common: Add Kconfig option for FDT mem alignment
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in common/board_f.c. Add Kconfig option, assign default value of 0x1000 and enable option to change this value.
---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);
dts/Kconfig +7 -0
@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name> +config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory + for fdt. + config OF_LIST string "List of device tree files to include for DT control" depends on SPL_LOAD_FIT || MULTI_DTB_FIT
Signature · 1 line
2.26.0
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 5 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.
Please, describe why this patch is needed.
Quoted 14 lines
Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +0
-0
common/board_f.c static int reserve_fdt(void) · line 553
Quoted 9 lines
common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);
This change does not relate to the commit message. You are not adjusting the alignment of the device tree location. You are adjusting the size of the memory available for the device tree.
reserve_fdt() is called after reserve_global_data() where we have:gd->start_addr_sp -= sizeof(gd_t).
A typical debug output from reserve_global_data() is:
Reserving 544 Bytes for Global Data at: bf740d98
So in this case the device tree will have an alignment of 8 no matter what power of 2 (>= 8) you choose for CONFIG_FDT_MEM_ALIGN_SIZE.
What about other places where we allocate memory for device trees like copy_fdt() in cmd/bootefi.?
dts/Kconfig config DEFAULT_DEVICE_TREE · line 128
Quoted 13 lines
dts/Kconfig +5
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name> +config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory
%s/is used to set the default alignment/sets the alignment/
Please, mention if this value should be a power of 2.
Best regards
Heinrich
Quoted 6 lines
dts/Kconfig +2
-0+ for fdt. + config OF_LIST string "List of device tree files to include for DT control" depends on SPL_LOAD_FIT || MULTI_DTB_FIT
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 30 lines · Heinrich Schuchardt
Quoted 5 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Please, describe why this patch is needed.
Quoted 21 lines
Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 );
Quoted 6 lines
common/board_f.c static int reserve_fdt(void) · line 553
Quoted 2 lines
common/board_f.c +0
-0gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);This change does not relate to the commit message. You are not adjusting the alignment of the device tree location. You are adjusting the size of the memory available for the device tree.
Let me correct that description in v2.
It is additional size for actual FDT size. I am also not sure why this is needed.
Quoted 9 lines
reserve_fdt()is called afterreserve_global_data()where we have:gd->start_addr_sp-=sizeof(gd_t).A typical debug output from
reserve_global_data()is:
Reserving 544 Bytes for Global Data at:bf740d98So in this case the device tree will have an alignment of 8 no matter what power of 2 (>= 8) you choose for
CONFIG_FDT_MEM_ALIGN_SIZE.
fdt_size should be aligned by 32 bytes as is written above.
Quoted 3 lines
What about other places where we allocate memory for device trees like
copy_fdt()in cmd/bootefi.?
This is interesting. You are using 0x3000 alignment.
This address is also interesting:
127 new_fdt_addr = (uintptr_t)map_sysmem(fdt_ram_start + 0x7f00000 +
128 fdt_size, 0);
Anyway. If you are happy to use 0x1000 here we can also include it. Also if you are aware about any other location which is related to this we are happy to include it.
Quoted 17 lines
Quoted 6 lines
dts/Kconfig +0
-0dts/Kconfig config DEFAULT_DEVICE_TREE · line 128
Quoted 8 lines
dts/Kconfig +5
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name> +config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory%s/is used to set the default alignment/sets the alignment/
Quoted 1 line
Please, mention if this value should be a power of 2.
And is it really necessary? I think the question is why there is 0x1000 additional space. It was added by Simon in 2013. Is this space even used for something?
I expect that you don't run fdt resize on in this space anyway.
Thanks,
Michal
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 38 lines · Michal Simek
Quoted 30 lines · Heinrich Schuchardt
Quoted 5 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Please, describe why this patch is needed.
Quoted 21 lines
Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 );Quoted 6 lines
common/board_f.c static int reserve_fdt(void) · line 553
Quoted 2 lines
common/board_f.c +0
-0gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);This change does not relate to the commit message. You are not adjusting the alignment of the device tree location. You are adjusting the size of the memory available for the device tree.
Quoted 3 lines
Let me correct that description in v2.
It is additional size for actual FDT size. I am also not sure why this is needed.
In image_setup_libfdt() additional fields are added to the device tree. There must be some space available to accommodate these. Then we pass the device tree to the operating system or bootloader which again may make changes.
In the case of UEFI booting we make a copy of the original device tree before updating and currently provide 12 KiB of headspace. This copy is needed because the UEFI binary may return to U-Boot and when we call the next binary we want to use the original device tree. The alignment of the copy is 4 KiB.
Best regards
Heinrich
Quoted 58 lines
Quoted 11 lines
reserve_fdt()is called afterreserve_global_data()where we have:gd->start_addr_sp-=sizeof(gd_t).A typical debug output from
reserve_global_data()is:
Reserving 544 Bytes for Global Data at:bf740d98So in this case the device tree will have an alignment of 8 no matter what power of 2 (>= 8) you choose for
CONFIG_FDT_MEM_ALIGN_SIZE.
fdt_sizeshould be aligned by 32 bytes as is written above.Quoted 3 lines
What about other places where we allocate memory for device trees like
copy_fdt()in cmd/bootefi.?This is interesting. You are using
0x3000alignment.This address is also interesting:
127new_fdt_addr= (uintptr_t)map_sysmem(fdt_ram_start +0x7f00000+
128fdt_size, 0);Anyway. If you are happy to use
0x1000here we can also include it. Also if you are aware about any other location which is related to this we are happy to include it.Quoted 17 lines
Quoted 6 lines
dts/Kconfig +0
-0dts/Kconfig config DEFAULT_DEVICE_TREE · line 128
Quoted 8 lines
dts/Kconfig +5
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name> +config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory%s/is used to set the default alignment/sets the alignment/
Quoted 1 line
Please, mention if this value should be a power of 2.
And is it really necessary? I think the question is why there is
0x1000additional space. It was added by Simon in 2013. Is this space even used for something?
I expect that you don't run fdt resize on in this space anyway.Thanks,
Michal
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
In reply to Michal SimekQuoted 33 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);dts/Kconfig +0
-0
dts/Kconfig config DEFAULT_DEVICE_TREE · line 129
Quoted 9 lines
dts/Kconfig +6
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name> +config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory + for fdt.
I'm not sure this is clear enough of a description. At first I thought this was about where the start address needs to be, and that is 8 bytes and non-configurable (both arm32 and arm64 require 64bit aligned). What I don't see is where the size of the overall blob needs to be aligned. We need to point at that requirement somewhere in the help so that we don't have people using bad values and then working around it without realizing the problem. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200416/de0183a3/attachment.sig>
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 38 lines · Tom Rini
Quoted 36 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);dts/Kconfig +0
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name>
Quoted 14 lines
dts/Kconfig config DEFAULT_DEVICE_TREE · line 129
Quoted 6 lines
dts/Kconfig +6
-0+config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory + for fdt.I'm not sure this is clear enough of a description. At first I thought this was about where the start address needs to be, and that is 8 bytes and non-configurable (both arm32 and arm64 require 64bit aligned). What I don't see is where the size of the overall blob needs to be aligned. We need to point at that requirement somewhere in the help so that we don't have people using bad values and then working around it without realizing the problem. Thanks!
Definitely description should be better as we agreed in second review. But the point is do we really need such a big FDT alignment here? It was added by Simon long time ago without any explanation as the part of bigger patch.
But are we allowing resizing FDT that we need additional "4k" alignment?
Thanks,
Michal
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 54 lines · Michal Simek
Quoted 38 lines · Tom Rini
Quoted 36 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);dts/Kconfig +0
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name>Quoted 14 lines
dts/Kconfig config DEFAULT_DEVICE_TREE · line 129
Quoted 6 lines
dts/Kconfig +6
-0+config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory + for fdt.I'm not sure this is clear enough of a description. At first I thought this was about where the start address needs to be, and that is 8 bytes and non-configurable (both arm32 and arm64 require 64bit aligned). What I don't see is where the size of the overall blob needs to be aligned. We need to point at that requirement somewhere in the help so that we don't have people using bad values and then working around it without realizing the problem. Thanks!
Quoted 5 lines
Definitely description should be better as we agreed in second review. But the point is do we really need such a big FDT alignment here? It was added by Simon long time ago without any explanation as the part of bigger patch.
But are we allowing resizing FDT that we need additional "4k" alignment?
So, I stumbled on an even older thread asking about this where it seems like part of the reason we do something here is so that there's room to add bootargs, etc to /chosen. The start address must be 64bit-aligned, but the size seems like it just needs to be big enough for everything we could have in it, and at this point in the code we don't know just how much that is?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200416/aab4f739/attachment.sig>
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 61 lines · Tom Rini
Quoted 54 lines · Michal Simek
Quoted 38 lines · Tom Rini
Quoted 36 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);dts/Kconfig +0
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name>Quoted 14 lines
dts/Kconfig config DEFAULT_DEVICE_TREE · line 129
Quoted 6 lines
dts/Kconfig +6
-0+config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory + for fdt.I'm not sure this is clear enough of a description. At first I thought this was about where the start address needs to be, and that is 8 bytes and non-configurable (both arm32 and arm64 require 64bit aligned). What I don't see is where the size of the overall blob needs to be aligned. We need to point at that requirement somewhere in the help so that we don't have people using bad values and then working around it without realizing the problem. Thanks!
Quoted 5 lines
Definitely description should be better as we agreed in second review. But the point is do we really need such a big FDT alignment here? It was added by Simon long time ago without any explanation as the part of bigger patch.
But are we allowing resizing FDT that we need additional "4k" alignment?
Quoted 6 lines
So, I stumbled on an even older thread asking about this where it seems like part of the reason we do something here is so that there's room to add bootargs, etc to /chosen. The start address must be 64bit-aligned, but the size seems like it just needs to be big enough for everything we could have in it, and at this point in the code we don't know just how much that is?
Adding space for DT modifications certainly makes sense. This isn't alignment though, it's just adding space.
Looking back at the original patch, there was no change to alignment of the start or end of the DT, just the ability to configure the amount of extra space added to the DT. Nothing should refer to that as alignment, since it's not.
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 69 lines · Stephen Warren
Quoted 61 lines · Tom Rini
Quoted 54 lines · Michal Simek
Quoted 38 lines · Tom Rini
Quoted 36 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);dts/Kconfig +0
-0@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name>Quoted 14 lines
dts/Kconfig config DEFAULT_DEVICE_TREE · line 129
Quoted 6 lines
dts/Kconfig +6
-0+config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory + for fdt.I'm not sure this is clear enough of a description. At first I thought this was about where the start address needs to be, and that is 8 bytes and non-configurable (both arm32 and arm64 require 64bit aligned). What I don't see is where the size of the overall blob needs to be aligned. We need to point at that requirement somewhere in the help so that we don't have people using bad values and then working around it without realizing the problem. Thanks!
Quoted 5 lines
Definitely description should be better as we agreed in second review. But the point is do we really need such a big FDT alignment here? It was added by Simon long time ago without any explanation as the part of bigger patch.
But are we allowing resizing FDT that we need additional "4k" alignment?Quoted 6 lines
So, I stumbled on an even older thread asking about this where it seems like part of the reason we do something here is so that there's room to add bootargs, etc to /chosen. The start address must be 64bit-aligned, but the size seems like it just needs to be big enough for everything we could have in it, and at this point in the code we don't know just how much that is?
Quoted 2 lines
Adding space for DT modifications certainly makes sense. This isn't alignment though, it's just adding space.
yes but 4k additional space pointed by $fdtcontroladdr.
As Heinrich pointed out UEFI is doing own copy.
I tried to run booti 80000 - $fdtcontroladdr (bootm should be the same) and DT is copied to different location anyway (based on fdt_high) which is reported by
"Loading Device Tree to 000000000fff3000, end 000000000fffffff ... OK" And on this copy image_setup_libfdt() is called.
And 4k is not enough for playing games with DT overlays anyway.
That's why my question remains. Do we use this additional 4k space in GD structure for any purpose?
Quoted 5 lines
Looking back at the original patch, there was no change to alignment of the start or end of the DT, just the ability to configure the amount of extra space added to the DT. Nothing should refer to that as alignment, since it's not.
That description will be fixed when we finish this discussion.
Thanks,
Michal
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
In reply to Michal SimekQuoted 7 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.
Quoted 7 lines
Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
+Marek since he is doing a similar thing
Quoted 36 lines
common/board_f.c +2
-1@@ -546,7 +546,8 @@ static int reserve_fdt(void)* will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); + gd->fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) + +CONFIG_FDT_MEM_ALIGN_SIZE ,32 ); gd->start_addr_sp -= gd->fdt_size; gd->new_fdt =map_sysmem (gd->start_addr_sp, gd->fdt_size);dts/Kconfig +7
-1@@ -121,6 +121,13 @@ config DEFAULT_DEVICE_TREE It can be overridden from the command line: $ make DEVICE_TREE=<device-tree-name> +config FDT_MEM_ALIGN_SIZE + hex "FDT memory alignment size" + default 0x1000 + help + This option is used to set the default alignment when reserving memory + for fdt. + config OF_LIST string "List of device tree files to include for DT control" depends on SPL_LOAD_FIT || MULTI_DTB_FIT --2.26.0
PATCH 1/1 common: Add Kconfig option for FDT mem alignment
Quoted 12 lines · Simon Glass
Quoted 11 lines · Michal Simek
From: Ashok Reddy Soma <[email protected]>
FDT memory is aligned by 4KB. This is hardcoded in
common/board_f.c. AddKconfigoption, assign default value of0x1000and enable option to change this value.Signed-off-by Ashok Reddy Soma <[email protected]>Signed-off-by Michal Simek <[email protected]>---
Quoted 5 lines
Quoted 3 lines
common/board_f.c | 3 ++- dts/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)+Marek since he is doing a similar thing
I talked to Marek and his approach is different
https://lists.denx.de/pipermail/u-boot/2020-April/406438.html
He is adding padding to DTB and based on our chat he wants to touch dtb before this space is allocated. That's why I still don't think that this 4k space is really used anywhere.
It means I am heading to v2 where DTB start address should be aligned to start at 64bit aligned address and remove this extra unused space. If someone requires to have more space it should be done by adding padding before DTB is built.
What do you think?
Thanks,
Michal