Bug #1132

Power off for PCI devices

Added by hasso over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

http://leaf.dragonflybsd.org/~hasso/pci-detatch-powerdown.patch

With this tiny patch power is turned off for PCI devices during detach
(ie. when you unload module). It makes is possible to preserve power in
laptops (and make them cooler) with unloading network and/or sound device
modules not in use and load them only if really needed.

However, I'm really not sure about all consequences this patch might
cause, might knowledge about newbus and friends are still quite limited.
Any objections to commit this?

Tested with em(4), ath(4) and snd_hda(4).

History

#1 Updated by hasso over 5 years ago

Committed.

#2 Updated by Johannes.Hofmann over 5 years ago

Nice! Do the modules have to be loaded (and then unloaded) for this to
take effect or is it enough to just not load them in the first place?

Thanks,
Johannes

#3 Updated by hasso over 5 years ago

It was enough to just not load them even before this patch. Powering down
not used devices at boot time was already there with this commit:

http://leaf.dragonflybsd.org/mailarchive/commits/2008-09/msg00051.html

This patch adds just the ability to power down a devices on module unload.

#4 Updated by Johannes.Hofmann over 5 years ago

Ah ok. Is there a way to verify the state of the pci devices?
On my T42 thinkpad I don't see any difference in power consumption
with hw.pci.do_power_nodriver=1 (measured with an external device and
battery removed). I'm always around 20 Watt, with est enabled,
"DynamicClocks" "on" in xorg.conf, and screen backlight set to the
lowest possible value.

Cheers,
Johannes

#5 Updated by hasso over 5 years ago

I use hw.pci.do_power_nodriver=3, btw, but it shouldn't matter much. Is
there unused devices at all? And these devices have to have power
management capabilities, not all PCI devices have these.

I use sysutils/pciutils from pkgsrc to play with PCI configuration space.
It doesn't compile in DragonFly without the patch, pkgsrc bugreport is
there about year or so :(. Take patch is available at [1]. lspci -vvv
shows to you all devices with decoded configuration space. For example
ABOUT my wireless card it shows this:

Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1+ D2- AuxCurrent=375mA
PME(D0+,D1+,D2-,D3hot+,D3cold-)
Status: D3 PME-Enable- DSel=0 DScale=0 PME-

Important bit is "Status: D3" - ie. this device is powered down.

[1] -
http://leaf.dragonflybsd.org/~hasso/pkgsrc-patches/pkgsrc-sysutils-pciutils.patch

#6 Updated by Johannes.Hofmann over 5 years ago

lspci -vv indeed shows some devices (usb controller, sound card, ethernet card,
and modem) in D3 state.

Thanks,
Johannes

Also available in: Atom PDF