Skip to contentSkip to conversation

Runtime PM for PCI-based USB host controllers

DISCUSSION Alan Stern 3 participants 3 messages May 26, 2010 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Alan Stern

author
#1 lore raw
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Alan Stern

Rafael:

I've been updating the patch Matthew Garrett posted last November, adding runtime PM methods for PCI USB controllers. Overall the situation is now easier, since the rest of the USB subsystem has been converted over to the runtime PM framework. And it even seems to work!

Quoted 7 lines
Quoted 4 lines

But there is one problem. The device driver needs to know, during its pm_suspend callback, whether or not wakeup should be enabled. (Or more accurately, the pm_suspend callback needs to fail if wakeup isn't going to be available.)

The driver can check that by calling pci_dev_run_wake() which returns false if there's no wakeup support for the device.

Ah, okay, thanks.

Quoted 5 lines

However, that's not enough on
some broken machines where some signal pins are simply not connected to the system core logic (as a result the PCI core thinks that wakeup is supported, but in fact it doesn't work due to the broken hardware - yes, there are machines like this in the wild, Matthew has one).

We don't have to worry about that. If the hardware is broken and the kernel doesn't realize it, the user will just have to tell it not to allow runtime suspend for those devices.

Alan Stern

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 26 lines · Alan Stern
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Alan Stern

Rafael:

I've been updating the patch Matthew Garrett posted last November, adding runtime PM methods for PCI USB controllers. Overall the situation is now easier, since the rest of the USB subsystem has been converted over to the runtime PM framework. And it even seems to work!

Quoted 7 lines
Quoted 4 lines

But there is one problem. The device driver needs to know, during its pm_suspend callback, whether or not wakeup should be enabled. (Or more accurately, the pm_suspend callback needs to fail if wakeup isn't going to be available.)

The driver can check that by calling pci_dev_run_wake() which returns false if there's no wakeup support for the device.

Ah, okay, thanks.

Quoted 5 lines

However, that's not enough on
some broken machines where some signal pins are simply not connected to the system core logic (as a result the PCI core thinks that wakeup is supported, but in fact it doesn't work due to the broken hardware - yes, there are machines like this in the wild, Matthew has one).

Quoted 3 lines

We don't have to worry about that. If the hardware is broken and the kernel doesn't realize it, the user will just have to tell it not to allow runtime suspend for those devices.

Yup.

That's why we keep the PCI devices runtime PM in the "forbidden" state until user space changes that.

Rafael

#4 lore raw
In reply to a message not in the archive
Quoted 3 lines · Alan Stern

We don't have to worry about that. If the hardware is broken and the kernel doesn't realize it, the user will just have to tell it not to allow runtime suspend for those devices.

It's worse than that - Windows simply doesn't use legacy PCI PMEs for anything, so an increasing number of modern machines don't have them wired up. Defaulting to runtime PM simply isn't practical, since the behaviour will simply be that the devices stop working without any indication that they've stopped working. The "easiest" workaround would be a thread that polls for PCI devices with set PME bits, along with a set of heuristics for determining whether the device can really wake up.

Devices in the core logic (like USB generally is) will be fine in any case. It's discrete PCI devices that are the problem.

Signature · 1 line
Matthew Garrett | [email protected]