target/riscv: flush TLB pages if PMP permission has been changed

If PMP permission of any address has been changed by updating PMP entry,
flush all TLB pages to prevent from getting old permission.

Backports 2c2e0f2842520bcd25472285cfce39696e52e662
This commit is contained in:
Jim Shu 2021-03-30 15:09:11 -04:00 committed by Lioncash
parent 7dad65cea1
commit 85ccd1a71e

View file

@ -28,6 +28,7 @@
#include "qapi/error.h"
#include "cpu.h"
#include "qemu-common.h"
#include "exec/exec-all.h"
#ifndef CONFIG_USER_ONLY
@ -350,6 +351,9 @@ void pmpcfg_csr_write(CPURISCVState *env, uint32_t reg_index,
cfg_val = (val >> 8 * i) & 0xff;
pmp_write_cfg(env, (reg_index * 4) + i, cfg_val);
}
/* If PMP permission of any addr has been changed, flush TLB pages. */
tlb_flush(env_cpu(env));
}