Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The KP when inject legacy AppleIntelCPUPowerManagement kexts. #631

Open
gujiangjiang opened this issue Sep 19, 2023 · 15 comments
Open

The KP when inject legacy AppleIntelCPUPowerManagement kexts. #631

gujiangjiang opened this issue Sep 19, 2023 · 15 comments

Comments

@gujiangjiang
Copy link

gujiangjiang commented Sep 19, 2023

I'm using ThinkPad x230 running macOS Sonoma with intel Core I5-3320M Ivybridge.

In Ventura, I'm using [XCPM] and the patch works fine both Clover and OpenCore.
But when I upgrade to Sonoma the -xcpm kernel patch doesn't work anymore so I revert to legacy AppleIntelCPUPowerManagement to work.
https://github.com/5T33Z0/OC-Little-Translated/tree/main/01_Adding_missing_Devices_and_enabling_Features/CPU_Power_Management/CPU_Power_Management_(Legacy)#re-enabling-acpi-power-management-in-macos-ventura

But I tried many times it aways kp when boot. I tried delete SSDT-CpuPm and other tried but have nothing works it still kp when boot.

I tried OpenCore later and the AppleIntelCPUPowerManagement.kext works. The kexts works fine with OpenCore I don't know why cause this.
截屏2023-09-19 22 08 08

Does it related with the order of kext inject?
Here is the kexts folder with Sonoma in Clover:
截屏2023-09-19 22 03 20

Here is the kexts order in OpenCore:
截屏2023-09-19 22 02 58

I don't know what cause the kp. My Clover and OpenCore shared same DSDT/Patches/Kexts/SMBIOS and Clover can inject any kexts with no problem but [AppleIntelCPUPowerManagement.kext].

@gujiangjiang
Copy link
Author

I found a clue but not sure.

I boot Sonoma with -v using Clover and OpenCore.
I shot the screen and I found that when Clover boot have ACPI Error but OpenCore boot with no error, the Clover and OpenCore shared same SSDT and same ACPIPatch, The ACPI error in Clover is [cpupm]. I don't know if related with DSDT?

Here is the -v with OpenCore, No ACPI errors.
44f82404e7a273b45965b8931c8a1b74

Here is the -v with Clover, have ACPI Error about CPUPM.
7467f44df0c034f1c2c7f80c57a720b0

PS:
Beside. I found Clover DSDT have another bug in SSDT Drop.
I Using SSDT Drop before but it with no use.
I tried both TableID and LengthID but still no use.
When I boot into macOS and found the [Dropped SSDT] still exist in System ACPI.
WX20230920-003625

WX20230920-003643

WX20230920-003706

However the OpenCore with no bug in Drop SSDT. OpenCore can Drop SSDT successfully with no problem.

WX20230920-003827

Now I just can guess if [AppleIntelCPUPowerManagement.kext] load failed is related with ACPI Error in Clover?

@gujiangjiang
Copy link
Author

gujiangjiang commented Sep 19, 2023

New Found.

acidanthera/bugtracker#969

I read this topic and I found it happed in Clover.

image

I found when I Drop SSDT-CpuPm and boot into macOS, System ACPI can see CpuPm(Droped Failed) and CpuCst(?).

This is strange. CpuCst Is internal Table for CpuPm why they show in SystemACPi when I set Drop SSDT CpuPm. However, The OpenCore will not see CpuPm and CpuCst when I Droped CpuPm.

Does this is the difference between OpenCore and Clover in original ACPI Dump?

@gujiangjiang
Copy link
Author

gujiangjiang commented Sep 19, 2023

I tried Drop CpuPm and all of it's internal SSDTs like blew:
QQ20230920-030422

Sadly it still KP when boot with AppleIntelCPUPowerManagement .

I looked into Clover boot.log and I find this:
QQ20230920-030506
QQ20230920-030524

Clover boot .log show it Dropped CpuPm and Cpu0Ist Successfully but actually only Cpu0Ist dropped successfully, The CpuPm dropped failed and have a SSDT called CpuCst?

