lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87shi31l6c.fsf@linux.intel.com>
Date:   Tue, 11 Jul 2017 10:34:35 +0300
From:   Felipe Balbi <balbi@...nel.org>
To:     Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>,
        Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>,
        John Youn <John.Youn@...opsys.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-usb\@vger.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: dwc2: gadget: On disconnect reset device address to zero


Hi,

Minas Harutyunyan <Minas.Harutyunyan@...opsys.com> writes:
>> Minas Harutyunyan <Minas.Harutyunyan@...opsys.com> writes:
>>> USB CV driver stack doesn't perform USB RESET after device disconnect/
>>> connect, so need to reset to zero DEVADDR field in DCFG to pass
>>> enumeration again.
>>>
>>> Signed-off-by: Minas Harutyunyan <hminas@...opsys.com>
>>> ---
>>>  drivers/usb/dwc2/gadget.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>> index 98a4a79e7f6e..deb3d901b99d 100644
>>> --- a/drivers/usb/dwc2/gadget.c
>>> +++ b/drivers/usb/dwc2/gadget.c
>>> @@ -3174,6 +3174,9 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
>>>  		return;
>>>
>>>  	hsotg->connected = 0;
>>> +	/* On disconnect reset device address to zero */
>>> +	__bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
>>> +
>>
>> Which of the tests are you talking about? Which particular USB CV are
>> you running?
>>
> I used USB 3 Gen X CV (downloaded from usb.org 1-2 week ago). Tests are:
> 1. "Device Summary" - after 1st pass, disconnect then connect again test 
> failed. Actually it show as "test passed" but not able to enumerate 
> device again.
> 2. MSC "USB Mass Storage Power Up Test". After disconnect, by suite 
> request, and then connect test failed (pass, if reloading driver).

I'll try these tests tomorrow next time I'm in the office. Woke up sick,
working from home today :-s

>> I don't remember ever seeing this with dwc3. How should I go about
>> triggering this problem? If this was really the case, then we would have
>> this on *all* UDCs.
>>
> dwc2 driver resetting DEVADDR in DCFG register only in function 
> dwc2_hsotg_core_init_disconnected() by soft reset. This function not 
> called on disconnect/connect with CV SW stack (function call not seen in 
> dmesg).

right, this is a bug in dwc2. You should clear DEVADDR from your Reset
handler, not disconnect.

> This issue not seen with any other EHCI/XHCI hosts either on 
> Linux/Windows because these hosts issuing USB RESET, as result called 
> dwc2_hsotg_core_init_disconnected().
>
> In dwc3 per my understanding same stuff done in function 
> dwc3_gadget_reset_interrupt(), am I right?

right, as it should. If dwc3_gadget_reset_interrupt() runs, this means
the host *is* issuing USB reset signalling.

>> I just did a fresh install of USB 3 Gen X CV (that I just download from
>> usb.org). Ran Chapter 9 tests against a HS dwc3 board I have around and
>> I can't see the problem you're talking about.
>>
> Yes, this issue not seen with dwc3.

because we clear DEVADDR on Reset.

-- 
balbi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