Skip to contentSkip to conversation

bootm: Clean up arch-specific, pre-OS clean-up

PATCH Superseded Simon Glass 6 participants 40 messages Jan 7 – Jan 12

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover bootm: Clean up arch-specific, pre-OS clean-up

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

EFT_LOADER has its own special code, regardless of which arch is being booted.

It is quite hard to know what actually happens in the final milliseconds before the OS boot.

This series attempts to clean up U-Boot in this area.

The basic approach is to create a new bootm_final() function which is called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic.

RISC-V, x86 and ARM are converted over to use this new function. For consistency, EFI loader is converted as well.

A noteable change is that EFI_LOADER now does bootstage processing before boot, if enabled, thus producing a report.

There is also a patch to drop EFI_GRUB_ARM32_WORKAROUND, as discussed recently on the mailing list.

Future work could take this a little further:
- Drop board_quiesce_devices() and rely on driver model for that
- Similarly with udc_disconnect()
- cleanup_before_linux() could use more details as to what it is supposed to do, to reduce the number of arch-specific variations

Note: This is the first 10 patches for an 18-part series from the Concept tree, as requested. The patches after that complete the cleanup on ARM and RISC-V.

Simon Glass (10):
boot: Create a function for final pre-boot steps
efi: Make use of bootm_final()
bootm: Add a message when booting
bootstage: Add some missing dummy functions
bootm: Do bootstage processing in bootm_final()
x86: Call bootm_final()
riscv: Drop board_quiesce_devices()
riscv: Call bootm_final()
efi: Drop EFI_GRUB_ARM32_WORKAROUND
x86: Add cleanup_before_linux()

 MAINTAINERS                           |  1 +
 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 24 +------------------
 arch/x86/cpu/cpu.c                    |  5 ++++
 arch/x86/lib/bootm.c                  | 14 +----------
 boot/Makefile                         |  2 +-
 boot/bootm_final.c                    | 34 +++++++++++++++++++++++++++
 configs/mt7623n_bpir2_defconfig       |  1 -
 include/bootm.h                       | 17 ++++++++++++++
 include/bootstage.h                   |  8 +++++++
 lib/efi_loader/Kconfig                | 10 --------
 lib/efi_loader/efi_boottime.c         | 30 +----------------------
 test/boot/bootflow.c                  |  2 +-
 13 files changed, 70 insertions(+), 79 deletions(-)
 create mode 100644 boot/bootm_final.c
Signature · 4 lines
2.43.0

base-commit: 6cdd7597a2fbfc1572c1b0af23d3daf1cefa2de7
branch: bootma-us
#1 lore raw

PATCH 1/10 boot: Create a function for final pre-boot steps

From: Simon Glass <[email protected]>

There are various functions which announce that booting is imminent and do related preparation. Most of these are arch-specific.

In practice, most archs do the a similar thing. It would be better to have a common function, with perhaps some events for things that are really arch- and board-specific.

Create a new function for this. For now, nothing uses it. Be careful to avoid using BIT() macros which are not available with host tools.

---

 MAINTAINERS        |  1 +
 boot/Makefile      |  2 +-
 boot/bootm_final.c | 12 ++++++++++++
 include/bootm.h    | 17 +++++++++++++++++
 4 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 boot/bootm_final.c
MAINTAINERS +1 -0
index 27ce73d83f4..f0bd2562f77 100644
@@ -981,6 +981,7 @@ M:	Simon Glass <[email protected]>
 S:	Maintained
 F:	boot/bootdev*.c
 F:	boot/bootflow.c
+F:	boot/bootm_final.c
 F:	boot/bootmeth*.c
 F:	boot/bootstd.c
 F:	cmd/bootdev.c
boot/Makefile +1 -1
index 7fb56e7ef37..12477fabe28 100644
@@ -15,7 +15,7 @@ obj-$(CONFIG_PXE_UTILS) += pxe_utils.o
 
 endif
 
-obj-y += image.o image-board.o
+obj-y += image.o image-board.o bootm_final.o
 
 obj-$(CONFIG_ANDROID_AB) += android_ab.o
 obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o
boot/bootm_final.c new file +12 -0
new file mode 100644
index 00000000000..15ddbbe5e74
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Cleanup before handing off to the OS
+ *
+ * Copyright 2025 Simon Glass <[email protected]>
+ */
+
+#include <bootm.h>
+
+void bootm_final(enum bootm_final_t flags)
+{
+}
include/bootm.h +17 -0
index 4060cec7fc0..32711eabb2e 100644
@@ -16,6 +16,16 @@ struct cmd_tbl;
 #define BOOTM_ERR_OVERLAP		(-2)
 #define BOOTM_ERR_UNIMPLEMENTED	(-3)
 
+/**
+ * enum bootm_final_t - flags to control bootm_final()
+ *
+ * @BOOTM_FINAL_FAKE: true to do everything except actually boot; it then
+ *	returns to the caller
+ */
+enum bootm_final_t {
+	BOOTM_FINAL_FAKE	= 1 << 0,
+};
+
 /**
  * struct bootm_info() - information used when processing images to boot
  *
@@ -321,4 +331,11 @@ void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
  */
 int bootm_boot_start(ulong addr, const char *cmdline);
 
+/**
+ * bootm_final() - Announce and do cleanup before boot
+ *
+ * @flags: Flags to control what this function does
+ */
+void bootm_final(enum bootm_final_t flags);
+
 #endif
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/10 efi: Make use of bootm_final()

In reply to Simon Glass

From: Simon Glass <[email protected]>

Call this function from the EFI code. Add the required call to dm_remove_devices_active() there.

---

 boot/bootm_final.c            | 2 ++
 lib/efi_loader/efi_boottime.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
boot/bootm_final.c +2 -0
index 15ddbbe5e74..263cd95dcb3 100644
@@ -6,7 +6,9 @@
  */
 
 #include <bootm.h>
+#include <dm/root.h>
 
 void bootm_final(enum bootm_final_t flags)
 {
+	dm_remove_devices_active();
 }
lib/efi_loader/efi_boottime.c +1 -1
index ddc935d2240..13d0d4dbe88 100644
@@ -2241,7 +2241,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 		if (IS_ENABLED(CONFIG_DM_ETH))
 			eth_halt();
 		board_quiesce_devices();
-		dm_remove_devices_active();
+		bootm_final(0);
 	}
 
 	/* Patch out unsupported runtime function */
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/10 bootm: Add a message when booting

In reply to Simon Glass

From: Simon Glass <[email protected]>

Add a message about starting the kernel. For EFI this will be printed when boot-services are exited.

---

 boot/bootm_final.c | 2 ++
 1 file changed, 2 insertions(+)
boot/bootm_final.c +2 -0
index 263cd95dcb3..71661334e11 100644
@@ -10,5 +10,7 @@
 
 void bootm_final(enum bootm_final_t flags)
 {
+	printf("\nStarting kernel ...\n\n");
+
 	dm_remove_devices_active();
 }
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/10 bootstage: Add some missing dummy functions

In reply to Simon Glass

From: Simon Glass <[email protected]>

Neither bootstage_fdt_add_report() nor bootstage_report() has a dummy double for when bootstage is disabled. Add them.

---

 include/bootstage.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/bootstage.h +8 -0
index 528d0ca0614..62fb99110f0 100644
@@ -435,6 +435,14 @@ static inline uint32_t bootstage_accum(enum bootstage_id id)
 	return 0;
 }
 
