Jump to content

[GUIDE] HWP(Intel Speed Shift) enable with full power management


syscl
 Share

171 posts in this topic

Recommended Posts

Thanks @PMHeart and @syscl, it's working now.

For my information where do you get the VectorFrequency for the plist and what do you change in it for the 6700k ?

Also in Slice test:

(post-112217-0-55635100-1487187172.png

 

i see a green graph: GT. What is that graph ?

Firstly congratulations!

 

You can find it out in the plist -> FrequencyVectors, obviously. :)

About the changes. You may try to compare the vanilla one from X86PlatformPlugin and my patched one via Hex Fiend. (Yes. And the right text mode may help you more.) About the changes. Eh. I just set HWP enabled, others... Sorry I've forgotten. (It's been a couple of time for me when I made the patched plist at that time for @Slice...) BTW. I don't think the FrequencyVectors is specific to certain CPU models. It's basically universal.

About "graph", it's your integrated graphics related values. (For your 6700k it should be HD530 right? Of course assuming that you don't turn it off in the BIOS.)

Edited by PMheart
Link to comment
Share on other sites

Firstly congratulations!

 

You can find it out in the plist -> FrequencyVectors, obviously. :)

About the changes. You may try to compare the vanilla one from X86PlatformPlugin and my patched one via Hex Fiend. (Yes. And the right text mode may help you more.) About the changes. Eh. I just set HWP enabled, others... Sorry I've forgotten. (It's been a couple of time for me when I made the patched plist at that time for @Slice...) BTW. I don't think the FrequencyVectors is specific to certain CPU models. It's basically universal.

About "graph", it's your integrated graphics related values. (For your 6700k it should be HD530 right? Of course assuming that you don't turn it off in the BIOS.)

 

Thanks a lot @PMHeart for the information.

I don't have GT graphs because i don't use the Integrated graphics (turn off in bios), i'm using my nVidia GT970.

  • Like 1
Link to comment
Share on other sites

Thanks a lot @PMHeart for the information.

I don't have GT graphs because i don't use the Integrated graphics (turn off in bios), i'm using my nVidia GT970.

Yes and in this case you won't see any information about graphics in Intel Power Gadget because apparently you've simply disabled it.

Link to comment
Share on other sites

Firstly congratulations!

 

You can find it out in the plist -> FrequencyVectors, obviously. :)

About the changes. You may try to compare the vanilla one from X86PlatformPlugin and my patched one via Hex Fiend. (Yes. And the right text mode may help you more.) About the changes. Eh. I just set HWP enabled, others... Sorry I've forgotten. (It's been a couple of time for me when I made the patched plist at that time for @Slice...) BTW. I don't think the FrequencyVectors is specific to certain CPU models. It's basically universal.

About "graph", it's your integrated graphics related values. (For your 6700k it should be HD530 right? Of course assuming that you don't turn it off in the BIOS.)

With that said, should this work with a 6600K?

Link to comment
Share on other sites

Thanks @syscl @PMheart.

I had been trying unsuccessfully to get full power management on my hack since I built it. The CPU floor would always hang around 1.4 Ghz. With the plist provided by PMheart and this guide to enable the HWP my setup reaches the appropriate floor of 800 MHz. 

post-1589215-0-66779700-1489628824_thumb.png

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Hi xtddd,

The 2 generate is for loading X86*, it's not related to HWP.

should do other settings besides checking hwp..?

@xtddd 

it doesn't seem to make a difference - so you can leave Clover config.plist Generate/PStates or CStates/false.

should do other settings besides checking hwp..?

Link to comment
Share on other sites

@xtddd

 

i followed this guide and a used these basic steps (and then use my HWP scripts to edit standard model profiles)

 

1) use model that support HWP - for example MBP13,1

2) switch to mini - SSDT-CPU - which set SSDT plugin type 1

3) HWPEnable = true in Clover

4) Create X86PlatformPlugin to match my CPU speed. 

5) validate X86PlatformPlugin loaded via kextstat or IOReg

  • Like 2
Link to comment
Share on other sites

@xtddd

 

i followed this guide and a used these basic steps (and then use my HWP scripts to edit standard model profiles)

 

1) use model that support HWP - for example MBP13,1

