|
From: <ge...@op...> - 2025-09-23 16:54:11
|
This is an automated email from Gerrit. "Tomas Vanek <va...@fb...>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9143 -- gerrit commit 1fa033ecb95663c27993bbbb325e82810554a9a4 Author: zhefan.lv <zhe...@sp...> Date: Thu May 15 16:32:19 2025 +0800 target/riscv: fix address translation in hypervisor mode Imported from https://github.com/riscv-collab/riscv-openocd/pull/1258 address translation don't need to care hstatus.HU Checkpatch-ignore: NO_AUTHOR_SIGN_OFF Change-Id: I40a15ec17347dffaa6e663a637150dfb393471a0 Signed-off-by: Tomas Vanek <va...@fb...> diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 44a02a145f..a52e0b9237 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -3045,22 +3045,6 @@ static int riscv_mmu(struct target *target, bool *enabled) unsigned int xlen = riscv_xlen(target); if (v_mode) { - /* vsatp and hgatp registers are considered active for the - * purposes of the address-translation algorithm unless the - * effective privilege mode is U and hstatus.HU=0. */ - if (effective_mode == PRV_U) { - riscv_reg_t hstatus; - if (riscv_reg_get(target, &hstatus, GDB_REGNO_HSTATUS) != ERROR_OK) { - LOG_TARGET_ERROR(target, "Failed to read hstatus register."); - return ERROR_FAIL; - } - - if (get_field(hstatus, HSTATUS_HU) == 0) - /* In hypervisor mode regular satp translation - * doesn't happen. */ - return ERROR_OK; - } - 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, -- |