+static inline void bootstage_report(void)
+{
+}
+
+static inline void bootstage_fdt_add_report(void)
+{
+}
+
 static inline int bootstage_stash(void *base, int size)
 {
 	return 0;	/* Pretend to succeed */
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/10 bootm: Do bootstage processing in bootm_final()

In reply to Simon Glass

From: Simon Glass <[email protected]>

Mark kernel start before booting. If enabled, show a bootstage report.

---

 boot/bootm_final.c   | 6 ++++++
 test/boot/bootflow.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
boot/bootm_final.c +6 -0
index 71661334e11..dd7cac55f1e 100644
@@ -6,11 +6,17 @@
  */
 
 #include <bootm.h>
+#include <bootstage.h>
 #include <dm/root.h>
 
 void bootm_final(enum bootm_final_t flags)
 {
 	printf("\nStarting kernel ...\n\n");
 
+	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+	if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
+		bootstage_report();
+
 	dm_remove_devices_active();
 }
test/boot/bootflow.c +1 -1
index a56435d053f..80adc074070 100644
@@ -1381,7 +1381,7 @@ static int bootflow_efi(struct unit_test_state *uts)
 
 	/* TODO: Why the \r ? */
 	ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
-	ut_assert_nextline("Exiting test app");
+	ut_assert_skip_to_line("Exiting test app");
 	ut_assert_nextline("Boot failed (err=-14)");
 
 	ut_assert_console_end();
Signature · 1 line
2.43.0
#6 lore raw

Re: [PATCH 05/10] bootm: Do bootstage processing in bootm_final()

Am 7. Januar 2026 01:31:22 MEZ schrieb Simon Glass <[email protected]>:

Quoted 17 lines

From: Simon Glass <[email protected]>

Mark kernel start before booting. If enabled, show a bootstage report.

---

boot/bootm_final.c | 6 ++++++
test/boot/bootflow.c | 2 +-

2 files changed, 7 insertions(+), 1 deletion(-)
boot/bootm_final.c +0 -0
index 71661334e11..dd7cac55f1e 100644

boot/bootm_final.c line 14

Quoted 9 lines
boot/bootm_final.c +1 -0
@@ -6,11 +6,17 @@
 */
 
 #include <bootm.h>
+#include <bootstage.h>
 #include <dm/root.h>
 
 void bootm_final(enum bootm_final_t flags)
 {
 	printf("\nStarting kernel ...\n\n");

This noisy message makes no sense for EFI booting. The kernel in not started in ExitBootServices().

Operating systems like Ubuntu tend to boot the kernel with argument "quiet" for aesthetic reasons. We should not disrupt this.

Best regards

Heinrich

Quoted 21 lines
boot/bootm_final.c +5 -0
+	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+	if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
+		bootstage_report();
+
 	dm_remove_devices_active();
 }
test/boot/bootflow.c +1 -1
index a56435d053f..80adc074070 100644
@@ -1381,7 +1381,7 @@ static int bootflow_efi(struct unit_test_state *uts)
 
 	/* TODO: Why the \r ? */
 	ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
-	ut_assert_nextline("Exiting test app");
+	ut_assert_skip_to_line("Exiting test app");
 	ut_assert_nextline("Boot failed (err=-14)");
 
 	ut_assert_console_end();
#7 lore raw

Re: [PATCH 05/10] bootm: Do bootstage processing in bootm_final()

Hi Heinrich,

Quoted 25 lines · Heinrich Schuchardt

Am 7. Januar 2026 01:31:22 MEZ schrieb Simon Glass <[email protected]>:

Quoted 23 lines

From: Simon Glass <[email protected]>

Mark kernel start before booting. If enabled, show a bootstage report.

---

boot/bootm_final.c | 6 ++++++
test/boot/bootflow.c | 2 +-

2 files changed, 7 insertions(+), 1 deletion(-)
boot/bootm_final.c +1 -0
index 71661334e11..dd7cac55f1e 100644
@@ -6,11 +6,17 @@
 */
 
 #include <bootm.h>
+#include <bootstage.h>
 #include <dm/root.h>
 
Quoted 5 lines

boot/bootm_final.c line 14

Quoted 3 lines
boot/bootm_final.c +0 -0
 void bootm_final(enum bootm_final_t flags)
 {
      printf("\nStarting kernel ...\n\n");

This noisy message makes no sense for EFI booting. The kernel in not started in ExitBootServices().

Can you explain that a bit more? I believe that's exactly when the kernel starts.

Quoted 2 lines

Operating systems like Ubuntu tend to boot the kernel with argument "quiet" for aesthetic reasons. We should not disrupt this.

When I boot (with this patch) I see these messages on the serial console:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Scanning for bootflows in all bootdevs

Seq  Method       State   Uclass    Part  E  Name                      Filename
---  -----------  ------  --------  ----  -  ------------------------

----------------
Scanning global bootmeth 'efi_mgr':
0 efi_mgr ready (none) 0 <NULL>
** Booting bootflow '<NULL>' with efi_mgr
try_load_entry() Booting: Label: Ubuntu Device path:
/HD(1,GPT,eccaac1c-b634-441b-a788-ab0f959111af,0x800,0x165800)/\EFI\ubuntu\shimx64.efi

Starting kernel ...
<<<

So it is not silent today. The last line is the new one. Every other boot method writes this line.

However, the video display is silent once grub has finished and I just noticed that this patch draws some pixels on the display, as if the EFI display is set to a different mode from what U-Boot expects. I suppose this is understandable, as grub has run by then and has probably changed the mode.

So I wonder what would be best here. We don't support dynamic video sizing right now and I don't feel the urge to implement it just for this. Perhaps with EFI we could disable the vidconsole when exit-boot-services is called, on the basis that we cannot deal with whatever has happened to the display in the interim?

Regards,
Simon

Quoted 19 lines

Best regards

Heinrich

Quoted 14 lines
boot/bootm_final.c +5 -0
+      bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+      if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
+              bootstage_report();
+
      dm_remove_devices_active();

}

test/boot/bootflow.c +0 -0
index a56435d053f..80adc074070 100644
@@ -1381,7 +1381,7 @@ static int bootflow_efi(struct unit_test_state *uts)
 
Quoted 8 lines

test/boot/bootflow.c static int bootflow_efi(struct unit_test_state *uts) · line 1387

Quoted 7 lines
test/boot/bootflow.c +1 -1
      /* TODO: Why the \r ? */
      ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
-      ut_assert_nextline("Exiting test app");
+      ut_assert_skip_to_line("Exiting test app");
      ut_assert_nextline("Boot failed (err=-14)");
 
      ut_assert_console_end();

Regards,
Simon

#8 lore raw

Re: [PATCH 05/10] bootm: Do bootstage processing in bootm_final()

Am 7. Januar 2026 20:02:39 MEZ schrieb Simon Glass <[email protected]>:

Quoted 43 lines

Hi Heinrich,

Quoted 25 lines · Heinrich Schuchardt

Am 7. Januar 2026 01:31:22 MEZ schrieb Simon Glass <[email protected]>:

Quoted 23 lines

From: Simon Glass <[email protected]>

Mark kernel start before booting. If enabled, show a bootstage report.

---

boot/bootm_final.c | 6 ++++++
test/boot/bootflow.c | 2 +-

2 files changed, 7 insertions(+), 1 deletion(-)
boot/bootm_final.c +1 -0
index 71661334e11..dd7cac55f1e 100644
@@ -6,11 +6,17 @@
 */
 
 #include <bootm.h>
+#include <bootstage.h>
 #include <dm/root.h>
 
Quoted 5 lines

boot/bootm_final.c line 14

Quoted 3 lines
boot/bootm_final.c +0 -0
 void bootm_final(enum bootm_final_t flags)
 {
      printf("\nStarting kernel ...\n\n");

This noisy message makes no sense for EFI booting. The kernel in not started in ExitBootServices().

Can you explain that a bit more? I believe that's exactly when the kernel starts.

Quoted 2 lines

Operating systems like Ubuntu tend to boot the kernel with argument "quiet" for aesthetic reasons. We should not disrupt this.

When I boot (with this patch) I see these messages on the serial console:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Scanning for bootflows in all bootdevs

Quoted 8 lines
Seq  Method       State   Uclass    Part  E  Name                      Filename
---  -----------  ------  --------  ----  -  ------------------------

----------------
Scanning global bootmeth 'efi_mgr':
0 efi_mgr ready (none) 0 <NULL>
** Booting bootflow '<NULL>' with efi_mgr
try_load_entry() Booting: Label: Ubuntu Device path:
/HD(1,GPT,eccaac1c-b634-441b-a788-ab0f959111af,0x800,0x165800)/\EFI\ubuntu\shimx64.efi

Here GRUB is running. If you don't see output, then because purposefully it has been quieted.

Quoted 2 lines

Starting kernel ...

ExitBootServices is called in the middle of the Linux kernel EFI stub and not when entering the kernel.

Best regards

Heinrich

Quoted 50 lines

<<<

So it is not silent today. The last line is the new one. Every other boot method writes this line.

However, the video display is silent once grub has finished and I just noticed that this patch draws some pixels on the display, as if the EFI display is set to a different mode from what U-Boot expects. I suppose this is understandable, as grub has run by then and has probably changed the mode.

So I wonder what would be best here. We don't support dynamic video sizing right now and I don't feel the urge to implement it just for this. Perhaps with EFI we could disable the vidconsole when exit-boot-services is called, on the basis that we cannot deal with whatever has happened to the display in the interim?

Regards,
Simon

Quoted 19 lines

Best regards

Heinrich

Quoted 14 lines
boot/bootm_final.c +5 -0
+      bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+      if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
+              bootstage_report();
+
      dm_remove_devices_active();

}

test/boot/bootflow.c +0 -0
index a56435d053f..80adc074070 100644
@@ -1381,7 +1381,7 @@ static int bootflow_efi(struct unit_test_state *uts)
 
Quoted 8 lines

test/boot/bootflow.c static int bootflow_efi(struct unit_test_state *uts) · line 1387

Quoted 7 lines
test/boot/bootflow.c +1 -1
      /* TODO: Why the \r ? */
      ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
-      ut_assert_nextline("Exiting test app");
+      ut_assert_skip_to_line("Exiting test app");
      ut_assert_nextline("Boot failed (err=-14)");
 
      ut_assert_console_end();

Regards,
Simon

#9 lore raw

Re: [PATCH 05/10] bootm: Do bootstage processing in bootm_final()

Quoted 56 lines

Date: Wed, 07 Jan 2026 20:14:05 +0100
From: Heinrich Schuchardt <[email protected]>

Am 7. Januar 2026 20:02:39 MEZ schrieb Simon Glass <[email protected]>:

Quoted 43 lines

Hi Heinrich,

Quoted 25 lines · Heinrich Schuchardt

Am 7. Januar 2026 01:31:22 MEZ schrieb Simon Glass <[email protected]>:

Quoted 23 lines

From: Simon Glass <[email protected]>

Mark kernel start before booting. If enabled, show a bootstage report.

---

boot/bootm_final.c | 6 ++++++
test/boot/bootflow.c | 2 +-

2 files changed, 7 insertions(+), 1 deletion(-)
boot/bootm_final.c +1 -0
index 71661334e11..dd7cac55f1e 100644
@@ -6,11 +6,17 @@
 */
 
 #include <bootm.h>
+#include <bootstage.h>
 #include <dm/root.h>
 
Quoted 5 lines

boot/bootm_final.c line 14

Quoted 3 lines
boot/bootm_final.c +0 -0
 void bootm_final(enum bootm_final_t flags)
 {
      printf("\nStarting kernel ...\n\n");

This noisy message makes no sense for EFI booting. The kernel in not started in ExitBootServices().

Can you explain that a bit more? I believe that's exactly when the kernel starts.

Quoted 2 lines

Operating systems like Ubuntu tend to boot the kernel with argument "quiet" for aesthetic reasons. We should not disrupt this.

When I boot (with this patch) I see these messages on the serial console:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Scanning for bootflows in all bootdevs

Quoted 8 lines
Seq  Method       State   Uclass    Part  E  Name                      Filename
---  -----------  ------  --------  ----  -  ------------------------

----------------
Scanning global bootmeth 'efi_mgr':
0 efi_mgr ready (none) 0 <NULL>
** Booting bootflow '<NULL>' with efi_mgr
try_load_entry() Booting: Label: Ubuntu Device path:
/HD(1,GPT,eccaac1c-b634-441b-a788-ab0f959111af,0x800,0x165800)/\EFI\ubuntu\shimx64.efi

Quoted 7 lines

Here GRUB is running. If you don't see output, then because purposefully it has been quieted.

Quoted 2 lines

Starting kernel ...

ExitBootServices is called in the middle of the Linux kernel EFI stub and not when entering the kernel.

Or it is called by the OS bootloader. But at that point the OS bootloader is in control of the output and U-Boot shouldn't print anything. In fact none of the EFI calls should result in U-Boot printing something (except for the EFI console output calls of course).

Quoted 52 lines
Quoted 50 lines

<<<

So it is not silent today. The last line is the new one. Every other boot method writes this line.

However, the video display is silent once grub has finished and I just noticed that this patch draws some pixels on the display, as if the EFI display is set to a different mode from what U-Boot expects. I suppose this is understandable, as grub has run by then and has probably changed the mode.

So I wonder what would be best here. We don't support dynamic video sizing right now and I don't feel the urge to implement it just for this. Perhaps with EFI we could disable the vidconsole when exit-boot-services is called, on the basis that we cannot deal with whatever has happened to the display in the interim?

Regards,
Simon

Quoted 19 lines

Best regards

Heinrich

Quoted 14 lines
boot/bootm_final.c +5 -0
+      bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+      if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
+              bootstage_report();
+
      dm_remove_devices_active();

}

test/boot/bootflow.c +0 -0
index a56435d053f..80adc074070 100644
@@ -1381,7 +1381,7 @@ static int bootflow_efi(struct unit_test_state *uts)
 
Quoted 8 lines

test/boot/bootflow.c static int bootflow_efi(struct unit_test_state *uts) · line 1387

Quoted 7 lines
test/boot/bootflow.c +1 -1
      /* TODO: Why the \r ? */
      ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
-      ut_assert_nextline("Exiting test app");
+      ut_assert_skip_to_line("Exiting test app");
      ut_assert_nextline("Boot failed (err=-14)");
 
      ut_assert_console_end();

Regards,
Simon

#10 lore raw

Re: [PATCH 05/10] bootm: Do bootstage processing in bootm_final()

In reply to Heinrich Schuchardt

Hi Heinrich,

Quoted 54 lines · Heinrich Schuchardt

Am 7. Januar 2026 20:02:39 MEZ schrieb Simon Glass <[email protected]>:

Quoted 43 lines

Hi Heinrich,

Quoted 25 lines · Heinrich Schuchardt

Am 7. Januar 2026 01:31:22 MEZ schrieb Simon Glass <[email protected]>:

Quoted 23 lines

From: Simon Glass <[email protected]>

Mark kernel start before booting. If enabled, show a bootstage report.

---

boot/bootm_final.c | 6 ++++++
test/boot/bootflow.c | 2 +-

2 files changed, 7 insertions(+), 1 deletion(-)
boot/bootm_final.c +1 -0
index 71661334e11..dd7cac55f1e 100644
@@ -6,11 +6,17 @@
 */
 
 #include <bootm.h>
+#include <bootstage.h>
 #include <dm/root.h>
 
Quoted 5 lines

boot/bootm_final.c line 14

Quoted 3 lines
boot/bootm_final.c +0 -0
 void bootm_final(enum bootm_final_t flags)
 {
      printf("\nStarting kernel ...\n\n");

This noisy message makes no sense for EFI booting. The kernel in not started in ExitBootServices().

Can you explain that a bit more? I believe that's exactly when the kernel starts.

Quoted 2 lines

Operating systems like Ubuntu tend to boot the kernel with argument "quiet" for aesthetic reasons. We should not disrupt this.

When I boot (with this patch) I see these messages on the serial console:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Scanning for bootflows in all bootdevs

Quoted 8 lines
Seq  Method       State   Uclass    Part  E  Name                      Filename
---  -----------  ------  --------  ----  -  ------------------------

----------------
Scanning global bootmeth 'efi_mgr':
0 efi_mgr ready (none) 0 <NULL>
** Booting bootflow '<NULL>' with efi_mgr
try_load_entry() Booting: Label: Ubuntu Device path:
/HD(1,GPT,eccaac1c-b634-441b-a788-ab0f959111af,0x800,0x165800)/\EFI\ubuntu\shimx64.efi

Quoted 1 line

Here GRUB is running. If you don't see output, then because purposefully it has been quieted.

OK, so there is no problem, right?

Quoted 5 lines
Quoted 3 lines

Starting kernel ...

ExitBootServices is called in the middle of the Linux kernel EFI stub and not when entering the kernel.

Oh I see. To my mind the kernel EFI stub is a bit like a bootloader tacked onto the front of Linux. Linux doesn't properly start until it has control of the machine and actually starts its init.

So we definitely want to get bootstage output (for example) covering that period, otherwise there is a significant uncounted time between the EFI app starting and Linux starting.

Regards,
Simon

Quoted 56 lines

Best regards

Heinrich

Quoted 50 lines

<<<

So it is not silent today. The last line is the new one. Every other boot method writes this line.

However, the video display is silent once grub has finished and I just noticed that this patch draws some pixels on the display, as if the EFI display is set to a different mode from what U-Boot expects. I suppose this is understandable, as grub has run by then and has probably changed the mode.

So I wonder what would be best here. We don't support dynamic video sizing right now and I don't feel the urge to implement it just for this. Perhaps with EFI we could disable the vidconsole when exit-boot-services is called, on the basis that we cannot deal with whatever has happened to the display in the interim?

Regards,
Simon

Quoted 19 lines

Best regards

Heinrich

Quoted 14 lines
boot/bootm_final.c +5 -0
+      bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+      if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
+              bootstage_report();
+
      dm_remove_devices_active();

}

test/boot/bootflow.c +0 -0
index a56435d053f..80adc074070 100644
@@ -1381,7 +1381,7 @@ static int bootflow_efi(struct unit_test_state *uts)
 
Quoted 8 lines

test/boot/bootflow.c static int bootflow_efi(struct unit_test_state *uts) · line 1387

Quoted 7 lines
test/boot/bootflow.c +1 -1
      /* TODO: Why the \r ? */
      ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
-      ut_assert_nextline("Exiting test app");
+      ut_assert_skip_to_line("Exiting test app");
      ut_assert_nextline("Boot failed (err=-14)");
 
      ut_assert_console_end();

Regards,
Simon

#11 lore raw

Re: [PATCH 05/10] bootm: Do bootstage processing in bootm_final()

Quoted 57 lines · Simon Glass

Hi Heinrich,

Quoted 54 lines · Heinrich Schuchardt

Am 7. Januar 2026 20:02:39 MEZ schrieb Simon Glass <[email protected]>:

Quoted 51 lines

Hi Heinrich,

Quoted 25 lines · Heinrich Schuchardt

Am 7. Januar 2026 01:31:22 MEZ schrieb Simon Glass <[email protected]>:

Quoted 23 lines

From: Simon Glass <[email protected]>

Mark kernel start before booting. If enabled, show a bootstage report.

---

boot/bootm_final.c | 6 ++++++
test/boot/bootflow.c | 2 +-

2 files changed, 7 insertions(+), 1 deletion(-)
boot/bootm_final.c +1 -0
index 71661334e11..dd7cac55f1e 100644
@@ -6,11 +6,17 @@
  */
 
 #include <bootm.h>
+#include <bootstage.h>
 #include <dm/root.h>
 
Quoted 5 lines

boot/bootm_final.c line 14

Quoted 3 lines
boot/bootm_final.c +0 -0
 void bootm_final(enum bootm_final_t flags)
 {
       printf("\nStarting kernel ...\n\n");

This noisy message makes no sense for EFI booting. The kernel in not started in ExitBootServices().

Can you explain that a bit more? I believe that's exactly when the kernel starts.

Quoted 2 lines

Operating systems like Ubuntu tend to boot the kernel with argument "quiet" for aesthetic reasons. We should not disrupt this.

When I boot (with this patch) I see these messages on the serial console:

Quoted 1 line
Quoted 1 line
Quoted 1 line

Scanning for bootflows in all bootdevs

Seq  Method       State   Uclass    Part  E  Name                      Filename
---  -----------  ------  --------  ----  -  ------------------------

----------------
Scanning global bootmeth 'efi_mgr':
0 efi_mgr ready (none) 0 <NULL>
** Booting bootflow '<NULL>' with efi_mgr
try_load_entry() Booting: Label: Ubuntu Device path:
/HD(1,GPT,eccaac1c-b634-441b-a788-ab0f959111af,0x800,0x165800)/\EFI\ubuntu\shimx64.efi

Quoted 3 lines
Quoted 1 line

Here GRUB is running. If you don't see output, then because purposefully it has been quieted.

OK, so there is no problem, right?

To make it clear:

Once the EFI application is started firmware like U-Boot or EDK II should not write any message to the video buffer or to the serial console.

Best regards

Heinrich

Quoted 74 lines
Quoted 6 lines
Quoted 4 lines

Starting kernel ...

ExitBootServices is called in the middle of the Linux kernel EFI stub and not when entering the kernel.

Oh I see. To my mind the kernel EFI stub is a bit like a bootloader tacked onto the front of Linux. Linux doesn't properly start until it has control of the machine and actually starts its init.

So we definitely want to get bootstage output (for example) covering that period, otherwise there is a significant uncounted time between the EFI app starting and Linux starting.

Regards,
Simon

Quoted 56 lines

Best regards

Heinrich

Quoted 50 lines

<<<

So it is not silent today. The last line is the new one. Every other boot method writes this line.

However, the video display is silent once grub has finished and I just noticed that this patch draws some pixels on the display, as if the EFI display is set to a different mode from what U-Boot expects. I suppose this is understandable, as grub has run by then and has probably changed the mode.

So I wonder what would be best here. We don't support dynamic video sizing right now and I don't feel the urge to implement it just for this. Perhaps with EFI we could disable the vidconsole when exit-boot-services is called, on the basis that we cannot deal with whatever has happened to the display in the interim?

Regards,
Simon

Quoted 19 lines

Best regards

Heinrich

Quoted 14 lines
boot/bootm_final.c +5 -0
+      bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+
+      if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
+              bootstage_report();
+
       dm_remove_devices_active();

}

test/boot/bootflow.c +0 -0
index a56435d053f..80adc074070 100644
@@ -1381,7 +1381,7 @@ static int bootflow_efi(struct unit_test_state *uts)
 
Quoted 8 lines

test/boot/bootflow.c static int bootflow_efi(struct unit_test_state *uts) · line 1387

Quoted 7 lines
test/boot/bootflow.c +1 -1
       /* TODO: Why the \r ? */
       ut_assert_nextline("U-Boot test app for EFI_LOADER\r");
-      ut_assert_nextline("Exiting test app");
+      ut_assert_skip_to_line("Exiting test app");
       ut_assert_nextline("Boot failed (err=-14)");
 
       ut_assert_console_end();

Regards,
Simon

#12 lore raw

PATCH 6/10 x86: Call bootm_final()

In reply to Simon Glass

From: Simon Glass <[email protected]>

The x86 code in bootm_announce_and_cleanup() is very similar to the new bootm_final() function, so just use the latter. Move over a useful comment.

---

 arch/x86/lib/bootm.c | 14 +-------------
 boot/bootm_final.c   |  5 +++++
 2 files changed, 6 insertions(+), 13 deletions(-)
arch/x86/lib/bootm.c +1 -13
index 0827a884b1d..8e54fdb5178 100644
@@ -34,22 +34,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void bootm_announce_and_cleanup(void)
 {
-	printf("\nStarting kernel ...\n\n");
-
 #ifdef CONFIG_SYS_COREBOOT
 	timestamp_add_now(TS_START_KERNEL);
 #endif
-	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#if IS_ENABLED(CONFIG_BOOTSTAGE_REPORT)
-	bootstage_report();
-#endif
-
-	/*
-	 * Call remove function of all devices with a removal flag set.
-	 * This may be useful for last-stage operations, like cancelling
-	 * of DMA operation or releasing device internal buffers.
-	 */
-	dm_remove_devices_active();
+	bootm_final(0);
 }
 
 #if defined(CONFIG_OF_LIBFDT) && !defined(CONFIG_OF_NO_KERNEL)
boot/bootm_final.c +5 -0
index dd7cac55f1e..7077702d8c7 100644
@@ -18,5 +18,10 @@ void bootm_final(enum bootm_final_t flags)
 	if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
 		bootstage_report();
 
+	/*
+	 * Call remove function of all devices with a removal flag set.
+	 * This may be useful for last-stage operations, like cancelling
+	 * of DMA operation or releasing device internal buffers.
+	 */
 	dm_remove_devices_active();
 }