2) switch to mini - SSDT-CPU - which set SSDT plugin type 1

3) HWPEnable = true in Clover

4) Create X86PlatformPlugin to match my CPU speed. 

5) validate X86PlatformPlugin loaded via kextstat or IOReg

i set smbios to mac pro5.1 and have 29 p-stages.X86PlatformPlugin also loads.

Link to comment
Share on other sites

i set smbios to mac pro5.1 and have 29 p-stages.X86PlatformPlugin also loads.

First of all, I can tell. You must miss something related to power management unless you use Pike's freqVectorsEdit.sh or the dummy kext of X86PlatfromPlugin to inject the FrequencyVectors. For otherwise, you are experiencing incomplete power management definitely. Note that there's no support natively in MacPro5,1 with X86* mechanism.

  • Like 1
Link to comment
Share on other sites

Hi everyone,

 

Thanks for the useful information. HWP is working successfully on my iMac17,1 build with a 6700k CPU - although I've had to manually switch the plist into the X86PlatformPlugin kext to get it to work properly. This is probably not ideal, but I'll explain the steps I took to get there so maybe someone can clue me in as to what I was doing wrong.

 

  • HWPEnable set in Clover with a HWPValue of 0x94002D01 (aggressive power saving, and I have a 4.5Ghz overclock). This works well in macOS, with the system scaling up and down as required - staying on 800Mhz when idle. However, X86PlatformPlugin is not loaded.
     
  • If I add an SSDT generated by ssdtPRGen.sh or the tiny SSDT attached to this thread (enabling 'plugin-type') my CPU runs at top speed constantly and doesn't scale. But X86PlatformPlugin is loading now.
     
  • Reading through this thread it seems I need to inject a customised plist for my board type into X86PlatformPlugin. I've tried each one in this thread that was customised for an iMac17,1 but they didn't seem to make any difference. Still running at top speed. But I am actually unsure if the kext injection is even working and don't know how to check.
     
  • As mentioned above, the way I have got HWP working and X86PlatformPlugin loading was to manually insert the customised plist into X86PlatformPlugin.

Anyone have any idea what I can check to see if injection is working? All my other kexts work fine. I wondered if I needed to update my kext cache or something but that didn't seem to help either.

 

Edit: clarified method I used to get it to work

 

Edit: got it working. I assumed this could be injected by Clover, but it needs to be installed in S/L/E as it uses a symlink that Clover won't follow.

Link to comment
Share on other sites

Hi @captain-j,

 

1 - I don't think HWPEnable is really needed if everything was configured properly. Note that there's no HWP support in the native FrequencyVectors of iMac17,1 and thus HWP won't be activated by default and yes, HWP isn't gonna be supported on real iMac if everything related is untouched/vanilla. So I guess you may need this injector. (HWP enabled, EPP 0x80)

X17PP.kext.zip

 

Notes:

- Install it to /S/L/E or /L/E, as for kext injection, it WON'T work!

- This dummy kexts needs board-id to be Mac-DB15BD556843C820 for iMac17,1, for otherwise please rename it inside ./X17PP.kext/C*/Resources/Mac-DB15BD556843C820.plist into the new one.

 

2 - Yep X86* is absolutely essential to be loaded and function correctly (No FrequencyVectors missing, or something else), for otherwise your power management will be incomplete.

 

3 - Again, some injectors like this will NOT work via kext injection, now you have to install them into /S/L/E or /L/E

 

[uPDATE]

Some technical backgrounds

 

Firstly. In my humble opinion. HWPEnable is for those which haven't HWP support, and then force to enable it.

Here is some disassembly from kernel:

_xcpm_hwp_enable:
ffffff800041c8d0        pushq        %rbp
ffffff800041c8d1        movq        %rsp, %rbp
ffffff800041c8d4        movl        $0x1aa, %ecx        
ffffff800041c8d9        rdmsr                       
ffffff800041c8db        movl        %edx, %edx
ffffff800041c8dd        movl        %eax, %eax
ffffff800041c8df        orq        $0x40, %rax
ffffff800041c8e3        movl        $0x1aa, %ecx
ffffff800041c8e8        wrmsr
ffffff800041c8ea        movl        $0x770, %ecx
ffffff800041c8ef        movl        $0x1, %eax
ffffff800041c8f4        xorl        %edx, %edx
ffffff800041c8f6        wrmsr                        ; Writing MSR 0x770, this enables HWP
ffffff800041c8f8        popq        %rbp
ffffff800041c8f9        retq
ffffff800041c8fa        nopw        (%rax,%rax)

