Re: [coreboot] Powersavings: 8W of difference between bios and coreboot
Hi Charlotte, here are some description of the EC in your board. Don't know how much you already know. The Thinkpad has 2 EC controller. 1x Thinker 1x H8S (W530 has a SMSC chip). The ectool dump only shows a buffer, which both side(host+ec) can use to communicate. The ectool usually talks to the H8S and not to the Thinker. There is a way to community to the Thinker using different I/O address. - |Chipset| - | | LPC | --- | H8S | --- | | SPI | - |Thinker| - best, lynxis -- Alexander Couzens mail: lyn...@fe80.eu jabber: lyn...@fe80.eu mobile: +4915123277221 gpg: 390D CF78 8BF9 AA50 4F8F F1E2 C29E 9DA6 A0DF 8604 pgpRERBbonAzu.pgp Description: OpenPGP digital signature -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
Re: [coreboot] Powersavings: 8W of difference between bios and coreboot
Quick update: I tried experimenting on the w530 to find which ACPI call turns off the dGPU. bbswitch reported it was: \_SB.PCI0.LPC.EC.PUBS._OFF however, in tests with powertop it failed to show any improvement. A lot of information was found on https://github.com/Lekensteyn/acpi-stuff/blob/master/notes.txt, with further discussion on https://github.com/Bumblebee-Project/bbswitch/issues/112 The following acpi call takes the power consumption of a W530 in the default bios from 20W to 13W, and is reported to also work on the W520 by http://hybrid-graphics-linux.tuxfamily.org/index.php?title=ACPI_calls \_SB.PCI0.PEG.VID._DSM {0xF8,0xD8,0x86,0xA4,0xDA,0x0B,0x1B,0x47,0xA7,0x2B,0x60,0x42,0xA6,0xB5,0xBE,0xE0} 0x100 0x1A {0x1,0x0,0x0,0x3} \_SB.PCI0.PEG.VID._PS3 _PS3 puts the card in D3 mode (what I was trying to do with setpci before) but not in totally off model. The card is truly off when lspci shows rev ff, and that is done by the _DSM. powertop then reports about 12W, so _PS3 shaves 7W and _DSM shaves 1W which is just what I may need to fix by extra consumption of 8W Apparently with the default bios some fields in the DSDT also change when Optimus is enabled, cf http://www.insanelymac.com/forum/topic/273621-guide-os-x-lion-on-thinkpad-w520/page-3 : OperationRegion (MNVS, SystemMemory, 0xBAF9D018, 0x1000) // optimusOperationRegion (GNVS, SystemMemory, 0xBAF3FE18, 0x01A6) // optimus OperationRegion (MNVS, SystemMemory, 0xBF79D018, 0x1000) // discreteOperationRegion (GNVS, SystemMemory, 0xBF73FE18, 0x01A6) // discrete I could confirm that on the extracted DSDT. I have yet to make sense of the content of MVNS and GNVS, and the consequences of the field changes. Switching between \_SB.PCI0.PEG.VID._PS3 and \_SB.PCI0.PEG.VID._PS0 ( with echo $i > /proc/acpi/call) changes the power consumption reliably by 7W, so I think this controls the Nvidia power I am now trying to replicate these results on coreboot, by studying the EC dump with ectool -d before and after switching the power. No success so far. I tried acpi_debug but the logs were not helpful. In case anyone is interested, here is the relevant part of the ACPI tables. Please read https://github.com/Lekensteyn/acpi-stuff/blob/master/notes.txt for a possible interpretation: Device(VID) { Name(_ADR, 0x00) OperationRegion(VPCG, PCI_Config, 0x00, 0x0100) Field(VPCG, DWordAcc, NoLock, Preserve) { Offset(0x2C),//Offset(44), VSID, 32, Offset(0x70),//Offset(112), VPWR, 8, } Name(_S3D, 0x03) Name(DGOS, 0x00) Method(_INI, 0, NotSerialized) { \VUPS(0x02) Store(\VCDL, VQDL) Store(\VCDC, VQDC) Store(\VCDT, VQD0) Store(\VCDD, VQD1) If(ISOP()) { \VHYB(0x04, 0x01) } } Method(_PS0, 0, NotSerialized) { If(ISOP()) { If(DGOS) { \VHYB(0x02, 0x00) Sleep(0x64) \VHYB(0x00, 0x01) Sleep(0x0A) Store(0x01, \_SB.PCI0.LPC.PCRS) Store(0x01, \_SB.PCI0.LPC.PCRQ) Sleep(0x64) \VHYB(0x02, 0x01) Sleep(0x01) \VHYB(0x08, 0x01) Store(0x0A, Local0) Store(0x32, Local1) While(Local1) { Sleep(Local0) If(\LCHK(0x01)) { Break } Decrement(Local1) } Store(0x00, \_SB.PCI0.LPC.PCRQ) \VHYB(0x04, 0x00) \SWTT(0x01) Store(Zero, DGOS) } Else { If(LNotEqual(VSID, 0x21D117AA)) { \VHYB(0x04, 0x00) } } \VHYB(0x09, \_SB.PCI0.PEG.VID.HDAS)
Re: [coreboot] Powersavings: 8W of difference between bios and coreboot
Quick update: Just having "device pci 01.0 on end" in the devicetree results in the following powertop measurements: 26W after boot, 21W with power savings applied, 20W at maximum power savings So just declaring the nvidia makes things much worse, even without really using the dGPU for anything. (there are no nvidia modules, to make sure it would not interfere with the measurements) Since it was in D0, I tried setting the Nvidia gpu in D3 state setpci -s 01:00.0 CAP_PM+4.b 08 setpci -s 01:00.0 CAP_PM+4.b=0b It didn't help with the power. To confirm whether disabling the Nvidia pcie interface results in this +4W in maximal power savings, I completed src/drivers/lenovo/hybrid_graphics.c with the PCI ID from my card. I could return to 17W with all power savings applied. So I'm back to trying to find a way to turn off the power completely with the EC, and hoping this is where the extra 8W come from. After some googling I found ec_access, but I don't know which register to write to. In case anyone is interested, here are the pci devices, of course ASPM is already enabled (root: 0xB0 : 0x43, peripheral: 0x88 : 0x4B) and I am not using the dGPU for anything at all. $ cat /sys/devices/pci:00/:00:01.0/:01:00.0/power/runtime_status suspended $ cat /sys/devices/pci:00/:00:01.0/:01:00.1/power/runtime_status active $ lspci -s 00:01.0 -xxx 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09 ) 00: 86 80 51 01 07 04 10 00 09 00 04 06 10 00 81 00 10: 00 00 00 00 00 00 00 00 00 01 01 00 20 20 00 20 20: 00 f0 00 f1 01 c0 f1 d1 00 00 00 00 00 00 00 00 30: 00 00 00 00 88 00 00 00 00 00 00 00 0b 01 03 00 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 80: 01 90 03 c8 08 00 00 00 0d 80 00 00 86 80 00 00 90: 05 a0 01 00 d8 02 e0 fe 00 00 00 00 00 00 00 00 a0: 10 00 42 01 01 80 00 00 00 00 00 00 03 ad 61 02 b0: 43 00 02 51 00 00 04 00 00 00 48 00 08 00 00 00 c0: 00 00 00 00 00 00 00 00 00 00 00 00 0e 00 00 00 d0: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f0: 00 00 00 00 00 00 01 00 00 00 00 00 01 00 10 00 #0 1 2 3 4 5 6 7 8 9 a b c d e f $ lspci -d 10de:0dfa -xxx 01:00.0 VGA compatible controller: NVIDIA Corporation GF108GLM [Quadro 1000M] (rev a1) 00: de 10 fa 0d 03 00 10 00 a1 00 00 03 10 00 80 00 10: 00 00 00 f0 0c 00 00 c0 00 00 00 00 0c 00 00 d0 20: 00 00 00 00 01 20 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 f1 60 00 00 00 00 00 00 00 0b 01 00 00 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50: 00 00 00 00 01 00 00 00 ce d6 23 00 00 00 00 00 60: 01 68 03 00 08 00 00 00 05 78 80 00 00 00 00 00 70: 00 00 00 00 00 00 00 00 10 b4 02 00 a0 8d 00 00 80: 10 28 00 00 02 2d 05 00 4b 01 02 11 00 00 00 00 90: 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 a0: 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 b0: 00 00 00 00 09 00 14 01 00 00 00 00 00 00 00 00 c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 #0 1 2 3 4 5 6 7 8 9 a b c d e f # 78 contains 10, on 88 : 4b $ lspci -d 10de:0bea -xxx 01:00.1 Audio device: NVIDIA Corporation GF108 High Definition Audio Controller (rev a1) 00: de 10 ea 0b 06 00 18 00 a1 00 03 04 10 00 80 00 10: 00 00 08 f1 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 60 00 00 00 00 00 00 00 0b 02 00 00 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 50: 00 00 00 00 00 00 00 00 ce d6 23 00 00 00 00 00 60: 01 68 03 00 08 00 00 00 05 78 80 00 00 00 00 00 70: 00 00 00 00 00 00 00 00 10 00 02 00 a0 8d 00 00 80: 10 28 00 00 02 2d 05 00 4b 01 02 11 00 00 00 00 90: 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Charlotte On Fri, Nov 18, 2016 at 4:04 PM, Charlotte Plusplus < pluspluscharlo...@gmail.com> wrote: > Hello > > Super interesting, I didn't know all that! > > Currently, I have only set in devicetree: > > device pci 00.0 on end # host bridge > device pci 01.0 off end # NVidia > device pci 02.0 on end # Intel > > and in my nvram options I have: > hybrid_graphics_mode = Integrated Only > > I assumed that would be sufficient to turn off the power for the dGPU > until I figure out a way to make it work. I will enable the NVidia and do > more power tests. > > After reading hybrid_graphics.c, I understand a bit more, but I also have >
Re: [coreboot] Powersavings: 8W of difference between bios and coreboot
Hello Super interesting, I didn't know all that! Currently, I have only set in devicetree: device pci 00.0 on end # host bridge device pci 01.0 off end # NVidia device pci 02.0 on end # Intel and in my nvram options I have: hybrid_graphics_mode = Integrated Only I assumed that would be sufficient to turn off the power for the dGPU until I figure out a way to make it work. I will enable the NVidia and do more power tests. After reading hybrid_graphics.c, I understand a bit more, but I also have more questions: - can I add register "pcie_hotplug_map" = "{ 0, 1, 0}" to make the NVidia removable? (so that the operating system will not freak out when the NVidia disappears from the PCI bus if I find a way to control the power by talking to the EC and send GFXCORE_ON_D + the other signal for the VRAM) - can you change the connection of the displayport? Based on the specsheets, it is connected to the dGPU, while the internal display is connected to the iGPU. If is it possible to control the muxes for the internal display, I suppose it is possible for the other displays as well. (I have just tested and I do not have any video on the displayport, and xrandr does not detect anything) - there seem to be some missing IDs in pci_device_ids_nvidia : cf http://envytools.readthedocs.io/en/latest/hw/pciid.html which agrees with the W530 : 0x0ffb, so I will propose a patch: 0x0dfa, /* Nvidia NVS Quadro 1000m Lenovo W520 */ 0x0ffb, /* Nvidia NVS Quadro K1000m Lenovo W530 */ 0x0ffc, /* Nvidia NVS Quadro K2000m Lenovo W530 */ It may also be the reason why the Nvidia is still getting power, as Iru noted that hybrid_graphics should turn off the power. I will test that separately. - until I can find a better solution, I am thinking of letting the Nvidia show on on the PCIe bus and then sending commands to get in into advanced sleep - like on https://wireless.wiki.kernel.org/en/users/documentation/aspm It should be possible as the w530 lspci -v shows: Capabilities: [60] Power Management version 3 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- Would you have a better idea? Thanks Charlotte On Fri, Nov 18, 2016 at 4:52 AM, Felix Heldwrote: > Hi! > > I don't know if Charlotte has added the ID of the dGPU to >> src/drivers/lenovo/hybrid_graphics.c. Does the dGPU consume power after >> hybrid_graphics.c disable the dGPU? >> > OPTIMUS_ENABLE is a PCH GPIO and controls the muxes that select if the > internal display is connected to the iGPU or the dGPU; that's done in > hybrid_graphics.c. > GFXCORE_ON_D (and another signal that controls the power supply of the > VRAM) are driven by the Thinker-1 chip; those switch on/off the power > supply of the GPU. So to really disable the GPU you probably have to ask > the EC to make that chip turn off the voltage for the GPU and VRAM. > > > Regards > Felix > > -- > coreboot mailing list: coreboot@coreboot.org > https://www.coreboot.org/mailman/listinfo/coreboot > -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
Re: [coreboot] Powersavings: 8W of difference between bios and coreboot
Hi! I don't know if Charlotte has added the ID of the dGPU to src/drivers/lenovo/hybrid_graphics.c. Does the dGPU consume power after hybrid_graphics.c disable the dGPU? OPTIMUS_ENABLE is a PCH GPIO and controls the muxes that select if the internal display is connected to the iGPU or the dGPU; that's done in hybrid_graphics.c. GFXCORE_ON_D (and another signal that controls the power supply of the VRAM) are driven by the Thinker-1 chip; those switch on/off the power supply of the GPU. So to really disable the GPU you probably have to ask the EC to make that chip turn off the voltage for the GPU and VRAM. Regards Felix -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
Re: [coreboot] Powersavings: 8W of difference between bios and coreboot
Hi, On Fri, Nov 18, 2016 at 4:43 PM, Felix Heldwrote: > Hi! > > > BIOS: 11W Coreboot: 19W [...] >> > Can you also measure the power consumption with the GPU enabled under the > vendor firmware? > > and no, the NVidia GPU was not enabled in corebooy. Both results were on >> integrated GPU only >> > Have you only disabled the nVidia GPU in devicetree.cb (that will only > disable the PCIe interface on the CPU side) or have you also disabled the > GPU power supply via the GFXCORE_ON_D signal? Since that signal is driven > by the power management companion chip (Thinker-1), you probably have to > talk to the EC to do that. > I don't know if Charlotte has added the ID of the dGPU to src/drivers/lenovo/hybrid_graphics.c. Does the dGPU consume power after hybrid_graphics.c disable the dGPU? Regards > Felix > > -- > coreboot mailing list: coreboot@coreboot.org > https://www.coreboot.org/mailman/listinfo/coreboot > Regards, Iru -- Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument instead! http://fsf.org/campaigns/opendocument/ -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
Re: [coreboot] Powersavings: 8W of difference between bios and coreboot
Hi! BIOS: 11W Coreboot: 19W [...] Can you also measure the power consumption with the GPU enabled under the vendor firmware? and no, the NVidia GPU was not enabled in corebooy. Both results were on integrated GPU only Have you only disabled the nVidia GPU in devicetree.cb (that will only disable the PCIe interface on the CPU side) or have you also disabled the GPU power supply via the GFXCORE_ON_D signal? Since that signal is driven by the power management companion chip (Thinker-1), you probably have to talk to the EC to do that. Regards Felix -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
[coreboot] Powersavings: 8W of difference between bios and coreboot
Hello Since I started using coreboot, I have noticed my battery doesn't seem to last as long. I have a very simple linux install on a separate partition that I use to compare power consumption, so I decided to verify if my perception was true. After some quick tests, I noticed the power profile seem to have changed a whole lot, so I decided to check exactly how much by running some tests. I had saved results when running the thinkpad bios, so I decided to get more measurements to compare the thinkpad bios to coreboot on the W520. The test environment is X with just a xterm open to display powertop results. Nothing else is running: there are just 130 wakeups per seconds (with 100 coming from tick_sched_timer), and according to powertop all the cores are in mode C7-IVB between about 98 to 99% of the time. So it should be the best environment to have accurate results without software interfering. To reduce sources of error, I always start from a cold boot, with the machine cold, no previous fan activity. With normal power saving options (everything toggled in powertop), network stopped, and measurement repeated every 5 seconds during 10 min and averaged, I get: BIOS: 11W Coreboot: 19W With the powersave governor BIOS: 9W Coreboot: 17W With brightness reduced to 200 BIOS: 8W Coreboot: 16W The steps between each operation seem identical (activating powersave: -2W, reducing brightness: -1W) however the baseline is off by about 8W. This is on the exact same software environement, running the exact same linux kernel with the exact same kernel options. (and no, the NVidia GPU was not enabled in corebooy. Both results were on integrated GPU only) I found that weird, so to confirm these results I put the hard drive into a borrowed W530. It has the exact same CPU and screen as my W520, the same USB peripherals (except a colormeter) and a similar memory configuration (4 dimms): I get about the same as the bios results I got before: 11W on the minimal install, going down to 8W at maximum power saving. However, with coreboot I just can't do any better than 16W. The difference of 8W is quite a lot, as with all powersavings applied, running coreboot mean taking 2x as much power. The room temperature hasn't changed (I have a thermostat), and I don't believe a single USB peripheral can take 8W. So I think there is only one conclusion: I have a lot of work to do on my W520 port to get even close to the initial power savings So I wonder if there is anything I can do to improve power savings? What are some basic suggestions?? The full 8W difference means there should be at least a few low hanging fruits!! Thanks Charlotte -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot