target/riscv/machine.c: do not migrate pmp state with kvm
The PMP emulation isn't present in the KVM driver. Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20260703180538.3346781-6-daniel.barboza@oss.qualcomm.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Daniel Henrique Barboza committed
Jul 3, 2026 at 15:05 UTC
6f6f6aaa26f23df0bf4d2040d5b362fa5b2bce31
1 file changed
+9
-4
target/riscv/machine.c
+9
-4
@@ -20,6 +20,7 @@
20
#include "cpu.h"
21
#include "qemu/error-report.h"
22
#include "system/kvm.h"
23
+#include "system/tcg.h"
24
#include "migration/cpu.h"
25
#include "exec/icount.h"
26
#include "target/riscv/debug.h"
@@ -29,21 +30,25 @@ static bool pmp_needed(void *opaque)
30
{
31
RISCVCPU *cpu = opaque;
32
32
- return cpu->cfg.pmp;
33
+ if (kvm_enabled()) {
34
+ return false;
35
+ }
36
+
37
+ return tcg_enabled() && cpu->cfg.pmp;
38
}
39
40
static int pmp_post_load(void *opaque, int version_id)
41
{
42
+#ifdef CONFIG_TCG
43
RISCVCPU *cpu = opaque;
44
CPURISCVState *env = &cpu->env;
39
- int i;
45
uint8_t pmp_regions = riscv_cpu_cfg(env)->pmp_regions;
46
42
- for (i = 0; i < pmp_regions; i++) {
47
+ for (int i = 0; i < pmp_regions; i++) {
48
pmp_update_rule_addr(env, i);
49
}
50
pmp_update_rule_nums(env);
46
-
51
+#endif
52
return 0;
53
}
54