Index: sys/dev/hyperv/vmbus/hv_hv.c =================================================================== --- sys/dev/hyperv/vmbus/hv_hv.c +++ sys/dev/hyperv/vmbus/hv_hv.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -77,6 +78,12 @@ return (now); } +static void +hv_idle_hook(sbintime_t sbt) +{ + rdmsr(HV_X64_MSR_GUEST_IDLE); +} + /** * @brief Invoke the specified hypercall */ @@ -172,7 +179,7 @@ hv_vmbus_g_context.hypercall_page = virt_addr; hv_et_init(); - + return (0); cleanup: @@ -510,6 +517,10 @@ /* Register virtual timecount */ tc_init(&hv_timecounter); } + + if (hyperv_features & HV_FEATURE_MSR_GUEST_IDLE) { + cpu_idle_hook = hv_idle_hook; + } } SYSINIT(hyperv_initialize, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hyperv_init, NULL); Index: sys/dev/hyperv/vmbus/hv_vmbus_priv.h =================================================================== --- sys/dev/hyperv/vmbus/hv_vmbus_priv.h +++ sys/dev/hyperv/vmbus/hv_vmbus_priv.h @@ -619,6 +619,7 @@ #define HV_X64_MSR_SINT14 (0x4000009E) #define HV_X64_MSR_SINT15 (0x4000009F) +#define HV_X64_MSR_GUEST_IDLE (0x400000F0) /* * Synthetic Timer MSRs. Four timers per vcpu. */