Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-21 Thread Lu Baolu
ci_cleanup_command_queue() > > We are calling it without locking, but we need to lock for accessing list. Yeah. I can make the patch. Best regards, Lu Baolu

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-21 Thread Lu Baolu
to >> CMD_RING_STATE_RUNNING so ring will really restart in the interrupt >> handler. > Just for record (no chance to make patch I myself for now, sorry), while > checking locking slightly, I noticed unrelated missing locking. > > xhci_cleanup_command_queue() > > We are calling it without locking, but we need to lock for accessing list. Yeah. I can make the patch. Best regards, Lu Baolu

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-21 Thread Lu Baolu
Hi, On 12/21/2016 08:48 PM, Mathias Nyman wrote: > On 21.12.2016 08:17, Lu Baolu wrote: >> Hi Mathias, >> >> I have some comments for the implementation of xhci_abort_cmd_ring() below. >> >> On 12/20/2016 11:13 PM, Mathias Nyman wrote: >>&

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-21 Thread Lu Baolu
Hi, On 12/21/2016 08:48 PM, Mathias Nyman wrote: > On 21.12.2016 08:17, Lu Baolu wrote: >> Hi Mathias, >> >> I have some comments for the implementation of xhci_abort_cmd_ring() below. >> >> On 12/20/2016 11:13 PM, Mathias Nyman wrote: >>&

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-21 Thread Lu Baolu
Hi, On 12/21/2016 08:57 PM, Mathias Nyman wrote: > On 21.12.2016 08:57, Lu Baolu wrote: >> Hi Mathias, >> >> I have some comments for the implementation of >> xhci_handle_command_timeout() as well. >> >> On 12/20/2016 11:13 PM, Mathias Nyman wrote: >

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-21 Thread Lu Baolu
Hi, On 12/21/2016 08:57 PM, Mathias Nyman wrote: > On 21.12.2016 08:57, Lu Baolu wrote: >> Hi Mathias, >> >> I have some comments for the implementation of >> xhci_handle_command_timeout() as well. >> >> On 12/20/2016 11:13 PM, Mathias Nyman wrote: >

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-20 Thread Lu Baolu
ved up to line 1295. 1323 1324 /* command timeout on stopped ring, ring can't be aborted */ 1325 xhci_dbg(xhci, "Command timeout on stopped ring\n"); 1326 xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); 1327 spin_unlock_irqrestore(>lock, flags); This part of code is tricky. I have no idea about in which case should this code be executed? Anyway, we shouldn't call xhci_handle_stopped_cmd_ring() here, right? 1328 return; 1329 } Best regards, Lu Baolu

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-20 Thread Lu Baolu
ved up to line 1295. 1323 1324 /* command timeout on stopped ring, ring can't be aborted */ 1325 xhci_dbg(xhci, "Command timeout on stopped ring\n"); 1326 xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); 1327 spin_unlock_irqrestore(>lock, flags); This part of code is tricky. I have no idea about in which case should this code be executed? Anyway, we shouldn't call xhci_handle_stopped_cmd_ring() here, right? 1328 return; 1329 } Best regards, Lu Baolu

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-20 Thread Lu Baolu
} else { 370 unsigned long flags; 371 372 spin_lock_irqsave(>lock, flags); 373 xhci_handle_stopped_cmd_ring(xhci, xhci_next_queued_cmd(xhci)); 374 spin_unlock_irqrestore(>lock, flags); 375 } 376 return 0; 377 } Best regards, Lu Baolu

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-20 Thread Lu Baolu
} else { 370 unsigned long flags; 371 372 spin_lock_irqsave(>lock, flags); 373 xhci_handle_stopped_cmd_ring(xhci, xhci_next_queued_cmd(xhci)); 374 spin_unlock_irqrestore(>lock, flags); 375 } 376 return 0; 377 } Best regards, Lu Baolu

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-19 Thread Lu Baolu
Hi, On 12/20/2016 02:46 PM, Baolin Wang wrote: > On 20 December 2016 at 14:39, Lu Baolu <baolu...@linux.intel.com> wrote: >> Hi, >> >> On 12/20/2016 02:06 PM, Baolin Wang wrote: >>> Hi, >>> >>> On 20 December 2016 at 12:29, Lu B

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-19 Thread Lu Baolu
Hi, On 12/20/2016 02:46 PM, Baolin Wang wrote: > On 20 December 2016 at 14:39, Lu Baolu wrote: >> Hi, >> >> On 12/20/2016 02:06 PM, Baolin Wang wrote: >>> Hi, >>> >>> On 20 December 2016 at 12:29, Lu Baolu wrote: >>>> Hi Ma

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-19 Thread Lu Baolu
Hi, On 12/20/2016 02:06 PM, Baolin Wang wrote: > Hi, > > On 20 December 2016 at 12:29, Lu Baolu <baolu...@linux.intel.com> wrote: >> Hi Mathias, >> >> On 12/19/2016 08:13 PM, Mathias Nyman wrote: >>> On 19.12.2016 13:34, Baolin Wang wrote: >>>&

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-19 Thread Lu Baolu
Hi, On 12/20/2016 02:06 PM, Baolin Wang wrote: > Hi, > > On 20 December 2016 at 12:29, Lu Baolu wrote: >> Hi Mathias, >> >> On 12/19/2016 08:13 PM, Mathias Nyman wrote: >>> On 19.12.2016 13:34, Baolin Wang wrote: >>>> Hi Mathias, >>>>

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-19 Thread Lu Baolu
mand queue becomes more and more complicated and hard for maintain. I am also seeing another case where a command may lose the chance to be tracked by the watch dog timer. Say, queue_command(the only command in queue) - completion irq fires--- timer times out at same time-- - another command enqueue-- - lock(xhci_lock ) - spin_on(xhci_lock) - spin_on(xhci_lock) - del_timer() fail - free the command and set current_cmd to NULL - unlock(xhci_lock) - lock(xhci_lock) - queue_command()(timer will not rescheduled since the timer is pending) - lock(xhci_lock) - no current command - return As the result, the later command isn't under track of the watch dog. If hardware fails to response to this command, kernel will hang in the thread which is waiting for the completion of the command. I can write a patch to fix this and cc stable kernel as well. For long term, in order to make it simple and easy to maintain, how about allocating a watch dog timer for each command? It could be part of the command structure and be managed just like the life cycle of a command structure. I can write a patch for review and discussion, if you think this change is possible. Best regards, Lu Baolu

