Welcome to our peer-to-peer forums, where owners help owners. Need help now? Visit eSupport here.

English Community

ThinkPad NotebooksThinkPad: P and W Series Mobile Workstations
All Forum Topics
Options

24 Posts

11-01-2018

United Kingdom of Great Britain and Northern Ireland

27 Signins

218 Page Views

  • Posts: 24
  • Registered: ‎11-01-2018
  • Location: United Kingdom of Great Britain and Northern Ireland
  • Views: 218
  • Message 1 of 5

Disable NVIDIA P520 on the P43s (ACPI Calls)

2019-10-08, 22:13 PM

Hello,

 

I've just picked up a Lenovo P43s, after installing Linux on the device and confirming with Powertop, I'm getting ~20W on Battery, a whopping 1.2 Hours!

 

This is due to the NVIDIA dGPU (P520) drawing all of the power it wants.

 

I've previously owned a Huawei Matebook X Pro, this device has an MX150, basically the exact same card, just clocked a little high, it was possible to power OFF the dGPU via ACPI Calls (bbswitch) - Calling a _DSM function.

 

However it appears Lenovo have done something to either:
A) Prevent the ACPI Call from actually reaching the dGPU
B) The NVIDIA P520 is recieving the Power OFF Call, then something else is trying to bring it up, this could be either UEFI or the EC.

 

If Lenovo can provide some insight into this that would be great, I don't plan on loading NVIDIA's vBIOS/Driver, and the device needs to be power off.

 

I've tried calling `\_SB.PCI0.RP09.PEGP._OFF` and `\_SB.PCI0.RP09.PEGP._S3` as well as bbswitch, OFF almost works, I can see it drop down to ~7W, then something brings it back up, I'd assume something Lenovo have written.

 

If Lenovo are unwilling to help, the next step is to patch the _ON ACPI call to do nothing, however I don't know if that will result in the dGPU being disabled.

 

Cheers.

Reply
Answer
Options

5 Posts

12-13-2019

Canada

8 Signins

99 Page Views

  • Posts: 5
  • Registered: ‎12-13-2019
  • Location: Canada
  • Views: 99

Re: Disable NVIDIA P520 on the P43s (ACPI Calls)

2019-12-15, 0:24 AM

Looks like my ACPI table mods get picked up on boot, but the changes don't actually apply. Not too sure why, however, I think I figured out why nothing was working by tracing the \_SB.PCI0.RP09.PEGP._OFF call.

 

TL;DR

Add this to your kernel cmd, then it should work

 

acpi_osi="!Linux-Lenovo-NV-HDMI-Audio"

 

 

 

 

The long version

 

 

Method (_OFF, 0, Serialized)  // _OFF: Power Off
{
    \_SB.PCI0.HGOF ()
    Return (Zero)
}

Method (HGOF, 0, Serialized)
{
    D8XH (Zero, 0xBB)
    If (LEqual (CCHK (Zero), Zero))
    {
        Return (Zero)
    }

    Store (Zero, ONOF) /* \_SB_.PCI0.ONOF */
    Store (LCTR, ELCT) /* \_SB_.PCI0.ELCT */
    Store (LREN, \_SB.PCI0.RP09.LTRE)
    Store (CMDR, CMDS) /* \_SB_.PCI0.CMDS */
    If (LEqual (\_SB.PCI0.RP09.PEGP.OTMS, One))
    {
        Store (One, LKD1) /* \_SB_.PCI0.LKD1 */
        Store (Zero, TCNT) /* \_SB_.PCI0.TCNT */
        While (LLess (TCNT, LDLY))
        {
            If (LEqual (LKS1, Zero))
            {
                Break
            }

            Sleep (0x10)
            Add (TCNT, 0x10, TCNT) /* \_SB_.PCI0.TCNT */
        }
    }
    Else
    {
        \_SB.PCI0.RP09.DL23 ()
    }

    SGPO (HRE0, HRG0, HRA0, One)
    Sleep (0x02)
    SGPO (PWE0, PWG0, PWA0, Zero)
    Sleep (0x64)
    Store (Zero, \_SB.PCI0.LPCB.EC.HKEY.ANGN) /* External reference */
    SWTT (Zero)
    Return (Zero)
}

 

