From owner-svn-src-all@FreeBSD.ORG Fri Mar 27 01:58:46 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E101BF6E; Fri, 27 Mar 2015 01:58:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B21FDD24; Fri, 27 Mar 2015 01:58:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2R1wkTq028895; Fri, 27 Mar 2015 01:58:46 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2R1wj6Y028888; Fri, 27 Mar 2015 01:58:45 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201503270158.t2R1wj6Y028888@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Fri, 27 Mar 2015 01:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280725 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2015 01:58:47 -0000 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); }