diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-04-04 11:15:05 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-06-28 14:27:59 +0200 |
commit | 9638cbde6c4f433b157672c0fdee783c10be45fe (patch) | |
tree | 86ec1808b1019729afa4843ec94b80122e5cc025 /target/riscv/machine.c | |
parent | 0573997713eb0a37ab98b545794e18b868b471ea (diff) | |
download | qemu-9638cbde6c4f433b157672c0fdee783c10be45fe.zip qemu-9638cbde6c4f433b157672c0fdee783c10be45fe.tar.gz qemu-9638cbde6c4f433b157672c0fdee783c10be45fe.tar.bz2 |
target/riscv: Restrict KVM-specific fields from ArchCPU
These fields shouldn't be accessed when KVM is not available.
Restrict the KVM timer migration state. Rename the KVM timer
post_load() handler accordingly, because cpu_post_load() is
too generic.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-Id: <20230626232007.8933-3-philmd@linaro.org>
Diffstat (limited to 'target/riscv/machine.c')
-rw-r--r-- | target/riscv/machine.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/target/riscv/machine.c b/target/riscv/machine.c index 3ce2970..c7c862c 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -194,12 +194,13 @@ static const VMStateDescription vmstate_rv128 = { } }; +#ifdef CONFIG_KVM static bool kvmtimer_needed(void *opaque) { return kvm_enabled(); } -static int cpu_post_load(void *opaque, int version_id) +static int cpu_kvmtimer_post_load(void *opaque, int version_id) { RISCVCPU *cpu = opaque; CPURISCVState *env = &cpu->env; @@ -213,7 +214,7 @@ static const VMStateDescription vmstate_kvmtimer = { .version_id = 1, .minimum_version_id = 1, .needed = kvmtimer_needed, - .post_load = cpu_post_load, + .post_load = cpu_kvmtimer_post_load, .fields = (VMStateField[]) { VMSTATE_UINT64(env.kvm_timer_time, RISCVCPU), VMSTATE_UINT64(env.kvm_timer_compare, RISCVCPU), @@ -221,6 +222,7 @@ static const VMStateDescription vmstate_kvmtimer = { VMSTATE_END_OF_LIST() } }; +#endif static bool debug_needed(void *opaque) { @@ -409,7 +411,9 @@ const VMStateDescription vmstate_riscv_cpu = { &vmstate_vector, &vmstate_pointermasking, &vmstate_rv128, +#ifdef CONFIG_KVM &vmstate_kvmtimer, +#endif &vmstate_envcfg, &vmstate_debug, &vmstate_smstateen, |