Author: grehan
Date: Fri Mar 27 01:58:44 2015
New Revision: 280725
URL: https://svnweb.freebsd.org/changeset/base/280725

Log:
  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

Modified:
  head/usr.sbin/bhyve/pci_virtio_block.c
  head/usr.sbin/bhyve/pci_virtio_net.c
  head/usr.sbin/bhyve/virtio.c

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_block.c      Fri Mar 27 01:48:54 2015        
(r280724)
+++ head/usr.sbin/bhyve/pci_virtio_block.c      Fri Mar 27 01:58:44 2015        
(r280725)
@@ -370,8 +370,6 @@ pci_vtblk_init(struct vmctx *ctx, struct
        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);

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==============================================================================
--- head/usr.sbin/bhyve/pci_virtio_net.c        Fri Mar 27 01:48:54 2015        
(r280724)
+++ head/usr.sbin/bhyve/pci_virtio_net.c        Fri Mar 27 01:58:44 2015        
(r280725)
@@ -640,8 +640,6 @@ pci_vtnet_init(struct vmctx *ctx, struct
        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;
        

Modified: head/usr.sbin/bhyve/virtio.c
==============================================================================
--- head/usr.sbin/bhyve/virtio.c        Fri Mar 27 01:48:54 2015        
(r280724)
+++ head/usr.sbin/bhyve/virtio.c        Fri Mar 27 01:58:44 2015        
(r280725)
@@ -148,8 +148,13 @@ vi_intr_init(struct virtio_softc *vs, in
                        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);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to