I delete AppleIntelCPUPowerManagement and boot into macOS and I found it still have CpuPm and CpuCst in System ACPI.
QQ20230920-030611

I guess the Clover can't Drop CpuPm and its internal SSDT? but with OpenCore I haven't drop any SSDT and it works fine, and the System ACPI can't see CpuCst.

Now I am sure the KP with AppleIntelCPUPowerManagement related with [CpuCst ] but Clover load it by default and have no method to drop it.

Any method to solve this bug.

@gujiangjiang
Copy link
Author

gujiangjiang commented Sep 20, 2023

Now I'm using OpenCore with AppleIntelCPUPowerManagement.

Here is the SystemACPI in OpenCore with no SSDT Dropped:
image

We can see the OpenCore only load CpuPm and Cpu0Ist, No CpuCst loaded.

image
Clover load CpuCst is an internal SSDT, CpuCst can't be loaded separete, it only been used by CpuPm.

This is a bug, and hope to fix.

Thanks Slice.

@SergeySlice
Copy link
Collaborator

Did you take into account that Clover generates own tables CpuPm and CpuCst?

@gujiangjiang
Copy link
Author

Did you take into account that Clover generates own tables CpuPm and CpuCst?

How to avoid clover to generate its own CpuPm and CpuCst

I can’t find way to disable clover to add these two ssdt in system ACPI

@gujiangjiang
Copy link
Author

gujiangjiang commented Sep 21, 2023

@SergeySlice
I found Clover generate C and P state by default when have no options in config.

I tried to add
` SSDT

	<dict>
		<key>Generate</key>
		<dict>
			<key>CStates</key>
			<false/>
			<key>PStates</key>
			<false/>
		</dict>
	</dict>`

to config and boo into macOS found CpuPm and CpuCst disappeared.

However. When I add AppleIntelCPUPowerManagement to Kexts folder it still boot in kernel panic .

Strange....

@gujiangjiang
Copy link
Author

I test the kexts order in OpenCore, I found no matter order of kexts loading it's always works fine with no Kernel Panic.

I don't know how to solve this.

Here is the boot.log.
preboot.log

@gujiangjiang
Copy link
Author

panic(cpu 0 caller 0xffffff802ad878d3): Kernel trap at 0xffffff802ebee58d, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0xffffffd0a834b000, CR3: 0x0000000033db8000, CR4: 0x00000000001626e0
RAX: 0x0000000000000407, RBX: 0xffffff802ec02650, RCX: 0x00000000000000e2, RDX: 0x0000000000000000
RSP: 0xffffffb0b5413ee0, RBP: 0xffffffb0b5413ee0, RSI: 0x00000000e1ff7ff8, RDI: 0xffffff802b8b4b00
R8: 0xffffff9084fcffa0, R9: 0xffffff90b716b840, R10: 0x0000000000000000, R11: 0x3800f0040000001e
R12: 0xffffffa5824e5d00, R13: 0x0000000000000000, R14: 0x0000000000000046, R15: 0xffffff802b8b4b00
RFL: 0x0000000000010002, RIP: 0xffffff802ebee58d, CS: 0x0000000000000008, SS: 0x0000000000000000
Fault CR2: 0xffffffd0a834b000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 0, VF: 0

Panicked task 0xffffffaa4f04ddf8: 65 threads: pid 0:
Backtrace (CPU 0), panicked thread: 0xffffffa5824c80f8, Frame : Return Address
0xffffff802a90c140 : 0xffffff802ac3a211
0xffffff802a90c190 : 0xffffff802ad97ce0
0xffffff802a90c1d0 : 0xffffff802ad8742c
0xffffff802a90c250 : 0xffffff802abd6951
0xffffff802a90c270 : 0xffffff802ac3a4fd
0xffffff802a90c360 : 0xffffff802ac39ba3
0xffffff802a90c3c0 : 0xffffff802b3d91ab
0xffffff802a90c4b0 : 0xffffff802ad878d3
0xffffff802a90c630 : 0xffffff802ad875b7
0xffffff802a90c6b0 : 0xffffff802abd6951
0xffffff802a90c6d0 : 0xffffff802ebee58d
0xffffffb0b5413ee0 : 0xffffff802ebdcdc5
0xffffffb0b5413f10 : 0xffffff802ebdf5ed
0xffffffb0b5413f50 : 0xffffff802ebe11d1
0xffffffb0b5413f60 : 0xffffff802ebe1d80
0xffffffb0b5413fa0 : 0xffffff802abd619e
Kernel Extensions in backtrace:
com.apple.driver.AppleIntelCPUPowerManagement(222.0)[20DD89B4-45CE-3E56-A484-15B74E79ACDD]@0xffffff802ebdc000->0xffffff802ec11fff

