Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] riscv: fix using wrong load type
@ 2025-08-19  2:19 Jimmy Ho
  2025-08-19  2:27 ` Troy Mitchell
  2025-08-19  3:33 ` Yao Zi
  0 siblings, 2 replies; 3+ messages in thread
From: Jimmy Ho @ 2025-08-19  2:19 UTC (permalink / raw)
  To: linux-riscv; +Cc: troy.mitchell, Jimmy Ho

thread_info.cpu field is 32 bits wide,
but is accessed using an XLEN-bit load, which might be 64bit load, fix it

Signed-off-by: Jimmy Ho <jimmy.ho@sifive.com>

Changes in v2:
- add a comment to explain why use lw instead of REG_L.
- correct commit message
---
 arch/riscv/kernel/entry.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index 3a0ec6fd5956..82306cecfdcb 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -45,8 +45,10 @@
 	 * Computes:
 	 * a0 = &new_vmalloc[BIT_WORD(cpu)]
 	 * a1 = BIT_MASK(cpu)
+	 * 
+	 * using lw instead of REG_L is because the thread_info.cpu field is 32 bits wide
 	 */
-	REG_L 	a2, TASK_TI_CPU(tp)
+	lw a2, TASK_TI_CPU(tp)
 	/*
 	 * Compute the new_vmalloc element position:
 	 * (cpu / 64) * 8 = (cpu >> 6) << 3
-- 
2.39.3


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-19  3:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19  2:19 [PATCH v2] riscv: fix using wrong load type Jimmy Ho
2025-08-19  2:27 ` Troy Mitchell
2025-08-19  3:33 ` Yao Zi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox