]> git.proxmox.com Git - qemu.git/blame - target-i386/hyperv.c
usb-host: add usb_host_full_speed_compat
[qemu.git] / target-i386 / hyperv.c
CommitLineData
28f52cc0
VR
1/*
2 * QEMU Hyper-V support
3 *
4 * Copyright Red Hat, Inc. 2011
5 *
6 * Author: Vadim Rozenfeld <vrozenfe@redhat.com>
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
15static bool hyperv_vapic;
16static bool hyperv_relaxed_timing;
17static int hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
18
19void hyperv_enable_vapic_recommended(bool val)
20{
21 hyperv_vapic = val;
22}
23
24void hyperv_enable_relaxed_timing(bool val)
25{
26 hyperv_relaxed_timing = val;
27}
28
29void 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
37bool hyperv_enabled(void)
38{
39 return hyperv_hypercall_available() || hyperv_relaxed_timing_enabled();
40}
41
42bool 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
51bool hyperv_vapic_recommended(void)
52{
53 return hyperv_vapic;
54}
55
56bool hyperv_relaxed_timing_enabled(void)
57{
58 return hyperv_relaxed_timing;
59}
60
61int hyperv_get_spinlock_retries(void)
62{
63 return hyperv_spinlock_attempts;
64}