Process name corresponding to current thread (0xffffffa5824c80f8): Unknown
Boot args: -no_compat_check revpatch=sbvmm,f16c revblock=media root-dmg=file:///BaseSystem/BaseSystem.dmg

Mac OS version:
Not yet set

Kernel version:
Darwin Kernel Version 23.0.0: Tue Aug 22 02:12:12 PDT 2023; root:xnu-10002.1.11~16/RELEASE_X86_64
Kernel UUID: FF4F5BA9-B01E-35AE-9D48-224B0DA98A07
roots installed: 0
KernelCache slide: 0x000000002a800000
KernelCache base: 0xffffff802aa00000
Kernel slide: 0x000000002a8e0000
Kernel text base: 0xffffff802aae0000
__HIB text base: 0xffffff802a900000
System model name: MacBookPro10,2 (Mac-AFD8A9D944EA4843)
System shutdown begun: NO
Panic diags file unavailable, panic occurred prior to initialization
Hibernation exit count: 0

System uptime in nanoseconds: 1105047151
Last Sleep: absolute base_tsc base_nano
Uptime : 0x0000000041ddb769
Sleep : 0x0000000000000000 0x0000000000000000 0x0000000000000000
Wake : 0x0000000000000000 0x00000015407bcade 0x0000000000000000
Compressor Info: 0% of compressed pages limit (OK) and 0% of segments limit (OK) with 0 swapfiles and OK swap space
Zone info:
Zone map: 0xffffff90b515b000 - 0xffffffb0b515b000
. PGZ : 0xffffff90b515b000 - 0xffffff90b715c000
. VM : 0xffffff90b715c000 - 0xffffff958395b000
. RO : 0xffffff958395b000 - 0xffffff971d15b000
. GEN0 : 0xffffff971d15b000 - 0xffffff9be995b000
. GEN1 : 0xffffff9be995b000 - 0xffffffa0b615b000
. GEN2 : 0xffffffa0b615b000 - 0xffffffa58295b000
. GEN3 : 0xffffffa58295b000 - 0xffffffaa4f15b000
. DATA : 0xffffffaa4f15b000 - 0xffffffb0b515b000
Metadata: 0xffffff9064fc5000 - 0xffffff9084fc5000
Bitmaps : 0xffffff9084fc5000 - 0xffffff9087fc5000
Extra : 0 - 0

last started kext at 1095479446: >!AAHCIPort 380 (addr 0xffffff802bc00000, size 61440)
loaded kexts:
com.zxystd.AirportItlwm 2.3.0
as.acidanthera.mieze.!IMausi 1.0.7
ru.joedm.SMCSuperIO 1.3.2
org.zhen.YogaSMC 1.5.3
as.acidanthera.voodoo.driver.PS2!C 2.3.5
as.vit9696.SMCProcessor 1.3.2
as.acidanthera.BlueToolFixup 2.6.8
com.dhinakg.AMFIPass 1.3.1
com.khronokernel.CryptexFixup 1.0.2
ru.usrsse2.SMCLightSensor 1.3.2
com.khronokernel.FeatureUnlock 1.1.5
as.acidanthera.BrightnessKeys 1.0.3
ru.usrsse2.SMCBatteryManager 1.3.2
as.vit9696.VirtualSMC 1.3.2
as.vit9696.RestrictEvents 1.1.2
com.1Revenger1.ECEnabler 1.0.4
as.lvs1974.HibernationFixup 1.4.9
as.acidanthera.BrcmFirmwareStore 2.6.8
as.vit9696.!AALC 1.8.5
as.vit9696.WhateverGreen 1.6.6
as.vit9696.Lilu 1.6.7

