Call for help for Skylake Power Management

You want Power Management (HWP/Speed Shift) on your Skylake to work?

Then please download/run debugMachKernel.sh after that you should boot with the -cpuid msgbuf=309212 arguments and enter the following command in a terminal window:

cat /var/log/system.log | grep 'cpuid_fn(0x00000006) eax:'

The result that I get here with a Intel i7-6700 is this:

cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

If CPUID.06H:EAX[bit 7] is set, then HWP provides several new architectural MSR’s: IA32_PM_ENABLE, IA32_HWP_CAPABILITIES, IA32_HWP_REQUEST and IA32_HWP_STATUS.

If CPUID.06H:EAX[bit 8] is set, then HWP provides IA32_HWP_INTERRUPT MSR to enable interrupt generation due to dynamic Performance changes and excursions.

If CPUID.06H:EAX[bit 9] is set, then HWP allows software to program the activity window in the IA32_HWP_REQUEST MSR.

If CPUID.06H:EAX[bit 10] is set, then HWP allows software to set an energy/performance preference hint in the IA32_HWP_REQUEST MSR. For the yet to be released MacBook9,1 this is set to 146. The default is 128.

If CPUID.06H:EAX[bit 11] is set, then HWP provides the IA32_HWP_REQUEST_PKG MSR to convey OS Power Management’s control hints for all logical processors in the physical package.

If CPUID.06H:EAX[bit 13] is set, then Hardware Duty Cycling is supported and the HDC base registers IA32_PKG_HDC_CTL, IA32_PM_CTL1, IA32_THREAD_STALL MSRs are supported. The primary use of HDC is to enable system software to manage low active workloads, to increase the package level C6 residency. Additionally, HDC can lower the effective average frequency in case or power or thermal limitation.

Edit: Here is the output of a next version of AppleIntelInfo.kext

Skylake iMac17,1 HWP i7-6700

One thing people definitely will have to get used to is the fact that the Most Efficient Performance is dynamically adjusted, and so far I have seen 1200, 1400, 1500 and 1600 MHz, yet CPUFloor is set to 800 MHz. And so is LFM.

And when I change the Energy Performance Preference to a lower or higher value, then I can immediately see the effect of it in the Intel Power Gadget.

Let me know what value you get. Thanks!

Advertisements

