diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -170,6 +170,10 @@ .It Va virtio_msix Ta bool Ta true Ta Use MSI-X interrupts for PCI VirtIO devices. If set to false, MSI interrupts are used instead. +.It Va virtio_subvendor Ta string Ta Ta +Specify which subvendor id should be used for VirtIO devices. +At the moment, either unset or "oracle" are supported as values. +The "oracle" option is required for Windows VMs with secure boot. .It Va config.dump Ta bool Ta false Ta If this value is set to true after .Xr bhyve 8 diff --git a/usr.sbin/bhyve/pci_virtio_9p.c b/usr.sbin/bhyve/pci_virtio_9p.c --- a/usr.sbin/bhyve/pci_virtio_9p.c +++ b/usr.sbin/bhyve/pci_virtio_9p.c @@ -334,7 +334,12 @@ pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_9P); - pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + const char *subvendor = get_config_value("virtio_subvendor"); + if (subvendor == NULL || strcmp(subvendor, "oracle") != 0) { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + } else { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR_ORACLE); + } if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) return (1); diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -557,7 +557,12 @@ pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_BLOCK); - pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + const char *subvendor = get_config_value("virtio_subvendor"); + if (subvendor == NULL || strcmp(subvendor, "oracle") != 0) { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + } else { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR_ORACLE); + } if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) { blockif_close(sc->bc); diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -713,7 +713,12 @@ pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_SIMPLECOMM); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_CONSOLE); - pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + const char *subvendor = get_config_value("virtio_subvendor"); + if (subvendor == NULL || strcmp(subvendor, "oracle") != 0) { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + } else { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR_ORACLE); + } if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) return (1); diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -639,7 +639,12 @@ pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_NETWORK); - pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + const char *subvendor = get_config_value("virtio_subvendor"); + if (subvendor == NULL || strcmp(subvendor, "oracle") != 0) { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + } else { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR_ORACLE); + } /* Link is always up. */ sc->vsc_config.status = 1; diff --git a/usr.sbin/bhyve/pci_virtio_rnd.c b/usr.sbin/bhyve/pci_virtio_rnd.c --- a/usr.sbin/bhyve/pci_virtio_rnd.c +++ b/usr.sbin/bhyve/pci_virtio_rnd.c @@ -58,6 +58,7 @@ #include #include "bhyverun.h" +#include "config.h" #include "debug.h" #include "pci_emul.h" #include "virtio.h" @@ -192,7 +193,12 @@ pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_CRYPTO); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_ENTROPY); - pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + const char *subvendor = get_config_value("virtio_subvendor"); + if (subvendor == NULL || strcmp(subvendor, "oracle") != 0) { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + } else { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR_ORACLE); + } if (vi_intr_init(&sc->vrsc_vs, 1, fbsdrun_virtio_msix())) return (1); diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -731,7 +731,12 @@ pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_SCSI); - pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + const char *subvendor = get_config_value("virtio_subvendor"); + if (subvendor == NULL || strcmp(subvendor, "oracle") != 0) { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); + } else { + pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR_ORACLE); + } if (vi_intr_init(&sc->vss_vs, 1, fbsdrun_virtio_msix())) return (1); diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -165,6 +165,7 @@ * PCI vendor/device IDs */ #define VIRTIO_VENDOR 0x1AF4 +#define VIRTIO_VENDOR_ORACLE 0x108E #define VIRTIO_DEV_NET 0x1000 #define VIRTIO_DEV_BLOCK 0x1001 #define VIRTIO_DEV_CONSOLE 0x1003