Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/vmbus/hv_hv.c
Show All 39 Lines | |||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include "hv_vmbus_priv.h" | #include "hv_vmbus_priv.h" | ||||
#define HV_X64_MSR_GUEST_OS_ID 0x40000000 | |||||
#define HV_X64_CPUID_MIN 0x40000005 | |||||
#define HV_X64_CPUID_MAX 0x4000ffff | |||||
#define HV_X64_MSR_TIME_REF_COUNT 0x40000020 | |||||
#define HV_NANOSECONDS_PER_SEC 1000000000L | #define HV_NANOSECONDS_PER_SEC 1000000000L | ||||
static u_int hv_get_timecount(struct timecounter *tc); | static u_int hv_get_timecount(struct timecounter *tc); | ||||
/** | /** | ||||
* Globals | * Globals | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | hv_vmbus_init(void) | ||||
hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); | hypercall_msr.as_uint64_t = rdmsr(HV_X64_MSR_HYPERCALL); | ||||
if (!hypercall_msr.u.enable) | if (!hypercall_msr.u.enable) | ||||
goto cleanup; | goto cleanup; | ||||
hv_vmbus_g_context.hypercall_page = virt_addr; | hv_vmbus_g_context.hypercall_page = virt_addr; | ||||
tc_init(&hv_timecounter); /* register virtual timecount */ | tc_init(&hv_timecounter); /* register virtual timecount */ | ||||
hv_et_init(); | |||||
return (0); | return (0); | ||||
cleanup: | cleanup: | ||||
if (virt_addr != NULL) { | if (virt_addr != NULL) { | ||||
if (hypercall_msr.u.enable) { | if (hypercall_msr.u.enable) { | ||||
hypercall_msr.as_uint64_t = 0; | hypercall_msr.as_uint64_t = 0; | ||||
wrmsr(HV_X64_MSR_HYPERCALL, | wrmsr(HV_X64_MSR_HYPERCALL, | ||||
▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines |