Add Hyper-V VMBus hypercalls blank handlers which
just returns error code - HV_STATUS_INVALID_HYPERCALL_CODE.

Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com>
Reviewed-by: Roman Kagan <rka...@virtuozzo.com>
CC: Paolo Bonzini <pbonz...@redhat.com>
CC: Richard Henderson <r...@twiddle.net>
CC: Eduardo Habkost <ehabk...@redhat.com>
CC: "Andreas Färber" <afaer...@suse.de>
CC: Marcelo Tosatti <mtosa...@redhat.com>
CC: Roman Kagan <rka...@virtuozzo.com>
CC: Denis V. Lunev <d...@openvz.org>
CC: k...@vger.kernel.org
---
 target-i386/hyperv.c | 14 ++++++++++++++
 target-i386/hyperv.h |  2 ++
 target-i386/kvm.c    |  3 +++
 3 files changed, 19 insertions(+)

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;
-- 
2.4.3


Reply via email to