Re: [PATCH v2 1/1] usb: xhci: dbc: Add SPDX identifiers to dbc files

2017-12-23 Thread Philippe Ombredanne
On Sat, Dec 23, 2017 at 8:52 AM, Lu Baolu  wrote:
> Update the xhci dbc files with the correct SPDX license identifiers.
>
> Fixes: dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")
> Cc: Philippe Ombredanne 
> Signed-off-by: Lu Baolu 
> ---
>  changes from v1:
>  * Use plain C style comments in header file.
>
>  drivers/usb/host/xhci-dbgcap.c | 1 +
>  drivers/usb/host/xhci-dbgcap.h | 2 +-
>  drivers/usb/host/xhci-dbgtty.c | 1 +
>  3 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
> index 452df0f..beea567 100644
> --- a/drivers/usb/host/xhci-dbgcap.c
> +++ b/drivers/usb/host/xhci-dbgcap.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /**
>   * xhci-dbgcap.c - xHCI debug capability support
>   *
> diff --git a/drivers/usb/host/xhci-dbgcap.h b/drivers/usb/host/xhci-dbgcap.h
> index e66ea07..ce0c607 100644
> --- a/drivers/usb/host/xhci-dbgcap.h
> +++ b/drivers/usb/host/xhci-dbgcap.h
> @@ -1,4 +1,4 @@
> -
> +/* SPDX-License-Identifier: GPL-2.0 */
>  /**
>   * xhci-dbgcap.h - xHCI debug capability support
>   *
> diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
> index 8d47b6f..033cc0e 100644
> --- a/drivers/usb/host/xhci-dbgtty.c
> +++ b/drivers/usb/host/xhci-dbgtty.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /**
>   * xhci-dbgtty.c - tty glue for xHCI debug capability
>   *
> --
> 2.7.4
>

Thank you!

Reviewed-by: Philippe Ombredanne 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MX25 USB timeout on ID 0951:1665 Kingston Technology Digital DataTraveler SE9 64GB

2017-12-23 Thread Michael Nazzareno Trimarchi
Hi Peter

On Tue, Dec 19, 2017 at 3:08 PM, Michael Nazzareno Trimarchi
 wrote:
> Hi Peter
>
> On Thu, Nov 16, 2017 at 10:20 AM, Peter Chen  wrote:
>>
>>> >
>>> > All USB registers, including USB transceiver, USB non-core, and USB core.
>>>
>>> I need to have some time to go to the platform again. It will be possible 
>>> this weekend.
>>> Have you any idea to restrict the debug apart register dump?
>>>
>>
>> I am afraid I don't have since imx25 is too old, I have little directly 
>> experiences on it.
>>
>
> I have done some testing on top. I can not easily dump registers on
> the 2.6.31. I have
> recompile the old kernel and re-instrumented it. Well I don't find any
> important thing.
>
> The old kernel was using ehci_fsl.c basecode and the new one use
> chipidea. Let's say that
> some changes are in USB_CTRL usbmisc controller initialization but
> even play with those bits
> I did not find any failure on that side. I will continue on
> difference. Hope that some other have some idea ;).

I have used a usb hardware tracer. What I can say that basically after
the reset the device
try to go in HIGH SPEED mode but the controller can only manage full
speed even is an ehci.

I have tried the errata to set PFSC bit but is even set from the dts
if we force the FULL SPEED mode.


Michael

>
> Michael
>
>
>> Peter



-- 
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb:dwc3:fix access poisoned list_head in dwc3_gadget_giveback

2017-12-23 Thread Yu Chen
From: Yu Chen 

Unable to handle kernel paging request at virtual address dead0108
pgd = fff7a3179000
[dead0108] *pgd=230e0003, *pud=230e0003,
*pmd=
Internal error: Oops: 9644 [#1] PREEMPT SMP
Modules linked in:
CPU: 2 PID: 1 Comm: init Tainted: GW   4.4.23+ #1
TGID: 1 Comm: init
Hardware name: kirin970 (DT)
task: fff99f19 ti: fff99f1740e0 task.ti: fff99f1740e0
PC is at dwc3_gadget_giveback+0xa8/0x228
LR is at dwc3_remove_requests+0x44/0x88

The crash occurred when usb work as rndis device and
__dwc3_gadget_kick_transfer return error in __dwc3_gadget_ep_queue.
The request submited in __dwc3_gadget_ep_queue is moved to started_list
but not kicked. It is stil on started_list although
__dwc3_gadget_kick_transfer failed. When dwc3_gadget_ep_queue return
error to u_ether driver, the request will be resubmit to dwc3 driver.
At last, the same request is both on started_list and pending_list,
it will be list_del twice in dwc3_remove_requests and cause crash.

Signed-off-by: Yu Chen 
---
 drivers/usb/dwc3/gadget.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 639dd1b163a0..a913e64ca4e0 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1278,9 +1278,28 @@ static void dwc3_gadget_start_isoc(struct dwc3 *dwc,
__dwc3_gadget_start_isoc(dwc, dep, cur_uf);
 }
 
+static int dwc3_gadget_is_req_pengding_or_started(struct dwc3_ep *dep,
+   struct dwc3_request *req)
+{
+   struct dwc3_request *iterate_req;
+
+   list_for_each_entry(iterate_req, >pending_list, list) {
+   if (iterate_req == req)
+   return 1;
+   }
+
+   list_for_each_entry(iterate_req, >started_list, list) {
+   if (iterate_req == req)
+   return 1;
+   }
+
+   return 0;
+}
+
 static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request 
*req)
 {
struct dwc3 *dwc = dep->dwc;
+   int ret;
 
if (!dep->endpoint.desc) {
dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n",
@@ -1334,7 +1353,14 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, 
struct dwc3_request *req)
}
 
 out:
-   return __dwc3_gadget_kick_transfer(dep);
+   ret = __dwc3_gadget_kick_transfer(dep);
+   if (ret && dwc3_gadget_is_req_pengding_or_started(dep, req)) {
+   dev_dbg(dwc->dev, "%s: req still on list, return 0\n",
+   dep->name);
+   ret = 0;
+   }
+
+   return ret;
 }
 
 static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
-- 
2.15.0-rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Subject: [PATCH] usb:dwc3:fix access poisoned list_head in dwc3_gadget_giveback

2017-12-23 Thread Yu Chen
From: Yu Chen 

Unable to handle kernel paging request at virtual address dead0108
pgd = fff7a3179000
[dead0108] *pgd=230e0003, *pud=230e0003,
*pmd=
Internal error: Oops: 9644 [#1] PREEMPT SMP
Modules linked in:
CPU: 2 PID: 1 Comm: init Tainted: GW   4.4.23+ #1
TGID: 1 Comm: init
Hardware name: kirin970 (DT)
task: fff99f19 ti: fff99f1740e0 task.ti: fff99f1740e0
PC is at dwc3_gadget_giveback+0xa8/0x228
LR is at dwc3_remove_requests+0x44/0x88

The crash occurred when usb work as rndis device and
__dwc3_gadget_kick_transfer return error in __dwc3_gadget_ep_queue.
The request submited in __dwc3_gadget_ep_queue is moved to started_list
but not kicked. It is stil on started_list although
__dwc3_gadget_kick_transfer failed. When dwc3_gadget_ep_queue return
error to u_ether driver, the request will be resubmit to dwc3 driver.
At last, the same request is both on started_list and pending_list,
it will be list_del twice in dwc3_remove_requests and cause crash.

Signed-off-by: Yu Chen 
---
 drivers/usb/dwc3/gadget.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 639dd1b163a0..a913e64ca4e0 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1278,9 +1278,28 @@ static void dwc3_gadget_start_isoc(struct dwc3 *dwc,
__dwc3_gadget_start_isoc(dwc, dep, cur_uf);
 }
 
+static int dwc3_gadget_is_req_pengding_or_started(struct dwc3_ep *dep,
+   struct dwc3_request *req)
+{
+   struct dwc3_request *iterate_req;
+
+   list_for_each_entry(iterate_req, >pending_list, list) {
+   if (iterate_req == req)
+   return 1;
+   }
+
+   list_for_each_entry(iterate_req, >started_list, list) {
+   if (iterate_req == req)
+   return 1;
+   }
+
+   return 0;
+}
+
 static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request 
*req)
 {
struct dwc3 *dwc = dep->dwc;
+   int ret;
 
if (!dep->endpoint.desc) {
dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n",
@@ -1334,7 +1353,14 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, 
struct dwc3_request *req)
}
 
 out:
-   return __dwc3_gadget_kick_transfer(dep);
+   ret = __dwc3_gadget_kick_transfer(dep);
+   if (ret && dwc3_gadget_is_req_pengding_or_started(dep, req)) {
+   dev_dbg(dwc->dev, "%s: req still on list, return 0\n",
+   dep->name);
+   ret = 0;
+   }
+
+   return ret;
 }
 
 static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
-- 
2.15.0-rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html