]> Git Repo - qemu.git/blob - target-i386/hyperv.c
Merge remote-tracking branch 'afaerber/qom-cpu.v5' into staging
[qemu.git] / target-i386 / hyperv.c
1 /*
2  * QEMU Hyper-V support
3  *
4  * Copyright Red Hat, Inc. 2011
5  *
6  * Author: Vadim Rozenfeld     <[email protected]>
7  *
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.
10  *
11  */
12
13 #include "hyperv.h"
14
15 static bool hyperv_vapic;
16 static bool hyperv_relaxed_timing;
17 static int hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
18
19 void hyperv_enable_vapic_recommended(bool val)
20 {
21     hyperv_vapic = val;
22 }
23
24 void hyperv_enable_relaxed_timing(bool val)
25 {
26     hyperv_relaxed_timing = val;
27 }
28
29 void hyperv_set_spinlock_retries(int val)
30 {
31     hyperv_spinlock_attempts = val;
32     if (hyperv_spinlock_attempts < 0xFFF) {
33         hyperv_spinlock_attempts = 0xFFF;
34     }
35 }
36
37 bool hyperv_enabled(void)
38 {
39     return hyperv_hypercall_available() || hyperv_relaxed_timing_enabled();
40 }
41
42 bool hyperv_hypercall_available(void)
43 {
44     if (hyperv_vapic ||
45         (hyperv_spinlock_attempts != HYPERV_SPINLOCK_NEVER_RETRY)) {
46       return true;
47     }
48     return false;
49 }
50
51 bool hyperv_vapic_recommended(void)
52 {
53     return hyperv_vapic;
54 }
55
56 bool hyperv_relaxed_timing_enabled(void)
57 {
58     return hyperv_relaxed_timing;
59 }
60
61 int hyperv_get_spinlock_retries(void)
62 {
63     return hyperv_spinlock_attempts;
64 }
This page took 0.026914 seconds and 4 git commands to generate.