Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Aug 2020 11:51:15 -0400
From:      Nathan Whitehorn <nwhitehorn@freebsd.org>
To:        Hans Petter Selasky <hselasky@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r364379 - head/sys/dev/usb/controller
Message-ID:  <da18d04d-f442-290c-1f2d-189b246ff6f1@freebsd.org>
In-Reply-To: <202008191150.07JBoCjh096637@repo.freebsd.org>
References:  <202008191150.07JBoCjh096637@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Either this or r364347 has broken Yubikeys (at least Yubikey 4) plugged
into XHCI ports, which are completely invisible to the USB stack after
the change. I'm going to try to debug further, but wanted to give you a
heads-up in case you can get there first.
-Nathan

On 2020-08-19 07:50, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Wed Aug 19 11:50:12 2020
> New Revision: 364379
> URL: https://svnweb.freebsd.org/changeset/base/364379
>
> Log:
>   Avoid evaluating the XHCI control endpoint context.
>   
>   The XHCI specification says that the XHCI controller should detect
>   reception of the USB device descriptors, and automatically update
>   the max packet size in the control endpoint context.
>   
>   Differential Revision:	https://reviews.freebsd.org/D26104
>   Reviewed by:	kp@
>   MFC after:	1 week
>   Sponsored by:	Mellanox Technologies
>
> Modified:
>   head/sys/dev/usb/controller/xhci.c
>   head/sys/dev/usb/controller/xhci.h
>
> Modified: head/sys/dev/usb/controller/xhci.c
> ==============================================================================
> --- head/sys/dev/usb/controller/xhci.c	Wed Aug 19 10:40:02 2020	(r364378)
> +++ head/sys/dev/usb/controller/xhci.c	Wed Aug 19 11:50:12 2020	(r364379)
> @@ -2398,8 +2398,6 @@ xhci_configure_endpoint(struct usb_device *udev,
>  
>  	/* store endpoint mode */
>  	pepext->trb_ep_mode = ep_mode;
> -	/* store bMaxPacketSize for control endpoints */
> -	pepext->trb_ep_maxp = edesc->wMaxPacketSize[0];
>  	usb_pc_cpu_flush(pepext->page_cache);
>  
>  	if (ep_mode == USB_EP_MODE_STREAMS) {
> @@ -2929,17 +2927,6 @@ xhci_transfer_insert(struct usb_xfer *xfer)
>  		return (USB_ERR_NOMEM);
>  	}
>  
> -	/* check if bMaxPacketSize changed */
> -	if (xfer->flags_int.control_xfr != 0 &&
> -	    pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) {
> -
> -		DPRINTFN(8, "Reconfigure control endpoint\n");
> -
> -		/* force driver to reconfigure endpoint */
> -		pepext->trb_halted = 1;
> -		pepext->trb_running = 0;
> -	}
> -
>  	/* check for stopped condition, after putting transfer on interrupt queue */
>  	if (pepext->trb_running == 0) {
>  		struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus);
> @@ -3917,8 +3904,10 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer)
>  	if (!(sc->sc_hw.devs[index].ep_configured & mask)) {
>  		sc->sc_hw.devs[index].ep_configured |= mask;
>  		err = xhci_cmd_configure_ep(sc, buf_inp.physaddr, 0, index);
> -	} else {
> +	} else if (epno != 1) {
>  		err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index);
> +	} else {
> +		err = 0;
>  	}
>  
>  	if (err != 0) {
>
> Modified: head/sys/dev/usb/controller/xhci.h
> ==============================================================================
> --- head/sys/dev/usb/controller/xhci.h	Wed Aug 19 10:40:02 2020	(r364378)
> +++ head/sys/dev/usb/controller/xhci.h	Wed Aug 19 11:50:12 2020	(r364379)
> @@ -393,7 +393,6 @@ struct xhci_endpoint_ext {
>  	uint8_t			trb_halted;
>  	uint8_t			trb_running;
>  	uint8_t			trb_ep_mode;
> -	uint8_t			trb_ep_maxp;
>  };
>  
>  enum {
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?da18d04d-f442-290c-1f2d-189b246ff6f1>