Skip to contentSkip to conversation

arm/bootstage: Move the bootstage call after gd init

PATCH New Vikram Narayanan 3 participants 5 messages Dec 23, 2012 – Dec 27, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/bootstage: Move the bootstage call after gd init

bootstage_mark_name calls timer_get_boot_us which inturn calls the arch timer. The arch timer uses the gd pointer to save the lastinc count. A call to bootstage_mark_name here results in a data abort as gd is uninitialized.

Cc Simon Glass <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Albert Aribaud <[email protected]>

---
Though it is true that there are currently no users for this feature, it isn't good to see an abort when someone tries to use BOOTSTAGE. I was bugged by this error when trying to use this feature on i.Mx6Q based board.

 arch/arm/lib/board.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/lib/board.c +2 -2
index e0cb635..2f09ab9 100644
@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)
 	void *new_fdt = NULL;
 	size_t fdt_size = 0;
 
-	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
-
 	/* Pointer is writable since we allocated a register for it */
 	gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
 	/* compiler optimization barrier needed for GCC >= 3.4 */
 	__asm__ __volatile__("": : :"memory");
 
+	bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
+
 	memset((void *)gd, 0, sizeof(gd_t));
 
 	gd->mon_len = _bss_end_ofs;
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 arm/bootstage: Move the bootstage call after gd init

Hi Vikram,

Quoted 9 lines · Vikram Narayanan

bootstage_mark_name calls timer_get_boot_us which inturn calls the arch timer. The arch timer uses the gd pointer to save the lastinc count. A call to bootstage_mark_name here results in a data abort as gd is uninitialized.

Cc Simon Glass <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Albert Aribaud <[email protected]>

This bug will affect boards which don't have their own timer_get_boot_us() function.

Albert, I think we should try to get this in as a bug fix in the upcoming release.

Thanks for the fix Vikram.

Quoted 30 lines

---
Though it is true that there are currently no users for this feature, it isn't good to see an abort when someone tries to use BOOTSTAGE. I was bugged by this error when trying to use this feature on i.Mx6Q based board.

 arch/arm/lib/board.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/lib/board.c +2 -3
index e0cb635..2f09ab9 100644
@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)
        void *new_fdt = NULL;
        size_t fdt_size = 0;
 
-       bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
-
        /* Pointer is writable since we allocated a register for it */
        gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
        /* compiler optimization barrier needed for GCC >= 3.4 */
        __asm__ __volatile__("": : :"memory");
 
+       bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
+
        memset((void *)gd, 0, sizeof(gd_t));
 
        gd->mon_len = _bss_end_ofs;
--
Quoted 2 lines

1.7.4.1

Regards,
Simon

#2 lore raw

PATCH 1/1 arm/bootstage: Move the bootstage call after gd init

Hi Simon,

Quoted 15 lines · Simon Glass

Hi Vikram,

Quoted 9 lines · Vikram Narayanan

bootstage_mark_name calls timer_get_boot_us which inturn calls the arch timer. The arch timer uses the gd pointer to save the lastinc count. A call to bootstage_mark_name here results in a data abort as gd is uninitialized.

Cc Simon Glass <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Albert Aribaud <[email protected]>
Quoted 7 lines

This bug will affect boards which don't have their own timer_get_boot_us() function.

Albert, I think we should try to get this in as a bug fix in the upcoming release.

Thanks for the fix Vikram.

Thanks Vikram and Simon; I'll pull this in today.

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH 1/1 arm/bootstage: Move the bootstage call after gd init

Quoted 22 lines · Albert ARIBAUD

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Vikram,

Quoted 9 lines · Vikram Narayanan

bootstage_mark_name calls timer_get_boot_us which inturn calls the arch timer. The arch timer uses the gd pointer to save the lastinc count. A call to bootstage_mark_name here results in a data abort as gd is uninitialized.

Cc Simon Glass <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Albert Aribaud <[email protected]>

This bug will affect boards which don't have their own timer_get_boot_us() function.

Quoted 6 lines
Quoted 4 lines

Albert, I think we should try to get this in as a bug fix in the upcoming release.

Thanks for the fix Vikram.

Thanks Vikram and Simon; I'll pull this in today.

... actually, this will depend on whether my crt0 change gets in for 2013.01, as with this change, gd is already initialized when entering board_init_f().

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 1/1 arm/bootstage: Move the bootstage call after gd init

Quoted 27 lines · Albert ARIBAUD
Quoted 25 lines · Albert ARIBAUD

Hi Simon,

Quoted 21 lines · Simon Glass

Hi Vikram,

Quoted 9 lines · Vikram Narayanan

bootstage_mark_name calls timer_get_boot_us which inturn calls the arch timer. The arch timer uses the gd pointer to save the lastinc count. A call to bootstage_mark_name here results in a data abort as gd is uninitialized.

Cc Simon Glass <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Albert Aribaud <[email protected]>

This bug will affect boards which don't have their own timer_get_boot_us() function.

Albert, I think we should try to get this in as a bug fix in the upcoming release.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Thanks for the fix Vikram.

Thanks Vikram and Simon; I'll pull this in today.

... actually, this will depend on whether my crt0 change gets in for 2013.01, as with this change, gd is already initialized when entering board_init_f().

Yes. You are right. If your patch goes in, my patch need not be applied.

Regards,
Vikram