Well, and when will _xcpm_hwp_enable() be called? Obviously. While hwp == 0x01 (enabled) in FrequencyVectors. This is what I mainly changed for iMac17,1. :) Alright, it's admittedly more complex than something like this, and I don't think it can be explained here in two words...

As for HWPEnable, it does the same thing for us without calling _xcpm_hwp_enable() (Or we can say Clover does the alternative stuffs), but I think we'll have incomplete power management in this case. (X86 not loaded, lack of FrequencyVectors, etc)

 

[uPDATE 2]

Add all iMac17,1 models support. (Mac-DB15BD556843C820.plist, Mac-B809C3757DA9BB8D, Mac-65CE76090165799A) No need to rename anything any longer.

Edited by PMheart
  • Like 3
Link to comment
Share on other sites

Hi @PMheart,

 

Thanks for your detailed reply. You're absolutely right - HWPEnable is not needed. I unchecked HWPEnable and removed the HWPValue from Clover and have just used the injector kext (installed in /Library/Extensions) and HWP is still enabled, and X86PlatformPlugin is loading as well. Great stuff! :)
 

I've tweaked the EPP in the FrequencyVectors to be slightly higher - 192 or 0xC0, and I also adjusted perf-bias from 1 to 15 (I grabbed that value from Piker's AppleIntelInfo source code. It seems 1, 5 and 15 are the expected values for perf-bias).

 

a7qvVrI.png

 

Bit hard to say if it's helping with energy effiency (I didn't really check the average power use before this), but it is certainly 'stepping' up and down as expected. Although it only seems to hit a floor of 1000Mhz now, instead of the 800Mhz I was expecting. Also I ran AppleIntelInfo again, and ran a Geekbench test to use the CPU heavily, and the number of P-States returned was only a few.

 

Although Ioreg has X86PlatformPlugin showing all 38 P-States. I don't know if this really matters, maybe this is how HWP works? Anyway, unless something seems strange to you I am happy to use this as it is now.

 

kuN7hjN.png

  • Like 1
Link to comment
Share on other sites

Hi @PMheart,

 

Thanks for your detailed reply. You're absolutely right - HWPEnable is not needed. I unchecked HWPEnable and removed the HWPValue from Clover and have just used the injector kext (installed in /Library/Extensions) and HWP is still enabled, and X86PlatformPlugin is loading as well. Great stuff! :)

 

I've tweaked the EPP in the FrequencyVectors to be slightly higher - 192 or 0xC0, and I also adjusted perf-bias from 1 to 15 (I grabbed that value from Piker's AppleIntelInfo source code. It seems 1, 5 and 15 are the expected values for perf-bias).

 

a7qvVrI.png

 

Bit hard to say if it's helping with energy effiency (I didn't really check the average power use before this), but it is certainly 'stepping' up and down as expected. Although it only seems to hit a floor of 1000Mhz now, instead of the 800Mhz I was expecting. Also I ran AppleIntelInfo again, and ran a Geekbench test to use the CPU heavily, and the number of P-States returned was only a few.

 

Although Ioreg has X86PlatformPlugin showing all 38 P-States. I don't know if this really matters, maybe this is how HWP works? Anyway, unless something seems strange to you I am happy to use this as it is now.

 

kuN7hjN.png

Hi. Unfortunately I'm now on my mobile and I may not reply very well.

 

1. If I remembered correctly, when EPP is supported, then perf-bias is not required. (It prefers EPP value to perf-bias)

 

2. As for energy efficiency. I saw you were over clocking right? If so and then it may be somewhat hard to get a lowered P-States, but now my brain is a total mess... I can't remember the details. Sorry.

 

3. No. I don't suppose that XCPM is really designed for more P-States, instead, the major feature can be flexibility (We don't need to change a lot unlike the old AICPUPM mechanism)

 

4. As for checking HWP, yup, Pike's AppleIntelInfo will give you a hand I guess. (Check MSR 0x770 status)

 

 

