Enable ASPM in T61 running Windows for saving ~2W of power consumption

Discussion in 'Hardware Components and Aftermarket Upgrades' started by tqbinh, Aug 24, 2011.

Thread Status:
Not open for further replies.
  1. tqbinh

    tqbinh Notebook Enthusiast

    Reputations:
    92
    Messages:
    44
    Likes Received:
    32
    Trophy Points:
    26
    Active State Power Management or ASPM is a power management protocol used to manage PCI Express-based serial link devices as links become less active over time. It is normally used on laptops and other mobile Internet devices to extend battery life (Wikipedia). Details on ASPM can be found in this Microsoft’s documents
    Unfortunately, due to unknown for me reason, Lenovo (and some other laptop manufacturers) disable BIOS support for ASPM in all Thinkpads models, though most of PCI-E devices are ASPM capable. The workarround in Linux is simple: just add an option pcie_aspm=force to Linux boot command line. Using this trick, my T61’s (see config below) idle power consumption in Ubuntu 11.04 go down from 15.6W to 11.9W (!).
    In Windows OS, at this moment there no workarround for enabling ASPM (at least from my search on internet) because windows does not have option to force ASPM as Linux. Some people complain about it on Lenovo forum. Fortunately, the specialist on undervolting under the nick Nando4 in notebookreview.com give me a hint on using the setpci command in grub2 boot loader (grub2 boot loader is installed when you install Ubuntu). Using Nando4’s advice, I was successful in enabling ASPM in Windows 7 (and Windows XP). The procedure is as follows:

    1. Tools needed:
    - Installation of Linux (Ubuntu 11.04 in my case). My T61 has triple boot: Ubuntu, Windows 7 64 bit and Windows XP.
    - HWInfo (32 or 64 bit version depend on your system) for detecting which PCI-e device is ASPM capable and which ASPM mode (L0, L0s, or L1) is activated.
    - Optional: R-W everthing tool to read / write to PCI registries (thanks to Nando4 for the link). This tool allow to read / write PCI-e registries in Windows instead of lspci and setpci in Linux.

    2. Knowledge required:
    - Understanding about ASPM modes (see the above MS document for ASPM modes).
    - Understanding how to calculate the address in PCI-e registry that store ASPM modes. Please read the very good tutorial on Linux Wireless on ASPM. Though it is written about WLAN card, it can be applied for any other PCI-e card.
    - Know about how to convert hexadecimal value to binary (you can use Windows’ or Linux’s calculator to do the conversion).

    3. Procedures:
    - Start Ubuntu, using the Linux Wireless’s tutorial (link above) to determine which PCI-e device is ASPM capable but not activated. In my case it is nVidia video card (L0s enabled windows and L0 in Ubuntu) and PCI-e ports 0,1,2...
    - For those devices determine the root device (if any, for example my nVidia card is sit on root pci-e port 0), the address in PCI-e registry of each devices that stores ASPM value (please, look at the tutorial again). Write down this (hexadecimal) value.
    - Using calculator to convert hexadecimal values into binary ones and check the last to bits: they must be 11 for activate ASPM in full (L1) mode, other wise change these bits to 11 and convert the value back to hexadecimal. Example: my nVidia card has value 0x48 at address 0x88 (0x means hexadecimal). 0x48 converted to binary is 1001000, the last two bits are 00 meaning ASPM is disabled, I changed them to 11 (i.e. 1001011) and convert value back to 0x4B.
    - Run Ubuntu terminal and type sudo gedit to open editor as administrator, when it asked, enter your password (not admin password, you do not have it). In GEditor open file grub.cfg in directory /boot/grub/, find the lines concerning loading Windows 7 (or XP) like this:
    Code:
    menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
    	insmod part_msdos
    	insmod ntfs
    	set root='(/dev/sda,msdos1)'
    	search --no-floppy --fs-uuid --set=root 5A0EFA630EFA3819
    	chainloader +1
    }
    And then add the required setpci command in the following format: setpci -s (device address) (port address).B=value (again, see the Linux Wireless’s tutorial above for understading). In the case of my T61, it look as follows:
    Code:
    menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
    	insmod part_msdos
    	insmod ntfs
    	set root='(/dev/sda,msdos1)'
    [COLOR="Red"]	setpci -s 00:01.0 0xB0.B=0x43
    [B]	setpci -s 01:00.0 0x88.B=0x4B[/B]
    	setpci -s 00:1c.0 0x50.B=0x03
    	setpci -s 00:1c.1 0x50.B=0x43
    	setpci -s 00:1c.2 0x50.B=0x03
    	setpci -s 03:00.0 0xF0.B=0x43	[/COLOR]
    	search --no-floppy --fs-uuid --set=root 5A0EFA630EFA3819
    	chainloader +1
    } 
    Where the second setpci command is used to enable ASPM on nVidia video card.
    - Save the grub.cfg file and reboot to Windows 7 (or XP), use HWInfo to check if ASPM is enabled for each device (in the left tree of HWInfo go to Bus node and open all its sub-node, for each sub-node check the info on the right panel)
    - Use Power Manager or other tool to check if the power consumption is decreased. For my T61 with the following specs:
    CPU: T9300, GPU: nVidia NVS140M undervolting to 0.95v, UXGA 15.1” Flexview (chasis and LCD from T60p), 4GB RAM (single module), HDD: WD 3200BEKT black with SATA Aggressive Link Power Management (ALPM) enabled, Windows 7 64 bits.
    The power consumption as follow:
    Code:
    ASPM	SATA ALPM	Power consumption
    No	No		14.16-14.6 W
    Yes	No		12.6-12.9 W
    No	Yes, LPMSTATE=0	13.40W
    No	Yes, LPMSTATE=1	13.30W
    Yes	Yes, LPMSTATE=1	11.40W
    
    
    Thus, enabling ASPM saves 1.9W, ALPM saves another 1W of power consumption. As the results, the computer is running noticably cooler and battery time on 6-cells battery increase by ~30 minutes under light use.
     
    duttyend likes this.
  2. miro_gt

    miro_gt Notebook Deity

    Reputations:
    433
    Messages:
    1,748
    Likes Received:
    4
    Trophy Points:
    56
    nice work :D

    I got only XP though, so will see when and how I shall install grub2
     
  3. forteller

    forteller Newbie

    Reputations:
    32
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    5
    Great tutorial! Thank you very much.

    I was getting strange behavior with my 6910p. If I was unplugging my lappy from AC charged up to 100%, it was idling at ~11W, but after reboot discharge rate was raising to 13W. This tutorial seems to resolve this issue.

    I had few problems though. When I started W7 first time after adding those lines in grub, it froze at starting logo. I removed the line used with my GPU using grub editor (so it was only one-time job), and after reboot it ran smoothly. Strange.

    Another thing is, that Windows 7 still reports that ASPM is disabled if I run powercfg /energy in command line. HWInfo says otherwise, and power consumption dropped, so I think that isn't true.
     
  4. tqbinh

    tqbinh Notebook Enthusiast

    Reputations:
    92
    Messages:
    44
    Likes Received:
    32
    Trophy Points:
    26
    The same for my T61 and T60.
    IMO, Windows 7 reports that ASPM is disabled because the ICH8M's Audio controller is not ASPM capable (strange thing because ICH7M's Audio controller in my T60 is ASPM capable). Another possible reason is that the BIOS might report to Windows that the computer is not ASPM capable.
    --------------------------
    To all:
    Currently I am doing research on how to turn the USB subsystem into lowest possible power state to save another 1.5W. On my T42p and X60 when I disconnect all USB drivers the power consumption is dropped by 1.5W. For example:
    Code:
    Computer	USB devices		Power consumption
    T42p		No			X
    T42p		flash driver		X+4W
    T42p		flash driver, mouse	X+5W
    T42p		mouse			X+3W
    ------------
    T61		No			Y
    T61		flash driver		Y+1.5W
    T61		flash driver, mouse	Y+2.3W
    T61		mouse			Y+0.8W
    In the above table, X and Y denotes base power consumption of T42p and T61 respectively.
    The X60s behaves similar to T42p, while T60 behaves similar to T61. Therefore, T42p and X60s BIOSes can turn off the USB controller while it is idle, while T6x not.
    I will appreciate any hint on how to enable this feature in T6x :)
     
    duttyend likes this.
  5. User Retired 2

    User Retired 2 Notebook Nobel Laureate NBR Reviewer

    Reputations:
    4,127
    Messages:
    7,860
    Likes Received:
    10
    Trophy Points:
    0
    @tqbinh - a bios mod to the ACPI FACP entry can be used to eliminate the Linux warning that appears in dmesg. Ie:
    I didn't check prior but Windows7 error below might be eliminated too:
    The ACPIspec40a tells us
    Table 5-11 tells us PCIe ASPM Controls (bit 4) If set, indicates to OSPM that it must not enable OSPM ASPM control on this platform.

    How to check your FACP IAPC_BOOT_ARCH value?

    Get ACPI tables and write to files (*.dat). This kit contains asl.exe and iasl.exe for ACPI extraction and modification.
    Code:
    iasl -g
    Then hex view the resultant FACP_*.dat file, byte 0x6D (109d). Below we see it's 0x13 (10011b). So want to turn off bit 4 to make this value 0x3 (11b). This can be done by finding where this FACP lives in your bios file and mod that byte. I've just done that to a HP 2510P bios and it now eliminates that Linux error.

    [​IMG]

    I did check the APSMs of various devices but found they were still disabled. So I too added the following entries to my grub2 /boot/grub/grub.cfg configuration file to force enable them:

    Code:
    	setpci -s 00:1c.0 0x50.B=0x03
    	setpci -s 00:1c.1 0x50.B=0x43
    	setpci -s 10:00.0 0xF0.B=0x43
    Maybe you can ask middleton to added pcie APSMs bios support to his ultimate bios referring to this post for the details of how to do it?

    Refer also to Making sense of PCIe ASPM for Linux kernel boot option workarounds.
     
  6. tqbinh

    tqbinh Notebook Enthusiast

    Reputations:
    92
    Messages:
    44
    Likes Received:
    32
    Trophy Points:
    26
    Thank you very much for the hints on FACP ACPI table. I checked it on my T61 and it show 0x12 at address 0x6D. Following your explanation, it should be changed to 0x02. However, when trying to find FACP using a hex string in BIOS file (*.fl1 and *.fl2 in the case of Thinkpad T61) I did not find anything. Maybe these files are encoded or FACP is stored in separate file / BIOS space?
    To say frankly, I am satisfying with the setpci command in Grub2 boot loader. IMO, playing with BIOS is a dangerous business for me because I am not a specialist in this field :) . You are right when advice me to ask Middletone to do this BIOS mod.

    My current concerns are the following:
    1. To activate USB controller shuttdown / sleep when inactive (it was explained in my previous post).
    2. To make voltage mod for the chipset, specially the VCC 1R5M 1.5V voltage (I have plan to mod the resistors in the feedback circuit of MAX1540 voltage regulator, but did not have time to do it).
    3. To discover the possibility to change the width of PCI-E link to the GPU, from 16x to, said, 8x or even 1x, to save power on this link.
     
    duttyend likes this.
  7. MightyMauz

    MightyMauz Newbie

    Reputations:
    0
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    5
    I am trying to do this too on my X200s with Ubuntu 14 and Windows 7 dual boot. But I get stuck quite quickly. Installing the dualboot worked, but I have no clue if ASPM is working in Ubuntu, or even if it should.

    I have tried to follow the Linux wireless tutorial, but it isn’t available anymore. I did however find this ASPM - Linux Wireless . But I have no clue what the output is saying me if I run “lspci –vvv”.

    I am new to Linux but I do have _some_ terminal experience and I really would like this to work.
     
  8. MightyMauz

    MightyMauz Newbie

    Reputations:
    0
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    5
    Actually after a full day on the issue, reading thoroughly this topic and ASPM on Linux I somewhat succeeded:
    -I could enable ASPM for my Intel AGN 5300
    -But my audio card doesn't support ASPM at all
    So the result is that powercfg -energy is still reporting ASPM error and HWinfo reporting all PCIe devices as ASPM L1 but the sound card as unable to do ASPM. So unless someone has an idea how to put the Conexant 20561 into ASPM, I'm afraid that I am not much further than I started with...
     
Loading...
Thread Status:
Not open for further replies.

Share This Page