Merge remote-tracking branch 'bonzini/scsi-next' into staging
[qemu/opensuse.git] / target-i386 / hyperv.c
blobf284e997722d00a5e8fae3c0f6d9ddcf27c20089
1 /*
2 * QEMU Hyper-V support
4 * Copyright Red Hat, Inc. 2011
6 * Author: Vadim Rozenfeld <vrozenfe@redhat.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
9 * See the COPYING file in the top-level directory.
13 #include "hyperv.h"
15 static bool hyperv_vapic;
16 static bool hyperv_relaxed_timing;
17 static int hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
19 void hyperv_enable_vapic_recommended(bool val)
21 hyperv_vapic = val;
24 void hyperv_enable_relaxed_timing(bool val)
26 hyperv_relaxed_timing = val;
29 void hyperv_set_spinlock_retries(int val)
31 hyperv_spinlock_attempts = val;
32 if (hyperv_spinlock_attempts < 0xFFF) {
33 hyperv_spinlock_attempts = 0xFFF;
37 bool hyperv_enabled(void)
39 return hyperv_hypercall_available() || hyperv_relaxed_timing_enabled();
42 bool hyperv_hypercall_available(void)
44 if (hyperv_vapic ||
45 (hyperv_spinlock_attempts != HYPERV_SPINLOCK_NEVER_RETRY)) {
46 return true;
48 return false;
51 bool hyperv_vapic_recommended(void)
53 return hyperv_vapic;
56 bool hyperv_relaxed_timing_enabled(void)
58 return hyperv_relaxed_timing;
61 int hyperv_get_spinlock_retries(void)
63 return hyperv_spinlock_attempts;