Signature · 1 line
2.43.0
#13 lore raw

PATCH 7/10 riscv: Drop board_quiesce_devices()

In reply to Simon Glass

From: Simon Glass <[email protected]>

This is not used on RISC-V so drop it.

---

 arch/riscv/include/asm/u-boot-riscv.h | 1 -
 arch/riscv/lib/bootm.c                | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)
arch/riscv/include/asm/u-boot-riscv.h +0 -1
index 543a1688db8..3a8fdb57136 100644
@@ -16,7 +16,6 @@ int cleanup_before_linux(void);
 
 /* board/.../... */
 int board_init(void);
-void board_quiesce_devices(void);
 int riscv_board_reserved_mem_fixup(void *fdt);
 int riscv_fdt_copy_resv_mem_node(const void *src_fdt, void *dest_fdt);
 
arch/riscv/lib/bootm.c +3 -5
index 9544907ab1e..35403e03ab0 100644
@@ -25,10 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-__weak void board_quiesce_devices(void)
-{
-}
-
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
  *
@@ -46,7 +42,9 @@ static void announce_and_cleanup(int fake)
 	bootstage_report();
 #endif
 
-	board_quiesce_devices();
+#ifdef CONFIG_USB_DEVICE
+	udc_disconnect();
+#endif
 
 	/*
 	 * Call remove function of all devices with a removal flag set.
Signature · 1 line
2.43.0
#14 lore raw

Re: [PATCH 07/10] riscv: Drop board_quiesce_devices()

Quoted 40 lines · Simon Glass

From: Simon Glass <[email protected]>

This is not used on RISC-V so drop it.

---

 arch/riscv/include/asm/u-boot-riscv.h | 1 -
 arch/riscv/lib/bootm.c                | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)
arch/riscv/include/asm/u-boot-riscv.h +0 -1
index 543a1688db8..3a8fdb57136 100644
@@ -16,7 +16,6 @@ int cleanup_before_linux(void);
 
 /* board/.../... */
 int board_init(void);
