Page MenuHomeFreeBSD

D57365.1795735081.diff
No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None

D57365.1795735081.diff

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
@@ -109,7 +109,7 @@
.vc_qnotify = pci_vt9p_notify,
.vc_cfgread = pci_vt9p_cfgread,
.vc_apply_features = pci_vt9p_neg_features,
- .vc_hv_caps = (1 << 0),
+ .vc_hv_caps = (1 << 0) | VIRTIO_F_VERSION_1,
};
static void
@@ -334,6 +334,8 @@
if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix()))
return (1);
vi_set_io_bar(&sc->vsc_vs, 0);
+ if (vi_set_modern_bar(&sc->vsc_vs, true) != 0)
+ return (1);
return (0);
}
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
@@ -90,7 +90,8 @@
VTBLK_F_BLK_SIZE | \
VTBLK_F_FLUSH | \
VTBLK_F_TOPOLOGY | \
- VIRTIO_RING_F_INDIRECT_DESC ) /* indirect descriptors */
+ VIRTIO_RING_F_INDIRECT_DESC | /* indirect descriptors */ \
+ VIRTIO_F_VERSION_1 )
/*
* The current blockif_delete() interface only allows a single delete
@@ -440,8 +441,7 @@
sc = arg;
sc->vbsc_cfg.vbc_capacity = new_size / VTBLK_BSIZE; /* 512-byte units */
- vi_interrupt(&sc->vbsc_vs, VIRTIO_PCI_ISR_CONFIG,
- sc->vbsc_vs.vs_msix_cfg_idx);
+ vi_config_changed(&sc->vbsc_vs);
}
static int
@@ -561,6 +561,11 @@
return (1);
}
vi_set_io_bar(&sc->vbsc_vs, 0);
+ if (vi_set_modern_bar(&sc->vbsc_vs, true) != 0) {
+ blockif_close(sc->bc);
+ free(sc);
+ return (1);
+ }
blockif_register_resize_callback(sc->bc, pci_vtblk_resized, sc);
return (0);
}
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
@@ -80,8 +80,9 @@
#define VTCON_F_SIZE 0
#define VTCON_F_MULTIPORT 1
#define VTCON_F_EMERG_WRITE 2
-#define VTCON_S_HOSTCAPS \
- (VTCON_F_SIZE | VTCON_F_MULTIPORT | VTCON_F_EMERG_WRITE)
+#define VTCON_S_HOSTCAPS \
+ (VTCON_F_SIZE | VTCON_F_MULTIPORT | VTCON_F_EMERG_WRITE | \
+ VIRTIO_F_VERSION_1)
static int pci_vtcon_debug;
#define DPRINTF(params) if (pci_vtcon_debug) PRINTLN params
@@ -722,6 +723,8 @@
if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix()))
return (1);
vi_set_io_bar(&sc->vsc_vs, 0);
+ if (vi_set_modern_bar(&sc->vsc_vs, true) != 0)
+ return (1);
/* create control port */
sc->vsc_control_port.vsp_sc = sc;
diff --git a/usr.sbin/bhyve/pci_virtio_input.c b/usr.sbin/bhyve/pci_virtio_input.c
--- a/usr.sbin/bhyve/pci_virtio_input.c
+++ b/usr.sbin/bhyve/pci_virtio_input.c
@@ -162,7 +162,7 @@
.vc_reset = pci_vtinput_reset,
.vc_cfgread = pci_vtinput_cfgread,
.vc_cfgwrite = pci_vtinput_cfgwrite,
- .vc_hv_caps = 0,
+ .vc_hv_caps = VIRTIO_F_VERSION_1,
};
static void
@@ -740,6 +740,9 @@
goto failed;
/* add virtio register */
vi_set_io_bar(&sc->vsc_vs, 0);
+ /* add modern MMIO BAR */
+ if (vi_set_modern_bar(&sc->vsc_vs, true) != 0)
+ goto failed;
return (0);
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
@@ -69,7 +69,8 @@
#define VTNET_S_HOSTCAPS \
( VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | \
- VIRTIO_F_NOTIFY_ON_EMPTY | VIRTIO_RING_F_INDIRECT_DESC)
+ VIRTIO_F_NOTIFY_ON_EMPTY | VIRTIO_RING_F_INDIRECT_DESC | \
+ VIRTIO_F_VERSION_1)
/*
* PCI config-space "registers"
@@ -650,6 +651,12 @@
/* use BAR 0 to map config regs in IO space */
vi_set_io_bar(&sc->vsc_vs, 0);
+ /* use BAR 2 to expose modern VirtIO MMIO capabilities */
+ if (vi_set_modern_bar(&sc->vsc_vs, true) != 0) {
+ free(sc);
+ return (1);
+ }
+
sc->resetting = 0;
sc->rx_merge = 0;
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
@@ -86,7 +86,7 @@
.vc_cfgsize = 0,
.vc_reset = pci_vtrnd_reset,
.vc_qnotify = pci_vtrnd_notify,
- .vc_hv_caps = 0,
+ .vc_hv_caps = VIRTIO_F_VERSION_1,
};
static void
@@ -192,6 +192,8 @@
if (vi_intr_init(&sc->vrsc_vs, 1, fbsdrun_virtio_msix()))
return (1);
vi_set_io_bar(&sc->vrsc_vs, 0);
+ if (vi_set_modern_bar(&sc->vrsc_vs, false) != 0)
+ return (1);
return (0);
}
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
@@ -311,7 +311,7 @@
.vc_cfgread = pci_vtscsi_cfgread,
.vc_cfgwrite = pci_vtscsi_cfgwrite,
.vc_apply_features = pci_vtscsi_neg_features,
- .vc_hv_caps = VIRTIO_RING_F_INDIRECT_DESC,
+ .vc_hv_caps = VIRTIO_RING_F_INDIRECT_DESC | VIRTIO_F_VERSION_1,
};
static void *
@@ -1106,6 +1106,9 @@
vi_set_io_bar(&sc->vss_vs, 0);
+ if (vi_set_modern_bar(&sc->vss_vs, true) != 0)
+ goto fail;
+
return (0);
fail:

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 26, 11:18 PM (2 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42030814
Default Alt Text
D57365.1795735081.diff (4 KB)

Event Timeline