Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Sep 2016 00:16:26 +0000 (UTC)
From:      Peter Grehan <grehan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r305716 - stable/11/usr.sbin/bhyve
Message-ID:  <201609120016.u8C0GQUd046313@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: grehan
Date: Mon Sep 12 00:16:26 2016
New Revision: 305716
URL: https://svnweb.freebsd.org/changeset/base/305716

Log:
  MFC r302972,r303349
  
  r302972
      Disallow interrupt requests on disabled endpoints.
  
  r303349
      Catch another case where an XHCI interrupt was being
      injected without state being set up.

Modified:
  stable/11/usr.sbin/bhyve/pci_xhci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/pci_xhci.c
==============================================================================
--- stable/11/usr.sbin/bhyve/pci_xhci.c	Mon Sep 12 00:15:40 2016	(r305715)
+++ stable/11/usr.sbin/bhyve/pci_xhci.c	Mon Sep 12 00:16:26 2016	(r305716)
@@ -2537,9 +2537,11 @@ static int
 pci_xhci_dev_intr(struct usb_hci *hci, int epctx)
 {
 	struct pci_xhci_dev_emu *dev;
+	struct xhci_dev_ctx	*dev_ctx;
 	struct xhci_trb		evtrb;
 	struct pci_xhci_softc	*sc;
 	struct pci_xhci_portregs *p;
+	struct xhci_endp_ctx	*ep_ctx;
 	int	error;
 	int	dir_in;
 	int	epid;
@@ -2557,7 +2559,8 @@ pci_xhci_dev_intr(struct usb_hci *hci, i
 
 	/* check if device is ready; OS has to initialise it */
 	if (sc->rtsregs.erstba_p == NULL ||
-	    (sc->opregs.usbcmd & XHCI_CMD_RS) == 0)
+	    (sc->opregs.usbcmd & XHCI_CMD_RS) == 0 ||
+	    dev->dev_ctx == NULL)
 		return (0);
 
 	p = XHCI_PORTREG_PTR(sc, hci->hci_port);
@@ -2578,6 +2581,14 @@ pci_xhci_dev_intr(struct usb_hci *hci, i
 			goto done;
 	}
 
+	dev_ctx = dev->dev_ctx;
+	ep_ctx = &dev_ctx->ctx_ep[epid];
+	if ((ep_ctx->dwEpCtx0 & 0x7) == XHCI_ST_EPCTX_DISABLED) {
+		DPRINTF(("xhci device interrupt on disabled endpoint %d\r\n",
+		         epid));
+		return (0);
+	}
+
 	DPRINTF(("xhci device interrupt on endpoint %d\r\n", epid));
 
 	pci_xhci_device_doorbell(sc, hci->hci_port, epid, 0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609120016.u8C0GQUd046313>