Index: sys/dev/hyperv/include/hyperv.h =================================================================== --- sys/dev/hyperv/include/hyperv.h +++ sys/dev/hyperv/include/hyperv.h @@ -36,6 +36,9 @@ #include #include +#define VM_GUEST_IS_HYPERV \ + (vm_guest == VM_GUEST_HV || vm_guest == VM_GUEST_HV_SCSI) + struct hyperv_guid { uint8_t hv_guid[16]; } __packed; Index: sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c =================================================================== --- sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c +++ sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c @@ -73,6 +73,7 @@ #include #include #include +#include #include /* prototypes */ @@ -94,7 +95,7 @@ /* * Don't probe if not running in a Hyper-V environment */ - if (vm_guest != VM_GUEST_HV) + if (!VM_GUEST_IS_HYPERV) return (ENXIO); if (device_get_unit(parent) != 0 || device_get_ivars(dev) != 0) Index: sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c =================================================================== --- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -2325,3 +2325,14 @@ return DRIVER_STORVSC; return DRIVER_UNKNOWN; } + +static void +storvsc_ident(void *arg __unused) +{ + if (vm_guest != VM_GUEST_HV) + return; + /* Enlightened SCSI driver is going to take over disks. */ + vm_guest = VM_GUEST_HV_SCSI; +} +/* SI_ORDER_SECOND - MUST after Hypercall creation */ +SYSINIT(storvsc_ident, SI_SUB_DRIVERS, SI_ORDER_SECOND, storvsc_ident, NULL); Index: sys/dev/hyperv/vmbus/vmbus.c =================================================================== --- sys/dev/hyperv/vmbus/vmbus.c +++ sys/dev/hyperv/vmbus/vmbus.c @@ -996,7 +996,7 @@ char *id[] = { "VMBUS", NULL }; if (ACPI_ID_PROBE(device_get_parent(dev), dev, id) == NULL || - device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV || + device_get_unit(dev) != 0 || !VM_GUEST_IS_HYPERV || (hyperv_features & CPUID_HV_MSR_SYNIC) == 0) return (ENXIO); @@ -1177,7 +1177,7 @@ { struct vmbus_softc *sc = vmbus_get_softc(); - if (vm_guest != VM_GUEST_HV || sc == NULL) + if (!VM_GUEST_IS_HYPERV || sc == NULL) return; /* Index: sys/kern/subr_param.c =================================================================== --- sys/kern/subr_param.c +++ sys/kern/subr_param.c @@ -149,6 +149,7 @@ "hv", "vmware", "kvm", + "hv", /* Hyper-V w/ SCSI driver */ NULL }; CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST); Index: sys/sys/systm.h =================================================================== --- sys/sys/systm.h +++ sys/sys/systm.h @@ -74,7 +74,7 @@ * Keep in sync with vm_guest_sysctl_names[]. */ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, - VM_GUEST_VMWARE, VM_GUEST_KVM, VM_LAST }; + VM_GUEST_VMWARE, VM_GUEST_KVM, VM_GUEST_HV_SCSI, VM_LAST }; #if defined(WITNESS) || defined(INVARIANT_SUPPORT) void kassert_panic(const char *fmt, ...) __printflike(1, 2);