diff options
author | grehan <grehan@FreeBSD.org> | 2015-03-27 01:58:44 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2015-03-27 01:58:44 +0000 |
commit | d96cec83fc1cb1ea7d64fde821609f2f463201c7 (patch) | |
tree | 66b391f922d0738892bd0eb6773e520497eb5094 /usr.sbin/bhyve | |
parent | 86fa361d5928fd87070cb01688fcb04ff242b186 (diff) | |
download | FreeBSD-src-d96cec83fc1cb1ea7d64fde821609f2f463201c7.zip FreeBSD-src-d96cec83fc1cb1ea7d64fde821609f2f463201c7.tar.gz |
Move legacy interrupt allocation for virtio devices to common code.
There are a number of assumptions about legacy interrupts always
being available in virtio so don't allow back-ends to make the
decision to support them.
This fixes the issue seen with virtio-rnd on OpenBSD. MSI-x vectors
were not being used, and the virtio-rnd backend wasn't allocating a
legacy interrupt resulting in a bhyve assert and guest exit.
Reported by: Julian Hsiao, madoka at nyanisore dot net
Reviewed by: neel
MFC after: 1 week
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r-- | usr.sbin/bhyve/pci_virtio_block.c | 2 | ||||
-rw-r--r-- | usr.sbin/bhyve/pci_virtio_net.c | 2 | ||||
-rw-r--r-- | usr.sbin/bhyve/virtio.c | 5 |
3 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c index 985272b..967b528 100644 --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -370,8 +370,6 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_BLOCK); - pci_lintr_request(pi); - if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) { blockif_close(sc->bc); free(sc); diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c index f3656b7..457a405 100644 --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -640,8 +640,6 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK); pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET); - pci_lintr_request(pi); - /* link always up */ sc->vsc_config.status = 1; diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c index e985805..41a9e42 100644 --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -148,8 +148,13 @@ vi_intr_init(struct virtio_softc *vs, int barnum, int use_msix) return (1); } else vs->vs_flags &= ~VIRTIO_USE_MSIX; + /* Only 1 MSI vector for bhyve */ pci_emul_add_msicap(vs->vs_pi, 1); + + /* Legacy interrupts are mandatory for virtio devices */ + pci_lintr_request(vs->vs_pi); + return (0); } |