]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: resume needs to be a global
authorAnton Blanchard <antonb@tenstorrent.com>
Thu, 8 Aug 2024 02:14:17 +0000 (02:14 +0000)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Tue, 29 Oct 2024 11:58:14 +0000 (19:58 +0800)
If we take an exception before u-boot is relocated, there's a good
chance we will end up in an endless loop of exceptions because resume is
invalid until after relocation.

Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
arch/riscv/include/asm/global_data.h
arch/riscv/lib/interrupts.c

index 593d9276d35affa3d9d55c61b7a676c6a67b3841..d356752a56aa7ee6afa8b163379763f371c2b1c2 100644 (file)
@@ -42,6 +42,7 @@ struct arch_global_data {
 #ifdef CONFIG_SMBIOS
        ulong smbios_start;             /* Start address of SMBIOS table */
 #endif
+       struct resume_data *resume;
 };
 
 #include <asm-generic/global_data.h>
index 714cc92d03e0f6164959372016729ef3271d582a..ef1056eeb6f0215469000545769d13fa509d3db0 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static struct resume_data *resume;
-
 void set_resume(struct resume_data *data)
 {
-       resume = data;
+       gd->arch.resume = data;
 }
 
 static void show_efi_loaded_images(uintptr_t epc)
@@ -138,9 +136,9 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
                "Store/AMO page fault",
        };
 
-       if (resume) {
-               resume->code = code;
-               longjmp(resume->jump, 1);
+       if (gd->arch.resume) {
+               gd->arch.resume->code = code;
+               longjmp(gd->arch.resume->jump, 1);
        }
 
        if (code < ARRAY_SIZE(exception_code))