|
From: openocd-gerrit <ope...@us...> - 2025-11-12 20:33:48
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 18734bcf953324f9f40b518bc973634bfd9f41cd (commit)
from ffdbdf6b03438a7c4474d98a60873a7b31e38880 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 18734bcf953324f9f40b518bc973634bfd9f41cd
Author: Tomas Vanek <va...@fb...>
Date: Fri May 16 11:06:10 2025 +0800
target/riscv: fix get mode filed for vsatp and hgatp
Imported from
https://github.com/riscv-collab/riscv-openocd/pull/1258
developed by Mark Zhuang <mar...@sp...>
Add the necessary get_filed and add a comment to indicate
this section is for VU/VS mode
Change-Id: I898bba6250258c5076a98eb95411fcabccc52b96
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9144
Reviewed-by: Evgeniy Naydanov <evg...@sy...>
Tested-by: jenkins
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 3e587732e..7ad695c20 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -3034,6 +3034,8 @@ static int riscv_mmu(struct target *target, bool *enabled)
unsigned int xlen = riscv_xlen(target);
if (v_mode) {
+ /* In VU or VS mode, MMU is considered enabled when
+ * either hgatp or vsatp mode is not OFF */
riscv_reg_t vsatp;
if (riscv_reg_get(target, &vsatp, GDB_REGNO_VSATP) != ERROR_OK) {
LOG_TARGET_ERROR(target, "Failed to read vsatp register; priv=0x%" PRIx64,
@@ -3041,7 +3043,7 @@ static int riscv_mmu(struct target *target, bool *enabled)
return ERROR_FAIL;
}
/* vsatp is identical to satp, so we can use the satp macros. */
- if (RISCV_SATP_MODE(xlen) != SATP_MODE_OFF) {
+ if (get_field(vsatp, RISCV_SATP_MODE(xlen)) != SATP_MODE_OFF) {
LOG_TARGET_DEBUG(target, "VS-stage translation is enabled.");
*enabled = true;
return ERROR_OK;
@@ -3053,7 +3055,7 @@ static int riscv_mmu(struct target *target, bool *enabled)
priv);
return ERROR_FAIL;
}
- if (RISCV_HGATP_MODE(xlen) != HGATP_MODE_OFF) {
+ if (get_field(hgatp, RISCV_HGATP_MODE(xlen)) != HGATP_MODE_OFF) {
LOG_TARGET_DEBUG(target, "G-stage address translation is enabled.");
*enabled = true;
} else {
-----------------------------------------------------------------------
Summary of changes:
src/target/riscv/riscv.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|