diff options
author | Beata Michalska <beata.michalska@linaro.org> | 2020-03-12 00:34:00 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-03-12 16:31:10 +0000 |
commit | aca53be34ac3e7cac5f39396a51a338860a5a837 (patch) | |
tree | 2928643f774eb828dcc519cd78714c91948eb57d /target/arm/kvm64.c | |
parent | 6785aee00c0797c1c8ce7d07dc434ace464f97ea (diff) | |
download | qemu-aca53be34ac3e7cac5f39396a51a338860a5a837.zip qemu-aca53be34ac3e7cac5f39396a51a338860a5a837.tar.gz qemu-aca53be34ac3e7cac5f39396a51a338860a5a837.tar.bz2 |
target/arm: kvm: Inject events at the last stage of sync
KVM_SET_VCPU_EVENTS might actually lead to vcpu registers being modified.
As such this should be the last step of sync to avoid potential overwriting
of whatever changes KVM might have done.
Signed-off-by: Beata Michalska <beata.michalska@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-id: 20200312003401.29017-2-beata.michalska@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/kvm64.c')
-rw-r--r-- | target/arm/kvm64.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 93ba144..be5b31c 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -1094,17 +1094,22 @@ int kvm_arch_put_registers(CPUState *cs, int level) return ret; } - ret = kvm_put_vcpu_events(cpu); - if (ret) { - return ret; - } - write_cpustate_to_list(cpu, true); if (!write_list_to_kvmstate(cpu, level)) { return -EINVAL; } + /* + * Setting VCPU events should be triggered after syncing the registers + * to avoid overwriting potential changes made by KVM upon calling + * KVM_SET_VCPU_EVENTS ioctl + */ + ret = kvm_put_vcpu_events(cpu); + if (ret) { + return ret; + } + kvm_arm_sync_mpstate_to_kvm(cpu); return ret; |