Re: [PATCH 2/2] usb: host: xhci: Handle the right timeout command

2016-12-19 Thread Lu Baolu
ase > it seems that patch 2/2 can be replaced by a single line change: > > if (!xhci->current_cmd || timer_pending(>cmd_timer)) > > Right? > > -Mathias > It seems that the watch dog algorithm for command queue becomes more and more complicated and hard for maintain. I am also seeing another case where a command may lose the chance to be tracked by the watch dog timer. Say, queue_command(the only command in queue) - completion irq fires--- timer times out at same time-- - another command enqueue-- - lock(xhci_lock ) - spin_on(xhci_lock) - spin_on(xhci_lock) - del_timer() fail - free the command and set current_cmd to NULL - unlock(xhci_lock) - lock(xhci_lock) - queue_command()(timer will not rescheduled since the timer is pending) - lock(xhci_lock) - no current command - return As the result, the later command isn't under track of the watch dog. If hardware fails to response to this command, kernel will hang in the thread which is waiting for the completion of the command. I can write a patch to fix this and cc stable kernel as well. For long term, in order to make it simple and easy to maintain, how about allocating a watch dog timer for each command? It could be part of the command structure and be managed just like the life cycle of a command structure. I can write a patch for review and discussion, if you think this change is possible. Best regards, Lu Baolu

Re: [PATCH 1/1] usb: xhci: fix possible wild pointer

2016-12-05 Thread Lu Baolu
Hi, On 12/02/2016 09:39 PM, Mathias Nyman wrote: > On 02.12.2016 04:29, Lu Baolu wrote: >> handle_cmd_completion() frees a command structure which might >> be still referenced by xhci->current_cmd. This might cause >> problem when xhci->current_cmd is accessed after t

Re: [PATCH 1/1] usb: xhci: fix possible wild pointer

2016-12-05 Thread Lu Baolu
Hi, On 12/02/2016 09:39 PM, Mathias Nyman wrote: > On 02.12.2016 04:29, Lu Baolu wrote: >> handle_cmd_completion() frees a command structure which might >> be still referenced by xhci->current_cmd. This might cause >> problem when xhci->current_cmd is accessed after t

Re: [PATCH 1/1] usb: xhci: fix possible wild pointer

2016-12-01 Thread Lu Baolu
Hi, On 12/02/2016 12:18 PM, Baolin Wang wrote: > On 2 December 2016 at 10:29, Lu Baolu <baolu...@linux.intel.com> wrote: >> handle_cmd_completion() frees a command structure which might >> be still referenced by xhci->current_cmd. This might cause >> problem when

Re: [PATCH 1/1] usb: xhci: fix possible wild pointer

2016-12-01 Thread Lu Baolu
Hi, On 12/02/2016 12:18 PM, Baolin Wang wrote: > On 2 December 2016 at 10:29, Lu Baolu wrote: >> handle_cmd_completion() frees a command structure which might >> be still referenced by xhci->current_cmd. This might cause >> problem when xhci->current_cmd is accessed af

[PATCH 1/1] usb: xhci: fix possible wild pointer

2016-12-01 Thread Lu Baolu
_cmd. Cc: <sta...@vger.kernel.org> # v3.16+ Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/usb/host/xhci-ring.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index bdf6b13..13e05f6 10

[PATCH 1/1] usb: xhci: fix possible wild pointer

2016-12-01 Thread Lu Baolu
# v3.16+ Signed-off-by: Lu Baolu --- drivers/usb/host/xhci-ring.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index bdf6b13..13e05f6 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/h

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-12-01 Thread Lu Baolu
Hi, On 12/01/2016 04:03 PM, Baolin Wang wrote: > On 1 December 2016 at 15:44, Lu Baolu <baolu...@linux.intel.com> wrote: >> Hi, >> >> On 12/01/2016 03:35 PM, Baolin Wang wrote: >>> On 1 December 2016 at 14:35, Lu Baolu <baolu...@linux.intel.com> wrote:

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-12-01 Thread Lu Baolu
Hi, On 12/01/2016 04:03 PM, Baolin Wang wrote: > On 1 December 2016 at 15:44, Lu Baolu wrote: >> Hi, >> >> On 12/01/2016 03:35 PM, Baolin Wang wrote: >>> On 1 December 2016 at 14:35, Lu Baolu wrote: >>>> Hi, >>>> >>>> On 12/01/

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-11-30 Thread Lu Baolu
Hi, On 12/01/2016 03:35 PM, Baolin Wang wrote: > On 1 December 2016 at 14:35, Lu Baolu <baolu...@linux.intel.com> wrote: >> Hi, >> >> On 12/01/2016 02:04 PM, Baolin Wang wrote: >>> Hi Baolu, >>> >>> On 1 December 2016 at 13:45, Lu Baolu <

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-11-30 Thread Lu Baolu
Hi, On 12/01/2016 03:35 PM, Baolin Wang wrote: > On 1 December 2016 at 14:35, Lu Baolu wrote: >> Hi, >> >> On 12/01/2016 02:04 PM, Baolin Wang wrote: >>> Hi Baolu, >>> >>> On 1 December 2016 at 13:45, Lu Baolu wrote: >>>

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-11-30 Thread Lu Baolu
Hi, On 12/01/2016 02:04 PM, Baolin Wang wrote: > Hi Baolu, > > On 1 December 2016 at 13:45, Lu Baolu <baolu...@linux.intel.com> wrote: >> Hi, >> >> On 11/30/2016 05:02 PM, Baolin Wang wrote: >>> If the hardware never responds to the stop endpoint com

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-11-30 Thread Lu Baolu
Hi, On 12/01/2016 02:04 PM, Baolin Wang wrote: > Hi Baolu, > > On 1 December 2016 at 13:45, Lu Baolu wrote: >> Hi, >> >> On 11/30/2016 05:02 PM, Baolin Wang wrote: >>> If the hardware never responds to the stop endpoint command, the >>> URBs will

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-11-30 Thread Lu Baolu
e timer is the tail end of the last - * stop endpoint command, and the endpoint's command is still pending, we assume - * the host is dying. Best regards, Lu Baolu > > We also need to clean up the command queue before trying to halt the > xHCI host in xhci_stop_endpoint_command_timeout() function. > > Signed-off-by: Baolin Wang <baolin.w...@linaro.org>

Re: [RFC] usb: host: xhci: Remove the watchdog timer and use command timer to watch stop endpoint command

2016-11-30 Thread Lu Baolu
e timer is the tail end of the last - * stop endpoint command, and the endpoint's command is still pending, we assume - * the host is dying. Best regards, Lu Baolu > > We also need to clean up the command queue before trying to halt the > xHCI host in xhci_stop_endpoint_command_timeout() function. > > Signed-off-by: Baolin Wang

[PATCH v5 2/4] x86: add support for earlyprintk via USB3 debug port

2016-11-14 Thread Lu Baolu
ory blocks. This requires to delay setting up debugging hardware and registering boot console until the memblocks are filled. Cc: Ingo Molnar <mi...@redhat.com> Cc: x...@kernel.org Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- Documentation/kernel-parameters.txt | 1 + arch/x86/kernel/e

[PATCH v5 2/4] x86: add support for earlyprintk via USB3 debug port

2016-11-14 Thread Lu Baolu
ory blocks. This requires to delay setting up debugging hardware and registering boot console until the memblocks are filled. Cc: Ingo Molnar Cc: x...@kernel.org Signed-off-by: Lu Baolu --- Documentation/kernel-parameters.txt | 1 + arch/x86/kernel/early_printk.c | 5 + arch/x86/kern

[PATCH v5 0/4] usb: early: add support for early printk through USB3 debug port

2016-11-14 Thread Lu Baolu
document. v1->v2: - Refactor the duplicate code in xdbc_early_start() and xdbc_handle_external_reset(). - Free resources when hardware not used any more. - Refine the user guide document. Lu Baolu (4): usb: dbc: early driver for xhci debug capability x86: add support for earlypri

[PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2016-11-14 Thread Lu Baolu
.ny...@linux.intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- arch/x86/Kconfig.debug| 14 + drivers/usb/Kconfig |3 + drivers/usb/Makefile |2 +- drivers/usb/early/Makefile|1 + drivers/usb/early/xhci-d

[PATCH v5 4/4] usb: doc: add document for USB3 debug port usage

2016-11-14 Thread Lu Baolu
Add Documentation/usb/usb3-debug-port.rst. This document includes the user guide for USB3 debug port. Cc: linux-...@vger.kernel.org Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- Documentation/usb/usb3-debug-port.rst | 95 +++ 1 file changed, 95 inse

[PATCH v5 0/4] usb: early: add support for early printk through USB3 debug port

2016-11-14 Thread Lu Baolu
document. v1->v2: - Refactor the duplicate code in xdbc_early_start() and xdbc_handle_external_reset(). - Free resources when hardware not used any more. - Refine the user guide document. Lu Baolu (4): usb: dbc: early driver for xhci debug capability x86: add support for earlypri

[PATCH v5 1/4] usb: dbc: early driver for xhci debug capability

2016-11-14 Thread Lu Baolu
de 100644 index 000..5ac4223 --- /dev/null +++ b/drivers/usb/early/xhci-dbc.c @@ -0,0 +1,1068 @@ +/** + * xhci-dbc.c - xHCI debug capability early driver + * + * Copyright (C) 2016 Intel Corporation + * + * Author: Lu Baolu + * + * This program is free software; you can redistribute it a

[PATCH v5 4/4] usb: doc: add document for USB3 debug port usage

2016-11-14 Thread Lu Baolu
Add Documentation/usb/usb3-debug-port.rst. This document includes the user guide for USB3 debug port. Cc: linux-...@vger.kernel.org Signed-off-by: Lu Baolu --- Documentation/usb/usb3-debug-port.rst | 95 +++ 1 file changed, 95 insertions(+) create mode 100644

[PATCH v5 3/4] usb: serial: usb_debug: add support for dbc debug device

2016-11-14 Thread Lu Baolu
This patch add dbc debug device support in usb_debug driver. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> Acked-by: Johan Hovold <jo...@kernel.org> --- drivers/usb/serial/usb_debug.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --g

[PATCH v5 3/4] usb: serial: usb_debug: add support for dbc debug device

2016-11-14 Thread Lu Baolu
This patch add dbc debug device support in usb_debug driver. Signed-off-by: Lu Baolu Acked-by: Johan Hovold --- drivers/usb/serial/usb_debug.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-11 Thread Lu Baolu
Hi Peter, On 11/11/2016 08:28 PM, Peter Zijlstra wrote: > On Fri, Nov 11, 2016 at 12:33:29PM +0800, Lu Baolu wrote: > >> Things become complicated when it comes to USB debug port. >> But it's still addressable. >> >> At this time, we can do it like this. >>

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-11 Thread Lu Baolu
Hi Peter, On 11/11/2016 08:28 PM, Peter Zijlstra wrote: > On Fri, Nov 11, 2016 at 12:33:29PM +0800, Lu Baolu wrote: > >> Things become complicated when it comes to USB debug port. >> But it's still addressable. >> >> At this time, we can do it like this. >>

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi Peter, On 11/10/2016 07:44 PM, Peter Zijlstra wrote: > On Thu, Nov 10, 2016 at 09:56:41AM +0100, Thomas Gleixner wrote: >> On Thu, 10 Nov 2016, Lu Baolu wrote: >>> This seems to be a common issue for all early printk drivers. >> No. The other early printk drivers

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi Peter, On 11/10/2016 07:44 PM, Peter Zijlstra wrote: > On Thu, Nov 10, 2016 at 09:56:41AM +0100, Thomas Gleixner wrote: >> On Thu, 10 Nov 2016, Lu Baolu wrote: >>> This seems to be a common issue for all early printk drivers. >> No. The other early printk drivers

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi, On 11/11/2016 10:24 AM, Lu Baolu wrote: >> The only thing you can do to make this work is to prevent printing in NMI >> > context: >> > >> > write() >> > { >> >if (in_nmi()) >> >return; >> > >

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi, On 11/11/2016 10:24 AM, Lu Baolu wrote: >> The only thing you can do to make this work is to prevent printing in NMI >> > context: >> > >> > write() >> > { >> >if (in_nmi()) >> >return; >> > >

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi, On 11/10/2016 04:56 PM, Thomas Gleixner wrote: > On Thu, 10 Nov 2016, Lu Baolu wrote: >> On 11/09/2016 05:37 PM, Thomas Gleixner wrote: >>> On Tue, 1 Nov 2016, Lu Baolu wrote: >>>> +static void early_xdbc_write(struct console *con, const char *str, u32 n)

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-10 Thread Lu Baolu
Hi, On 11/10/2016 04:56 PM, Thomas Gleixner wrote: > On Thu, 10 Nov 2016, Lu Baolu wrote: >> On 11/09/2016 05:37 PM, Thomas Gleixner wrote: >>> On Tue, 1 Nov 2016, Lu Baolu wrote: >>>> +static void early_xdbc_write(struct console *con, const char *str, u32 n)

[PATCH v2 1/1] usb: xhci: handle endpoint error caused by TRB error

2016-11-10 Thread Lu Baolu
onding USB device stays in unresponsive state. This patch enhances xHCI driver on this by printing out the malformed TRB and clearing the endpoint Error state. Tested-by: Wang Wendy <wendy.w...@intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- Change log: v1->

[PATCH v2 1/1] usb: xhci: handle endpoint error caused by TRB error

2016-11-10 Thread Lu Baolu
onding USB device stays in unresponsive state. This patch enhances xHCI driver on this by printing out the malformed TRB and clearing the endpoint Error state. Tested-by: Wang Wendy Signed-off-by: Lu Baolu --- Change log: v1->v2: - Correct the email of Tested-by. drivers/usb/host/xhc

Re: [PATCH 1/1] usb: xhci: handle endpoint error caused by TRB error

2016-11-10 Thread Lu Baolu
Hi, On 11/11/2016 09:03 AM, Lu Baolu wrote: > When xHCI host sees a malformed TRB in a transfer ring, > it will generate a transfer event with the completion > code set to COMP_TRB_ERR (5), and sets the endpoint > state in output endpoint context to EP_STATE_ERROR. > The endpoi

Re: [PATCH 1/1] usb: xhci: handle endpoint error caused by TRB error

2016-11-10 Thread Lu Baolu
Hi, On 11/11/2016 09:03 AM, Lu Baolu wrote: > When xHCI host sees a malformed TRB in a transfer ring, > it will generate a transfer event with the completion > code set to COMP_TRB_ERR (5), and sets the endpoint > state in output endpoint context to EP_STATE_ERROR. > The endpoi

[PATCH 1/1] usb: xhci: handle endpoint error caused by TRB error

2016-11-10 Thread Lu Baolu
onding USB device stays in unresponsive state. This patch enhances xHCI driver on this by printing out the malformed TRB and clearing the endpoint Error state. Tested-by: Wang Wendy <wendy.w...@inte.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/usb

[PATCH 1/1] usb: xhci: handle endpoint error caused by TRB error

2016-11-10 Thread Lu Baolu
onding USB device stays in unresponsive state. This patch enhances xHCI driver on this by printing out the malformed TRB and clearing the endpoint Error state. Tested-by: Wang Wendy Signed-off-by: Lu Baolu --- drivers/usb/host/xhci-ring.c | 35 +++ drivers/usb/h

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Lu Baolu
Hi, On 11/09/2016 05:37 PM, Thomas Gleixner wrote: > On Tue, 1 Nov 2016, Lu Baolu wrote: >> +static void early_xdbc_write(struct console *con, const char *str, u32 n) >> +{ >> +int chunk, ret; >> +static char buf[XDBC_MAX_PACKET]; >> +int use_cr = 0

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Lu Baolu
Hi, On 11/09/2016 05:37 PM, Thomas Gleixner wrote: > On Tue, 1 Nov 2016, Lu Baolu wrote: >> +static void early_xdbc_write(struct console *con, const char *str, u32 n) >> +{ >> +int chunk, ret; >> +static char buf[XDBC_MAX_PACKET]; >> +int use_cr = 0

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Lu Baolu
Hi, On 11/09/2016 05:23 PM, Thomas Gleixner wrote: > On Tue, 1 Nov 2016, Lu Baolu wrote: >> +static int __init xdbc_init(void) >> +{ > ... >> +base = ioremap_nocache(xdbc.xhci_start, xdbc.xhci_length); >> +if (!base) { >> +xdbc_tra

Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-11-09 Thread Lu Baolu
Hi, On 11/09/2016 05:23 PM, Thomas Gleixner wrote: > On Tue, 1 Nov 2016, Lu Baolu wrote: >> +static int __init xdbc_init(void) >> +{ > ... >> +base = ioremap_nocache(xdbc.xhci_start, xdbc.xhci_length); >> +if (!base) { >> +xdbc_tra

Re: [PATCH 1/1] usb: xhci: cleanup cmd_completion in xhci_virt_device

2016-11-03 Thread Lu Baolu
Hi, On 11/03/2016 07:36 PM, Mathias Nyman wrote: > On 03.11.2016 12:22, Sergei Shtylyov wrote: >> On 11/3/2016 9:48 AM, Lu Baolu wrote: >> >>> cmd_completion in struct xhci_virt_device is legacy. With command >>> strutcture and command queue i

Re: [PATCH 1/1] usb: xhci: cleanup cmd_completion in xhci_virt_device

2016-11-03 Thread Lu Baolu
Hi, On 11/03/2016 07:36 PM, Mathias Nyman wrote: > On 03.11.2016 12:22, Sergei Shtylyov wrote: >> On 11/3/2016 9:48 AM, Lu Baolu wrote: >> >>> cmd_completion in struct xhci_virt_device is legacy. With command >>> strutcture and command queue i

[PATCH 1/1] usb: xhci: cleanup cmd_completion in xhci_virt_device

2016-11-03 Thread Lu Baolu
cmd_completion in struct xhci_virt_device is legacy. With command strutcture and command queue introduced in xhci, cmd_completion is not used any more. This patch removes it. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/usb/host/xhci-mem.c | 1 - drivers/usb/host/xhci.h

[PATCH 1/1] usb: xhci: cleanup cmd_completion in xhci_virt_device

2016-11-03 Thread Lu Baolu
cmd_completion in struct xhci_virt_device is legacy. With command strutcture and command queue introduced in xhci, cmd_completion is not used any more. This patch removes it. Signed-off-by: Lu Baolu --- drivers/usb/host/xhci-mem.c | 1 - drivers/usb/host/xhci.h | 1 - 2 files changed, 2

[PATCH 1/1] usb: xhci: remove the use of xhci->addr_dev

2016-11-01 Thread Lu Baolu
ver. It is time to get rid of addr_dev and use the completion in the command structure instead. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- drivers/usb/host/xhci-mem.c | 1 - drivers/usb/host/xhci.c | 18 ++ drivers/usb/host/xhci.h | 1 - 3 files changed, 10 i

[PATCH 1/1] usb: xhci: remove the use of xhci->addr_dev

2016-11-01 Thread Lu Baolu
ver. It is time to get rid of addr_dev and use the completion in the command structure instead. Signed-off-by: Lu Baolu --- drivers/usb/host/xhci-mem.c | 1 - drivers/usb/host/xhci.c | 18 ++ drivers/usb/host/xhci.h | 1 - 3 files changed, 10 insertions(+), 10 deletions(-) d

[PATCH v4 3/4] usb: serial: usb_debug: add support for dbc debug device

2016-10-31 Thread Lu Baolu
This patch add dbc debug device support in usb_debug driver. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> Acked-by: Johan Hovold <jo...@kernel.org> --- drivers/usb/serial/usb_debug.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --g

[PATCH v4 3/4] usb: serial: usb_debug: add support for dbc debug device

2016-10-31 Thread Lu Baolu
This patch add dbc debug device support in usb_debug driver. Signed-off-by: Lu Baolu Acked-by: Johan Hovold --- drivers/usb/serial/usb_debug.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial

[PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-10-31 Thread Lu Baolu
.ny...@linux.intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- arch/x86/Kconfig.debug| 14 + drivers/usb/Kconfig |3 + drivers/usb/Makefile |2 +- drivers/usb/early/Makefile|1 + drivers/usb/early/xhci-d

[PATCH v4 4/4] usb: doc: add document for USB3 debug port usage

2016-10-31 Thread Lu Baolu
Add Documentation/usb/usb3-debug-port.rst. This document includes the user guide for USB3 debug port. Cc: linux-...@vger.kernel.org Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- Documentation/usb/usb3-debug-port.rst | 95 +++ 1 file changed, 95 inse

[PATCH v4 4/4] usb: doc: add document for USB3 debug port usage

2016-10-31 Thread Lu Baolu
Add Documentation/usb/usb3-debug-port.rst. This document includes the user guide for USB3 debug port. Cc: linux-...@vger.kernel.org Signed-off-by: Lu Baolu --- Documentation/usb/usb3-debug-port.rst | 95 +++ 1 file changed, 95 insertions(+) create mode 100644

[PATCH v4 1/4] usb: dbc: early driver for xhci debug capability

2016-10-31 Thread Lu Baolu
de 100644 index 000..728a1a0 --- /dev/null +++ b/drivers/usb/early/xhci-dbc.c @@ -0,0 +1,1050 @@ +/** + * xhci-dbc.c - xHCI debug capability early driver + * + * Copyright (C) 2016 Intel Corporation + * + * Author: Lu Baolu + * + * This program is free software; you can redistribute it a

[PATCH v4 0/4] usb: early: add support for early printk through USB3 debug port

2016-10-31 Thread Lu Baolu
rly_start() and xdbc_handle_external_reset(). - Free resources when hardware not used any more. - Refine the user guide document. Lu Baolu (4): usb: dbc: early driver for xhci debug capability x86: add support for earlyprintk via USB3 debug port usb: serial: usb_debug: add support for dbc deb

[PATCH v4 0/4] usb: early: add support for early printk through USB3 debug port

2016-10-31 Thread Lu Baolu
rly_start() and xdbc_handle_external_reset(). - Free resources when hardware not used any more. - Refine the user guide document. Lu Baolu (4): usb: dbc: early driver for xhci debug capability x86: add support for earlyprintk via USB3 debug port usb: serial: usb_debug: add support for dbc deb

[PATCH v4 2/4] x86: add support for earlyprintk via USB3 debug port

2016-10-31 Thread Lu Baolu
ory blocks. This requires to delay setting up debugging hardware and registering boot console until the memblocks are filled. Cc: Ingo Molnar <mi...@redhat.com> Cc: x...@kernel.org Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- Documentation/kernel-parameters.txt | 1 + arch/x86/kernel/e

[PATCH v4 2/4] x86: add support for earlyprintk via USB3 debug port

2016-10-31 Thread Lu Baolu
ory blocks. This requires to delay setting up debugging hardware and registering boot console until the memblocks are filled. Cc: Ingo Molnar Cc: x...@kernel.org Signed-off-by: Lu Baolu --- Documentation/kernel-parameters.txt | 1 + arch/x86/kernel/early_printk.c | 5 + arch/x86/kern

[PATCH v2 1/1] usb: xhci: clean up error_bitmask usage

2016-10-20 Thread Lu Baolu
in xhci_handle_event(). Otherwise, those errors are just ignored silently. This patch cleans up this by replacing the setting of error_bitmask with the kernel print functions, so that users can easily check and report the errors happened in xhci_handle_event(). Signed-off-by: Lu Baolu <ba

[PATCH v2 1/1] usb: xhci: clean up error_bitmask usage

2016-10-20 Thread Lu Baolu
in xhci_handle_event(). Otherwise, those errors are just ignored silently. This patch cleans up this by replacing the setting of error_bitmask with the kernel print functions, so that users can easily check and report the errors happened in xhci_handle_event(). Signed-off-by: Lu Baolu --- Changelog

Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage

2016-10-20 Thread Lu Baolu
Hi, On 10/20/2016 04:30 PM, Jani Nikula wrote: > On Thu, 20 Oct 2016, Lu Baolu <baolu...@linux.intel.com> wrote: >> Hi Jani, >> >> On 10/19/2016 03:48 PM, Jani Nikula wrote: >>> On Wed, 19 Oct 2016, Lu Baolu <baolu...@linux.intel.com> wrote: >

Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage

2016-10-20 Thread Lu Baolu
Hi, On 10/20/2016 04:30 PM, Jani Nikula wrote: > On Thu, 20 Oct 2016, Lu Baolu wrote: >> Hi Jani, >> >> On 10/19/2016 03:48 PM, Jani Nikula wrote: >>> On Wed, 19 Oct 2016, Lu Baolu wrote: >>>> Add Documentation/usb/usb3-debug-port.txt. This document i

Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability

2016-10-20 Thread Lu Baolu
mostly work. > Thank you again. Your comments make sense to me. I will remove the lock and work queue usages in the new version. Best regards, Lu Baolu

Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability

2016-10-20 Thread Lu Baolu
mostly work. > Thank you again. Your comments make sense to me. I will remove the lock and work queue usages in the new version. Best regards, Lu Baolu

Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability

2016-10-20 Thread Lu Baolu
Hi Peter, Thanks for your comments. On 10/19/2016 09:09 PM, Peter Zijlstra wrote: > On Wed, Oct 19, 2016 at 08:18:22AM +0800, Lu Baolu wrote: >> +++ b/drivers/usb/early/xhci-dbc.c >> +static int xdbc_bulk_write(const char *bytes, int size) >> +{ >> +unsigned

Re: [RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability

2016-10-20 Thread Lu Baolu
Hi Peter, Thanks for your comments. On 10/19/2016 09:09 PM, Peter Zijlstra wrote: > On Wed, Oct 19, 2016 at 08:18:22AM +0800, Lu Baolu wrote: >> +++ b/drivers/usb/early/xhci-dbc.c >> +static int xdbc_bulk_write(const char *bytes, int size) >> +{ >> +unsigned

Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage

2016-10-19 Thread Lu Baolu
Hi Jani, On 10/19/2016 03:48 PM, Jani Nikula wrote: > On Wed, 19 Oct 2016, Lu Baolu <baolu...@linux.intel.com> wrote: >> Add Documentation/usb/usb3-debug-port.txt. This document includes >> the user guide for USB3 debug port. > If you're adding completely new files,

Re: [RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage

2016-10-19 Thread Lu Baolu
Hi Jani, On 10/19/2016 03:48 PM, Jani Nikula wrote: > On Wed, 19 Oct 2016, Lu Baolu wrote: >> Add Documentation/usb/usb3-debug-port.txt. This document includes >> the user guide for USB3 debug port. > If you're adding completely new files, please at least consi

Re: [PATCH 1/1] usb: xhci: clean up error_bitmask usage

2016-10-19 Thread Lu Baolu
Hi, On 10/19/2016 02:52 PM, Mathias Nyman wrote: > Hi > > On 19.10.2016 03:53, Lu Baolu wrote: >> In xhci_handle_event(), when errors are detected, driver always sets >> a bit in error_bitmask (one member of the xhci private driver data). >> That means users have to re

Re: [PATCH 1/1] usb: xhci: clean up error_bitmask usage

2016-10-19 Thread Lu Baolu
Hi, On 10/19/2016 02:52 PM, Mathias Nyman wrote: > Hi > > On 19.10.2016 03:53, Lu Baolu wrote: >> In xhci_handle_event(), when errors are detected, driver always sets >> a bit in error_bitmask (one member of the xhci private driver data). >> That means users have to re

[PATCH 1/1] usb: xhci: clean up error_bitmask usage

2016-10-18 Thread Lu Baolu
in xhci_handle_event(). Otherwise, those errors are just ignored silently. This patch cleans up this by replacing the setting of error_bitmask with the kernel print functions, so that users can easily check and report the errors happened in xhci_handle_event(). Signed-off-by: Lu Baolu <ba

[PATCH 1/1] usb: xhci: clean up error_bitmask usage

2016-10-18 Thread Lu Baolu
in xhci_handle_event(). Otherwise, those errors are just ignored silently. This patch cleans up this by replacing the setting of error_bitmask with the kernel print functions, so that users can easily check and report the errors happened in xhci_handle_event(). Signed-off-by: Lu Baolu --- drivers/usb

[RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage

2016-10-18 Thread Lu Baolu
Add Documentation/usb/usb3-debug-port.txt. This document includes the user guide for USB3 debug port. Cc: linux-...@vger.kernel.org Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- Documentation/usb/usb3-debug-port.txt | 87 +++ 1 file changed, 87 inse

[RESEND PATCH v2 4/4] usb: doc: add document for USB3 debug port usage

2016-10-18 Thread Lu Baolu
Add Documentation/usb/usb3-debug-port.txt. This document includes the user guide for USB3 debug port. Cc: linux-...@vger.kernel.org Signed-off-by: Lu Baolu --- Documentation/usb/usb3-debug-port.txt | 87 +++ 1 file changed, 87 insertions(+) create mode 100644

[RESEND PATCH v2 2/4] x86: add support for earlyprintk via USB3 debug port

2016-10-18 Thread Lu Baolu
ory blocks. This requires to delay setting up debugging hardware and registering boot console until the memblocks are filled. Cc: Ingo Molnar <mi...@redhat.com> Cc: x...@kernel.org Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- Documentation/kernel-parameters.txt | 1 + arch/x86/kernel/e

[RESEND PATCH v2 2/4] x86: add support for earlyprintk via USB3 debug port

2016-10-18 Thread Lu Baolu
ory blocks. This requires to delay setting up debugging hardware and registering boot console until the memblocks are filled. Cc: Ingo Molnar Cc: x...@kernel.org Signed-off-by: Lu Baolu --- Documentation/kernel-parameters.txt | 1 + arch/x86/kernel/early_printk.c | 5 + arch/x86/kern

[RESEND PATCH v2 3/4] usb: serial: usb_debug: add support for dbc debug device

2016-10-18 Thread Lu Baolu
This patch add dbc debug device support in usb_debug driver. Signed-off-by: Lu Baolu <baolu...@linux.intel.com> Acked-by: Johan Hovold <jo...@kernel.org> --- drivers/usb/serial/usb_debug.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --g

[RESEND PATCH v2 3/4] usb: serial: usb_debug: add support for dbc debug device

2016-10-18 Thread Lu Baolu
This patch add dbc debug device support in usb_debug driver. Signed-off-by: Lu Baolu Acked-by: Johan Hovold --- drivers/usb/serial/usb_debug.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial

[RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability

2016-10-18 Thread Lu Baolu
.ny...@linux.intel.com> Signed-off-by: Lu Baolu <baolu...@linux.intel.com> --- arch/x86/Kconfig.debug| 14 + drivers/usb/Kconfig |3 + drivers/usb/Makefile |2 +- drivers/usb/early/Makefile|1 + drivers/usb/early/xhci-d

[RESEND PATCH v2 1/4] usb: dbc: early driver for xhci debug capability

2016-10-18 Thread Lu Baolu
le mode 100644 index 000..939fff2 --- /dev/null +++ b/drivers/usb/early/xhci-dbc.c @@ -0,0 +1,1097 @@ +/** + * xhci-dbc.c - xHCI debug capability early driver + * + * Copyright (C) 2016 Intel Corporation + * + * Author: Lu Baolu + * + * This program is free software; you can redistribute it a

[RESEND PATCH v2 0/4] usb: early: add support for early printk through USB3 debug port

2016-10-18 Thread Lu Baolu
;v2: - Refactor the duplicate code in xdbc_early_start() and xdbc_handle_external_reset(). - Free resources when hardware not used any more. - Refine the user guide document. Lu Baolu (4): usb: dbc: early driver for xhci debug capability x86: add support for earlyprintk via USB3 debug p

[RESEND PATCH v2 0/4] usb: early: add support for early printk through USB3 debug port

2016-10-18 Thread Lu Baolu
;v2: - Refactor the duplicate code in xdbc_early_start() and xdbc_handle_external_reset(). - Free resources when hardware not used any more. - Refine the user guide document. Lu Baolu (4): usb: dbc: early driver for xhci debug capability x86: add support for earlyprintk via USB3 debug p

Re: [PATCH v17 3/4] usb: gadget: Integrate with the usb gadget supporting for usb charger

2016-10-10 Thread Lu Baolu
't usb_charger_exit() a better place? > The usb_charger_exit() will issue usb_charger_unregister() and we need > use the usb_charger structure in usb_charger_unregister() to > unregister the usb charger. > This seems not to be a strong reason. :-) You can unregister the charger first and then free the structure. Just do the reverse operation of what you have done in the init function. Best regards, Lu Baolu

Re: [PATCH v17 3/4] usb: gadget: Integrate with the usb gadget supporting for usb charger

2016-10-10 Thread Lu Baolu
't usb_charger_exit() a better place? > The usb_charger_exit() will issue usb_charger_unregister() and we need > use the usb_charger structure in usb_charger_unregister() to > unregister the usb charger. > This seems not to be a strong reason. :-) You can unregister the charger first and then free the structure. Just do the reverse operation of what you have done in the init function. Best regards, Lu Baolu

<    6   7   8   9   10   11   12   13   14   15   >