[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 02/10] xue: reset XHCI ports when initializing dbc


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 15 Jun 2022 16:35:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WeHCGjt12bsp6OuqvQHlX0XzDaFGViCx4bAk4abJIQk=; b=F9Z2vX//HjOwCKWMZkf9Qr+OqCqdHcizBWW3oO+DS5s2sq4gKnGGpXmwQwwqb3JkWEis+WE7dpVvGkDx271b5y6tbzvQ1IUKcmZtvzQ61R5PjERqLhJ6agvOkAtLOr4E5lcT13RYQ7ICIGyEr1q8mjitOg0yc1H6ZfUEL3Ib2/QRmBkmwATW1wjYVOg1jTpjiX+uBqYY40DTUkWm1GuWB8mw6LerS43Xmxh+60dfm+2Q9WP+jGuFjVlk5L39EBWs9H2q5uPgcvWjDUdhWoVy1HPrFg/pmEuhx2jdqpIqul2NJ8DGJ1HYenXVHDn+0A/tyMf94hlyB3T7IvlcnZc9xA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLqMzH6OssWr9ZKwuiGp5KM0Gh4kZVOB16XYAZ55PShiZ6UaSPV2tqkv9QvIdgj6qobhNEvgwyjC/RY6ty5Cyud7DY5iP00ntXc4Zq+2UzIinu5qgdcUMMgWuj/GmYCc4AB3nl/ai8kF/MH3/rne8LSzcNZ1do1Y62PW3fuVyiv4cu5kPepG8YeWDsaP2or3n1VrY0RL9GAIMCl5eVaTJ3tOOvqeOtzpa/TNah0vFGArBC791QUNULUrpx2jgdT8jpg3pajMIXGr6+zq1O490AJrJk0pzuKFAHxadXgxJDCxP33J36SuIGdP1uqEY33YgOCCWYzuS1CGjAUzK6R7Sw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 15 Jun 2022 14:35:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.06.2022 16:30, Marek Marczykowski-Górecki wrote:
> Reset ports, to force host system to re-enumerate devices. Otheriwse it
> will require the cable to be re-plugged, or will wait in the
> "configuring" state indefinitely.
> 
> Trick and code copied from Linux:
> drivers/usb/early/xhci-dbc.c:xdbc_start()->xdbc_reset_debug_port()
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>

Just two style nits:

> --- a/xen/drivers/char/xue.c
> +++ b/xen/drivers/char/xue.c
> @@ -60,6 +60,10 @@
>      ((1UL << XUE_PSC_CSC) | (1UL << XUE_PSC_PRC) | (1UL << XUE_PSC_PLC) |    
>   \
>       (1UL << XUE_PSC_CEC))
>  
> +#define     XUE_XHC_EXT_PORT_MAJOR(x)  (((x) >> 24) & 0xff)
> +#define PORT_RESET  (1 << 4)
> +#define PORT_CONNECT  (1 << 0)

Odd multiple blanks on the first of the lines you add.

> @@ -604,6 +608,68 @@ static void xue_init_strings(struct xue *xue, uint32_t 
> *info)
>      info[8] = (4 << 24) | (30 << 16) | (8 << 8) | 6;
>  }
>  
> +static void xue_do_reset_debug_port(struct xue *xue, u32 id, u32 count)
> +{
> +    uint32_t *ops_reg;
> +    uint32_t *portsc;
> +    u32 val, cap_length;
> +    int i;
> +
> +    cap_length = (*(uint32_t*)xue->xhc_mmio) & 0xff;
> +    ops_reg = xue->xhc_mmio + cap_length;
> +
> +    id--;
> +    for ( i = id; i < (id + count); i++ )
> +    {
> +        portsc = ops_reg + 0x100 + i * 0x4;
> +        val = *portsc;
> +        if ( !(val & PORT_CONNECT) )
> +            *portsc = val | PORT_RESET;
> +    }
> +}
> +
> +
> +static void xue_reset_debug_port(struct xue *xue)

Please don't add double blank lines.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.