Sent from my iPhone 7 using Tapatalk

Link to comment
Share on other sites

Hi again,

 

For those that are curious, here are the injectors I used for my iMac17,1. There are a few different configurations, which you should be able to denote by the filenames:

 

1HWPEnablerPerfBias5-EPP255.kext

1HWPEnablerPerfBias15-EPP192.kext

1HWPEnablerPerfBias15-EPP255.kext

 

The kexts inject the custom board plist with modified frequencyVectors. You will have to rename the board plist inside the kext to match your model.

 

They all enable HWP, and adjust the perf-bias and EPP values. This set is predominately for energy saving.

 

Please note, as per earlier posts by all:

  • must have 'plugin-type' set by (tiny) SSDT (see OP post)
  • remove/disable HWPEnable and HWPValue from Clover, not needed with this kext
  • kext must be properly installed to /Library/Extensions (my personal preference) or with the system kexts in /System/Library/Extensions

Have fun!

iMac17,1-HWPenable.zip

  • Like 3
Link to comment
Share on other sites

@captain-j, thanks for sharing. I'm running a 6700K with the same overclock as you (4.5 Ghz), so I've tried your injector (1HWPEnablerPerfBias15-EPP192.kext with modified board-id). I've followed the same steps, but I'm still having trouble getting my CPU to clock lower when idling. It doesn't seem to like going lower than 2,68 Ghz.

 

3YPJyIk.png

 

I did notice in ioRegistryExplorer that my CPUPStates in X86PlatformPlugin all start with 0 which seems to differ with what I'm seeing here. But I don't know how much this matters, since we're using HWP?

 

j1DwTAk.png

 

When I stop injecting an SSDT I seem to get correct frequencies, from 0.8 Ghz all the way up to 4.5 Ghz. But X86PlatformPlugin of course won't load that way, which isn't desirable. What am I missing here?

Link to comment
Share on other sites

@tjrt I have observed similar behaviour. When I activate HWP in Windows 10 (using a utility called ThrottleStop) it also drops to 800Mhz during idle. macOS does the same in the way you describe (only when the SSDT for 'plugin-type' is not used). As you mention, X86PlatformPlugin doesn't load in that case but it seems the CPU is running more efficiently.

 

Honestly, I don't know why. It would be interesting to know how much power is consumed on average: without HWP, with HWP, and with HWP & X86PlatformPlugin.

 

My P States definitely show up numbered 0 - 38, and my CPU does drop to as low as 1.0Ghz (but never less, and certainly not as often as I am expecting). Are you injecting any other SSDT for the CPU? How have you made your 4.5Ghz overclock in BIOS? Have you disabled EIST in BIOS?

Link to comment
Share on other sites

@captain-j I agree, it's puzzling! Whatever I try, I can't seem to get my cores to drop below that 2,68 Ghz. 

 

I have experimented with various options: 

  • Enabling/disabling EIST doesn't seem to alter my frequencies.
  • I overclock by upping the turbo frequencies on all cores to 4.5 Ghz. Disabling the overclock doesn't seem to alter the frequencies when idling. Output looks about the same.
  • I alternately ran that SSDT for plugin-type from OP and a SSDT generated with the ssdtPRGen script by Piker-Alpha. Frequencies again seem to be the same with whatever SSDT I use.

 

Good suggestion about measuring power consumption. I have a wattmeter lying around, so I connected it to my system and took it for a spin. I don't know how accurate it is absolutely speaking, but at least I can compare different settings. Here are the results after I let my system idling for a couple of minutes:

  • Using Injector with HWP and SSDT for plugin-type: ~80 watt
  • Using injector with HWP and SSDT generated with ssdtPRGen: ~80 watt
  • No SSDT (and no X86PlatformPlugin but seemingly correct frequencies): ~77 watt

Using no SSDT seems to be a bit more efficient, but a lot less than I would've expected. Maybe the upped efficiency of the CPU is largely negated by the loss of other power saving functions provided by the X86PlatformPlugin that isn't loading. It's hard to say.

 

Also interesting: I additionaly have Windows 10 running on my system, so I checked power consumption over there. I measured ~54 watt after idling for a couple of minutes. A pretty big difference.

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...