We can see HGOF exits if CCHK(Zero) is Zero, calling CCHK(Zero) verifies that it is returning Zero (causing HGOF to bail):

 

\_SB.PCI0.CCHK 0
Returns 0x00

 

Looking at CCHK there are a number of variable checks. I was able to echo them all, and we can see it's that \LXVF is One causing CCHK return Zero

Method (CCHK, 1, NotSerialized)
{
    If (LEqual (\LXVF, One))
    {
        Return (Zero)
    }

    If (LEqual (PVID, IVID))
    {
        Return (Zero)
    }

    If (LEqual (Arg0, Zero))
    {
        If (LEqual (ONOF, Zero))
        {
            Return (Zero)
        }
    }
    ElseIf (LEqual (Arg0, One))
    {
        If (LEqual (ONOF, One))
        {
            Return (Zero)
        }
    }

    Return (One)
}
\LXVF
Returns 0x1

\_SB.PCI0.IVID
Returns 0xFFFF1ED

\_SB.PCI0.PVID
Returns 0x80861ED

\_SB.PCI0.ONOF
Return 0x1

 

LXVF can be found in a couple spots

 

Name (\LXVF, 0x01)
Method (\LXVA, 1, NotSerialized)
{
    Store (One, \LXVF)
}
....
If (\_OSI ("Linux-Lenovo-NV-HDMI-Audio"))
{
    Store (One, \LXVF)
}
Else
{
    Store (Zero, \LXVF)
}

 

It is initizlied to One, and only set to Zero if Not \_OSI("Linux-Lenovo-NV-HDMI-Audio"). Looking at dmesg we see Linux-Lenvo-NV-HDMI-Audio is added on boot.

 

[    3.061236] ACPI: Added _OSI(Module Device)
[    3.061236] ACPI: Added _OSI(Processor Device)
[    3.061236] ACPI: Added _OSI(3.0 _SCP Extensions)
[    3.061236] ACPI: Added _OSI(Processor Aggregator Device)
[    3.061236] ACPI: Added _OSI(Linux-Dell-Video)
[    3.061236] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    3.061236] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)

 

We can remove this by adding it to kernel CMD

acpi_osi="!Linux-Lenovo-NV-HDMI-Audio"

 

After booting and loading bbswitch we can see it loads

 

[  237.937698] bbswitch: loading out-of-tree module taints kernel.
[  237.938157] bbswitch: version 0.8
[  237.938162] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[  237.938170] bbswitch: Found discrete VGA device 0000:3c:00.0: \_SB_.PCI0.RP09.PEGP
[  237.938221] bbswitch: detected an Optimus _DSM function
[  237.938325] bbswitch: disabling discrete graphics
[  238.063711] bbswitch: Succesfully loaded. Discrete card 0000:3c:00.0 is off

 

Anecdotally, from running for an hour it seems I'm down approximately 5W/4C

Reply

Replies(4)
Options

24 Posts

11-01-2018

United Kingdom of Great Britain and Northern Ireland

27 Signins

218 Page Views

  • Posts: 24
  • Registered: ‎11-01-2018
  • Location: United Kingdom of Great Britain and Northern Ireland
  • Views: 218
  • Message 2 of 5

Re: Disable NVIDIA P520 on the P43s (ACPI Calls)

2019-10-11, 13:55 PM

It's been a few days and still no responce?

Reply
Options

5 Posts

12-13-2019

Canada

8 Signins

99 Page Views

  • Posts: 5
  • Registered: ‎12-13-2019
  • Location: Canada
  • Views: 99
  • Message 3 of 5

Re: Disable NVIDIA P520 on the P43s (ACPI Calls)

2019-12-13, 21:48 PM

Calling _DSM followed by _S3 produced expected outputs based on https://github.com/mkottman/acpi_call/blob/master/examples/dellL702X.sh#L23

 

\_SB.PCI0.RP09.PEGP.NVOP {0xF8,0xD8,0x86,0xA4,0xDA,0x0B,0x1B,0x47,0xA7,0x2B,0x60,0x42,0xA6,0xB5,0xBE,0xE0} 0x100 0x1A {0x1,0x0,0x0,0x3}

Returns {0x59, 0x00, 0x00, 0x11}

\_SB.PCI0.RP09.PEGP._PS3

Returns {0xF}

