efi_loader: re-enable GRUB workaround on 32bit ARM
GRUB on ARM 32bit prior to version 2.04 lacks proper handling of caches.
In U-Boot v2019.04 a workaround for this was inadvertently removed.
The workaround is currently also needed for booting on systems with caches
that cannot be managed via CP15 (e.g. with an i.MX6 CPU).
Re-enable the workaround and make it customizable.
Fixes: f69d63fae2 ("efi_loader: use efi_start_image() for bootefi")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
			
			
This commit is contained in:
		
							parent
							
								
									d0d07ba86a
								
							
						
					
					
						commit
						6f3badb67d
					
				|  | @ -107,4 +107,12 @@ config EFI_HAVE_RUNTIME_RESET | ||||||
| 	default y | 	default y | ||||||
| 	depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || SYSRESET_X86 | 	depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || SYSRESET_X86 | ||||||
| 
 | 
 | ||||||
|  | config EFI_GRUB_ARM32_WORKAROUND | ||||||
|  | 	bool "Workaround for GRUB on 32bit ARM" | ||||||
|  | 	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. | ||||||
| endif | endif | ||||||
|  |  | ||||||
|  | @ -39,14 +39,6 @@ LIST_HEAD(efi_register_notify_events); | ||||||
| /* Handle of the currently executing image */ | /* Handle of the currently executing image */ | ||||||
| static efi_handle_t current_image; | static efi_handle_t current_image; | ||||||
| 
 | 
 | ||||||
| /*
 |  | ||||||
|  * 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 | #ifdef CONFIG_ARM | ||||||
| /*
 | /*
 | ||||||
|  * The "gd" pointer lives in a register on ARM and AArch64 that we declare |  * The "gd" pointer lives in a register on ARM and AArch64 that we declare | ||||||
|  | @ -1911,13 +1903,21 @@ error: | ||||||
|  */ |  */ | ||||||
| static void efi_exit_caches(void) | static void efi_exit_caches(void) | ||||||
| { | { | ||||||
| #if defined(CONFIG_ARM) && !defined(CONFIG_ARM64) | #if defined(CONFIG_EFI_GRUB_ARM32_WORKAROUND) | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Grub on 32bit ARM needs to have caches disabled before jumping into | 	 * Boooting Linux via GRUB prior to version 2.04 fails on 32bit ARM if | ||||||
| 	 * a zImage, but does not know of all cache layers. Give it a hand. | 	 * 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. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (efi_is_direct_boot) | 	cleanup_before_linux(); | ||||||
| 		cleanup_before_linux(); |  | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2893,8 +2893,6 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle, | ||||||
| 	if (ret != EFI_SUCCESS) | 	if (ret != EFI_SUCCESS) | ||||||
| 		return EFI_EXIT(EFI_INVALID_PARAMETER); | 		return EFI_EXIT(EFI_INVALID_PARAMETER); | ||||||
| 
 | 
 | ||||||
| 	efi_is_direct_boot = false; |  | ||||||
| 
 |  | ||||||
| 	image_obj->exit_data_size = exit_data_size; | 	image_obj->exit_data_size = exit_data_size; | ||||||
| 	image_obj->exit_data = exit_data; | 	image_obj->exit_data = exit_data; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue