Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/vmbus/hv_hv.c
Show All 30 Lines | |||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/pcpu.h> | #include <sys/pcpu.h> | ||||
#include <sys/timetc.h> | #include <sys/timetc.h> | ||||
#include <sys/kernel.h> | |||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#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" | ||||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | hv_vmbus_init(void) | ||||
hypercall_msr.as_uint64_t = 0; | hypercall_msr.as_uint64_t = 0; | ||||
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 */ | |||||
hv_et_init(); | 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; | ||||
▲ Show 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | void hv_vmbus_synic_cleanup(void *arg) | ||||
siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); | siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); | ||||
siefp.u.siefp_enabled = 0; | siefp.u.siefp_enabled = 0; | ||||
siefp.u.base_siefp_gpa = 0; | siefp.u.base_siefp_gpa = 0; | ||||
wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); | wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); | ||||
} | } | ||||
static void | |||||
hv_tc_init(void) | |||||
{ | |||||
if (vm_guest != VM_GUEST_HV) | |||||
return; | |||||
/* register virtual timecounter */ | |||||
tc_init(&hv_timecounter); | |||||
} | |||||
SYSINIT(hv_tc_init, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, hv_tc_init, NULL); |