- 
                Notifications
    
You must be signed in to change notification settings  - Fork 47
 
Description
Background
Owing to the lack of symbol resolver and bitmasking, @syscl and I created a tremendous number of patches in Clover years ago, which conversely helps us cope with the bytes nowadays despite messy. There @syscl (or I) added patches earlier than 10.12 as well, yet it has not been well tested. (Or rather NOT AT ALL!) I think the first time people started this heated debate was by the time @Piker-Alpha posted his (probably the first detailed) article at his blog.
And now with OC, it would be nice to handle this much more properly.
What to patch
As summed up at InsanelyMac, XCPM on unsupported CPUs requires several patches:
- Function wise: _cpuid_set_info(), _xcpm_bootstrap() (functional with our CPUID patch, as of acidanthera/OcSupportPkg@98ef065)
 - MSR wise: _xcpm_SMT_scope_msrs (DONE at acidanthera/OcSupportPkg@2366b81), _xcpm_core_scope_msrs (DONE at PatchAppleXcpmCfgLock() a long time ago) and _xcpm_pkg_scope_msrs (DONE at acidanthera/OcSupportPkg@4e916c6) under function _xcpm_init()
 - Certain Skylake+ with HWP needs patches applied to _xcpm_idle(). (functional as of acidanthera/OcSupportPkg@b2b0fa3)
 - Low-end Haswell+ Celeron and Pentium needs AVX patch in addition. (NO SUPPORT! See NOTES below for Haswell+ low-end)
 - Performance fix for certain high-end models, although the current implementation does not seem sane. (See NOTES below for performance fix)
 
Special NOTES for Haswell+ low-end
Your support gets dropped as of 10.13 or 10.14 kindly by Apple. Sorry, I cannot tell the exact version, but it indeed is bad news. Well, I will be able to post the necessary patches if you just want to try out earlier versions with your lovely low-end models. LOL
First, apply CPUID patch via Kernel->Emulate:
Cpuid1Data: <A9 06 03 00 00 00 00 00 00 00 00 00 00 00 00 00>
Cpuid1Mask: <FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00>
This will fake CPUID as 0x306A9 (Ivy Bridge) in order to successfully boot. Yet Ivy Bridge is an XCPM-unsupported model, thus patch to _xcpm_bootstrap might be needed depending on macOS version, as well as a universal patch for AVX (see below):
- For 10.11 and older, just apply the CPUID patch above and simply accompanied by 
boot-argnamed-xcpm. - For 10.12 and newer, please apply whichever fitting macOS version in addition to the CPUID patch above:
 
_xcpm_bootstrap (Haswell+ low-end Celeron/Pentium) 10.12
Base: _xcpm_bootstrap
Comment: _xcpm_bootstrap (Haswell+ low-end Celeron/Pentium) 10.12
Count: 1
Enabled: YES
Find: C4830022
Identifier: kernel
Limit: 0
Mask: FFFF00FF
MatchKernel: 16.
Replace: C6830022
ReplaceMask: FFFF00FF
Skip: 0
_xcpm_bootstrap (Haswell+ low-end Celeron/Pentium) 10.13+ (10.13-10.15 at least)
Base: _xcpm_bootstrap
Comment: _xcpm_bootstrap (Haswell+ low-end Celeron/Pentium) 10.13+
Count: 1
Enabled: YES
Find: 00C43C22
Identifier: kernel
Limit: 0
Mask: 00FFFFFF
MatchKernel: 16.
Replace: 00C63C22
ReplaceMask: 00FFFFFF
Skip: 0
As well as this universal AVX patch for 10.12+:
Base: [EMPTY]
Comment: Haswell+ low-end Celeron/Pentium cpuid_set_info_rdmsr (c) vit9696
Count: 1
Enabled: YES
Find: B9A00100000F32
Identifier: kernel
Limit: 0
Mask: [EMPTY]
MatchKernel: [EMPTY]
Replace: B9A001000031C0
ReplaceMask: [EMPTY]
Skip: 0
Special NOTES for performance fix
Firstly. Do NOT use this patch whenever possible! It basically even breaks the idea of CPU power management. Secondly, it is named AppleXcpmForceBoost in OpenCore quirks.
Legacy patch depending on macOS version
XCPM performance fix (10.8.5 - 10.13.3)
Base: [EMPTY]
Comment: XCPM performance fix (c) okrasit 10.8.5 - 10.13.3
Count: 0
Enabled: YES
Find: 89D8C1E0 08000000
Identifier: kernel
Limit: 0
Mask: FFFFFFFF FF000000
MatchKernel: [EMPTY]
Replace: B800FF00 00000000
ReplaceMask: FFFFFFFF FF000000
Skip: 0
XCPM performance fix (10.13.4+)
Base: [EMPTY]
Comment: XCPM performance fix (c) okrasit & vit9696 10.13.4+
Count: 0
Enabled: YES
Find: C1E3084863D389D048C1EA20B99901
Identifier: kernel
Limit: 0
Mask: [EMPTY]
MatchKernel: [EMPTY]
Replace: C1E308B800FF000031D29090B99901
ReplaceMask: [EMPTY]
Skip: 0