[PATCH 1/3] x86: coreboot: Update the timestamp code to use sysinfo

Rather than using a special variable, get the timestamp info from the coreboot sysinfo struct. Return a proper error as well.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/x86/cpu/coreboot/timestamp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/x86/cpu/coreboot/timestamp.c b/arch/x86/cpu/coreboot/timestamp.c index ec4003c4e77..681191d85bb 100644 --- a/arch/x86/cpu/coreboot/timestamp.c +++ b/arch/x86/cpu/coreboot/timestamp.c @@ -6,13 +6,12 @@ */
#include <bootstage.h> +#include <errno.h> #include <asm/arch/timestamp.h> #include <asm/cb_sysinfo.h> #include <asm/u-boot-x86.h> #include <linux/compiler.h>
-static struct timestamp_table *ts_table __section(".data"); - void timestamp_init(void) { timestamp_add_now(TS_U_BOOT_INITTED); @@ -20,6 +19,8 @@ void timestamp_init(void)
void timestamp_add(enum timestamp_id id, uint64_t ts_time) { + const struct sysinfo_t *info = cb_get_sysinfo(); + struct timestamp_table *ts_table = info->tstamp_table; struct timestamp_entry *tse;
if (!ts_table || (ts_table->num_entries == ts_table->max_entries)) @@ -37,13 +38,15 @@ void timestamp_add_now(enum timestamp_id id)
int timestamp_add_to_bootstage(void) { + const struct sysinfo_t *info = cb_get_sysinfo(); + const struct timestamp_table *ts_table = info->tstamp_table; uint i;
if (!ts_table) - return -1; + return -ENOENT;
for (i = 0; i < ts_table->num_entries; i++) { - struct timestamp_entry *tse = &ts_table->entries[i]; + const struct timestamp_entry *tse = &ts_table->entries[i]; const char *name = NULL;
switch (tse->entry_id) {

Receiving timestamps from coreboot was unceremoniously dropped some time ago. Add it back.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 8ad01ce36f7 ("x86: Remove x86 specific GD flags as they are...") ---
arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index d474c79e25e..7cf38f2b76c 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -82,6 +82,8 @@ static void board_final_init(void)
static int last_stage_init(void) { + timestamp_add_to_bootstage(); + if (IS_ENABLED(CONFIG_SPL_BUILD)) return 0;

Receiving timestamps from coreboot was unceremoniously dropped some time ago. Add it back.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 8ad01ce36f7 ("x86: Remove x86 specific GD flags as they are...") ---
arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!

Hi Simon,
On 2024-10-18 01:12, Simon Glass wrote:
Receiving timestamps from coreboot was unceremoniously dropped some time ago. Add it back.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 8ad01ce36f7 ("x86: Remove x86 specific GD flags as they are...")
arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!
I was under the impression that you would rework this to prepend the coreboot bootstage records instead of adding the preceding coreboot records in the middle of existing U-Boot records.
Or did I misinterpret your response [1] to my "bootstage: Do not sort records" patch [2] and you instead wanted me to do this?
[1] https://lore.kernel.org/u-boot/CAFLszTjz9dX2UzUHgbmsr2no4seK07oo2PC++hS2t7CP... [2] https://patchwork.ozlabs.org/project/uboot/patch/20240803124149.2916030-3-jo...
Regards, Jonas

Hi Jonas,
On Fri, 18 Oct 2024 at 01:44, Jonas Karlman jonas@kwiboo.se wrote:
Hi Simon,
On 2024-10-18 01:12, Simon Glass wrote:
Receiving timestamps from coreboot was unceremoniously dropped some time ago. Add it back.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 8ad01ce36f7 ("x86: Remove x86 specific GD flags as they are...")
arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!
I was under the impression that you would rework this to prepend the coreboot bootstage records instead of adding the preceding coreboot records in the middle of existing U-Boot records.
Or did I misinterpret your response [1] to my "bootstage: Do not sort records" patch [2] and you instead wanted me to do this?
I decided to worry about this later. There is a coreboot update as well in this lot of patches. Once that is applied I have some more pending patches and I will take a look at this.
I sort-of agree that sorting shouldn't be necessary...it's just that with the boot sequence getting so complicated these days, I'm not sure. But let's go with unsorted and worry about it later when we have other cases (i.e. other than a prior stage) to worry about.
Regards, Simon
[1] https://lore.kernel.org/u-boot/CAFLszTjz9dX2UzUHgbmsr2no4seK07oo2PC++hS2t7CP... [2] https://patchwork.ozlabs.org/project/uboot/patch/20240803124149.2916030-3-jo...

Hi Simon,
On 2024-10-18 16:59, Simon Glass wrote:
Hi Jonas,
On Fri, 18 Oct 2024 at 01:44, Jonas Karlman jonas@kwiboo.se wrote:
Hi Simon,
On 2024-10-18 01:12, Simon Glass wrote:
Receiving timestamps from coreboot was unceremoniously dropped some time ago. Add it back.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 8ad01ce36f7 ("x86: Remove x86 specific GD flags as they are...")
arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!
I was under the impression that you would rework this to prepend the coreboot bootstage records instead of adding the preceding coreboot records in the middle of existing U-Boot records.
Or did I misinterpret your response [1] to my "bootstage: Do not sort records" patch [2] and you instead wanted me to do this?
I decided to worry about this later. There is a coreboot update as well in this lot of patches. Once that is applied I have some more pending patches and I will take a look at this.
I sort-of agree that sorting shouldn't be necessary...it's just that with the boot sequence getting so complicated these days, I'm not sure. But let's go with unsorted and worry about it later when we have other cases (i.e. other than a prior stage) to worry about.
Does that mean you will merge my patch [2] to remove the sorting? It is currently marked as 'Changes Requested', yet there is no request to change anything. Only a request to insert the coreboot records in correct order, something that is more related to this patch in my mind.
Regards, Jonas
Regards, Simon
[1] https://lore.kernel.org/u-boot/CAFLszTjz9dX2UzUHgbmsr2no4seK07oo2PC++hS2t7CP... [2] https://patchwork.ozlabs.org/project/uboot/patch/20240803124149.2916030-3-jo...

On Fri, Oct 18, 2024 at 06:30:54PM +0200, Jonas Karlman wrote:
Hi Simon,
On 2024-10-18 16:59, Simon Glass wrote:
Hi Jonas,
On Fri, 18 Oct 2024 at 01:44, Jonas Karlman jonas@kwiboo.se wrote:
Hi Simon,
On 2024-10-18 01:12, Simon Glass wrote:
Receiving timestamps from coreboot was unceremoniously dropped some time ago. Add it back.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 8ad01ce36f7 ("x86: Remove x86 specific GD flags as they are...")
arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!
I was under the impression that you would rework this to prepend the coreboot bootstage records instead of adding the preceding coreboot records in the middle of existing U-Boot records.
Or did I misinterpret your response [1] to my "bootstage: Do not sort records" patch [2] and you instead wanted me to do this?
I decided to worry about this later. There is a coreboot update as well in this lot of patches. Once that is applied I have some more pending patches and I will take a look at this.
I sort-of agree that sorting shouldn't be necessary...it's just that with the boot sequence getting so complicated these days, I'm not sure. But let's go with unsorted and worry about it later when we have other cases (i.e. other than a prior stage) to worry about.
Does that mean you will merge my patch [2] to remove the sorting? It is currently marked as 'Changes Requested', yet there is no request to change anything. Only a request to insert the coreboot records in correct order, something that is more related to this patch in my mind.
Regards, Jonas
Regards, Simon
[1] https://lore.kernel.org/u-boot/CAFLszTjz9dX2UzUHgbmsr2no4seK07oo2PC++hS2t7CP... [2] https://patchwork.ozlabs.org/project/uboot/patch/20240803124149.2916030-3-jo...
Moving this patch back to "New" for now so it's not so easily lost, I'm sure I marked it as Changes Requested at the time based on how the thread was reading to me then.

Hi Jonas,
On Fri, 18 Oct 2024 at 10:31, Jonas Karlman jonas@kwiboo.se wrote:
Hi Simon,
On 2024-10-18 16:59, Simon Glass wrote:
Hi Jonas,
On Fri, 18 Oct 2024 at 01:44, Jonas Karlman jonas@kwiboo.se wrote:
Hi Simon,
On 2024-10-18 01:12, Simon Glass wrote:
Receiving timestamps from coreboot was unceremoniously dropped some time ago. Add it back.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 8ad01ce36f7 ("x86: Remove x86 specific GD flags as they are...")
arch/x86/cpu/coreboot/coreboot.c | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!
I was under the impression that you would rework this to prepend the coreboot bootstage records instead of adding the preceding coreboot records in the middle of existing U-Boot records.
Or did I misinterpret your response [1] to my "bootstage: Do not sort records" patch [2] and you instead wanted me to do this?
I decided to worry about this later. There is a coreboot update as well in this lot of patches. Once that is applied I have some more pending patches and I will take a look at this.
I sort-of agree that sorting shouldn't be necessary...it's just that with the boot sequence getting so complicated these days, I'm not sure. But let's go with unsorted and worry about it later when we have other cases (i.e. other than a prior stage) to worry about.
Does that mean you will merge my patch [2] to remove the sorting? It is currently marked as 'Changes Requested', yet there is no request to change anything. Only a request to insert the coreboot records in correct order, something that is more related to this patch in my mind.
OK thanks for the reminder. Yes, will do, once I sort out the current PR.
Regards, Simon
Regards, Jonas
Regards, Simon
[1] https://lore.kernel.org/u-boot/CAFLszTjz9dX2UzUHgbmsr2no4seK07oo2PC++hS2t7CP... [2] https://patchwork.ozlabs.org/project/uboot/patch/20240803124149.2916030-3-jo...

Bring this information into bootstage.
Signed-off-by: Simon Glass sjg@chromium.org ---
configs/coreboot_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/coreboot_defconfig b/configs/coreboot_defconfig index 0b103efe16d..692cfd84bf5 100644 --- a/configs/coreboot_defconfig +++ b/configs/coreboot_defconfig @@ -11,6 +11,7 @@ CONFIG_SYS_MONITOR_BASE=0x01110000 CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTAGE=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro" @@ -30,6 +31,7 @@ CONFIG_CMD_USB=y CONFIG_BOOTP_BOOTFILESIZE=y CONFIG_CMD_TIME=y CONFIG_CMD_SOUND=y +CONFIG_CMD_BOOTSTAGE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_ENV_OVERWRITE=y

Bring this information into bootstage.
Signed-off-by: Simon Glass sjg@chromium.org ---
configs/coreboot_defconfig | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-dm, thanks!

Rather than using a special variable, get the timestamp info from the coreboot sysinfo struct. Return a proper error as well.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/x86/cpu/coreboot/timestamp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Applied to u-boot-dm, thanks!
participants (3)
-
Jonas Karlman
-
Simon Glass
-
Tom Rini