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.
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
)
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)
45 (hyperv_spinlock_attempts
!= HYPERV_SPINLOCK_NEVER_RETRY
)) {
51 bool hyperv_vapic_recommended(void)
56 bool hyperv_relaxed_timing_enabled(void)
58 return hyperv_relaxed_timing
;
61 int hyperv_get_spinlock_retries(void)
63 return hyperv_spinlock_attempts
;