Blame SOURCES/0274-linuxefi-Invalidate-i-cache-before-starting-the-kern.patch

fd0330
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
fd0330
From: dann frazier <dann.frazier@canonical.com>
fd0330
Date: Thu, 25 Aug 2022 17:08:09 -0600
fd0330
Subject: [PATCH] linuxefi: Invalidate i-cache before starting the kernel
fd0330
fd0330
We need to flush the memory range of the code we are about to execute
fd0330
from the instruction cache before we can safely execute it. Not doing
fd0330
so appears to be the source of rare synchronous exceptions a user
fd0330
is seeing on a Cortex-A72-based platform while executing the Linux EFI
fd0330
stub. Notably they seem to correlate with an instruction on a cache
fd0330
line boundary.
fd0330
fd0330
Signed-off-by: dann frazier <dann.frazier@canonical.com>
fd0330
---
fd0330
 grub-core/loader/efi/linux.c | 4 ++++
fd0330
 1 file changed, 4 insertions(+)
fd0330
fd0330
diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
fd0330
index 277f352e0c..e413bdcc23 100644
fd0330
--- a/grub-core/loader/efi/linux.c
fd0330
+++ b/grub-core/loader/efi/linux.c
fd0330
@@ -16,6 +16,7 @@
fd0330
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
fd0330
  */
fd0330
 
fd0330
+#include <grub/cache.h>
fd0330
 #include <grub/err.h>
fd0330
 #include <grub/mm.h>
fd0330
 #include <grub/types.h>
fd0330
@@ -210,6 +211,9 @@ grub_efi_linux_boot (grub_addr_t kernel_addr, grub_size_t kernel_size,
fd0330
   asm volatile ("cli");
fd0330
 #endif
fd0330
 
fd0330
+  /* Invalidate the instruction cache */
fd0330
+  grub_arch_sync_caches((void *)kernel_addr, kernel_size);
fd0330
+
fd0330
   hf = (handover_func)((char *)kernel_addr + handover_offset + offset);
fd0330
   hf (grub_efi_image_handle, grub_efi_system_table, kernel_params);
fd0330