lkml.org 
[lkml]   [2015]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] usb: notify hcd when USB device suspend or resume


On 05/07/2015 10:34 PM, Alan Stern wrote:
> On Thu, 7 May 2015, Lu, Baolu wrote:
>
>>>> + void (*device_suspend)(struct usb_hcd *, struct usb_device *udev,
>>>> + pm_message_t msg);
>>>> + void (*device_resume)(struct usb_hcd *, struct usb_device *udev,
>>>> + pm_message_t msg);
>>>> };
>>> Your callbacks don't use the msg argument. What makes you think it is
>>> needed?
>> This msg argument is valuable. XHCI spec defines a capability named FSC
>> (Force Save context Capability). When this capability is implemented, the
>> Save State operation (do during host suspend) shall save any cached Slot,
>> Endpoint, Stream or other Context information to memory. xHCI hcd could
>> use this "msg" to determine whether it needs to issue stop endpoint with
>> SP (suspend) bit set.
> I don't understand. What is the advantage of using FSC?

I'm sorry, I didn't make it clear.

As part of host suspend, controller save state will be issued to save
host internal state in xhci_suspend():

/* step 4: set CSS flag */
command = readl(&xhci->op_regs->command);
command |= CMD_CSS;
writel(command, &xhci->op_regs->command);
if (xhci_handshake(&xhci->op_regs->status,
STS_SAVE, 0, 10 * 1000)) {
xhci_warn(xhci, "WARN: xHC save state timeout\n");
spin_unlock_irq(&xhci->lock);
return -ETIMEDOUT;
}

If FSC is supported, the cached Slot, Endpoint, Stream, or other
Context information are also saved.

Hence, when FSC is supported, software does not have to issue Stop
Endpoint Command to push public and private endpoint state into
memory as part of system suspend process.

The logic in xhci_device_suspend() will look like:

if xhci_device_suspend() callback was called due to system suspend,
(mesg.event & PM_EVENT_SUSPEND is true) and FSC is supported by
the xHC implementation, xhci_device_suspend() could ignore stop
endpoint command, since CSS will be done in xhc_suspend() later and
where all the endpoint caches will be pushed to memory.

>
> How would xhci-hcd use "msg" to determine this? And why doesn't your
> 2/3 patch already do it?

xhci-hcd can use "msg" to determine which case the callback is called,
run-time suspend or system suspend.

FSC needs a separate patch, I already have it in Mathias' gate. I didn't
bring it together with this patch series because it's still not tested yet.

>
> Alan Stern

Thank you!
Baolu

>
>
>



\
 
 \ /
  Last update: 2015-05-08 03:21    [W:0.084 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site