!AAHCIPort 380
@private.KextAudit 1.0
!ARTC 2.0.1
!AHPET 1.8
!AACPIButtons 6.1
!ASMBIOS 2.1
!AACPIEC 6.1
!AAPIC 1.7
@!ASystemPolicy 2.0.0
@nke.applicationfirewall 404
!A!ICPUPowerManagement 222.0.0
|IOKitRegistryCompatibility 1
|EndpointSecurity 1
@Dont_Steal_Mac_OS_X 7.0.0
!ADiskImages2 272.0.0
@kec.!AEncryptedArchive 1
|IOAHCI!F 304
usb.!UEHCIPCI 1.2
usb.!UEHCI 1.2
|IO80211!F 1200.13.0
corecapture 1.0.4
!AEFINVRAM 2.1
usb.!UXHCIPCI 1.2
usb.!UXHCI 1.2
!AEFIRuntime 2.1
|IOHID!F 2.0.0
|IOSMBus!F 1.1
|IOTimeSync!F 1200.91
|IOSkywalk!F 1.0
mDNSOffloadUserClient 1.0.1b8
|IONetworking!F 3.4
DiskImages 493.0.0
|IO!B!F 9.0.0
|IOReport!F 47
$quarantine 4
$sandbox 300.0
@kext.!AMatch 1.0.0d1
!ASSE 1.0
!ALockdownMode 1
!AKeyStore 2
!UTDM 556
|IOUSBMass!SDriver 240
|IOSCSIBlockCommandsDevice 492
|IOSCSIArchitectureModel!F 492
!AFDEKeyStore 28.30
!AEffaceable!S 1.0
|IO!S!F 2.1
!ACyrus 1
!ACredentialManager 1.0
KernelRelayHost 1
|IOUSBHost!F 1.2
!UHostMergeProperties 1.2
usb.!UCommon 1.0
!AMobileFileIntegrity 1.0.5
$!AImage4 5.0.0
@kext.CoreTrust 1
|CoreAnalytics!F 1
!ABusPower!C 1.0
!ASEPManager 1.0.1
IOSlaveProcessor 1
!AACPIPlatform 6.1
!ASMC 3.1.9
|IOPCI!F 2.9
|IOACPI!F 1.4
watchdog 1
@kec.pthread 1
@kec.XrtHostedXnu 1
@kec.Libm 1
@kec.Compression 1.0
@kec.corecrypto 14.0

@SergeySlice
Copy link
Collaborator

May be your MSR 0xE2 is locked and Clover did not unlock it automatically?

@gujiangjiang
Copy link
Author

gujiangjiang commented Oct 30, 2023

@SergeySlice
Yes the MSR0xE2 locked but it passed by clover and can see log in clover.log.
I have checked [AppleIntelCPUPM] in Clvoer and it works fine in Catalina which needed AppleIntelCPUPowerManagement.

Does the MSR 0xE2 patch changed in Ventura and Sonoma?
In OpenCore i selected [AppleCpuPmCfgLock] and works fine.

@gujiangjiang
Copy link
Author

acidanthera/OpenCorePkg#448
acidanthera/OpenCorePkg@77d02b3

OpenCore have some commit about this.

@jief666
Copy link
Contributor

jief666 commented Jan 4, 2024

These commits are now imported into Clover. Could you try the latest version : CloverX64-2024-01-04-10-59-02-0094e0c-jief.zip ?
You can also compile yourself the master branch.

@gujiangjiang
Copy link
Author

@jief666 i will try later.
Thanks.

@SergeySlice
Copy link
Collaborator

VirtualSMC is not compatible with Clover. Replace it by FakeSMC with plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants