@@ -92,3 +92,9 @@ is used in the hypercall for future use.
Architecture: mips
Status: active
Purpose: Return the frequency of CP0_Count in HZ.
+
+7. KVM_HC_MIPS_EXIT_VM
+------------------------
+Architecture: mips
+Status: active
+Purpose: Shut down the virtual machine.
@@ -40,6 +40,15 @@ static int kvm_mips_hypercall(struct kvm_vcpu *vcpu, unsigned long num,
*hret = (s32)vcpu->arch.count_hz;
break;
+ case KVM_HC_MIPS_EXIT_VM:
+ /* Pass shutdown system event to userland */
+ memset(&vcpu->run->system_event, 0,
+ sizeof(vcpu->run->system_event));
+ vcpu->run->system_event.type = KVM_SYSTEM_EVENT_SHUTDOWN;
+ vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
+ ret = RESUME_HOST;
+ break;
+
default:
/* Report unimplemented hypercall to guest */
*hret = -KVM_ENOSYS;
Implement the MIPS EXIT_VM hypercall used by paravirtual guest kernels. When the guest performs this hypercall, the request is passed to userland in the form of a KVM_EXIT_SYSTEM_EVENT exit reason with system event type KVM_SYSTEM_EVENT_SHUTDOWN. We also document the hypercall along with the others as the documentation was never added. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Radim Krčmář" <rkrcmar@redhat.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com> Cc: David Daney <david.daney@cavium.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org Cc: linux-doc@vger.kernel.org --- Documentation/virtual/kvm/hypercalls.txt | 6 ++++++ arch/mips/kvm/hypcall.c | 9 +++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)