target/riscv: Fix mode in riscv_tlb_fill
authorIrina Ryapolova <irina.ryapolova@syntacore.com>
Wed, 20 Mar 2024 17:28:28 +0000 (20:28 +0300)
committerAlistair Francis <alistair.francis@wdc.com>
Fri, 22 Mar 2024 05:32:33 +0000 (15:32 +1000)
Need to convert mmu_idx to privilege mode for PMP function.

Signed-off-by: Irina Ryapolova <irina.ryapolova@syntacore.com>
Fixes: b297129ae1 ("target/riscv: propagate PMP permission to TLB page")
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <20240320172828.23965-1-irina.ryapolova@syntacore.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/cpu_helper.c

index ce7322011d5d651fe37ea57e89a1aff39b9777e3..fc090d729a1be6185cb51419a319fffbcc0efd42 100644 (file)
@@ -1315,7 +1315,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
     bool two_stage_lookup = mmuidx_2stage(mmu_idx);
     bool two_stage_indirect_error = false;
     int ret = TRANSLATE_FAIL;
-    int mode = mmu_idx;
+    int mode = mmuidx_priv(mmu_idx);
     /* default TLB page size */
     target_ulong tlb_size = TARGET_PAGE_SIZE;