aboutsummaryrefslogtreecommitdiff
path: root/target-i386/hyperv.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-01-23 11:00:26 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-23 11:00:26 -0600
commit5b4448d27d7c6ff6e18a1edc8245cb1db783e37c (patch)
treea3b896984ff6ae566892eb198e5b34b197288194 /target-i386/hyperv.c
parentc4ccbeaca521bdbf5cb8db37dc67c47e1add0586 (diff)
parent6a48ffaaa732b2142c1b5030178f2d4a0fa499fe (diff)
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
* qemu-kvm/uq/master: kvm: Activate in-kernel irqchip support kvm: x86: Add user space part for in-kernel IOAPIC kvm: x86: Add user space part for in-kernel i8259 kvm: x86: Add user space part for in-kernel APIC kvm: x86: Establish IRQ0 override control kvm: Introduce core services for in-kernel irqchip support memory: Introduce memory_region_init_reservation ioapic: Factor out base class for KVM reuse ioapic: Drop post-load irr initialization i8259: Factor out base class for KVM reuse i8259: Completely privatize PicState apic: Open-code timer save/restore apic: Factor out base class for KVM reuse apic: Introduce apic_report_irq_delivered apic: Inject external NMI events via LINT1 apic: Stop timer on reset kvm: Move kvmclock into hw/kvm folder msi: Generalize msix_supported to msi_supported hyper-v: initialize Hyper-V CPUID leaves. hyper-v: introduce Hyper-V support infrastructure. Conflicts: Makefile.target Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'target-i386/hyperv.c')
-rw-r--r--target-i386/hyperv.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/target-i386/hyperv.c b/target-i386/hyperv.c
new file mode 100644
index 0000000000..f284e99772
--- /dev/null
+++ b/target-i386/hyperv.c
@@ -0,0 +1,64 @@
+/*
+ * QEMU Hyper-V support
+ *
+ * Copyright Red Hat, Inc. 2011
+ *
+ * Author: Vadim Rozenfeld <vrozenfe@redhat.com>
+ *
+ * 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 "hyperv.h"
+
+static bool hyperv_vapic;
+static bool hyperv_relaxed_timing;
+static int hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
+
+void hyperv_enable_vapic_recommended(bool val)
+{
+ hyperv_vapic = val;
+}
+
+void hyperv_enable_relaxed_timing(bool val)
+{
+ hyperv_relaxed_timing = val;
+}
+
+void hyperv_set_spinlock_retries(int val)
+{
+ hyperv_spinlock_attempts = val;
+ if (hyperv_spinlock_attempts < 0xFFF) {
+ hyperv_spinlock_attempts = 0xFFF;
+ }
+}
+
+bool hyperv_enabled(void)
+{
+ return hyperv_hypercall_available() || hyperv_relaxed_timing_enabled();
+}
+
+bool hyperv_hypercall_available(void)
+{
+ if (hyperv_vapic ||
+ (hyperv_spinlock_attempts != HYPERV_SPINLOCK_NEVER_RETRY)) {
+ return true;
+ }
+ return false;
+}
+
+bool hyperv_vapic_recommended(void)
+{
+ return hyperv_vapic;
+}
+
+bool hyperv_relaxed_timing_enabled(void)
+{
+ return hyperv_relaxed_timing;
+}
+
+int hyperv_get_spinlock_retries(void)
+{
+ return hyperv_spinlock_attempts;
+}