Contribute
Register

[Guide] Native Power Management for Laptops

Joined
Sep 28, 2017
Messages
39
Motherboard
Lenovo IdeaPad 320S-13IKB
CPU
Intel Core i5-8250U
Graphics
Intel UHD Graphics 620 + NVIDIA GeForce MX150
It means your statement "frequency always remains constant" is proved false by AppleIntelInfo.kext output.
I'm sorry, I think you quoted the wrong post :v
 
Joined
Apr 7, 2014
Messages
13
Motherboard
Dell Inspiron 13" 5378-B40C/Clover
CPU
i7-7500U
Graphics
HD 620 @ 1920x1080
Mobile Phone
Android
I can't get my hackintosh to use idle frequency at 0.8GHz (for battery life optimization purposes).

I used to achieve that only after waking up from sleep when I had custom ssdt.aml in /EFI/CLOVER/ACPI/PATCHED folder, but I was advised to not use it on my build, so I deleted it.

I use X86PlatformPluginInjector.kext with edited .plist

Sleep is unstable. Sometimes I get a kernel panic when waking up from sleep.

Could you please help me to get stable sleep and 0.8GHz idle frequency?
 

Attachments

Joined
Aug 21, 2016
Messages
9
Motherboard
ASUS Zenbook UX461UA
CPU
i7- 8550U
Graphics
HD 620+GeForce mx150
Hello,
My asus laptop has Thermal and power throttling control in BIOS, which can be disabled by using throttlestop and check "disable memory mapped turbo power limits" . Anyone can help me disable this annoying limits on Mojave ? My 8550u can run at 40w on windows but in Macos it can only runs at 6w when temp reached 60*C . really bad.
Thanks
 

Attachments

Last edited:
Joined
Oct 1, 2018
Messages
29
Motherboard
X1Carbon 5Gen
CPU
i7-7500U
Graphics
GTX 1080
Mobile Phone
iOS
Overview

Power Management should be one of the first things implemented when trying to install OS X on a laptop. Because of heat/noise and battery life issues, using NullCPUPowerManagement is not a realistic option on a laptop.

Fortunately, with Clover, NullCPUPowerManagement is never needed.

This guide will assume you started by following my Clover guide for laptops:
https://www.tonymacx86.com/threads/guide-booting-the-os-x-installer-on-laptops-with-clover.148093/


Disable Hibernation

Be aware that hibernation (suspend to disk or S4 sleep) is not supported on hackintosh.

You should disable it:
Code:
sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage
sudo mkdir /var/vm/sleepimage
Always check your hibernatemode after updates and disable it. System updates tend to re-enable it, although the trick above (making sleepimage a directory) tends to help.

And it may be a good idea to disable the other hibernation related options:
Code:
sudo pmset -a standby 0
sudo pmset -a autopoweroff 0

Custom SSDT.aml using ssdtPRGen.sh

Note: If you followed the guide linked above, and you have a Haswell or later CPU, there is nothing for you to do here, as CPU PM is already enabled with the plists provided by the guide. No need for ssdtPRgen.sh generated SSDT.aml with Haswell and later as the required properties are injected by Clover with config.plist/ACPI/SSDT/Generate/PluginType=true.

But for Sandy Bridge and Ivy Bridge, use the ssdtPRGen.sh script by Pike R. Alpha: https://github.com/Piker-Alpha/ssdtPRGen.sh

Instructions for using it are provided in the README.

The generated SSDT.aml should be placed on the EFI partition at /EFI/Clover/ACPI/patched/SSDT.aml.

Based on the current instructions at the README, what follows is a synopsis...

To prepare, you only need to do the first two commands:
Code:
cd ~
curl -o ./ssdtPRGen.sh https://raw.githubusercontent.com/Piker-Alpha/ssdtPRGen.sh/master/ssdtPRGen.sh
chmod +x ./ssdtPRGen.sh
With newer CPUs, you might want to use the beta branch:
Code:
cd ~
curl -o ./ssdtPRGen.sh https://raw.githubusercontent.com/Piker-Alpha/ssdtPRGen.sh/Beta/ssdtPRGen.sh
chmod +x ./ssdtPRGen.sh
Then you can run the script:
Code:
./ssdtPRGen.sh
For some Ivy Bridge CPUs, you may need to use the "-w 2" or "-w 3" (non-beta branch, "-c 2" or "-c 3" for the beta branch).

Note: If you have a CPU currently unsupported by the script (the Beta branch has more comprehensive data, so this is less likely with the Beta), you may have to provide the data for it.

For example, using i7-4710HQ as a template for i7-4720HQ ():
Code:
./ssdtPRGen.sh -p 'i7-4710HQ' -f 2600 -turbo 3600
Please note that you typically would NOT use ssdtPRgen.sh with this CPU as config.plist/ACPI/SSDT/Generate/PluginType=true is enough for Haswell and later.

