Skip to contentSkip to conversation

efi_loader: remove efi_exit_caches()

PATCH New Heinrich Schuchardt 4 participants 4 messages Sep 23, 2018 – Nov 24, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi_loader: remove efi_exit_caches()

Since GRUB patch d0c070179d4d ("arm/efi: Switch to arm64 linux loader", 2018-07-09) we do not need a workaround for GRUB on 32bit ARM anymore.

So let's eliminate function efi_exit_caches().

This will require Linux distributions to update grub-efi-arm to the GRUB git HEAD (a tag containing the aforementioned GRUB patch is not available yet).

---
 lib/efi_loader/efi_boottime.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
lib/efi_loader/efi_boottime.c +0 -28
index 2496608981..97eb19cd14 100644
@@ -26,14 +26,6 @@ LIST_HEAD(efi_obj_list);
 /* List of all events */
 LIST_HEAD(efi_events);
 
-/*
- * If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
- * we need to do trickery with caches. Since we don't want to break the EFI
- * aware boot path, only apply hacks when loading exiting directly (breaking
- * direct Linux EFI booting along the way - oh well).
- */
-static bool efi_is_direct_boot = true;
-
 #ifdef CONFIG_ARM
 /*
  * The "gd" pointer lives in a register on ARM and AArch64 that we declare
@@ -1686,8 +1678,6 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 
 	EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
 
-	efi_is_direct_boot = false;
-
 	/* call the image! */
 	if (setjmp(&image_obj->exit_jmp)) {
 		/*
@@ -1795,21 +1785,6 @@ static efi_status_t EFIAPI efi_unload_image(efi_handle_t image_handle)
 	return EFI_EXIT(EFI_SUCCESS);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
-	/*
-	 * Grub on 32bit ARM needs to have caches disabled before jumping into
-	 * a zImage, but does not know of all cache layers. Give it a hand.
-	 */
-	if (efi_is_direct_boot)
-		cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -1863,9 +1838,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
 	board_quiesce_devices();
 
-	/* Fix up caches for EFI payloads if necessary */
-	efi_exit_caches();
-
 	/* This stops all lingering devices */
 	bootm_disable_interrupts();
 
Signature · 1 line
2.19.0
#1 lore raw

PATCH 1/1 efi_loader: remove efi_exit_caches()

Quoted 8 lines · Heinrich Schuchardt

Since GRUB patch d0c070179d4d ("arm/efi: Switch to arm64 linux loader", 2018-07-09) we do not need a workaround for GRUB on 32bit ARM anymore.

So let's eliminate function efi_exit_caches().

This will require Linux distributions to update grub-efi-arm to the GRUB git HEAD (a tag containing the aforementioned GRUB patch is not available yet).

OpenBSD/armv7 can no longer boot with U-Boot after this commit as it currently does not explicitly invalidate/flush caches in efiboot.

Quoted 73 lines
---
 lib/efi_loader/efi_boottime.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
lib/efi_loader/efi_boottime.c +0 -28
index 2496608981..97eb19cd14 100644
@@ -26,14 +26,6 @@ LIST_HEAD(efi_obj_list);
 /* List of all events */
 LIST_HEAD(efi_events);
 
-/*
- * If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
- * we need to do trickery with caches. Since we don't want to break the EFI
- * aware boot path, only apply hacks when loading exiting directly (breaking
- * direct Linux EFI booting along the way - oh well).
- */
-static bool efi_is_direct_boot = true;
-
 #ifdef CONFIG_ARM
 /*
  * The "gd" pointer lives in a register on ARM and AArch64 that we declare
@@ -1686,8 +1678,6 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 
 	EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
 
-	efi_is_direct_boot = false;
-
 	/* call the image! */
 	if (setjmp(&image_obj->exit_jmp)) {
 		/*
@@ -1795,21 +1785,6 @@ static efi_status_t EFIAPI efi_unload_image(efi_handle_t image_handle)
 	return EFI_EXIT(EFI_SUCCESS);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
-	/*
-	 * Grub on 32bit ARM needs to have caches disabled before jumping into
-	 * a zImage, but does not know of all cache layers. Give it a hand.
-	 */
-	if (efi_is_direct_boot)
-		cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -1863,9 +1838,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
 	board_quiesce_devices();
 
-	/* Fix up caches for EFI payloads if necessary */
-	efi_exit_caches();
-
 	/* This stops all lingering devices */
 	bootm_disable_interrupts();
 
Signature · 6 lines
2.19.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
#2 lore raw

PATCH 1/1 efi_loader: remove efi_exit_caches()

Quoted 4 lines · Jonathan Gray
Quoted 3 lines · Heinrich Schuchardt

Since GRUB patch d0c070179d4d ("arm/efi: Switch to arm64 linux loader", 2018-07-09) we do not need a workaround for GRUB on 32bit ARM anymore.

Quoted 8 lines
Quoted 5 lines

So let's eliminate function efi_exit_caches().

This will require Linux distributions to update grub-efi-arm to the GRUB git HEAD (a tag containing the aforementioned GRUB patch is not available yet).

OpenBSD/armv7 can no longer boot with U-Boot after this commit as it currently does not explicitly invalidate/flush caches in efiboot.

Shoot. I thought I had included a revert of this patch for 2018.11, but apparently missed it :(.

I'll revert it for efi-next then. We will have to give this a good bit more thought.

Alex

Quoted 74 lines
Quoted 74 lines
---
 lib/efi_loader/efi_boottime.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
lib/efi_loader/efi_boottime.c +0 -28
index 2496608981..97eb19cd14 100644
@@ -26,14 +26,6 @@ LIST_HEAD(efi_obj_list);
 /* List of all events */
 LIST_HEAD(efi_events);
 
-/*
- * If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
- * we need to do trickery with caches. Since we don't want to break the EFI
- * aware boot path, only apply hacks when loading exiting directly (breaking
- * direct Linux EFI booting along the way - oh well).
- */
-static bool efi_is_direct_boot = true;
-
 #ifdef CONFIG_ARM
 /*
  * The "gd" pointer lives in a register on ARM and AArch64 that we declare
@@ -1686,8 +1678,6 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 
 	EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
 
-	efi_is_direct_boot = false;
-
 	/* call the image! */
 	if (setjmp(&image_obj->exit_jmp)) {
 		/*
@@ -1795,21 +1785,6 @@ static efi_status_t EFIAPI efi_unload_image(efi_handle_t image_handle)
 	return EFI_EXIT(EFI_SUCCESS);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
-	/*
-	 * Grub on 32bit ARM needs to have caches disabled before jumping into
-	 * a zImage, but does not know of all cache layers. Give it a hand.
-	 */
-	if (efi_is_direct_boot)
-		cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -1863,9 +1838,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
 	board_quiesce_devices();
 
-	/* Fix up caches for EFI payloads if necessary */
-	efi_exit_caches();
-
 	/* This stops all lingering devices */
 	bootm_disable_interrupts();
 
Signature · 6 lines
2.19.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
#3 lore raw

PATCH 1/1 efi_loader: remove efi_exit_caches()

Quoted 16 lines · On Thu, 15 Nov 2018 21:23:31 +0100 Alexander Graf <[email protected]> wrote:
Quoted 4 lines · Jonathan Gray
Quoted 3 lines · Heinrich Schuchardt

Since GRUB patch d0c070179d4d ("arm/efi: Switch to arm64 linux loader", 2018-07-09) we do not need a workaround for GRUB on 32bit ARM anymore.

Quoted 8 lines
Quoted 5 lines

So let's eliminate function efi_exit_caches().

This will require Linux distributions to update grub-efi-arm to the GRUB git HEAD (a tag containing the aforementioned GRUB patch is not available yet).

OpenBSD/armv7 can no longer boot with U-Boot after this commit as it currently does not explicitly invalidate/flush caches in efiboot.

Quoted 8 lines

Shoot. I thought I had included a revert of this patch for 2018.11, but apparently missed it :(.

I'll revert it for efi-next then. We will have to give this a good bit more thought.

Alex

Same problem for FreeBSD/armv{6,7}, I don't think that we should
disable the caches but we should at least flush them no ?

Quoted 78 lines
Quoted 67 lines
Quoted 67 lines
---
 lib/efi_loader/efi_boottime.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
lib/efi_loader/efi_boottime.c +0 -28
index 2496608981..97eb19cd14 100644
@@ -26,14 +26,6 @@ LIST_HEAD(efi_obj_list);
 /* List of all events */
 LIST_HEAD(efi_events);
 
-/*
- * If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
- * we need to do trickery with caches. Since we don't want to break the EFI
- * aware boot path, only apply hacks when loading exiting directly (breaking
- * direct Linux EFI booting along the way - oh well).
- */
-static bool efi_is_direct_boot = true;
-
 #ifdef CONFIG_ARM
 /*
  * The "gd" pointer lives in a register on ARM and AArch64 that we declare
@@ -1686,8 +1678,6 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
 
 	EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
 
-	efi_is_direct_boot = false;
-
 	/* call the image! */
 	if (setjmp(&image_obj->exit_jmp)) {
 		/*
@@ -1795,21 +1785,6 @@ static efi_status_t EFIAPI efi_unload_image(efi_handle_t image_handle)
 	return EFI_EXIT(EFI_SUCCESS);
 }
 
-/**
- * efi_exit_caches() - fix up caches for EFI payloads if necessary
- */
-static void efi_exit_caches(void)
-{
-#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
-	/*
-	 * Grub on 32bit ARM needs to have caches disabled before jumping into
-	 * a zImage, but does not know of all cache layers. Give it a hand.
-	 */
-	if (efi_is_direct_boot)
-		cleanup_before_linux();
-#endif
-}
-
 /**
  * efi_exit_boot_services() - stop all boot services
  * @image_handle: handle of the loaded image
@@ -1863,9 +1838,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
 
 	board_quiesce_devices();
 
-	/* Fix up caches for EFI payloads if necessary */
-	efi_exit_caches();
-
 	/* This stops all lingering devices */
 	bootm_disable_interrupts();
 
Quoted 7 lines
Quoted 7 lines
Signature · 6 lines
2.19.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>