-void board_quiesce_devices(void);
 int riscv_board_reserved_mem_fixup(void *fdt);
 int riscv_fdt_copy_resv_mem_node(const void *src_fdt, void *dest_fdt);
 
arch/riscv/lib/bootm.c +0 -4
index 9544907ab1e..35403e03ab0 100644
@@ -25,10 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-__weak void board_quiesce_devices(void)
-{
-}
-
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
  *

arch/riscv/lib/bootm.c static void announce_and_cleanup(int fake) · line 50

Quoted 10 lines
arch/riscv/lib/bootm.c +3 -1
@@ -46,7 +42,9 @@ static void announce_and_cleanup(int fake)
 	bootstage_report();
 #endif
 
-	board_quiesce_devices();
+#ifdef CONFIG_USB_DEVICE
+	udc_disconnect();
+#endif
 
 	/*
 	 * Call remove function of all devices with a removal flag set.

You're dropping the generic hook board_quiesce_devices which is wrong and adding udc_disconnect() and a test for CONFIG_USB_DEVICE which is not present in mainline.

Signature · 1 line
Tom
#15 lore raw

PATCH 8/10 riscv: Call bootm_final()

In reply to Simon Glass

From: Simon Glass <[email protected]>

Make use of this function, adding some pieces needed by RISC-V

Drop the udc_disconnect() from EFI_LOADER since it is now done in bootm_final()

---

 arch/riscv/lib/bootm.c        | 22 +---------------------
 boot/bootm_final.c            |  9 ++++++++-
 lib/efi_loader/efi_boottime.c |  2 --
 3 files changed, 9 insertions(+), 24 deletions(-)
arch/riscv/lib/bootm.c +1 -21
index 35403e03ab0..bd47275b52e 100644
@@ -32,27 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 static void announce_and_cleanup(int fake)
 {
-	printf("\nStarting kernel ...%s\n\n", fake ?
-		"(fake run for tracing)" : "");
-	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_FDT
-	bootstage_fdt_add_report();
-#endif
-#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
-	bootstage_report();
-#endif
-
-#ifdef CONFIG_USB_DEVICE
-	udc_disconnect();
-#endif
-
-	/*
-	 * Call remove function of all devices with a removal flag set.
-	 * This may be useful for last-stage operations, like cancelling
-	 * of DMA operation or releasing device internal buffers.
-	 */
-	dm_remove_devices_active();
-
+	bootm_final(fake);
 	cleanup_before_linux();
 }
 
boot/bootm_final.c +8 -1
index 7077702d8c7..7f069877d06 100644
@@ -7,17 +7,24 @@
 
 #include <bootm.h>
 #include <bootstage.h>
+#include <usb.h>
 #include <dm/root.h>
 
 void bootm_final(enum bootm_final_t flags)
 {
-	printf("\nStarting kernel ...\n\n");
+	printf("\nStarting kernel ...%s\n\n", flags & BOOTM_FINAL_FAKE ?
+		"(fake run for tracing)" : "");
 
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
 
+	if (IS_ENABLED(CONFIG_BOOTSTAGE_FDT) && IS_ENABLED(CONFIG_CMD_FDT))
+		bootstage_fdt_add_report();
 	if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
 		bootstage_report();
 
+	if (IS_ENABLED(CONFIG_USB_DEVICE))
+		udc_disconnect();
+
 	/*
 	 * Call remove function of all devices with a removal flag set.
 	 * This may be useful for last-stage operations, like cancelling
lib/efi_loader/efi_boottime.c +0 -2
index 13d0d4dbe88..0bc66ee61a8 100644
@@ -2238,8 +2238,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
 	if (!efi_st_keep_devices) {
 		bootm_disable_interrupts();
-		if (IS_ENABLED(CONFIG_DM_ETH))
-			eth_halt();
 		board_quiesce_devices();
 		bootm_final(0);
 	}
Signature · 1 line
2.43.0
#16 lore raw

Re: [PATCH 08/10] riscv: Call bootm_final()

Quoted 7 lines · Simon Glass

From: Simon Glass <[email protected]>

Make use of this function, adding some pieces needed by RISC-V

Drop the udc_disconnect() from EFI_LOADER since it is now done in bootm_final()

This is two different changes, please split the patch.

Quoted 2 lines

Do you have a clone? Choose one email for a signoff please.

Quoted 86 lines

---

 arch/riscv/lib/bootm.c        | 22 +---------------------
 boot/bootm_final.c            |  9 ++++++++-
 lib/efi_loader/efi_boottime.c |  2 --
 3 files changed, 9 insertions(+), 24 deletions(-)
arch/riscv/lib/bootm.c +1 -21
index 35403e03ab0..bd47275b52e 100644
@@ -32,27 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 static void announce_and_cleanup(int fake)
 {
-       printf("\nStarting kernel ...%s\n\n", fake ?
-               "(fake run for tracing)" : "");
-       bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_FDT
-       bootstage_fdt_add_report();
-#endif
-#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
-       bootstage_report();
-#endif
-
-#ifdef CONFIG_USB_DEVICE
-       udc_disconnect();
-#endif
-
-       /*
-        * Call remove function of all devices with a removal flag set.
-        * This may be useful for last-stage operations, like cancelling
-        * of DMA operation or releasing device internal buffers.
-        */
-       dm_remove_devices_active();
-
+       bootm_final(fake);
        cleanup_before_linux();
 }
 
boot/bootm_final.c +8 -1
index 7077702d8c7..7f069877d06 100644
@@ -7,17 +7,24 @@
 
 #include <bootm.h>
 #include <bootstage.h>
+#include <usb.h>
 #include <dm/root.h>
 
 void bootm_final(enum bootm_final_t flags)
 {
-       printf("\nStarting kernel ...\n\n");
+       printf("\nStarting kernel ...%s\n\n", flags & BOOTM_FINAL_FAKE ?
+               "(fake run for tracing)" : "");
 
        bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
 
+       if (IS_ENABLED(CONFIG_BOOTSTAGE_FDT) && IS_ENABLED(CONFIG_CMD_FDT))
+               bootstage_fdt_add_report();
        if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
                bootstage_report();
 
+       if (IS_ENABLED(CONFIG_USB_DEVICE))
+               udc_disconnect();
+
        /*
         * Call remove function of all devices with a removal flag set.
         * This may be useful for last-stage operations, like cancelling
lib/efi_loader/efi_boottime.c +0 -3
index 13d0d4dbe88..0bc66ee61a8 100644
@@ -2238,8 +2238,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
        if (!efi_st_keep_devices) {
                bootm_disable_interrupts();
-               if (IS_ENABLED(CONFIG_DM_ETH))
-                       eth_halt();
                board_quiesce_devices();
                bootm_final(0);
        }
--

2.43.0

#17 lore raw

Re: [PATCH 08/10] riscv: Call bootm_final()

Quoted 11 lines · Peter Robinson
Quoted 7 lines · Simon Glass

From: Simon Glass <[email protected]>

Make use of this function, adding some pieces needed by RISC-V

Drop the udc_disconnect() from EFI_LOADER since it is now done in bootm_final()

This is two different changes, please split the patch.

OK

Quoted 5 lines
Quoted 3 lines

Do you have a clone? Choose one email for a signoff please.

Yes it seems I do, and will do.

Quoted 87 lines
Quoted 87 lines

---

 arch/riscv/lib/bootm.c        | 22 +---------------------
 boot/bootm_final.c            |  9 ++++++++-
 lib/efi_loader/efi_boottime.c |  2 --
 3 files changed, 9 insertions(+), 24 deletions(-)
arch/riscv/lib/bootm.c +1 -21
index 35403e03ab0..bd47275b52e 100644
@@ -32,27 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 static void announce_and_cleanup(int fake)
 {
-       printf("\nStarting kernel ...%s\n\n", fake ?
-               "(fake run for tracing)" : "");
-       bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
-#ifdef CONFIG_BOOTSTAGE_FDT
-       bootstage_fdt_add_report();
-#endif
-#if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT)
-       bootstage_report();
-#endif
-
-#ifdef CONFIG_USB_DEVICE
-       udc_disconnect();
-#endif
-
-       /*
-        * Call remove function of all devices with a removal flag set.
-        * This may be useful for last-stage operations, like cancelling
-        * of DMA operation or releasing device internal buffers.
-        */
-       dm_remove_devices_active();
-
+       bootm_final(fake);
        cleanup_before_linux();
 }
 