By providing the name 'i7-4710HQ' (similar enough to i7-4720HQ), and overrides for the non-turbo and turbo frequencies, the script is successful. Eventually, it would not be necessary, provided the script is updated with the new CPUs.

When it asks if you want to copy to /Extra just respond 'n'. Same for opening ssdt.dsl... respond 'n'.

The results are at ~/Library/ssdtPRGen/SSDT.aml.

Assuming your EFI partition is mounted at /Volumes/EFI, copy that file to EFI partition, /EFI/Clover/ACPI/patched/SSDT.aml

Code:
cd ~
cp ~/Library/ssdtPRGen/ssdt.aml /Volumes/EFI/EFI/Clover/ACPI/patched/SSDT.aml

Testing PM

After installing the custom SSDT, you should reboot and test it. Use AppleIntelInfo.kext to test it.

Download AppleIntelInfo.kext from here: http://www.tonymacx86.com/attachments/appleintelinfo-kext-zip.196205/?temp_hash=0002086c90d343986436cd5b87e253ff

DO NOT install the kext to /L/E or /S/L/E.

Extract the kext from the ZIP, then copy it where it can be loaded:
Code:
cd ~/Downloads
sudo mkdir /kexts
sudo cp -R AppleIntelInfo.kext /kexts
Now load it:
Code:
sudo kextutil /kexts/AppleIntelInfo.kext
Now use your computer to do a variety of tasks, benchmarks, etc.
You can look at the AppleIntelInfo.kext results:
Code:
# view with page control
sudo cat /tmp/AppleIntelInfo.dat|more
Or make a copy of the file that you can load in TextEdit:
Code:
# create copy of it
sudo cp /tmp/AppleIntelInfo.dat AppleIntelInfo.txt
# open in TextEdit
open AppleIntelInfo.txt
In addition, for Ivy Bridge and later (eg. Ivy, Haswell, Broadwell, Skylake, KabyLake, etc), you should run IORegistryExplorer and verify that X86PlatformPlugin is loading under the CPU0 node.

More information on Native PM is available here: http://www.tonymacx86.com/mountain-lion-desktop-support/86807-ml-native-ivy-bridge-cpu-gpu-power-management.html

For Mavericks specific information, read here: http://www.tonymacx86.com/mavericks-desktop-support/128926-mavericks-native-cpu-igpu-power-management.html

Also, read here:
https://www.tonymacx86.com/threads/macos-native-cpu-igpu-power-management.222982/


Checklist

Here is a quick Ivy/Sandy/Haswell+ Power Management checklist.

- SSDT.aml at EFI/Clover/ACPI/patched (Sandy/Ivy only)
- config.plist/KernelAndKextPatches/AppleIntelCPUPM=true (pre-Haswell)
- config.plist/KernelAndKextPatches/KernelPm=true (Haswell+)
- config.plist/KernelAndKextPatches/KernelLapic=true (for those with Local APIC panic)
- appropriate System Definition (SMBIOS) for your CPU (config.plist/SMBIOS)
- no rollbacks of AppleACPIPlatform.kext
- no NullCPUPowerManagement.kext (usually implies patched AppleIntelCPUPowerManagement)
- Processor objects declared in Scope (_SB) or Scope (_PR) in DSDT (pretty rare not to have them in OEM DSDT)
- Verify that the generated SSDT injects into the same scope as Processor declarations in DSDT (usually _PR)


AppleACPIPlatform and EmbeddedControl

Note: For Sandy Bridge PM, it is possible to run a rollback of AppleACPIPlatform.kext but it is discouraged. Watch out for battery manager packages that include a rolled back AppleACPIPlatform.kext.

Note: Running stock AppleACPIPlatform.kext means any DSDT methods that manipulate EC (EmbeddedControl) registers larger than 8-bits will not work and will cause the method to fail. These methods must be patched. Access to such registers is common in DSDT battery methods. Some patches are provided at my laptop DSDT patch repository at: https://github.com/RehabMan/Laptop-DSDT-Patch


Note on laptops with AMD Radeon

It is sometimes necessary to drop the MCFG table (use config.plist/ACPI/DropTables).


Note on older CPUs

For CPUs older than Sandy Bridge, use config.plist/Generate=true instead of custom SSDT.aml. Since that option causes Clover to generate replacement CPU SSDTs, you will also need to drop the OEM CPU related SSDTs. Usually that means setting config.plist/ACPI/SSDT/DropOem=true, although you may be able to drop the individual tables with DropTables.


Notes on DropOem=true

With older hardware you may need to drop OEM CPU related SSDTs (as mentioned above). Although you can drop individual tables with config.plist/ACPI/DropTables, it is easiest to drop all with config.plist/ACPI/SSDT/DropOem=true.

With modern hardware (Haswell and later), the system almost always works better if you retain all the SSDTs. The newer systems may even have trouble booting if you eliminate them.

As a result, don't use DropOem=true unless you have to. It is needed on certain computers Sandy Bridge and older.

More information regarding DropOem is available in the ACPI patching guide:
https://www.tonymacx86.com/threads/guide-patching-laptop-dsdt-ssdts.152573/


