diff mbox

[v1,2/2] target-i386/kvm: Hyper-V VMBus hypercalls blank handlers

Message ID 1452597070-25985-3-git-send-email-asmetanin@virtuozzo.com
State New
Headers show

Commit Message

Andrey Smetanin Jan. 12, 2016, 11:11 a.m. UTC
Add Hyper-V VMBus hypercalls blank handlers which
just returns error code - HV_STATUS_INVALID_HYPERCALL_CODE.

Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Richard Henderson <rth@twiddle.net>
CC: Eduardo Habkost <ehabkost@redhat.com>
CC: "Andreas Färber" <afaerber@suse.de>
CC: Marcelo Tosatti <mtosatti@redhat.com>
CC: Roman Kagan <rkagan@virtuozzo.com>
CC: Denis V. Lunev <den@openvz.org>
CC: kvm@vger.kernel.org
---
 target-i386/hyperv.c | 14 ++++++++++++++
 target-i386/hyperv.h |  2 ++
 target-i386/kvm.c    |  3 +++
 3 files changed, 19 insertions(+)
diff mbox

Patch

diff --git a/target-i386/hyperv.c b/target-i386/hyperv.c
index e79b173..bd09506 100644
--- a/target-i386/hyperv.c
+++ b/target-i386/hyperv.c
@@ -125,3 +125,17 @@  int kvm_hv_sint_route_set_sint(HvSintRoute *sint_route)
 {
     return event_notifier_set(&sint_route->sint_set_notifier);
 }
+
+int kvm_hv_handle_hypercall(X86CPU *cpu, struct kvm_run *run)
+{
+    uint16_t code;
+
+    code  = run->hv_hcall.input & 0xffff;
+    switch (code) {
+    case HV_X64_HCALL_POST_MESSAGE:
+    case HV_X64_HCALL_SIGNAL_EVENT:
+    default:
+        run->hv_hcall.result = HV_STATUS_INVALID_HYPERCALL_CODE;
+        return 0;
+    }
+}
diff --git a/target-i386/hyperv.h b/target-i386/hyperv.h
index b26201f..9515b6e 100644
--- a/target-i386/hyperv.h
+++ b/target-i386/hyperv.h
@@ -39,4 +39,6 @@  void kvm_hv_sint_route_destroy(HvSintRoute *sint_route);
 
 int kvm_hv_sint_route_set_sint(HvSintRoute *sint_route);
 
+int kvm_hv_handle_hypercall(X86CPU *cpu, struct kvm_run *run);
+
 #endif
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index ab65a6e..adb1d64 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -3026,6 +3026,9 @@  int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
         ioapic_eoi_broadcast(run->eoi.vector);
         ret = 0;
         break;
+    case KVM_EXIT_HYPERV_HCALL:
+        ret = kvm_hv_handle_hypercall(cpu, run);
+        break;
     default:
         fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
         ret = -1;