qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/6] target/riscv: flush tb when PMP entry changes


From: LIU Zhiwei
Subject: Re: [PATCH 5/6] target/riscv: flush tb when PMP entry changes
Date: Tue, 18 Apr 2023 15:28:20 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0


On 2023/4/13 17:01, Weiwei Li wrote:
The translation block may also be affected when PMP entry changes.

Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn>
Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn>
---
  target/riscv/pmp.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index aced23c4d5..c2db52361f 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -25,6 +25,7 @@
  #include "cpu.h"
  #include "trace.h"
  #include "exec/exec-all.h"
+#include "exec/tb-flush.h"
static bool pmp_write_cfg(CPURISCVState *env, uint32_t addr_index,
                            uint8_t val);
@@ -492,6 +493,7 @@ void pmpcfg_csr_write(CPURISCVState *env, uint32_t 
reg_index,
      /* If PMP permission of any addr has been changed, flush TLB pages. */
      if (modified) {
          tlb_flush(env_cpu(env));
+        tb_flush(env_cpu(env));

Move this to pmp_update_rules.

Zhiwei

      }
  }
@@ -545,6 +547,7 @@ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
                  env->pmp_state.pmp[addr_index].addr_reg = val;
                  pmp_update_rule(env, addr_index);
                  tlb_flush(env_cpu(env));
+                tb_flush(env_cpu(env));
              }
          } else {
              qemu_log_mask(LOG_GUEST_ERROR,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]