boot/bootm_final.c +8 -1
index 7077702d8c7..7f069877d06 100644
@@ -7,17 +7,24 @@
 
 #include <bootm.h>
 #include <bootstage.h>
+#include <usb.h>
 #include <dm/root.h>
 
 void bootm_final(enum bootm_final_t flags)
 {
-       printf("\nStarting kernel ...\n\n");
+       printf("\nStarting kernel ...%s\n\n", flags & BOOTM_FINAL_FAKE ?
+               "(fake run for tracing)" : "");
 
        bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
 
+       if (IS_ENABLED(CONFIG_BOOTSTAGE_FDT) && IS_ENABLED(CONFIG_CMD_FDT))
+               bootstage_fdt_add_report();
        if (IS_ENABLED(CONFIG_BOOTSTAGE_REPORT))
                bootstage_report();
 
+       if (IS_ENABLED(CONFIG_USB_DEVICE))
+               udc_disconnect();
+
        /*
         * Call remove function of all devices with a removal flag set.
         * This may be useful for last-stage operations, like cancelling
lib/efi_loader/efi_boottime.c +0 -3
index 13d0d4dbe88..0bc66ee61a8 100644
@@ -2238,8 +2238,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
        if (!efi_st_keep_devices) {
                bootm_disable_interrupts();
-               if (IS_ENABLED(CONFIG_DM_ETH))
-                       eth_halt();
                board_quiesce_devices();
                bootm_final(0);
        }
--

2.43.0

#18 lore raw

PATCH 9/10 efi: Drop EFI_GRUB_ARM32_WORKAROUND

In reply to Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -10
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
 	  hardware we can create a bounce buffer so that payloads don't have to
 	  worry about platform details.
 
-config EFI_GRUB_ARM32_WORKAROUND
-	bool "Workaround for GRUB on 32bit ARM"
-	default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-	default y
-	depends on ARM && !ARM64
-	help
-	  GRUB prior to version 2.04 requires U-Boot to disable caches. This
-	  workaround currently is also needed on systems with caches that
-	  cannot be managed via CP15.
-
 config EFI_ESRT
 	bool "Enable the UEFI ESRT generation"
 	depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
lib/efi_loader/efi_boottime.c +0 -26
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
 	return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-	/*
-	 * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-	 * caches are enabled.
-	 *
-	 * TODO:
-	 * According to the UEFI spec caches that can be managed via CP15
-	 * operations should be enabled. Caches requiring platform information
-	 * to manage should be disabled. This should not happen in
-	 * ExitBootServices() but before invoking any UEFI binary is invoked.
-	 *
-	 * We want to keep the current workaround while GRUB prior to version
-	 * 2.04 is still in use.
-	 */
-	cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 	/* Patch out unsupported runtime function */
 	efi_runtime_detach();
 
-	/* Fix up caches for EFI payloads if necessary */
-	efi_exit_caches();
-
 	/* Disable boot time services */
 	systab.con_in_handle = NULL;
 	systab.con_in = NULL;
Signature · 1 line
2.43.0
#19 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

As stated in the cover letter, this should be sent separately so it can be assessed on it's own merit.

Quoted 6 lines · Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Just because something is quite old doesn't mean it's not still needed, please describe the what the work around achieves, why it's not needed any longer, the benefits of dropping the workaround, eg does it slow boot process down?

Quoted 91 lines

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -10
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.
 
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.
-
 config EFI_ESRT
        bool "Enable the UEFI ESRT generation"
        depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
lib/efi_loader/efi_boottime.c +0 -27
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
        return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-       /*
-        * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-        * caches are enabled.
-        *
-        * TODO:
-        * According to the UEFI spec caches that can be managed via CP15
-        * operations should be enabled. Caches requiring platform information
-        * to manage should be disabled. This should not happen in
-        * ExitBootServices() but before invoking any UEFI binary is invoked.
-        *
-        * We want to keep the current workaround while GRUB prior to version
-        * 2.04 is still in use.
-        */
-       cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        /* Patch out unsupported runtime function */
        efi_runtime_detach();
 
-       /* Fix up caches for EFI payloads if necessary */
-       efi_exit_caches();
-
        /* Disable boot time services */
        systab.con_in_handle = NULL;
        systab.con_in = NULL;
--

2.43.0

#20 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

Quoted 3 lines · Peter Robinson

As stated in the cover letter, this should be sent separately so it can be assessed on it's own merit.

See my response there.

Quoted 13 lines · Simon Glass
Quoted 6 lines

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Just because something is quite old doesn't mean it's not still needed, please describe the what the work around achieves, why it's not needed any longer, the benefits of dropping the workaround, eg does it slow boot process down?

How about this:

what the work around achieves - allows booting with grub earlier 2.04 with 32-bit ARM
why it's not needed any longer - dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this
benefits of dropping the workaround - just a code clean-up. I haven't noticed a slow-down recently but I have certainly seen boards in the last few years that draw the grub menu at an excruciatingly slow pace

Quoted 92 lines
Quoted 92 lines

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -10
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.
 
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.
-
 config EFI_ESRT
        bool "Enable the UEFI ESRT generation"
        depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
lib/efi_loader/efi_boottime.c +0 -27
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
        return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-       /*
-        * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-        * caches are enabled.
-        *
-        * TODO:
-        * According to the UEFI spec caches that can be managed via CP15
-        * operations should be enabled. Caches requiring platform information
-        * to manage should be disabled. This should not happen in
-        * ExitBootServices() but before invoking any UEFI binary is invoked.
-        *
-        * We want to keep the current workaround while GRUB prior to version
-        * 2.04 is still in use.
-        */
-       cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        /* Patch out unsupported runtime function */
        efi_runtime_detach();
 
-       /* Fix up caches for EFI payloads if necessary */
-       efi_exit_caches();
-
        /* Disable boot time services */
        systab.con_in_handle = NULL;
        systab.con_in = NULL;
--

2.43.0

#21 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

In reply to Simon Glass
Quoted 37 lines · Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -0
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.

lib/efi_loader/Kconfig config EFI_LOADER_BOUNCE_BUFFER · line 516

Quoted 10 lines
lib/efi_loader/Kconfig +0 -9
 
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.

This also states that it's needed for systems that can't be managed by CP15, what systems are they, how are those platforms addressed?

Quoted 50 lines
lib/efi_loader/Kconfig +0 -0
 config EFI_ESRT
        bool "Enable the UEFI ESRT generation"
        depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
lib/efi_loader/efi_boottime.c +0 -27
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
        return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-       /*
-        * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-        * caches are enabled.
-        *
-        * TODO:
-        * According to the UEFI spec caches that can be managed via CP15
-        * operations should be enabled. Caches requiring platform information
-        * to manage should be disabled. This should not happen in
-        * ExitBootServices() but before invoking any UEFI binary is invoked.
-        *
-        * We want to keep the current workaround while GRUB prior to version
-        * 2.04 is still in use.
-        */
-       cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        /* Patch out unsupported runtime function */
        efi_runtime_detach();
 
-       /* Fix up caches for EFI payloads if necessary */
-       efi_exit_caches();
-
        /* Disable boot time services */
        systab.con_in_handle = NULL;
        systab.con_in = NULL;
--

2.43.0

#22 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

Quoted 40 lines · Peter Robinson
Quoted 38 lines · Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -0
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.
 
Quoted 12 lines

lib/efi_loader/Kconfig config EFI_LOADER_BOUNCE_BUFFER · line 516

Quoted 9 lines
lib/efi_loader/Kconfig +0 -9
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.

This also states that it's needed for systems that can't be managed by CP15, what systems are they, how are those platforms addressed?

I'm guessing that some systems have level2 caches with their own software interface. I certainly have seen this with Tegra2/3, for example.

Quoted 51 lines
Quoted 51 lines
lib/efi_loader/Kconfig +0 -0
 config EFI_ESRT
        bool "Enable the UEFI ESRT generation"
        depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
lib/efi_loader/efi_boottime.c +0 -27
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
        return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-       /*
-        * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-        * caches are enabled.
-        *
-        * TODO:
-        * According to the UEFI spec caches that can be managed via CP15
-        * operations should be enabled. Caches requiring platform information
-        * to manage should be disabled. This should not happen in
-        * ExitBootServices() but before invoking any UEFI binary is invoked.
-        *
-        * We want to keep the current workaround while GRUB prior to version
-        * 2.04 is still in use.
-        */
-       cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        /* Patch out unsupported runtime function */
        efi_runtime_detach();
 
-       /* Fix up caches for EFI payloads if necessary */
-       efi_exit_caches();
-
        /* Disable boot time services */
        systab.con_in_handle = NULL;
        systab.con_in = NULL;
--

2.43.0

#23 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

Quoted 57 lines

From: Simon Glass <[email protected]>
Date: Wed, 7 Jan 2026 12:02:27 -0700

Quoted 40 lines · Peter Robinson
Quoted 38 lines · Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -0
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.
 
Quoted 12 lines

lib/efi_loader/Kconfig config EFI_LOADER_BOUNCE_BUFFER · line 516

Quoted 9 lines
lib/efi_loader/Kconfig +0 -9
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.

This also states that it's needed for systems that can't be managed by CP15, what systems are they, how are those platforms addressed?

Quoted 3 lines

I'm guessing that some systems have level2 caches with their own software interface. I certainly have seen this with Tegra2/3, for example.

This is already being discussed in another thread on the mailing list started by Jan Kiszka:

https://lists.denx.de/pipermail/u-boot/2026-January/606817.html

My suggestion would be to drop this patch from your set and let that thread run its course.

Quoted 52 lines
Quoted 51 lines
Quoted 51 lines
lib/efi_loader/Kconfig +0 -0
 config EFI_ESRT
        bool "Enable the UEFI ESRT generation"
        depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
lib/efi_loader/efi_boottime.c +0 -27
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
        return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-       /*
-        * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-        * caches are enabled.
-        *
-        * TODO:
-        * According to the UEFI spec caches that can be managed via CP15
-        * operations should be enabled. Caches requiring platform information
-        * to manage should be disabled. This should not happen in
-        * ExitBootServices() but before invoking any UEFI binary is invoked.
-        *
-        * We want to keep the current workaround while GRUB prior to version
-        * 2.04 is still in use.
-        */
-       cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        /* Patch out unsupported runtime function */
        efi_runtime_detach();
 
-       /* Fix up caches for EFI payloads if necessary */
-       efi_exit_caches();
-
        /* Disable boot time services */
        systab.con_in_handle = NULL;
        systab.con_in = NULL;
--

2.43.0

#24 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

Hi Mark,

Quoted 62 lines · Mark Kettenis
Quoted 58 lines

From: Simon Glass <[email protected]>
Date: Wed, 7 Jan 2026 12:02:27 -0700

Quoted 40 lines · Peter Robinson
Quoted 38 lines · Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -0
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.
 
Quoted 12 lines

lib/efi_loader/Kconfig config EFI_LOADER_BOUNCE_BUFFER · line 516

Quoted 9 lines
lib/efi_loader/Kconfig +0 -9
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.

This also states that it's needed for systems that can't be managed by CP15, what systems are they, how are those platforms addressed?

Quoted 3 lines

I'm guessing that some systems have level2 caches with their own software interface. I certainly have seen this with Tegra2/3, for example.

Quoted 7 lines

This is already being discussed in another thread on the mailing list started by Jan Kiszka:

https://lists.denx.de/pipermail/u-boot/2026-January/606817.html

My suggestion would be to drop this patch from your set and let that thread run its course.

Yes I did see that and I was pleased to see that someone else was interested in this topic.

Still, that thread does not actually include a patch. So let's see how it pans out.

Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
lib/efi_loader/Kconfig +0 -0
 config EFI_ESRT
        bool "Enable the UEFI ESRT generation"
        depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
lib/efi_loader/efi_boottime.c +0 -23
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
        return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-       /*
-        * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-        * caches are enabled.
-        *
-        * TODO:
-        * According to the UEFI spec caches that can be managed via CP15
-        * operations should be enabled. Caches requiring platform information
-        * to manage should be disabled. This should not happen in
-        * ExitBootServices() but before invoking any UEFI binary is invoked.
-        *
-        * We want to keep the current workaround while GRUB prior to version
-        * 2.04 is still in use.
-        */
-       cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        /* Patch out unsupported runtime function */
        efi_runtime_detach();
 
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
lib/efi_loader/efi_boottime.c +0 -4
-       /* Fix up caches for EFI payloads if necessary */
-       efi_exit_caches();
-
        /* Disable boot time services */
        systab.con_in_handle = NULL;
        systab.con_in = NULL;
--

2.43.0

Regards,
Simon

#25 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

Quoted 70 lines · Simon Glass

Hi Mark,

Quoted 67 lines · Mark Kettenis
Quoted 58 lines

From: Simon Glass <[email protected]>
Date: Wed, 7 Jan 2026 12:02:27 -0700

Quoted 40 lines · Peter Robinson
Quoted 38 lines · Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -0
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.
 
Quoted 12 lines

lib/efi_loader/Kconfig config EFI_LOADER_BOUNCE_BUFFER · line 516

Quoted 9 lines
lib/efi_loader/Kconfig +0 -9
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.

This also states that it's needed for systems that can't be managed by CP15, what systems are they, how are those platforms addressed?

Quoted 3 lines

I'm guessing that some systems have level2 caches with their own software interface. I certainly have seen this with Tegra2/3, for example.

This is already being discussed in another thread on the mailing list started by Jan Kiszka:

https://lists.denx.de/pipermail/u-boot/2026-January/606817.html

Quoted 9 lines
Quoted 2 lines

My suggestion would be to drop this patch from your set and let that thread run its course.

Yes I did see that and I was pleased to see that someone else was interested in this topic.

Still, that thread does not actually include a patch. So let's see how it pans out.

I'm played with turning off the workaround on a socfpga target, and that apparently causes troubles:
https://lore.kernel.org/cip-dev/[email protected]/

I'm inclined now to keep cache disabling by default, only enable caches on known-good boards. If someone has a hint how to reliable identify targets that have architected CR15 cache control, I would use that as input. Otherwise, we need to maintain a positive list in Kconfig.

Along that, the control may need renaming because the original reason - broken bootloaders - is really history.

Jan

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#26 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

Quoted 85 lines · Jan Kiszka
Quoted 70 lines · Simon Glass

Hi Mark,

Quoted 67 lines · Mark Kettenis
Quoted 58 lines

From: Simon Glass <[email protected]>
Date: Wed, 7 Jan 2026 12:02:27 -0700

Quoted 40 lines · Peter Robinson
Quoted 38 lines · Simon Glass

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Drop it.

---

 configs/mt7623n_bpir2_defconfig |  1 -
 lib/efi_loader/Kconfig          | 10 ----------
 lib/efi_loader/efi_boottime.c   | 26 --------------------------
 3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -1
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 CONFIG_TARGET_MT7623=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
lib/efi_loader/Kconfig +0 -0
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
          hardware we can create a bounce buffer so that payloads don't have to
          worry about platform details.
 
Quoted 12 lines

lib/efi_loader/Kconfig config EFI_LOADER_BOUNCE_BUFFER · line 516

Quoted 9 lines
lib/efi_loader/Kconfig +0 -9
-config EFI_GRUB_ARM32_WORKAROUND
-       bool "Workaround for GRUB on 32bit ARM"
-       default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-       default y
-       depends on ARM && !ARM64
-       help
-         GRUB prior to version 2.04 requires U-Boot to disable caches. This
-         workaround currently is also needed on systems with caches that
-         cannot be managed via CP15.

This also states that it's needed for systems that can't be managed by CP15, what systems are they, how are those platforms addressed?

Quoted 3 lines

I'm guessing that some systems have level2 caches with their own software interface. I certainly have seen this with Tegra2/3, for example.

This is already being discussed in another thread on the mailing list started by Jan Kiszka:

https://lists.denx.de/pipermail/u-boot/2026-January/606817.html

Quoted 9 lines
Quoted 2 lines

My suggestion would be to drop this patch from your set and let that thread run its course.

Yes I did see that and I was pleased to see that someone else was interested in this topic.

Still, that thread does not actually include a patch. So let's see how it pans out.

I'm played with turning off the workaround on a socfpga target, and that apparently causes troubles:
https://lore.kernel.org/cip-dev/[email protected]/

Quoted 8 lines

I'm inclined now to keep cache disabling by default, only enable caches on known-good boards. If someone has a hint how to reliable identify targets that have architected CR15 cache control, I would use that as input. Otherwise, we need to maintain a positive list in Kconfig.

Along that, the control may need renaming because the original reason - broken bootloaders - is really history.

* TODO:
* According to the UEFI spec caches that can be managed via CP15
* operations should be enabled. Caches requiring platform information
* to manage should be disabled. This should not happen in
* ExitBootServices() but before invoking any UEFI binary is invoked.

So, that last sentence points out another issue for targets with non-architected caches: The current logic seems to disable them too late, right? Should the cache disabling move to do_bootefi_exec?

Jan

Signature · 2 lines
Siemens AG, Foundational Technologies
Linux Expert Center
#27 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

In reply to Simon Glass

Am 7. Januar 2026 01:31:26 MEZ schrieb Simon Glass <[email protected]>:

Quoted 5 lines

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Where do you disable caches that are not managed by CP15?

Best regards

Heinrich

Quoted 89 lines

Drop it.

---

configs/mt7623n_bpir2_defconfig |  1 -
lib/efi_loader/Kconfig          | 10 ----------
lib/efi_loader/efi_boottime.c   | 26 --------------------------
3 files changed, 37 deletions(-)
configs/mt7623n_bpir2_defconfig +0 -0
index 404380558f2..d75168a72ed 100644
@@ -13,7 +13,6 @@ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"

CONFIG_TARGET_MT7623=y
CONFIG_SYS_BOOTM_LEN=0x4000000
CONFIG_SYS_LOAD_ADDR=0x84000000
-# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
CONFIG_FIT=y
CONFIG_FIT_VERBOSE=y
CONFIG_DISTRO_DEFAULTS=y

lib/efi_loader/Kconfig +0 -10
index 13e44be1d06..5585c841c27 100644
@@ -505,16 +505,6 @@ config EFI_LOADER_BOUNCE_BUFFER
 	  hardware we can create a bounce buffer so that payloads don't have to
 	  worry about platform details.
 
-config EFI_GRUB_ARM32_WORKAROUND
-	bool "Workaround for GRUB on 32bit ARM"
-	default n if ARCH_BCM283X || ARCH_SUNXI || ARCH_QEMU
-	default y
-	depends on ARM && !ARM64
-	help
-	  GRUB prior to version 2.04 requires U-Boot to disable caches. This
-	  workaround currently is also needed on systems with caches that
-	  cannot be managed via CP15.
-

config EFI_ESRT
bool "Enable the UEFI ESRT generation" depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT

lib/efi_loader/efi_boottime.c +0 -26
index 0bc66ee61a8..c31ee53cde6 100644
@@ -2139,29 +2139,6 @@ error:
 	return EFI_EXIT(ret);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND)
