diff mbox

[U-Boot,v2,2/5] Align global_data to a 16-byte boundary

Message ID 1439261072-1341-3-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Aug. 11, 2015, 2:44 a.m. UTC
Some archs like to have larger alignment for their global data. Use 16 bytes
which suits all current archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Correct logic to round down instead of up

 common/board_f.c                  | 1 +
 include/asm-generic/global_data.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Bin Meng Aug. 11, 2015, 6:28 a.m. UTC | #1
On Tue, Aug 11, 2015 at 10:44 AM, Simon Glass <sjg@chromium.org> wrote:
> Some archs like to have larger alignment for their global data. Use 16 bytes
> which suits all current archs.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Correct logic to round down instead of up
>
>  common/board_f.c                  | 1 +
>  include/asm-generic/global_data.h | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/common/board_f.c b/common/board_f.c
> index 8cca4de..74f77f1 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -499,6 +499,7 @@ static int setup_machine(void)
>  static int reserve_global_data(void)
>  {
>         gd->start_addr_sp -= sizeof(gd_t);
> +       gd->start_addr_sp &= ~0xf;
>         gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
>         debug("Reserving %zu Bytes for Global Data at: %08lx\n",
>                         sizeof(gd_t), gd->start_addr_sp);
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index 2155265..147f646 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -99,7 +99,7 @@ typedef struct global_data {
>         int pcidelay_done;
>  #endif
>         struct udevice *cur_serial_dev; /* current serial device */
> -       struct arch_global_data arch;   /* architecture-specific data */
> +       struct arch_global_data arch __aligned(16);     /* arch-specific data */
>  } gd_t;
>  #endif
>
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Aug. 12, 2015, 3:55 a.m. UTC | #2
On 11 August 2015 at 00:28, Bin Meng <bmeng.cn@gmail.com> wrote:
> On Tue, Aug 11, 2015 at 10:44 AM, Simon Glass <sjg@chromium.org> wrote:
>> Some archs like to have larger alignment for their global data. Use 16 bytes
>> which suits all current archs.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>> Changes in v2:
>> - Correct logic to round down instead of up
>>
>>  common/board_f.c                  | 1 +
>>  include/asm-generic/global_data.h | 2 +-
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/board_f.c b/common/board_f.c
>> index 8cca4de..74f77f1 100644
>> --- a/common/board_f.c
>> +++ b/common/board_f.c
>> @@ -499,6 +499,7 @@ static int setup_machine(void)
>>  static int reserve_global_data(void)
>>  {
>>         gd->start_addr_sp -= sizeof(gd_t);
>> +       gd->start_addr_sp &= ~0xf;
>>         gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
>>         debug("Reserving %zu Bytes for Global Data at: %08lx\n",
>>                         sizeof(gd_t), gd->start_addr_sp);
>> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
>> index 2155265..147f646 100644
>> --- a/include/asm-generic/global_data.h
>> +++ b/include/asm-generic/global_data.h
>> @@ -99,7 +99,7 @@ typedef struct global_data {
>>         int pcidelay_done;
>>  #endif
>>         struct udevice *cur_serial_dev; /* current serial device */
>> -       struct arch_global_data arch;   /* architecture-specific data */
>> +       struct arch_global_data arch __aligned(16);     /* arch-specific data */
>>  } gd_t;
>>  #endif
>>
>> --
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot-x86
diff mbox

Patch

diff --git a/common/board_f.c b/common/board_f.c
index 8cca4de..74f77f1 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -499,6 +499,7 @@  static int setup_machine(void)
 static int reserve_global_data(void)
 {
 	gd->start_addr_sp -= sizeof(gd_t);
+	gd->start_addr_sp &= ~0xf;
 	gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
 	debug("Reserving %zu Bytes for Global Data at: %08lx\n",
 			sizeof(gd_t), gd->start_addr_sp);
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 2155265..147f646 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -99,7 +99,7 @@  typedef struct global_data {
 	int pcidelay_done;
 #endif
 	struct udevice *cur_serial_dev;	/* current serial device */
-	struct arch_global_data arch;	/* architecture-specific data */
+	struct arch_global_data arch __aligned(16);	/* arch-specific data */
 } gd_t;
 #endif