hyperv: Revert r297481

Use vm_guest == VM_GUEST_HV is not enough to determine whether FreeBSD
is running on Hyper-V or not.  What a mess.

Reported by:	smokehydration tutanota com
Sponsored by:	Microsoft OSTC
This commit is contained in:
Sepherosa Ziehau 2016-04-08 09:20:46 +00:00
parent 348256df6f
commit 222c454d33

View File

@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
#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>
@ -208,6 +207,8 @@ hv_vmbus_init(void)
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);
@ -436,14 +437,3 @@ void hv_vmbus_synic_cleanup(void *arg)
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);