-	/*
-	 * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if
-	 * caches are enabled.
-	 *
-	 * TODO:
-	 * According to the UEFI spec caches that can be managed via CP15
-	 * operations should be enabled. Caches requiring platform information
-	 * to manage should be disabled. This should not happen in
-	 * ExitBootServices() but before invoking any UEFI binary is invoked.
-	 *
-	 * We want to keep the current workaround while GRUB prior to version
-	 * 2.04 is still in use.
-	 */
-	cleanup_before_linux();
-#endif
-}
-
 /**
 * efi_exit_boot_services() - stop all boot services
 * @image_handle: handle of the loaded image
@@ -2245,9 +2222,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 	/* Patch out unsupported runtime function */
 	efi_runtime_detach();
 
-	/* Fix up caches for EFI payloads if necessary */
-	efi_exit_caches();
-
 	/* Disable boot time services */
 	systab.con_in_handle = NULL;
 	systab.con_in = NULL;
#28 lore raw

Re: [PATCH 09/10] efi: Drop EFI_GRUB_ARM32_WORKAROUND

Quoted 9 lines · Heinrich Schuchardt

Am 7. Januar 2026 01:31:26 MEZ schrieb Simon Glass <[email protected]>:

Quoted 5 lines

From: Simon Glass <[email protected]>

