diff options
author | Christoffer Dall <christoffer.dall@linaro.org> | 2016-04-27 10:28:00 +0100 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2016-05-20 15:39:43 +0200 |
commit | b13216cf6010ef482e69875e00711de7f9573c80 (patch) | |
tree | 7d3742fbf51175f95f6853f5fb396187b73837db /arch/arm/kvm | |
parent | 2defaff48aaf16072a6eac4cf8234917197dfa72 (diff) | |
download | op-kernel-dev-b13216cf6010ef482e69875e00711de7f9573c80.zip op-kernel-dev-b13216cf6010ef482e69875e00711de7f9573c80.tar.gz |
KVM: arm/arm64: Provide functionality to pause and resume a guest
For some rare corner cases in our VGIC emulation later we have to stop
the guest to make sure the VGIC state is consistent.
Provide the necessary framework to pause and resume a guest.
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'arch/arm/kvm')
-rw-r--r-- | arch/arm/kvm/arm.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index ceb9345..e89329d 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -492,30 +492,31 @@ bool kvm_arch_intc_initialized(struct kvm *kvm) return vgic_initialized(kvm); } -static void kvm_arm_halt_guest(struct kvm *kvm) __maybe_unused; -static void kvm_arm_resume_guest(struct kvm *kvm) __maybe_unused; - -static void kvm_arm_halt_guest(struct kvm *kvm) +void kvm_arm_halt_guest(struct kvm *kvm) { int i; struct kvm_vcpu *vcpu; kvm_for_each_vcpu(i, vcpu, kvm) vcpu->arch.pause = true; - force_vm_exit(cpu_all_mask); + kvm_make_all_cpus_request(kvm, KVM_REQ_VCPU_EXIT); +} + +static void kvm_arm_resume_vcpu(struct kvm_vcpu *vcpu) +{ + struct swait_queue_head *wq = kvm_arch_vcpu_wq(vcpu); + + vcpu->arch.pause = false; + swake_up(wq); } -static void kvm_arm_resume_guest(struct kvm *kvm) +void kvm_arm_resume_guest(struct kvm *kvm) { int i; struct kvm_vcpu *vcpu; - kvm_for_each_vcpu(i, vcpu, kvm) { - struct swait_queue_head *wq = kvm_arch_vcpu_wq(vcpu); - - vcpu->arch.pause = false; - swake_up(wq); - } + kvm_for_each_vcpu(i, vcpu, kvm) + kvm_arm_resume_vcpu(vcpu); } static void vcpu_sleep(struct kvm_vcpu *vcpu) |