However, this does not appear to have a meaningful impact on the power draw. Also, the PCI root node also still reports D0 power state

cat /sys/bus/pci/devices/0000\:00\:1d.0/firmware_node/real_power_state 
D0

I would have expected it to drop to D3cold if it was actually disabled. I am able to get the PCI root to drop to D3cold if I remove NVIDIA PCI device (after unbinding or blacklisting any drivers)

echo 1 > /sys/bus/pci/devices/0000\:3c\:00.0/remove

cat /sys/bus/pci/devices/0000\:00\:1d.0/firmware_node/real_power_state 
D3cold

but this still doesnt appear to meaninfully impact the power usage...

 

From looking at the ACPI tables it appears that \_SB.PCI0.RP09.PEGP._OFF simply calls \_SB.PCI0.HGOF, neither of which seem to do anything. The calls under \_SB.PCI0.RP09.PCRP look at little more promising. The \_SB.PCI0.RP09.PCRP._STA call appears to correspond to the PCI root node state. It returns 1 when it is in D0 and 0 when it is in D3Cold. Calling _OFF also puts the node into D3cold:

\_SB.PCI0.RP09.PEGP.NVOP {0xF8,0xD8,0x86,0xA4,0xDA,0x0B,0x1B,0x47,0xA7,0x2B,0x60,0x42,0xA6,0xB5,0xBE,0xE0} 0x100 0x1A {0x1,0x0,0x0,0x3}
Returns {0x59, 0x00, 0x00, 0x11}

\_SB.PCI0.RP09.PEGP._PS3
Returns 0xF

\_SB.PCI0.RP09.PCRP._STA
Returns 0x1

cat /sys/bus/pci/devices/0000\:00\:1d.0/firmware_node/real_power_state 
D0

\_SB.PCI0.RP09.PCRP._OFF
Returns 0xF

\_SB.PCI0.RP09.PCRP._STA
Returns 0x0

cat /sys/bus/pci/devices/0000\:00\:1d.0/firmware_node/real_power_state 
D3cold

Unfortunately, this still doesn't appear to meaninfully impace the power usage.

 

