On 22/6/26 23:25, Philippe Mathieu-Daudé wrote:
On 22/6/26 21:31, Daniel Henrique Barboza wrote:
The PMP emulation isn't present in the KVM driver.
Signed-off-by: Daniel Henrique Barboza <[email protected]>
---
target/riscv/machine.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/target/riscv/machine.c b/target/riscv/machine.c
index ba96ceceef..bd93d6f3a8 100644
--- a/target/riscv/machine.c
+++ b/target/riscv/machine.c
@@ -20,6 +20,7 @@
#include "cpu.h"
#include "qemu/error-report.h"
#include "system/kvm.h"
+#include "system/tcg.h"
#include "migration/cpu.h"
#include "exec/icount.h"
#include "target/riscv/debug.h"
@@ -29,6 +30,10 @@ static bool pmp_needed(void *opaque)
{
RISCVCPU *cpu = opaque;
+ if (kvm_enabled()) {
+ return false;
+ }
+
return cpu->cfg.pmp;
Here we want to keep logic parity, in case another RISCV
accelerator is added:
return tcg_enabled() ? cpu->cfg.pmp : false;
FYI there is also the hwaccel_enabled() helper, but I don't think
it applies here.
}
@@ -39,10 +44,12 @@ static int pmp_post_load(void *opaque, int
version_id)
int i;
uint8_t pmp_regions = riscv_cpu_cfg(env)->pmp_regions;
- for (i = 0; i < pmp_regions; i++) {
- pmp_update_rule_addr(env, i);
+ if (tcg_enabled()) {
+ for (i = 0; i < pmp_regions; i++) {
+ pmp_update_rule_addr(env, i);
+ }
+ pmp_update_rule_nums(env);
}
- pmp_update_rule_nums(env);
return 0;
}