[PATCH v2 3/3] timer: riscv_aclint_timer: add timer_get_boot_us for BOOTSTAGE

Chanho Park chanho61.park at samsung.com
Tue Sep 5 07:02:19 CEST 2023


Hi Simon,

> -----Original Message-----
> From: Simon Glass <sjg at chromium.org>
> Sent: Tuesday, September 5, 2023 1:49 AM
> To: Chanho Park <chanho61.park at samsung.com>
> Cc: Rick Chen <rick at andestech.com>; Leo <ycliang at andestech.com>; u-
> boot at lists.denx.de
> Subject: Re: [PATCH v2 3/3] timer: riscv_aclint_timer: add
> timer_get_boot_us for BOOTSTAGE
> 
> Hi Chanho,
> 
> On Mon, 28 Aug 2023 at 03:50, Chanho Park <chanho61.park at samsung.com>
> wrote:
> >
> > timer_get_boot_us function is required to record the boot stages as
> > us-based timestamp.
> >
> > Signed-off-by: Chanho Park <chanho61.park at samsung.com>
> > ---
> >  drivers/timer/riscv_aclint_timer.c | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/drivers/timer/riscv_aclint_timer.c
> b/drivers/timer/riscv_aclint_timer.c
> > index e29d527c8d77..8b67745bb4a2 100644
> > --- a/drivers/timer/riscv_aclint_timer.c
> > +++ b/drivers/timer/riscv_aclint_timer.c
> > @@ -6,6 +6,7 @@
> >
> >  #include <common.h>
> >  #include <clk.h>
> > +#include <div64.h>
> >  #include <dm.h>
> >  #include <timer.h>
> >  #include <asm/io.h>
> > @@ -44,6 +45,27 @@ u64 notrace timer_early_get_count(void)
> >  }
> >  #endif
> >
> > +#if CONFIG_IS_ENABLED(RISCV_MMODE) && CONFIG_IS_ENABLED(BOOTSTAGE)
> 
> Just a nit...you should not need this #if, since if the function is
> not used it will be stripped from the image by the linker.

Thank you for the suggestion.
Without these guards, compile error can be occurred due to multiple timer_get_boot_us definitions.
For risc-v, there are two timers for S-mode and M-mode, respectively.
So, I put them to avoid below build errors.

riscv64-unknown-linux-gnu-ld.bfd: drivers/timer/riscv_aclint_timer.o: in function `timer_get_boot_us':

/data/risc-v/qemu/u-boot/drivers/timer/riscv_aclint_timer.c:49: multiple definition of `timer_get_boot_us'; drivers/timer/riscv_timer.o:/data/risc-v/qemu/u-boot/drivers/timer/riscv_timer.c:55: first defined here

make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1

Best Regards,
Chanho Park



More information about the U-Boot mailing list