[PATCH 3/3] efi_loader: Move device-removal later in exit-boot-services

Simon Glass sjg at chromium.org
Mon Apr 7 03:06:36 CEST 2025


Hi Heinrich,

On Sun, 6 Apr 2025 at 10:30, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> Am 6. April 2025 00:12:47 MESZ schrieb Simon Glass <sjg at chromium.org>:
> >This removal should be the last thing done, so that U-Boot does no more
> >memory allocations afterwards. Move it and add a comment.
> >
> >Note that the TCG2 log is updated after this call, but I cannot see any
> >allocations there.
> >
> >Reported-by: Christian Kohlschütter <christian at kohlschutter.com>
>
> This commit message fails to describe which problem has been observed and you try to solve.
>
> A link to the original communication would be helpful.

OK I'll add those.

>
> Furthermore, please, rebase it on my patch adding eth_halt().
> <https://lore.kernel.org/u-boot/CAFLszTgp38yBXnSigfT-mEFU=rqyAKjp0WBQGgHP_N3vRxCq=Q@mail.gmail.com/T/#m1e55cc094f575797da3b4aed6b369544f8d6f8f4>

I see that has been applied to -master but I would like to target my
series for -next

I would rather that we fix the drivers that add your work-around, but
doing both is OK too.

Regards,
Simon

>
> Best regards
>
> Heinrich
>
> >
> >Signed-off-by: Simon Glass <sjg at chromium.org>
> >---
> >
> > lib/efi_loader/efi_boottime.c | 21 +++++++++++++--------
> > 1 file changed, 13 insertions(+), 8 deletions(-)
> >
> >diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> >index ffe43accd1e..e525662f82f 100644
> >--- a/lib/efi_loader/efi_boottime.c
> >+++ b/lib/efi_loader/efi_boottime.c
> >@@ -2250,14 +2250,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
> >                       list_del(&evt->link);
> >       }
> >
> >-      if (!efi_st_keep_devices) {
> >-              bootm_disable_interrupts();
> >-              if (IS_ENABLED(CONFIG_USB_DEVICE))
> >-                      udc_disconnect();
> >-              board_quiesce_devices();
> >-              dm_remove_devices_active();
> >-      }
> >-
> >       /* Patch out unsupported runtime function */
> >       efi_runtime_detach();
> >
> >@@ -2279,6 +2271,19 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
> >       /* Give the payload some time to boot */
> >       efi_set_watchdog(0);
> >       schedule();
> >+
> >+      /*
> >+       * this should be the last thing done, to avoid memory allocations
> >+       * between removing devices and the OS taking over
> >+       */
> >+      if (!efi_st_keep_devices) {
> >+              bootm_disable_interrupts();
> >+              if (IS_ENABLED(CONFIG_USB_DEVICE))
> >+                      udc_disconnect();
> >+              board_quiesce_devices();
> >+              dm_remove_devices_active();
> >+      }
> >+
> > out:
> >       if (IS_ENABLED(CONFIG_EFI_TCG2_PROTOCOL)) {
> >               if (ret != EFI_SUCCESS)
>


More information about the U-Boot mailing list