[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 36/48] i386: add hyperv-stub for CONFIG_HYPERV=n
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 36/48] i386: add hyperv-stub for CONFIG_HYPERV=n |
Date: |
Thu, 18 Oct 2018 22:32:03 +0200 |
From: Roman Kagan <address@hidden>
This will allow to build slightly leaner QEMU that supports some HyperV
features of KVM (e.g. SynIC timers, PV spinlocks, APIC assists, etc.)
but nothing else on the QEMU side.
Signed-off-by: Roman Kagan <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target/i386/Makefile.objs | 17 ++++++++++-------
target/i386/hyperv-stub.c | 35 +++++++++++++++++++++++++++++++++++
target/i386/hyperv.h | 2 ++
3 files changed, 47 insertions(+), 7 deletions(-)
create mode 100644 target/i386/hyperv-stub.c
diff --git a/target/i386/Makefile.objs b/target/i386/Makefile.objs
index 04678f5..32bf966 100644
--- a/target/i386/Makefile.objs
+++ b/target/i386/Makefile.objs
@@ -3,17 +3,20 @@ obj-$(CONFIG_TCG) += translate.o
obj-$(CONFIG_TCG) += bpt_helper.o cc_helper.o excp_helper.o fpu_helper.o
obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o mpx_helper.o
obj-$(CONFIG_TCG) += seg_helper.o smm_helper.o svm_helper.o
-obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o
-obj-$(CONFIG_KVM) += kvm.o hyperv.o
-obj-$(CONFIG_SEV) += sev.o
+ifeq ($(CONFIG_SOFTMMU),y)
+obj-y += machine.o arch_memory_mapping.o arch_dump.o monitor.o
+obj-$(CONFIG_KVM) += kvm.o
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
-obj-$(call lnot,$(CONFIG_SEV)) += sev-stub.o
-# HAX support
-ifdef CONFIG_WIN32
+obj-$(CONFIG_HYPERV) += hyperv.o
+obj-$(call lnot,$(CONFIG_HYPERV)) += hyperv-stub.o
+ifeq ($(CONFIG_WIN32),y)
obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-windows.o
endif
-ifdef CONFIG_DARWIN
+ifeq ($(CONFIG_DARWIN),y)
obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-darwin.o
obj-$(CONFIG_HVF) += hvf/
endif
obj-$(CONFIG_WHPX) += whpx-all.o
+endif
+obj-$(CONFIG_SEV) += sev.o
+obj-$(call lnot,$(CONFIG_SEV)) += sev-stub.o
diff --git a/target/i386/hyperv-stub.c b/target/i386/hyperv-stub.c
new file mode 100644
index 0000000..5919ba8
--- /dev/null
+++ b/target/i386/hyperv-stub.c
@@ -0,0 +1,35 @@
+/*
+ * Stubs for CONFIG_HYPERV=n
+ *
+ * Copyright (c) 2015-2018 Virtuozzo International GmbH.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hyperv.h"
+
+#ifdef CONFIG_KVM
+int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
+{
+ switch (exit->type) {
+ case KVM_EXIT_HYPERV_SYNIC:
+ if (!cpu->hyperv_synic) {
+ return -1;
+ }
+
+ /*
+ * Tracking the changes in the MSRs is unnecessary as there are no
+ * users for them beside save/load, which is handled nicely by the
+ * generic MSR save/load code
+ */
+ return 0;
+ case KVM_EXIT_HYPERV_HCALL:
+ exit->u.hcall.result = HV_STATUS_INVALID_HYPERCALL_CODE;
+ return 0;
+ default:
+ return -1;
+ }
+}
+#endif
diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h
index 5c49251..f0a27c3 100644
--- a/target/i386/hyperv.h
+++ b/target/i386/hyperv.h
@@ -18,6 +18,8 @@
#include "sysemu/kvm.h"
#include "hw/hyperv/hyperv.h"
+#ifdef CONFIG_KVM
int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit);
+#endif
#endif
--
1.8.3.1
- [Qemu-devel] [PULL 39/48] hyperv: only add SynIC in compatible configurations, (continued)
- [Qemu-devel] [PULL 39/48] hyperv: only add SynIC in compatible configurations, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 34/48] hyperv: factor out arch-independent API into hw/hyperv, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 41/48] hyperv: add synic message delivery, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 30/48] hyperv: make HvSintRoute reference-counted, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 42/48] hyperv: add synic event flag signaling, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 28/48] hyperv: allow passing arbitrary data to sint ack callback, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 31/48] hyperv: rename kvm_hv_sint_route_set_sint, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 40/48] hyperv: make overlay pages for SynIC, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 44/48] hyperv: add support for KVM_HYPERV_EVENTFD, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 32/48] hyperv: split hyperv-proto.h into x86 and arch-independent parts, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 36/48] i386: add hyperv-stub for CONFIG_HYPERV=n,
Paolo Bonzini <=
- [Qemu-devel] [PULL 43/48] hyperv: process SIGNAL_EVENT hypercall, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 46/48] hyperv_testdev: add SynIC message and event testmodes, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 45/48] hyperv: process POST_MESSAGE hypercall, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 47/48] target/i386: kvm: just return after migrate_add_blocker failed, Paolo Bonzini, 2018/10/18
- [Qemu-devel] [PULL 48/48] replay: pass raw icount value to replay_save_clock, Paolo Bonzini, 2018/10/18
- Re: [Qemu-devel] [PULL 00/48] Miscellaneous patches for 2018-10-18, Paolo Bonzini, 2018/10/19