XCPM only (not so experimental anymore,... it is proven to work)

If you have a computer with Haswell or later (eg. Haswell, Broadwell, Skylake, KabyLake, etc), you can use a simpler method that does not involve ssdtPRgen.sh. Since power management is in the kernel (XCPM), it appears the custom tables generated by ssdtPRgen.sh are not needed. But we still need X86PlatformPlugin to load.

In order to do that we only need an SSDT that will inject the "plugin-type" property ("plugin-type"=1). The SSDT is available in my hotpatch repo here: https://github.com/RehabMan/OS-X-Clover-Laptop-Config (hotpatch/SSDT-XCPM.dsl).

Direct link: https://raw.githubusercontent.com/RehabMan/OS-X-Clover-Laptop-Config/master/hotpatch/SSDT-XCPM.dsl

The contents of it are simple:
Code:
// Inject plugin-type=1 on _PR.CPU0
// This is experimental to see how only injecting plugin-type with native CPU PM SSDTs
// works on various platforms.
//
// Results: OK on Haswell+, not so good on Ivy
DefinitionBlock("", "SSDT", 2, "hack", "PluginType", 0)
{
    External(\_PR.CPU0, DeviceObj)
    Method (\_PR.CPU0._DSM, 4)
    {
        If (!Arg2) { Return (Buffer() { 0x03 } ) }
        Return (Package()
        {
            "plugin-type", 1
        })
    }
}
//EOF
To use it, compile it as AML in MaciASL, then copy to your EFI/Clover/ACPI/patched.

For example, in Terminal (assuming you have iasl installed):
Code:
# download SSDT-XCPM.dsl and compile it as SSDT-XCPM.aml
curl -o ./SSDT-XCPM.dsl https://raw.githubusercontent.com/RehabMan/OS-X-Clover-Laptop-Config/master/hotpatch/SSDT-XCPM.dsl
iasl SSDT-XCPM.dsl
# not valid to use both SSDT.aml and SSDT-XCPM.aml, so remove it
rm /Volumes/EFI/EFI/Clover/ACPI/patched/SSDT.aml
cp SSDT-XCPM.aml /Volumes/EFI/EFI/Clover/ACPI/patched/SSDT-XCPM.aml
For those using my fork of Clover (https://github.com/RehabMan/Clover), you can simply set config.plist/ACPI/SSDT/Generate/PluginType=true), as shown here:
View attachment 278588

Testing and verification is the same was when using SSDT.aml generated from ssdtPRgen.sh.

The config.plist/ACPI/SSDT/Generate/PluginType=true setting is already set on all applicable plists as linked from my Clover laptop guide: https://www.tonymacx86.com/threads/guide-booting-the-os-x-installer-on-laptops-with-clover.148093/


Experimental option for Skylake/Kaby Lake (and later): HWP

In Skylake CPUs, Intel introduced a new power management technology: SpeedShift (aka. SST, aka. HWP).

With HWP enabled, the CPU handles pstate management by itself instead of requiring the OS to do it. The CPU itself will automatically shift to higher and lower pstates depending on CPU demand.

In order to use HWP, use an SMBIOS that is enabled for HWP... currently MacBook9,1, MacBookPro13,x (and now MacBookPro14,x, MacBookPro15,x). Also, since HWP tends to cause the xcpm_idle to be invoked, make sure the xcpm_idle patch (courtesy of PikeRAlpha) is enabled. It is default in all current plists provided by my Clover laptop guide. If you're using older than current plists, you may have to copy the patch into your config.plist/KernelAndKextPatches/KernelToPatch section.

You can also enable HWP for other SMBIOS by creating a patched resources injector for X86PlatformPlugin.kext (or by patching the kext itself). But that is a subject for another day.

Note: You still need SSDT.aml from ssdtPRgen.sh or SSDT-XCPM.aml as discussed earlier.


Problem Reporting

Be precise about the nature of the problem.

Read FAQ, "Problem Reporting". Carefully. Attach all requested files/output.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/
Use the gen_debug.sh tool mentioned in the FAQ, that way it is less likely you'll omit something.
Hey, I have followed the guide on both clover installation and native PM, however my laptop still consumes lots of battery when sleeping. I am using HWP, with the xcpm_idle enabled and PluginType=1.

any ideas why?
 
Joined
Dec 17, 2012
Messages
18
Motherboard
Samsung NP350V5C-S09IT-Clover
CPU
i7-3630QM/HM76
Graphics
HD 4000+HD 7670, 1366x768
Hi guys,

I got a PM that works in turbo mode only: 3,2ghz (32x).
Debug report attached for help.

Thank you in advance.
 

Attachments

trs96

Moderator
Joined
Jul 31, 2012
Messages
14,462
Motherboard
GA-Z97X-UD3H-BK
CPU
i5-4690K
Graphics
HD4600 / RX 570
Mac
iMac, Mac mini
Mobile Phone
Android
Top