I tried patching the SSDT table to immediately call _OFF during _INI (per https://www.tonymacx86.com/threads/guide-disabling-discrete-graphics-in-dual-gpu-laptops.163772/) and it doesnt appear to do anything.

 

At this point I'm thinking that Lenovo didn't implement any ability to power down the card. Maybe someone with some more experience (or Lenovo) can weigh in on why the power usage doesn't change regardless if the card is in D0 or D3cold.

Reply
Answer
Options

5 Posts

12-13-2019

Canada

8 Signins

99 Page Views

  • Posts: 5
  • Registered: ‎12-13-2019
  • Location: Canada
  • Views: 99
  • Message 4 of 5

Re: Disable NVIDIA P520 on the P43s (ACPI Calls)

2019-12-15, 0:24 AM

Looks like my ACPI table mods get picked up on boot, but the changes don't actually apply. Not too sure why, however, I think I figured out why nothing was working by tracing the \_SB.PCI0.RP09.PEGP._OFF call.

 

TL;DR

Add this to your kernel cmd, then it should work

 

acpi_osi="!Linux-Lenovo-NV-HDMI-Audio"

 

 

 

 

The long version

 

 

Method (_OFF, 0, Serialized)  // _OFF: Power Off
{
    \_SB.PCI0.HGOF ()
    Return (Zero)
}

Method (HGOF, 0, Serialized)
{
    D8XH (Zero, 0xBB)
    If (LEqual (CCHK (Zero), Zero))
    {
        Return (Zero)
    }

    Store (Zero, ONOF) /* \_SB_.PCI0.ONOF */
    Store (LCTR, ELCT) /* \_SB_.PCI0.ELCT */
    Store (LREN, \_SB.PCI0.RP09.LTRE)
    Store (CMDR, CMDS) /* \_SB_.PCI0.CMDS */
    If (LEqual (\_SB.PCI0.RP09.PEGP.OTMS, One))
    {
        Store (One, LKD1) /* \_SB_.PCI0.LKD1 */
        Store (Zero, TCNT) /* \_SB_.PCI0.TCNT */
        While (LLess (TCNT, LDLY))
        {
            If (LEqual (LKS1, Zero))
            {
                Break
            }

            Sleep (0x10)
            Add (TCNT, 0x10, TCNT) /* \_SB_.PCI0.TCNT */
        }
    }
    Else
    {
        \_SB.PCI0.RP09.DL23 ()
    }

    SGPO (HRE0, HRG0, HRA0, One)
    Sleep (0x02)
    SGPO (PWE0, PWG0, PWA0, Zero)
    Sleep (0x64)
    Store (Zero, \_SB.PCI0.LPCB.EC.HKEY.ANGN) /* External reference */
    SWTT (Zero)
    Return (Zero)
}

 

We can see HGOF exits if CCHK(Zero) is Zero, calling CCHK(Zero) verifies that it is returning Zero (causing HGOF to bail):

 

\_SB.PCI0.CCHK 0
Returns 0x00

 

Looking at CCHK there are a number of variable checks. I was able to echo them all, and we can see it's that \LXVF is One causing CCHK return Zero

Method (CCHK, 1, NotSerialized)
{
    If (LEqual (\LXVF, One))
    {
        Return (Zero)
    }

    If (LEqual (PVID, IVID))
    {
        Return (Zero)
    }

    If (LEqual (Arg0, Zero))
    {
        If (LEqual (ONOF, Zero))
        {
            Return (Zero)
        }
    }
    ElseIf (LEqual (Arg0, One))
    {
        If (LEqual (ONOF, One))
        {
            Return (Zero)
        }
    }

    Return (One)
}
\LXVF
Returns 0x1

\_SB.PCI0.IVID
Returns 0xFFFF1ED

\_SB.PCI0.PVID
Returns 0x80861ED

\_SB.PCI0.ONOF
Return 0x1

 

LXVF can be found in a couple spots

 

Name (\LXVF, 0x01)
Method (\LXVA, 1, NotSerialized)
{
    Store (One, \LXVF)
}
....
If (\_OSI ("Linux-Lenovo-NV-HDMI-Audio"))
{
    Store (One, \LXVF)
}
Else
{
    Store (Zero, \LXVF)
}

 

It is initizlied to One, and only set to Zero if Not \_OSI("Linux-Lenovo-NV-HDMI-Audio"). Looking at dmesg we see Linux-Lenvo-NV-HDMI-Audio is added on boot.

 

[    3.061236] ACPI: Added _OSI(Module Device)
[    3.061236] ACPI: Added _OSI(Processor Device)
[    3.061236] ACPI: Added _OSI(3.0 _SCP Extensions)
[    3.061236] ACPI: Added _OSI(Processor Aggregator Device)
[    3.061236] ACPI: Added _OSI(Linux-Dell-Video)
[    3.061236] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    3.061236] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)

 

We can remove this by adding it to kernel CMD

acpi_osi="!Linux-Lenovo-NV-HDMI-Audio"

 

After booting and loading bbswitch we can see it loads

 

[  237.937698] bbswitch: loading out-of-tree module taints kernel.
[  237.938157] bbswitch: version 0.8
[  237.938162] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[  237.938170] bbswitch: Found discrete VGA device 0000:3c:00.0: \_SB_.PCI0.RP09.PEGP
[  237.938221] bbswitch: detected an Optimus _DSM function
[  237.938325] bbswitch: disabling discrete graphics
[  238.063711] bbswitch: Succesfully loaded. Discrete card 0000:3c:00.0 is off

 

Anecdotally, from running for an hour it seems I'm down approximately 5W/4C

0 person found this solution to be helpful.

This helped me too

Reply
Options

24 Posts

11-01-2018

United Kingdom of Great Britain and Northern Ireland

27 Signins

218 Page Views

  • Posts: 24
  • Registered: ‎11-01-2018
  • Location: United Kingdom of Great Britain and Northern Ireland
  • Views: 218
  • Message 5 of 5

Re: Disable NVIDIA P520 on the P43s (ACPI Calls)

2019-12-15, 5:48 AM

My. God.

 

Thank you so much, this fixed my issue! I'm idling ~5C, now I'm able to undervolt!

 

:smileywink:

 

1.7 Kudos to you!! :D

Reply
Forum Home

Community Guidelines

Please review our Guidelines before posting.

Learn More

Check out current deals!

Go Shop
X

Save

X

Delete

X

No, I don’t want to share ideas Yes, I agree to these terms