This work-around dates from 2019 and grub 2.04 which is quite old. New builds of grub don't have the problem and old boards presumably use an older U-Boot, so don't need this.

Where do you disable caches that are not managed by CP15?

I suppose it would be SoC-specific. See for example the code in this arch/arm/mach-tegra/cache.c - I'm not sure if this is using a standard ARM thing but I suspect it is tegra-specific:

/*
* Systems with an architectural L2 cache must not use the PL310.
* Config L2CTLR here for a data RAM latency of 3 cycles. */
asm("mrc p15, 1, %0, c9, c0, 2" : : "r" (reg));
reg &= ~7;
reg |= 2;
asm("mcr p15, 1, %0, c9, c0, 2" : : "r" (reg));
}

I also found this Nuvoton code that might qualify,

void set_pl310_ctrl(u32 enable)
{
struct pl310_regs *const pl310 = (struct pl310_regs *)CFG_SYS_PL310_BASE;

writel(enable, &pl310->pl310_ctrl);
}

Quoted 4 lines

Best regards

Heinrich

Regards,
Simon
[..]

#29 lore raw

PATCH 10/10 x86: Add cleanup_before_linux()

In reply to Simon Glass

From: Simon Glass <[email protected]>

This function is not present on x86, but there is an x86-specific version which is never called. Add the former, making it call the latter.

---

 arch/x86/cpu/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/cpu/cpu.c +5 -0
index c373b14df30..f756a9ebf09 100644
@@ -80,6 +80,11 @@ int __weak x86_cleanup_before_linux(void)
 	return 0;
 }
 
+int cleanup_before_linux(void)
+{
+	return x86_cleanup_before_linux();
+}
+
 int x86_init_cache(void)
 {
 	enable_caches();
Signature · 1 line
2.43.0
#30 lore raw

Re: [PATCH 10/10] x86: Add cleanup_before_linux()

Quoted 6 lines · Simon Glass

From: Simon Glass <[email protected]>

This function is not present on x86, but there is an x86-specific version which is never called. Add the former, making it call the latter.

If the later is never called up until now why is it actually needed, if it's not been missed until now why not just drop it? Please describe why in the commit.

Quoted 26 lines

---

 arch/x86/cpu/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/cpu/cpu.c +5 -1
index c373b14df30..f756a9ebf09 100644
@@ -80,6 +80,11 @@ int __weak x86_cleanup_before_linux(void)
        return 0;
 }
 
+int cleanup_before_linux(void)
+{
+       return x86_cleanup_before_linux();
+}
+
 int x86_init_cache(void)
 {
        enable_caches();
--

2.43.0

#31 lore raw

Re: [PATCH 10/10] x86: Add cleanup_before_linux()

Quoted 5 lines · Peter Robinson
Quoted 3 lines · Simon Glass

From: Simon Glass <[email protected]>

Quoted 7 lines
Quoted 3 lines

This function is not present on x86, but there is an x86-specific version which is never called. Add the former, making it call the latter.

If the later is never called up until now why is it actually needed, if it's not been missed until now why not just drop it? Please describe why in the commit.

I'll add it to the commit message for v2. The code is:

int __weak x86_cleanup_before_linux(void)

{
    int ret;

    ret = mp_park_aps();
    if (ret)
        return log_msg_ret("park", ret);
    bootstage_stash_default();

    return 0;
}

It seems important to park the APs before booting. I think it was just an oversight.

Quoted 27 lines
Quoted 27 lines

---

 arch/x86/cpu/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/cpu/cpu.c +5 -1
index c373b14df30..f756a9ebf09 100644
@@ -80,6 +80,11 @@ int __weak x86_cleanup_before_linux(void)
        return 0;
 }
 
+int cleanup_before_linux(void)
+{
+       return x86_cleanup_before_linux();
+}
+
 int x86_init_cache(void)
 {
        enable_caches();
--

2.43.0

#32 lore raw

Re: [PATCH 10/10] x86: Add cleanup_before_linux()

Quoted 29 lines · Simon Glass
Quoted 5 lines · Peter Robinson
Quoted 3 lines · Simon Glass

From: Simon Glass <[email protected]>

Quoted 7 lines
Quoted 3 lines

This function is not present on x86, but there is an x86-specific version which is never called. Add the former, making it call the latter.

If the later is never called up until now why is it actually needed, if it's not been missed until now why not just drop it? Please describe why in the commit.

I'll add it to the commit message for v2. The code is:

int __weak x86_cleanup_before_linux(void)

{
    int ret;

    ret = mp_park_aps();
    if (ret)
        return log_msg_ret("park", ret);
    bootstage_stash_default();

    return 0;
}
Quoted 2 lines

It seems important to park the APs before booting. I think it was just an oversight.

You think? Above you said it''s never been called before so it can't have been *that* important!

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

---

 arch/x86/cpu/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/cpu/cpu.c +5 -1
index c373b14df30..f756a9ebf09 100644
@@ -80,6 +80,11 @@ int __weak x86_cleanup_before_linux(void)
        return 0;
 }
 
+int cleanup_before_linux(void)
+{
+       return x86_cleanup_before_linux();
+}
+
 int x86_init_cache(void)
 {
        enable_caches();
--

2.43.0

#33 lore raw
In reply to Simon Glass
Quoted 2 lines · Simon Glass

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

Not that you should v2 anything right now, but, all of your patches are doubly signed off, which is wrong. And, since you're no longer at Google, for stats purposes, where should your contributions go (and would you like any previous pages re-generated) ? Thanks.

Signature · 1 line
Tom
#34 lore raw
Quoted 9 lines · Tom Rini
Quoted 2 lines · Simon Glass

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

Not that you should v2 anything right now, but, all of your patches are doubly signed off, which is wrong. And, since you're no longer at Google, for stats purposes, where should your contributions go (and would you like any previous pages re-generated) ? Thanks.

Following up on this part, as I need to at least update gitdm, thanks.

Signature · 1 line
Tom
#35 lore raw

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 5 lines · Tom Rini
Quoted 2 lines · Simon Glass

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

Quoted 6 lines
Quoted 4 lines

Not that you should v2 anything right now, but, all of your patches are doubly signed off, which is wrong. And, since you're no longer at Google, for stats purposes, where should your contributions go (and would you like any previous pages re-generated) ? Thanks.

Following up on this part, as I need to at least update gitdm, thanks.

From now on you can do Canonical but there is no need to regenerate anything, but thank you for asking.

Regards,
Simon

#36 lore raw
In reply to Simon Glass

Hi Simon,

Quoted 15 lines

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

EFT_LOADER has its own special code, regardless of which arch is being booted.

It is quite hard to know what actually happens in the final milliseconds before the OS boot.

This series attempts to clean up U-Boot in this area.

The basic approach is to create a new bootm_final() function which is called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic.

Quoted 5 lines

RISC-V, x86 and ARM are converted over to use this new function. For consistency, EFI loader is converted as well.

A noteable change is that EFI_LOADER now does bootstage processing before boot, if enabled, thus producing a report.

Why is the change needed, I don't see it explained in the patches or here and what the implications might be.

Quoted 2 lines

There is also a patch to drop EFI_GRUB_ARM32_WORKAROUND, as discussed recently on the mailing list.

That appears to be unrelated to this series, it should be a separate standalone patch else it needs to be described here why it's a dependency, and even then likely still posted separately as a dependency of this series.

Quoted 5 lines

Future work could take this a little further:
- Drop board_quiesce_devices() and rely on driver model for that
- Similarly with udc_disconnect(),
- cleanup_before_linux() could use more details as to what it is supposed to do, to reduce the number of arch-specific variations

What do you mean by that statement.

Quoted 38 lines

Note: This is the first 10 patches for an 18-part series from the Concept tree, as requested. The patches after that complete the cleanup on ARM and RISC-V.

Simon Glass (10):
boot: Create a function for final pre-boot steps
efi: Make use of bootm_final()
bootm: Add a message when booting
bootstage: Add some missing dummy functions
bootm: Do bootstage processing in bootm_final()
x86: Call bootm_final()
riscv: Drop board_quiesce_devices()
riscv: Call bootm_final()
efi: Drop EFI_GRUB_ARM32_WORKAROUND
x86: Add cleanup_before_linux()

 MAINTAINERS                           |  1 +
 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 24 +------------------
 arch/x86/cpu/cpu.c                    |  5 ++++
 arch/x86/lib/bootm.c                  | 14 +----------
 boot/Makefile                         |  2 +-
 boot/bootm_final.c                    | 34 +++++++++++++++++++++++++++
 configs/mt7623n_bpir2_defconfig       |  1 -
 include/bootm.h                       | 17 ++++++++++++++
 include/bootstage.h                   |  8 +++++++
 lib/efi_loader/Kconfig                | 10 --------
 lib/efi_loader/efi_boottime.c         | 30 +----------------------
 test/boot/bootflow.c                  |  2 +-
 13 files changed, 70 insertions(+), 79 deletions(-)
 create mode 100644 boot/bootm_final.c

--
2.43.0

base-commit: 6cdd7597a2fbfc1572c1b0af23d3daf1cefa2de7
branch: bootma-us

#37 lore raw

Hi Peter,

Quoted 18 lines · Peter Robinson

Hi Simon,

Quoted 15 lines

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

EFT_LOADER has its own special code, regardless of which arch is being booted.

It is quite hard to know what actually happens in the final milliseconds before the OS boot.

This series attempts to clean up U-Boot in this area.

The basic approach is to create a new bootm_final() function which is called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic.

Quoted 8 lines
Quoted 5 lines

RISC-V, x86 and ARM are converted over to use this new function. For consistency, EFI loader is converted as well.

A noteable change is that EFI_LOADER now does bootstage processing before boot, if enabled, thus producing a report.

Why is the change needed, I don't see it explained in the patches or here and what the implications might be.

At present EFI_LOADER ignores bootstage and so there is no timing report produced even if enabled. It was probably an oversight.

Quoted 8 lines
Quoted 3 lines

There is also a patch to drop EFI_GRUB_ARM32_WORKAROUND, as discussed recently on the mailing list.

That appears to be unrelated to this series, it should be a separate standalone patch else it needs to be described here why it's a dependency, and even then likely still posted separately as a dependency of this series.

In what way is it unrelated? In my view this is related as it is a pre-OS cleanup. What do you mean by dependency here?

Quoted 8 lines
Quoted 6 lines

Future work could take this a little further:
- Drop board_quiesce_devices() and rely on driver model for that
- Similarly with udc_disconnect(),
- cleanup_before_linux() could use more details as to what it is supposed to do, to reduce the number of arch-specific variations

What do you mean by that statement.

Well, the function does different things on differents archs and is mostly uncommented (apart from an ARM-specific note in a README). Ideally it would be commented with exactly what it should do, ideally at a high level so it is not just arch-specific.

Quoted 39 lines
Quoted 39 lines

Note: This is the first 10 patches for an 18-part series from the Concept tree, as requested. The patches after that complete the cleanup on ARM and RISC-V.

Simon Glass (10):
boot: Create a function for final pre-boot steps
efi: Make use of bootm_final()
bootm: Add a message when booting
bootstage: Add some missing dummy functions
bootm: Do bootstage processing in bootm_final()
x86: Call bootm_final()
riscv: Drop board_quiesce_devices()
riscv: Call bootm_final()
efi: Drop EFI_GRUB_ARM32_WORKAROUND
x86: Add cleanup_before_linux()

 MAINTAINERS                           |  1 +
 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 24 +------------------
 arch/x86/cpu/cpu.c                    |  5 ++++
 arch/x86/lib/bootm.c                  | 14 +----------
 boot/Makefile                         |  2 +-
 boot/bootm_final.c                    | 34 +++++++++++++++++++++++++++
 configs/mt7623n_bpir2_defconfig       |  1 -
 include/bootm.h                       | 17 ++++++++++++++
 include/bootstage.h                   |  8 +++++++
 lib/efi_loader/Kconfig                | 10 --------
 lib/efi_loader/efi_boottime.c         | 30 +----------------------
 test/boot/bootflow.c                  |  2 +-
 13 files changed, 70 insertions(+), 79 deletions(-)
 create mode 100644 boot/bootm_final.c

--
2.43.0

base-commit: 6cdd7597a2fbfc1572c1b0af23d3daf1cefa2de7
branch: bootma-us

#38 lore raw

Hi Simon,

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

EFT_LOADER has its own special code, regardless of which arch is being booted.

It is quite hard to know what actually happens in the final milliseconds before the OS boot.

This series attempts to clean up U-Boot in this area.

The basic approach is to create a new bootm_final() function which is called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic.

RISC-V, x86 and ARM are converted over to use this new function. For consistency, EFI loader is converted as well.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

A noteable change is that EFI_LOADER now does bootstage processing before boot, if enabled, thus producing a report.

Why is the change needed, I don't see it explained in the patches or here and what the implications might be.

At present EFI_LOADER ignores bootstage and so there is no timing report produced even if enabled. It was probably an oversight.

So please include that level of detail.

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

There is also a patch to drop EFI_GRUB_ARM32_WORKAROUND, as discussed recently on the mailing list.

That appears to be unrelated to this series, it should be a separate standalone patch else it needs to be described here why it's a dependency, and even then likely still posted separately as a dependency of this series.

In what way is it unrelated? In my view this is related as it is a pre-OS cleanup. What do you mean by dependency here?

It is unrelated because if you remove it from the series the series would still generally work as expected and if I apply the patch on it's own without the rest of the series it works as expected. It is only related by a vague association hence it should be sent separately and discussed on it's own merit.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Future work could take this a little further:
- Drop board_quiesce_devices() and rely on driver model for that
- Similarly with udc_disconnect(),
- cleanup_before_linux() could use more details as to what it is supposed to do, to reduce the number of arch-specific variations

Quoted 6 lines
Quoted 1 line

What do you mean by that statement.

Well, the function does different things on differents archs and is mostly uncommented (apart from an ARM-specific note in a README). Ideally it would be commented with exactly what it should do, ideally at a high level so it is not just arch-specific.

Well I would expect different arches to potentially do different things, but your response doesn't explain to me why doing the same thing is the right thing to do, why not doing the different things won't affect the arrch, I want to know why the details of change is good not a hand wavy thing (you yourself have asked others to do similar explanations in the past too).

Quoted 38 lines
Quoted 38 lines
Quoted 38 lines

Note: This is the first 10 patches for an 18-part series from the Concept tree, as requested. The patches after that complete the cleanup on ARM and RISC-V.

Simon Glass (10):
boot: Create a function for final pre-boot steps
efi: Make use of bootm_final()
bootm: Add a message when booting
bootstage: Add some missing dummy functions
bootm: Do bootstage processing in bootm_final()
x86: Call bootm_final()
riscv: Drop board_quiesce_devices()
riscv: Call bootm_final()
efi: Drop EFI_GRUB_ARM32_WORKAROUND
x86: Add cleanup_before_linux()

 MAINTAINERS                           |  1 +
 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 24 +------------------
 arch/x86/cpu/cpu.c                    |  5 ++++
 arch/x86/lib/bootm.c                  | 14 +----------
 boot/Makefile                         |  2 +-
 boot/bootm_final.c                    | 34 +++++++++++++++++++++++++++
 configs/mt7623n_bpir2_defconfig       |  1 -
 include/bootm.h                       | 17 ++++++++++++++
 include/bootstage.h                   |  8 +++++++
 lib/efi_loader/Kconfig                | 10 --------
 lib/efi_loader/efi_boottime.c         | 30 +----------------------
 test/boot/bootflow.c                  |  2 +-
 13 files changed, 70 insertions(+), 79 deletions(-)
 create mode 100644 boot/bootm_final.c

--
2.43.0

base-commit: 6cdd7597a2fbfc1572c1b0af23d3daf1cefa2de7
branch: bootma-us

#39 lore raw

Hi,

Quoted 62 lines · Peter Robinson

Hi Simon,

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

Each arch does something slightly different before booting the OS. Some archs even do different things depending on the CPU type.

EFT_LOADER has its own special code, regardless of which arch is being booted.

It is quite hard to know what actually happens in the final milliseconds before the OS boot.

This series attempts to clean up U-Boot in this area.

The basic approach is to create a new bootm_final() function which is called by all archs. It provides some flags for a couple of necessary variations but otherwise it is generic.

RISC-V, x86 and ARM are converted over to use this new function. For consistency, EFI loader is converted as well.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

A noteable change is that EFI_LOADER now does bootstage processing before boot, if enabled, thus producing a report.

Why is the change needed, I don't see it explained in the patches or here and what the implications might be.

At present EFI_LOADER ignores bootstage and so there is no timing report produced even if enabled. It was probably an oversight.

So please include that level of detail.

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

There is also a patch to drop EFI_GRUB_ARM32_WORKAROUND, as discussed recently on the mailing list.

That appears to be unrelated to this series, it should be a separate standalone patch else it needs to be described here why it's a dependency, and even then likely still posted separately as a dependency of this series.

In what way is it unrelated? In my view this is related as it is a pre-OS cleanup. What do you mean by dependency here?

It is unrelated because if you remove it from the series the series would still generally work as expected and if I apply the patch on it's own without the rest of the series it works as expected. It is only related by a vague association hence it should be sent separately and discussed on it's own merit.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Future work could take this a little further:
- Drop board_quiesce_devices() and rely on driver model for that
- Similarly with udc_disconnect(),
- cleanup_before_linux() could use more details as to what it is supposed to do, to reduce the number of arch-specific variations

Quoted 6 lines
Quoted 1 line

What do you mean by that statement.

Well, the function does different things on differents archs and is mostly uncommented (apart from an ARM-specific note in a README). Ideally it would be commented with exactly what it should do, ideally at a high level so it is not just arch-specific.

Quoted 45 lines

Well I would expect different arches to potentially do different things, but your response doesn't explain to me why doing the same thing is the right thing to do, why not doing the different things won't affect the arrch, I want to know why the details of change is good not a hand wavy thing (you yourself have asked others to do similar explanations in the past too).

Quoted 38 lines
Quoted 38 lines
Quoted 38 lines

Note: This is the first 10 patches for an 18-part series from the Concept tree, as requested. The patches after that complete the cleanup on ARM and RISC-V.

Simon Glass (10):
boot: Create a function for final pre-boot steps
efi: Make use of bootm_final()
bootm: Add a message when booting
bootstage: Add some missing dummy functions
bootm: Do bootstage processing in bootm_final()
x86: Call bootm_final()
riscv: Drop board_quiesce_devices()
riscv: Call bootm_final()
efi: Drop EFI_GRUB_ARM32_WORKAROUND
x86: Add cleanup_before_linux()

 MAINTAINERS                           |  1 +
 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 24 +------------------
 arch/x86/cpu/cpu.c                    |  5 ++++
 arch/x86/lib/bootm.c                  | 14 +----------
 boot/Makefile                         |  2 +-
 boot/bootm_final.c                    | 34 +++++++++++++++++++++++++++
 configs/mt7623n_bpir2_defconfig       |  1 -
 include/bootm.h                       | 17 ++++++++++++++
 include/bootstage.h                   |  8 +++++++
 lib/efi_loader/Kconfig                | 10 --------
 lib/efi_loader/efi_boottime.c         | 30 +----------------------
 test/boot/bootflow.c                  |  2 +-
 13 files changed, 70 insertions(+), 79 deletions(-)
 create mode 100644 boot/bootm_final.c

--
2.43.0

base-commit: 6cdd7597a2fbfc1572c1b0af23d3daf1cefa2de7
branch: bootma-us

Just stepping back a bit...I haven't seen any patch collect a review tag and the feedback seems less than encouraging. Here is the patchwork link:

https://patchwork.ozlabs.org/project/uboot/list/?series=487409&state=*

It is always hard to 'put the genie back in the bottle' once different parts of the code base have diverged.

Would anyone like me to pursue this, or would it be best to drop it?

Regards,
Simon