Hi Felix, On 2026-10-30T14:38:40+11:00, Felix Moessbauer <[email protected]> wrote: > efi_loader: implement EFI_TIMESTAMP_PROTOCOL > > EFI applications such as boot loaders (e.g systemd-boot, efibootguard) > measure the time spent inside the bootloader prior to loading the next > stage. These values are then forwarded via efi variables to systemd, > which exposes them via systemd-analyze. This helps to identify where in > the boot chain delays are happening. > > Without having the protocol, bootloaders have to fall back to direct > reads of the time counters, which are architecture specific. To unify > this, we implement the EFI_TIMESTAMP_PROTOCOL inside the efi provider, > resulting in an architecture independent interface.
Please can you use the imperative here, e.g. 'Implement EFI_TIMESTAMP_PROTOCOL in the EFI loader so that applications have an architecture-independent interface'. I'm not sure what 'efi provider' refers to. > As the implementation of the protocol is tiny, we default enable it. If > this is not desired, set EFI_TIMESTAMP_PROTOCOL=n. This should be CONFIG_EFI_TIMESTAMP_PROTOCOL=n > > As the implementation of the protocol is tiny, we default enable it. If > this is not desired, set EFI_TIMESTAMP_PROTOCOL=n. > > Signed-off-by: Felix Moessbauer <[email protected]> > > include/efi_api.h | 4 +++ > include/efi_loader.h | 4 +++ > include/efi_timestamp.h | 35 +++++++++++++++++++ > lib/efi_loader/Kconfig | 8 +++++ > lib/efi_loader/Makefile | 1 + > lib/efi_loader/efi_setup.c | 7 ++++ > lib/efi_loader/efi_timestamp.c | 79 > ++++++++++++++++++++++++++++++++++++++++++ > lib/uuid.c | 4 +++ > 8 files changed, 142 insertions(+) > diff --git a/lib/efi_loader/efi_timestamp.c b/lib/efi_loader/efi_timestamp.c > @@ -0,0 +1,79 @@ > + properties->frequency = get_tbclk(); > + /* get_ticks() extends narrower hardware counters to 64 bits */ > + properties->end_value = U64_MAX; Just to check: get_ticks() only extends a 32-bit counter correctly if it is called at least once per wrap, because the weak version in lib/time.c and timer_conv_64() both compare against the last value they saw. Once an EFI app is in control, U-Boot only reads the timer when the app calls into it. With a 32-bit counter at 24MHz a wrap takes about three minutes, so an app that reads a timestamp, waits at a menu with no boot-service calls, then reads another, could miss a wrap and report a wrong delta to systemd. I suggest mentioning that in your doc patch. Regards, Simon
