diff mbox series

[08/10] arm64: dts: Make sure that all DTBs are 64bit aligned for 64bit systems

Message ID d7368b5886e8899e62bbd1ceab52df7181bb196f.1629371983.git.michal.simek@xilinx.com
State Superseded
Delegated to: Michal Simek
Headers show
Series xilinx: Add support for DTB reselection | expand

Commit Message

Michal Simek Aug. 19, 2021, 11:19 a.m. UTC
DTBs for 64bit systems should be also 64bit aligned.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 arch/arm/dts/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andre Przywara Aug. 19, 2021, 4:10 p.m. UTC | #1
On 8/19/21 12:19 PM, Michal Simek wrote:

Hi Michal,

> DTBs for 64bit systems should be also 64bit aligned.

What does "align" mean here, exactly? This is about generating .dtb 
*files*, right? dtc makes sure that the internal structures are properly 
aligned, so what else should be aligned here?

> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
>   arch/arm/dts/Makefile | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 537c96bf5b35..8d4fc333ea7a 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -1,5 +1,9 @@
>   # SPDX-License-Identifier: GPL-2.0+
>   
> +ifdef CONFIG_PHYS_64BIT
> +DTC_FLAGS += -a 0x8

By looking into the dtc source this looks like to make sure the *size* 
of the DTB is 8-byte aligned, is that the intention here, or even 
useful? If it is, it should apply unconditionally, not only to 64-bit 
systems.

Cheers,
Andre

> +endif
> +
>   dtb-$(CONFIG_TARGET_SMARTWEB) += at91sam9260-smartweb.dtb
>   dtb-$(CONFIG_TARGET_TAURUS) += at91sam9g20-taurus.dtb
>   dtb-$(CONFIG_TARGET_CORVUS) += at91sam9g45-corvus.dtb
>
Michal Simek Aug. 19, 2021, 4:34 p.m. UTC | #2
Hi Andre,


On 8/19/21 6:10 PM, Andre Przywara wrote:
> On 8/19/21 12:19 PM, Michal Simek wrote:
> 
> Hi Michal,
> 
>> DTBs for 64bit systems should be also 64bit aligned.
> 
> What does "align" mean here, exactly? This is about generating .dtb
> *files*, right? dtc makes sure that the internal structures are properly
> aligned, so what else should be aligned here?
> 
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>>   arch/arm/dts/Makefile | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>> index 537c96bf5b35..8d4fc333ea7a 100644
>> --- a/arch/arm/dts/Makefile
>> +++ b/arch/arm/dts/Makefile
>> @@ -1,5 +1,9 @@
>>   # SPDX-License-Identifier: GPL-2.0+
>>   +ifdef CONFIG_PHYS_64BIT
>> +DTC_FLAGS += -a 0x8
> 
> By looking into the dtc source this looks like to make sure the *size*
> of the DTB is 8-byte aligned, is that the intention here, or even
> useful? If it is, it should apply unconditionally, not only to 64-bit
> systems.

The question is correct. I did it mostly for being safe that DTBs start
and end is 64bit aligned. I didn't hit any issue with not aligned end
and maybe it is not useful to do it. It was just more convenient for me
to work with also 64bit aligned image size.


Thanks,
Michal
diff mbox series

Patch

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 537c96bf5b35..8d4fc333ea7a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1,5 +1,9 @@ 
 # SPDX-License-Identifier: GPL-2.0+
 
+ifdef CONFIG_PHYS_64BIT
+DTC_FLAGS += -a 0x8
+endif
+
 dtb-$(CONFIG_TARGET_SMARTWEB) += at91sam9260-smartweb.dtb
 dtb-$(CONFIG_TARGET_TAURUS) += at91sam9g20-taurus.dtb
 dtb-$(CONFIG_TARGET_CORVUS) += at91sam9g45-corvus.dtb