75 thoughts on “Call for help for Skylake Power Management

      • You’re right – I forgot!
        But after doing the complete procedure now, I couldn’t boot anymore.
        So I had to change back the entry in /Library/Preferences/SystemConfiguration/com.apple.Boot.plist to “kext-dev-mode=1 rootless=0”, from which I thought ii would be obsolete in El Capitan!?!
        So still no values to be found …

      • You are right. Both kext-dev-mode and rootless are no longer supported in El Capitan. I presume that something else was wrong, since no kext was modified by debugMachKernel.sh

      • But it’s said in your instruction on GitHub:
        “Note: Make this change in /Library/Preferences/SystemConfiguration/com.apple.Boot.plist”
        ?
        But what confuses me besides that: I never set boot flags kext-dev-mode and rootless anywhere …
        I use CsrActiveConfig 0x7F in Clover plist.

      • Where did I say to include kext-dev-mode and rootless? That is only for previous versions of the OS. Not El Capitan. What you have in your Clover settings is fine.

      • I didn’t mean you said to include kext-dev-mode and rootless – I was just wondering where it comes from …

        You’re saying in GitHub to modify /Library/Preferences/SystemConfiguration/com.apple.Boot.plist …

      • I noticed when I boot withoult an ssdt for my processor, then because of the “unknown processor 0x5e” error the boot time is about 2-3 secouns longer then with an ssdt. Why is that if this is only a cosmetic error?

      • No. That is not a cosmetic error.

        Perhaps you’ve misread my reply to eembsen in which I said that it was an ‘unrelated error’ – to the topic we were discussing.

  1. Great to see more and more News on Specs and how-to-knows but all these are useless untill skylake SATA/LAN/M2 getting to work properes in Notebooks espacially 😦

  2. Same here, nothing (Core i5-6600k, GA-Z170X-UD3, iMac 17,1)

    Ran script, added boot-args. Full boot-args: ‘darkwake=0 uia_exclude=HS01;HS02;HS07;HS08;HS11;HS12;SS01;SS02;SS09 nvda_drv=1 debug=0x12a acpi_layer=0x08 acpi_level=0x02 msgbuf=309212 -v ‘

    Verbose had way more output than normally, but empty output for both “cat /var/log/system.log | grep ‘cpuid_fn(0x00000006) eax:'” and “cat /var/log/system.log | grep ‘cpuid_fn”

    ssdtPRGEN.sh SSDT present in patched (Clover).

      • You are right, used the bootflags from GitHub, sorry for that:

        Apr 8 22:41:37 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000001 edx:0x00000000
        Apr 8 22:41:37 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

        Same config (Removed the “debug=0x12a acpi_layer=0x08 acpi_level=0x02 msgbuf=309212” flags)

      • Perfect! Your Intel i5-6600k also supports HWP. Like the Intel i7-6700 I used for my testing.

        Now we have to figure out what processor models also support Hardware Duty Cycling (HDC). I presume that it will be limited to the U series and other more mobile oriented processors, but that is a guess only.

        p.s. The msgbuf=309212 argument reserves more memory for the output, and isn’t really necessary.

      • Ah! I read it as a single argument.

        “./debugMachKernel.sh restore” should restore the original kernel, removing patching done by the script, right?

        Also as this is the first time I’m posting here, I just wanted to say thanks for all of the work you and RevoGirl have been doing, after recently finding your blog and reading a bunch of posts, I realised that I have been using a lot of stuff from your sister and you for quite a while 🙂

  3. thanks for all your work. I’m new to hackintosh, but you really should add into your instructions here or on github to add the -cpuid to the clover boot args. I was getting no results when running the cat command until I read the comment down here to do that.

    Here are my results, using latest FakeSMC, 17,1 profile, and ssdtPRGEN.sh SSDT present.

    Apr 10 13:35:34 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000027f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000
    Apr 10 13:35:34 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000027f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

    Hopefully this helps in getting my speedstep and power states working 🙂

    • Thanks, but was there all the time already (“…after that you should boot with the -cpuid msgbuf=309212 arguments…“). The only step that was missing, a crucial one, was that you need to run debugMachKernel.sh first, and I only forgot to mention that because I always use a debug kernel.

      • You are right, I missed that. sorry! So I seem to be hitting different P States but the Intel power gadget shows my i5-6660k is still showing 3.9GHz on idle.

  4. Hi Pike,

    I’ve got an Intel Skylake 6200U. I ran your script “ssdtPRGen.sh” (got it from GitHub) but I dont know if the powermanagement is working now? Is there a way to check on it and would you advise me to give this “debugMachKernel.sh” a try?

    best regards

  5. I ran the script

    debugMachKernel.sh v0.2 Copyright (c) 2012 by † RevoGirl
    v1.2 Copyright (c) 2013-2016 by Pike R. Alpha
    —————————————————————-

    _kprintf found @ 0xFFFFFF800090E030
    Converted to…: 0x90e030 / 9494576
    File offset….: 0x70e030 / 7397424

    _printf found @ 0xFFFFFF80002EA680
    Converted to…: 0x2ea680 / 3057280
    File offset….: 0xea680 / 960128

    6+0 records in
    6+0 records out
    6 bytes transferred in 0.000032 secs (186414 bytes/sec)
    Done.

    do I have to reboot now? and set “-cpuid msgbuf=309212 ” (would you mind telling me how to set these boot arguments *shame*)

      • MacBookHP@Branimirs-MacBook-Air:~/Desktop$ cat /var/log/system.log | grep ‘cpuid_fn(0x00000006) eax:’
        Apr 11 00:22:23 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000027f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000
        Apr 11 00:22:23 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000027f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

        this is my output

      • Right. That confirms it. I mean bit-13 is set and thus your Intel U series processor supports Hardware Duty Cycling (HDC). Thanks!

        Edit: I won’t have time for this right now – leaving Spain for Amsterdam in two hours from now – but I will try to add the HDC MSR’s to the output of AppleIntelInfo.kext (HWP already added in local tree).

    • Yes, reboot and then set those options in Clover. You can do it when you boot by going to the Options and then editing the boot args

      • @Ryan thx 🙂 I tried it via Clover Configurator and i think it worked 😊
        @Pike I’m glad that it worked, I hope this helps your research, because I’m not quiet getting it yet 😄 but I’m new to the Hackintosh world… You leaving for Amsterdam hehe If you ever come to Cologne Germany, i’ll buy you a drink 🙌 cheers !

  6. Hi Pike,
    this is my output:
    Apr 13 08:48:36 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000001 edx:0x00000000
    Apr 13 08:48:36 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

    I reboot and add to Clover config boot args -cpuid msgbuf=309212
    After reboot my CPUFloor is set to 1000 MHz without ssdtPRGEN.sh SSDT but i have 1300 and 1500MHz in Intel Power Gadget. With SSDT on ssdtPRGEN.sh my CPUFloor is set to 900 MHz and don’t have 1200, 1400, 1500 and 1600 MHz.

    CPU like you CPU Core i7-6700k

    Maybe I did something wrong?

    Sorry my bad English….

    • The CPUID output is fine (expected result), and are you talking about the frequency you see in the Intel Power Gadget or in /var/log/system.log with the text: “CPUFloor”?

      • Yes I’m talking about the frequency I see in the Intel Power Gadget. Maybe I did something wrong, so the clock frequency is not correct?
        I use ssdtPRGEN.sh SSDT.aml in my Clover config:

        <key>DropTables</key>
        <array>
        	<dict>
        		<key>Signature</key>
        		<string>DMAR</string>
        	</dict>
        	<dict>
        		<key>Signature</key>
        		<string>SSDT</string>
        		<key>TableId</key>
        		<string>Cpu0Ist</string>
        	</dict>
        	<dict>
        		<key>Signature</key>
        		<string>BGRT</string>
        	</dict>
        	<dict>
        		<key>Signature</key>
        		<string>SSDT</string>
        		<key>TableId</key>
        		<string>CpuPm</string>
        	</dict>
        </array>
        <key>HaltEnabler</key>
        <false/>
        <key>SSDT</key>
        <dict>
        	<key>DropOem</key>
        	<false/>
        	<key>Generate</key>
        	<dict>
        		<key>CStates</key>
        		<false/>
        		<key>PStates</key>
        		<false/>
        	</dict>
        </dict>
        
      • Ok. That looks fine to me. Please note that I don’t use Clover so I may be wrong here.

        And in this case you should really try AppleIntelInfo.kext or use the command line tool of the Intel Power Gadget for the output to see if you are indeed missing the lower frequencies.

    • You shoudn’t need to drop those tables (At least that is not required to get full range of states on my board), you could try removing that part of the config and see if you get more states?

  7. Pike, this is my output on i5-6500…

    Apr 13 22:58:43 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000001 edx:0x00000000
    Apr 13 22:58:43 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000009 edu:0x00000000

    Thanks for all you do!

    • Thanks Paul. So far we have learned that while HWP/Intel® Speed Shift Technology is supported, OS X is not ready for it. We need a new update for this to work like it does in MS Windows 10. Or I must have missed it, but I don’t think so.

  8. Hi Pike

    This is what I get on an i5 6600 after running debugMachKernel.sh

    _kprintf found @ 0xFFFFFF800090E030
    Converted to...: 0x90e030 / 9494576
    File offset....: 0x70e030 / 7397424

    _printf found @ 0xFFFFFF80002EA680
    Converted to...: 0x2ea680 / 3057280
    File offset....: 0xea680 / 960128

    6+0 records in
    6+0 records out
    6 bytes transferred in 0.000035 secs (171196 bytes/sec)
    Done.

    Then on running the second command:

    Apr 14 08:48:41 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000001 edx:0x00000000
    Apr 14 08:48:41 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

    Thanks

  9. Here’s the output from my Skylake Core M5 (6Y54):
    Apr 23 14:02:45 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000027f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000
    Apr 23 14:02:45 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000027f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

    On a similar note, when I add the board ID for MacBook9,1, I get a kernel panic with a power management SSDT in place (made with your script). It will boot without it, but then obviously there’s no power management. So do you suppose it is because the HWP/Speedshift stuff is absent in your script? And if so, will you be adding it in the future? Thanks for all the work you do for the community!

  10. Hello & Warmest Greetings,
    on my Z170 6700K ssdt generated with your script seems to have no effect. Intel Power Gadget and HWMon both show idling at 1.5 ghz approx and speed stepping to 4.0. The Appleintelinfo kext shows no output in either terminal or system log in console. It does not even throw any error messages. The behavior is same irrespective of the portable is ssdt. I am flummoxed.

  11. With i5-6600 I have:
    Apr 26 11:05:33 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000001 edx:0x00000000
    Apr 26 11:05:33 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

  12. Piker,

    Need some help

    1. I downloaded the script and ran it
    2. Change config.plist to include the -cpuid boot argument
    3. Reboot

    When i run cat /var/log/system.log | grep ‘cupid’ , I get no output

    What am i doing wrong? I did also tried to change the com.apple.Boot.plist per github, But it did not help

      • Sorry for the typo. That was only in the post. I did run:

        cat /var/log/system.log | grep 'cpuid'

        There is no output.

        Edit: you keep making the same typo, which I fixed here for you, so are you sure that you used the correct command?

  13. This is my output, for some reason my i7 6700 can’t turbo boost up to prosper speed, it locks on 3,7Ghz,, is that normal??…

    May 3 15:05:20 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000001 edx:0x00000000
    May 3 15:05:20 localhost kernel[0]: cpuid_fn(0x00000006) eax:0x000007f7 ebx:0x00000002 ecx:0x00000009 edx:0x00000000

      • Hi, I’m using GA Z170X UD5 TH, and I’m using iMac 17 smbios..
        I’ve tried with different plist configs under ssdt section (clover configurator) and nothing… It lock’s on 3,7ghz while on cinebench.. I Also have a Asus Z170 M PLUS with 6700K and power management created with your command, and same thing happens, its lock on 4Ghz while it should have two turbo states, first @ 4,1Ghz second @ 4,4Ghz..
        Also have a X99 setup, which I have been unable to make ssdt for cpu management.. it gives me a KP while trying :/

        BTW, hope you had a nice time in spain, I live in Barcelona and I am really enjoying the weather 🙂

      • Ah ok so you have two different configurations with the same problem. I don’t have a hack at hand at this moment, but I can’t remember seeing this problem. I will check this as soon as possible, but perhaps someone else can help you.

        Barcelona is a really great city, and we lived there for almost two years, after which we moved to Marbella to run a hotel with my family. We recently moved out of the hotel to have some privacy.

      • Tbh I’ve spent countless hours reading all sorts, from many different people and have not really meet a “straight” answer to many questions.. I find myself coming back to the few people who seem to understand what going on here! (I’m no computer scientist lol) I consider you to be a source of knowledge and a transparent one at that. Anyways.. I might be doing something wrong, bios related or clover related, because I think the same happened to my i7 4790K on a GA Z97 HD3 ¿?¿?

        You mentioned above you don’t use clover…. What boot loader do you use, if its not too much to ask?

        Yeah, Barcelona is great, so you still live in Marbella/Spain?

      • Thank you. Very kind of you. And I use RevoBoot, which is pretty darn difficult to setup so you are better off with either Clover or Chameleon.

        What I can tell you is that power management has changed with the introduction of Skylake based processors, and a lot, so thing are going to be different. For example. CpuFloor was usually set to 800 MHz but now the frequency can go down to 100 MHz, and instead of the OS being in charge, now it’s up to processor firmware to decide what frequency to use. This is also why so many people wonder why their processor is running on a much higher frequency, than what they expect. What they don’t seem to understand is that the processor runs at the most efficient frequency, for the processor – stepping down/up is costly and unneeded in most cases. In other words. What you see may not be what you expect, but it may be correct. We all have to start trusting Intel, like we do for so many tasks for so long already.

        The next thing that we need is a better tool to test power management, and I am working on updates that will make this possible. Like never before!

        And yes. Still in the same place, be it 500 meters south 😉

      • Ok, it seems understandable that they know better than most of us what it needs to be done.. In regards to the case at hand, would you need anything to check or test (dsdt, ioreg, etc..) please just let me know.

        I think I checked once RevoBoot but I think it looked too tedious and got me running scared away from it! lol

        I still get the 800 MHz CpuFloor with both of the SkyLake cpu.. I think I’m doing something wrong.. :S

        How would I go about creating an SSDT for cpu power management for the i7 5820K I have in the X99 setup? Is a great cpu for the price, but it just crashes every time I try to make one.. I’ve read somewhere on InsanelyMac about using your ssdtPRGen.sh with something like defining the smbios to a iMac 14.2 within the same terminal window with some command so it recognises the cpu and other stuff, which in the end left my system unusable and had to reinstall from scratch.. X99 setups are a bit of a pain to work with.

        Well you’ve not gone too far, thats good, when I lived In London I ended up moving about 10 times in 8 years, and ended up crazy!

  14. Does that mean that for Skylake we needn’t use the ssdtPRGen script to make and subsequently load the ssdt.aml as we did for 4790K. Just leave everything as auto in the BIOS and trust everything will be okay on the Mac side of things? Or leave it so until you complete the updates you’re working on. Best wishes & thank you very much for your efforts.

  15. Is there any way to enable HWP in macos? Enabled it in BIOS, and in Windows it shows as enabled Speed Shift (even frequency ramping is absolutely different with it)

    • Yes you can. All you need to do is set bit-1 in MSR 0x770/IA32_PM_ENABLE. I do this with help of RevoBoot, but this will also be a new feature (setting) in the next update of AppleIntelInfo.kext. Another thing that you can do is change a XCPM related MSR that you don’t need/want anyway and thus can be used to set the bit.

      • About MSR – i tried to change it after system boot using old tool AnVMSR (from insanely forum, i’m not sure if it is working correctly at all) and this produces system freeze. In windows i have MSR 770 set as 1. I’m planning to try creating own kext that will set msr 770 to 1, let’s see if this will work.
        About XCPM – i don’t understand that. Can you describe in short what you mean and send me into proper direction for reading/digging/thinking/etc?

      • May i ask you more questions? Do we need only 0x770 MSR enabled for HWP? Is it enough for OS X to understand that HWP is available and enabled? Or still we need some extra configuration/patches for OS X to make it working as designed?

      • Sure. And no. The MSR (0x770) is all we need. The other MSR’s are only there to give us a handle to further fine tune it, but I did not change anything else.

        Apple also added the HWP setting in the FrequencyVectors data – I blogged about this when the MacBook was released. You can fine it with help of freqVectorsEdit.sh -d
        You’ll find hwp(1) in the Mac-9AE82516C7C6B903.plist of the MacBook9,1

      • I will investigate frequencyVectors.
        After enabling HWP there are strange things. Using HWMonitor or Intel Power Gadget i can see that frequency is almost always same (around maximum non-turbo), when there is high CPU usage – it increases to turbo freq. But at the same moment i can see very low power usage of CPU (less than 2 watts per whole package). Does this mean that HWP works as designed? Is it possible that with HWP current frequency reports incorrectly?
        P.S. If i’m changing EPP value to maximum powersaving – my cpu goes to lowest frequency. So “some how” it is working. Also changing EPP value i can see changes in scores from Geekbench. Just want to find a correct way to check that it works as expected

      • Appears to be working, but we can do very little. It’s all up to Intel what your CPU will and can do.

        About XCPM. Well. That may actually miss stuff, since it is initialised before you run the kext. This is also why I let RevoBoot do it for me.

      • Hm… Ok… As i’m using clover – i will try to modify it to set this MSR before OS X booting, let’s see how it will work. And about macbook9,1 – it’s great that it has hwp in frequency vectors, but in other side it has no turbo boost 🙂 That’s why most people are using currently iMac17,1 smbios

      • One more update from my experiments. Just compiled new Clover with new configuration option. Now i have enabled 0x770 before booting OS X kernel. And situation is same – in Intel Power Gadget i can see that most part of time frequency is around 2.6-2.7Ghz (mine cpu is i7 6700HQ). But power consumption is just around 3-4 watts. Can you share your experience? Do you have correct frequency changes in Intel Power Gadget?

  16. Thank you very much! Just made small kext that just writes 1 or 0 on start/stop to 0x770, and AppleIntelInfo now shows that HWP is enabled! And Intel Power Gadget also shows that frequency now changes by small steps (which means that SST is enabled). Going now to prepare some more tuning for 0x774…

  17. Kext will work, but you need also support in frequencyVectors. Currently in ElCap only MacBook9,1 has it and in latest Sierra also new MBP. Dunno if it is possible to add hwp flag in freqVectors for other boards.

    • But i suppose that Piker’s freqVectorsEdit script should also work to copy frequency vectors from board with HWP enabled to your current board

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s