* [PATCH] riscv: resume needs to be a global
@ 2024-08-08 2:14 Anton Blanchard
2024-10-29 11:55 ` Leo Liang
0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2024-08-08 2:14 UTC (permalink / raw)
To: rick, ycliang, trini, sjg, u-boot; +Cc: Anton Blanchard
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>
---
arch/riscv/include/asm/global_data.h | 1 +
arch/riscv/lib/interrupts.c | 10 ++++------
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h
index 593d9276d3..d356752a56 100644
--- a/arch/riscv/include/asm/global_data.h
+++ b/arch/riscv/include/asm/global_data.h
@@ -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>
diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c
index f9a1428a48..a0e069e749 100644
--- a/arch/riscv/lib/interrupts.c
+++ b/arch/riscv/lib/interrupts.c
@@ -22,11 +22,9 @@
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)
@@ -140,9 +138,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))
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] riscv: resume needs to be a global
2024-08-08 2:14 [PATCH] riscv: resume needs to be a global Anton Blanchard
@ 2024-10-29 11:55 ` Leo Liang
0 siblings, 0 replies; 2+ messages in thread
From: Leo Liang @ 2024-10-29 11:55 UTC (permalink / raw)
To: Anton Blanchard; +Cc: rick, trini, sjg, u-boot
On Thu, Aug 08, 2024 at 02:14:17AM +0000, Anton Blanchard wrote:
> 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>
> ---
> arch/riscv/include/asm/global_data.h | 1 +
> arch/riscv/lib/interrupts.c | 10 ++++------
> 2 files changed, 5 insertions(+), 6 deletions(-)
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-29 11:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 2:14 [PATCH] riscv: resume needs to be a global Anton Blanchard
2024-10-29 11:55 ` Leo Liang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.