vulgo / ga-h97n-wifi-hackintosh

macOS 12 Monterey on H97N-WIFI + OpenCore
24 stars 5 forks source link

Sleep panic and video problems using AMD GPU #19

Closed ants83 closed 1 year ago

ants83 commented 2 years ago

After putting the machine into sleep mode it freezes and cannot be awaken. Hard reset is required to reboot. See attached panic log: panic_sleep.log

My hardware configuration includes:

Monitor is attached to AMD GPU, which works out of the box. Software config is the vanilla one from this repository, with recommended GPU settings for Broadwell in BIOS and config.plist.

vulgo commented 2 years ago

Thanks. Please try these GPU settings in config.plist.

...
<key>DeviceProperties</key>
<dict>
    <key>Add</key>
    <dict>
        ...
        <key>PciRoot(0x0)/Pci(0x2,0x0)</key>
        <dict>
            ...
            <key>AAPL,ig-platform-id</key>
            <data>BAASBA==</data>
            <key>framebuffer-patch-enable</key>
            <data>AQAAAA==</data>
            <key>framebuffer-pipecount</key>
            <data>AAAAAA==</data>
            <key>framebuffer-portcount</key>
            <data>AAAAAA==</data>
            <key>framebuffer-memorycount</key>
            <data>AAAAAA==</data>
            <key>framebuffer-fbmem</key>
            <data>AAAAAA==</data>
            <key>framebuffer-flags</key>
            <data>AAAAAA==</data>
            ....
        </dict>
        ...
    </dict>
</dict>

I think those will make the Iris Pro work connectorless. The fault occured in Google Chrome renderer and I've never tested Broadwell with a discrete GPU, the iGPU seems like a good place to start. Backup your EFI boot partition to e.g. USB in case this causes new problems.

edit: @ants83 added framebuffer-patch-enable

ants83 commented 2 years ago

Thanks @vulgo. I replaced the iGPU configuration with the one you propose. The system boots fine and the Iris Pro 6200 does not show up anymore in the Graphics/Display section in System Information. I'll test the configuration for some time and (hopefully not) report any further panic after sleep.

For completeness I need to report that for months I have been struggling with BIOS not retaining settings after a random number of reboots. Still, after upgrading to rev F8 from F7, BIOS was always being reverted to the backup F7 image by the Dual BIOS system. I had never tried to update to rev F9b (classified as beta) until today. After the update problems seem solved. Did you experience any issue in this regard?

vulgo commented 2 years ago

@ants83 yes please provide further panic logs if you get them. It that's the case see if it panics without Chrome running and get that panic report also.

As well as panic reports pmset -g log | grep -i failure sometimes has useful information or just pmset -g log

There's instructions for getting a log from Chrome here.

I have rev 1.1 board F8 firmware, the dual bios is supposed to be automated but i have found it buggy and needed a special procedure, some dodgy power on and off timing trick to get things in a state where the dual BIOS would kick in. That said I've not experienced random loss of settings after reboots (edit: actually maybe i did, see below) Maybe NVRAM problem fixed it in F8? You had bad flash and/or buggy dual BIOS?

The firmwares on most of these x86 boards are pretty poor really (in my opinion). Maybe auto-generated from Aptio/Intel software operated by the PCB manufacturer's software engineer(s)?

vulgo commented 2 years ago

I know when I first got this motherboard I contacted the previous owner to ask if it was working when he sold it to me because i couldn't get it to do anything useful.

ants83 commented 2 years ago

@ants83 yes please provide further panic logs if you get them. It that's the case see if it panics without Chrome running and get that panic report also.

As well as panic reports pmset -g log | grep -i failure sometimes has useful information or just pmset -g log

There's instructions for getting a log from Chrome here.

I have rev 1.1 board F8 firmware, the dual bios is supposed to be automated but i have found it buggy and needed a special procedure, some dodgy power on and off timing trick to get things in a state where the dual BIOS would kick in. That said I've not experienced random loss of settings after reboots (edit: actually maybe i did, see below) Maybe NVRAM problem fixed it in F8? You had bad flash and/or buggy dual BIOS?

The firmwares on most of these x86 boards are pretty poor really (in my opinion). Maybe auto-generated from Aptio/Intel software operated by the PCB manufacturer's software engineer(s)?

The only BIOS image that worked, or at least up to now, was the F9b. Every time i tried to flash the F8, Dual Bios kicked in, automatically restoring F7.

ants83 commented 2 years ago

Today another panic after sleep. See the attached log:

panic_sleep_2.log

This is the output of pmset:

$ pmset -g log | grep -i failure
2022-03-29 08:53:25 +0200 Failure               Failure during wake: SAT0(AppleAHCI) : Some drivers failed to handle setPowerState panic              
2022-03-30 08:46:29 +0200 Failure               Failure during wake: PEG0(),IGPU(),B0D3(),SBUS() : Some drivers failed to handle setPowerState panic              
2022-03-30 21:51:11 +0200 Failure               Failure during wake: PEG0() : Some drivers failed to handle setPowerState             
2022-03-31 02:49:15 +0200 Failure               Failure during wake: PEG0(),IGPU(),B0D3(),SBUS() : Some drivers failed to handle setPowerState                
2022-03-31 08:43:42 +0200 Failure               Failure during wake: PEG0() : Some drivers failed to handle setPowerState panic               
2022-03-31 22:17:11 +0200 Failure               Failure during wake: PEG0(),IGPU(),B0D3(),SBUS() : Some drivers failed to handle setPowerState  

These are my settings:

$ pmset -g
System-wide power settings:
Currently in use:
 standby              0
 Sleep On Power Button 1
 womp                 0
 autorestart          0
 hibernatefile        /var/vm/sleepimage
 proximitywake        1
 powernap             0
 networkoversleep     0
 disksleep            10
 standbydelayhigh     86400
 sleep                1 (sleep prevented by apsd, apsd, nsurlsessiond, mds, sharingd, useractivityd, bluetoothd)
 autopoweroffdelay    259200
 hibernatemode        0
 autopoweroff         0
 ttyskeepawake        1
 displaysleep         10
 highstandbythreshold 50
 standbydelaylow      86400
vulgo commented 2 years ago

Thanks for the details. Again I suggest backing up your EFI partition. Maybe try the iMac18,2 system definition (and generate the serials) and use the Iris Pro iGPU device properties from comment 2. If you still get failure during wake revert to previous iMac16,2 EFI and please provide an IORegistry Explorer document from the iMac16,2 OS.

Also it's probably not an issue but what PSU is powering things?

vulgo commented 2 years ago

@ants83 any updates re: kernel panics when waking from sleep?

ants83 commented 2 years ago

@ants83 any updates re: kernel panics when waking from sleep?

@vulgo unfortunately I haven't been able to try your proposed solution for lack of time. I will try a fresh installation of macOS 12 on another drive and use a fresh iMac18,2 system definition.

The PSU is a 350 Enermax Thriatlor Eco. By disabling automatic sleep, the system has been up and running for 15 days straight without any issue. Before this period I tried manual sleep and got a panic.

vulgo commented 2 years ago

@ants83 i compiled the SSDT-SBUS-MCHC and added to config.plist, you will find on the main branch. Seeing as PCI devices seem to be disappearing and said drivers are supposed to control PCI power states it probably makes sense to have them loaded, not sure if you already did this.

Thanks for confirming PSU, re: firmware power management settings ErP and Platform Power Management can be disabled, i believe that is the default.

If you have time feel free to attach more complete logs (from boot to power state failure plus panic report for each panic) and if possible an IORegistry Explorer 2.1 document for each system definition used.

One can erase the pmset logs with

sudo rm /var/log/powermanagement/*"

Please reset NVRAM from OpenCore if switching system definitions.

vulgo commented 2 years ago

@ants83 it might be useful to me to look at your current IORegistry in any case and see if i can update the intel graphics readme, it's not a priority.

ants83 commented 2 years ago

@vulgo which parts of the IORegistry are needed? Since in the IORegistry dump there are also sensible data (i.e. system serial number, user names) I would like to provide only necessary data for debug.

vulgo commented 2 years ago

I do appreciate your concerns. Maybe i'm wrong but i don't think i uploaded a copy of my ioregistrys anywhere either. I'm interested in machine PM profile, power management logs, integrated logging logs, untested (by me) weg gpu device properties, AMD gpu, anything really. 2.1 registry explorer document would be convenient but its entirely up to you what you share and how, unless its with Apple in which case they probably know everything already. No joke.

vulgo commented 2 years ago

I think with OpenCore on USB and macOS installed to a separate APFS volume skipping Apple ID creation you could probably clean things up somewhat, and take a look at OnionShare.

ants83 commented 2 years ago

I think with OpenCore on USB and macOS installed to a separate APFS volume skipping Apple ID creation you could probably clean things up somewhat, and take a look at OnionShare.

This is what I'll do. I'll start with a new, disposable 16,2 iMac system definition and provide IORegistryExplorer 2.1 dump. After I'll use a 18,2 system definition and do the same.

vulgo commented 2 years ago

Thank you @ants83 having gone to that trouble, please do a quick

pmset -g log > $HOME/Desktop/pmlog.txt

after any panic.

Erase the log:

sudo rm /var/log/powermanagement/*"

Thanks again.

ants83 commented 2 years ago

@vulgo I made a fresh macOS install on another drive. No luck with the iMac18,2 system definition. The system freezes (blank screen) as soon as I hit a keyboard button to awake the machine. Here are two pmset logs after two distinct freezes and hard resets.

pmlog_imac18_2.txt pmlog2_imac18_2.txt

You can find a IORegistryExplorer 2.1 dump here:

http://removed.onion

The link will be deleted after the first download.

Please @vulgo, let me know if you need further debug data before I switch to the iMac16,2 definition.

vulgo commented 2 years ago

@ants83 thanks for the logs and link. The pmset logs show a similar fault to before. The onion link is down as of now, please can you re-upload - i was staying with friends for a few days and don't have tor access on my phone.

Also power state transistions are working in other OS as expected?

Of course can use 16,2 if you prefer or 18,2 causes other problems.

ants83 commented 2 years ago

@vulgo new link here (no key required):

http://removed.onion

I have no other OS installed on this machine. Both SSDs are currently used for macOS.

vulgo commented 2 years ago

@ant83 thanks i have the IOReg. If you think its worth checking PCI devices are being properly standby powered in S5 maybe a live USB? Another hardware possibility is something on the bus e.g. wireless card. Anyway I'll take a look at the document and get back.

ants83 commented 2 years ago

I have a Broadcom BCM94360CS2 Airport Card installed in the mini PCI-Express slot through an adapter. It works out of the box.

I could try a Linux live USB distribution, if necessary.

vulgo commented 2 years ago

@ants83 to be honest if it was a hardware problem i'd expect to see a difference in the power log. I will take some time to look at the document but i saw your loaded USBPorts.kext has 17 ports as in one in the repo. Which is fine for booting and installing but is a possible cause for wake issues. Please refer to README-usbtool.command.md.

Each USBPorts.kext is specific to the system definition. usbtool.command is supposed to be easy, you might need to right click (or ⌥ click) and open depending on your security policy, but disabling any 2 or more ports should do, some possibilities

You can use Hackintool if you prefer, the kext it generates should be compatible without config.plist edits at least.

ants83 commented 2 years ago

@vulgo sorry, I hadn't replaced the default USBPorts.kext with the one I typically use in my main volume installation, which has 15 ports. I'll replace the USBPorts.kext in the test volume, retry sleep and re-send logs/ioreg, still keeping iMac18,2 definition.

vulgo commented 2 years ago

@ants83 for testing any merged port map can be quickly revealed with

echo $(ioreg -rc AppleUSBXHCILPTHB -k 'ports' | grep '"ports" = {' | tr -d '[:space:]|/|')
vulgo commented 2 years ago

@ants83 also please try with the WEG device properties for Broadwell in README-Intel-Graphics.md and/or with the iGPU disabled in firmware settings. The WEG properties in comment 2 don't seem to be helping, i will look into it.

ants83 commented 2 years ago

@vulgo replaced USBPorts.kext with this one:

USBPorts.kext.zip

No luck:

pmlog3_imac18_2.txt

Now I am switching to iMac16,2 sys def to make further trials.

ants83 commented 2 years ago

Meanwhile, during successive reboots and freezes, my BIOS is still randomly losing settings. When this happens, I have to restore recommended settings. My previous F9b ROM was also rewritten to stock F7 by DualBios.

ants83 commented 2 years ago

@vulgo With the iMac16,2 system definition, having disabled iGPU in BIOS and using these settings:

...
<key>DeviceProperties</key>
<dict>
    <key>Add</key>
    <dict>
        ...
        <key>PciRoot(0x0)/Pci(0x2,0x0)</key>
        <dict>
            <key>AAPL,ig-platform-id</key>
            <data>BAASBA==</data>
        </dict>
        ...
    </dict>
</dict>
...

I have been able to put into sleep and awake the machine a couple of times in a row.

See pmlog:

pmlog_imac16_2_igpu_bios_off.txt

and ioreg dump:

http://removed.onion

vulgo commented 2 years ago

@ants83 16,2 with iGPU disabled is probably a good bet. Some bits taken from the WEG manual that may be of use

Force AMD AppleGVA decoder setting

defaults write com.apple.AppleGVA forceATI -boolean yes

Reset AppleGVA decoder setting

defaults delete com.apple.AppleGVA forceATI

Stop AppleVPA from trying to use iGPU, in config.plist

...
    <key>NVRAM</key>
    <dict>
        <key>Add</key>
        <dict>
            ...
            <key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
            <dict>
                ...
                <key>boot-args</key>
                <string>keepsyms=1 shikigva=32 shiki-id=Mac-7BA5B2D9E42DDD94</string>
                ...
            </dict>
        </dict>
        ...
    </dict>
...

Reset NVRAM from OpenCore after making changes to config.plist or changing system definition, please let me know how it goes over time. Hopefully the dual BIOS will settle again...

ants83 commented 2 years ago

@vulgo I left the machine sleeping all night. Unfortunately as soon as I hit a keyboard button to awake, the system restarted (not freezing).

See pmlog:

pmlog_imac16_2_igpu_bios_off_2.txt

One difference, if relevant, with the successful sleep/wake cases yesterday is that the monitor had gone off during night.

vulgo commented 2 years ago

@ants83 from here it looks like the log attachment has failed, please confirm and edit the comment, thanks.

vulgo commented 2 years ago

Thank you @ants83, please attach ~/Desktop/powerd.log zipped

log show -start '2022-05-05 00:46:31' -predicate 'process == "powerd"' -style compact > ~/Desktop/powerd.log

Output from pmset -g

Another ioregistry document if you have time. Thanks.

ants83 commented 2 years ago

Output from pmset -g:

System-wide power settings:
Currently in use:
 standby              1
 Sleep On Power Button 1
 womp                 1
 hibernatefile        /var/vm/sleepimage
 proximitywake        1
 powernap             0
 networkoversleep     0
 disksleep            10
 standbydelayhigh     86400
 sleep                0
 autopoweroffdelay    259200
 hibernatemode        0
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         10
 highstandbythreshold 50
 standbydelaylow      86400

~/Desktop/powerd.log zipped:

powerd.log.zip

vulgo commented 2 years ago

@ants83 try with

sudo pmset -a proximitywake 0

the rest of the settings look agreeable. Try disabling WOMP in Engergy Saver preferences.

I attach some CPUFriend kexts, config.plist edits and .plist source.

Only make sure the order in Kernel->Add is Lilu.kext and CPUFriendDataProvider.kext before CPUFriend.kext

The changes are

      <key>ProximityWake</key>
      <integer>0</integer>

and

<key>DarkWakeServices</key>
    <dict>
        <key>DarkWakeBackgroundTasks</key>
        <integer>0</integer>
        <key>SleepServices</key>
        <integer>0</integer>
        ...

cpu-friend.zip

You can reset pm override settings with

sudo rm /Library/Preferences/PowerManagement*.plist

Then use pmset or the settings app to match your previous ones.

vulgo commented 2 years ago

I keep seeing EHC1 and EHC2 in logs, i think with XHC set to enabled these should not be present in the device tree or ACPICA messages, unless it is a feature of the F7 BIOS.

Maybe try Win-Raid Forum with the loss of settings and dual BIOS issues, i don't really have a clue what's going on.

vulgo commented 2 years ago

@ants83 did you continue with the 18,2 installation and just change the sysdef or is it a fresh (or always 16,2) installation?

ants83 commented 2 years ago

@ants83 try with

sudo pmset -a proximitywake 0

the rest of the settings look agreeable.

I attach some CPUFriend kexts, config.plist edits and .plist source.

Only make sure the order in Kernel->Add is Lilu.kext and CPUFriendDataProvider.kext before CPUFriend.kext

The changes are

      <key>ProximityWake</key>
      <integer>0</integer>

and

<key>DarkWakeServices</key>
    <dict>
        <key>DarkWakeBackgroundTasks</key>
        <integer>0</integer>
        <key>SleepServices</key>
        <integer>0</integer>
        ...

cpu-friend.zip

You can reset pm override settings with

sudo rm /Library/Preferences/PowerManagement*.plist

Then use pmset or the settings app to match your previous ones.

@vulgo settings applied. Up to now it seems to work. I'll test for a longer period and report back.

pmlog.txt

ants83 commented 2 years ago

@ants83 did you continue with the 18,2 installation and just change the sysdef or is it a fresh (or always 16,2) installation?

@vulgo I am using the same fresh installation used with sysdef 18,2 but with sysdef 16,2 now.

ants83 commented 2 years ago

@vulgo after two days of sleep and wakes without any problem, tonight the pc freezed after a couple of minutes after wake, as soon as I started playing a YouTube video.

These settings are active in config.plist:

...
    <key>NVRAM</key>
    <dict>
        <key>Add</key>
        <dict>
            ...
            <key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
            <dict>
                ...
                <key>boot-args</key>
                <string>keepsyms=1 shikigva=32 shiki-id=Mac-7BA5B2D9E42DDD94</string>
                ...
            </dict>
        </dict>
        ...
    </dict>
...

and also:

defaults write com.apple.AppleGVA forceATI -boolean yes
vulgo commented 2 years ago

@ants83 maybe shikigva=40

...
    <key>NVRAM</key>
    <dict>
        <key>Add</key>
        <dict>
            ...
            <key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
            <dict>
                ...
                <key>boot-args</key>
                <string>keepsyms=1 shikigva=40 shiki-id=Mac-7BA5B2D9E42DDD94</string>
                ...
            </dict>
        </dict>
        ...
    </dict>
...

reseting NVRAM

vulgo commented 2 years ago

If you keep having what sounds like GPU related issues please open another issue, try and provide a log

e.g. start some time before the freeze

log show -start 'Y-M-D H:m:s' -style compact > ~/Desktop/freeze.log

you could also specify the -end 'Y-M-D H:m:s' option if you have a power off time

e.g. or last 5 minutes

log show -last 5m -style compact > ~/Desktop/freeze.log

With a text editor, delete from after the point of any reboot, delete messages a long time before the freeze, or from before last sleep/wake if you think its relevant. Zip it if it's a large file. Thanks.

@ants83 as an alternative to the shiki arguments and forceATI = yes see also if, with the power management settings in place, you can enable the iGPU in firmware settings without reintroducing wake problems.

As you have nothing connected to the DVI or HDMI ports on the motherboard the ig-platform-id in config.plist might be enough to have the IntelAccelerator loading, check in IORegistry Explorer.

Also do try Win Raid for input on the BIOS problems.

ants83 commented 2 years ago

The changes are

      <key>ProximityWake</key>
      <integer>0</integer>

and

<key>DarkWakeServices</key>
    <dict>
        <key>DarkWakeBackgroundTasks</key>
        <integer>0</integer>
        <key>SleepServices</key>
        <integer>0</integer>
        ...

cpu-friend.zip

You can reset pm override settings with

sudo rm /Library/Preferences/PowerManagement*.plist

Then use pmset or the settings app to match your previous ones.

@vulgo unfortunately re-enabling iGPU in BIOS causes sleep/wake freezes. Anyway, perhaps I am missing something. I see that the above mentioned changes are included in the attached Mac-FFE5EF870D7BA81A.plist. Do I need to manually replace the corresponding one in X86PlatformPlugin.kext or are the changes injected by CPUFriend?

vulgo commented 2 years ago

Hello @ants83.

unfortunately re-enabling iGPU in BIOS causes sleep/wake freezes

OK leave it disabled

I see that the above mentioned changes are included in the attached Mac-FFE5EF870D7BA81A.plist

This is for source documentary purposes only, you can't replace the files in X86PlatformPlugin.kext as the file system is immutable

are the changes injected by CPUFriend?

The entire Mac-FFE5EF870D7BA81A.plist with changes are injected by CPUFriendDataProvider.kext and X86PlatformPlugin.kext is patched by CPUFriend.kext. Please ignore the CPUFriendDataProvider.kext in 16,2-Default directory, that shouldn't be there. The kexts you want are in EFI/OC/Kexts

From CPUFriend instructions:

Usage of ResourceConverter.sh

--kext /path/to/file Create CPUFriendDataProvider.kext with information provided by file.

--acpi /path/to/file Create ssdt_data.dsl with information provided by file.

We don't use --acpi method as it conflicts with SSDT-PLUG, --kext argument takes a complete property list such as Mac-FFE5EF870D7BA81A.plist in the 16,2-custom directory and generates the codeless CPUFriendDataProvider.kext

ants83 commented 2 years ago

@vulgo after two days of sleep and wakes without any problem, tonight the pc freezed after a couple of minutes after wake, as soon as I started playing a YouTube video.

@vulgo same behavior experienced again. It seems the freezes are still related to power management:

pmlog.txt

panic.log

vulgo commented 2 years ago

@ant83 please send ioregistry document and logs as in this comment issuecomment-1121932661. Also please confirm XHC is set to enabled in firmware settings. HECI is the management engine, it is renamed to IMEI by Whatevergreen. As far as I know there is no device on RP01.

What we need is working connectorless Iris Pro for a driver for Macs that only used it for graphics output and never with a discrete GPU. And IMEI driver loaded.

ants83 commented 2 years ago

@vulgo ioregistry and freeze log around the minute 2022-05-12 22:37:43:

http://removed.onion

I confirm XHC is set to enabled.

vulgo commented 2 years ago

OK, ACPI is saying EHC* wake reason etc. but in IORegistry there is no EHC loaded.

If you disable the iGPU in BIOS you probably require the shiki WEG boot arguments otherwise apps will try decoding the with iGPU and other things will go wrong. This may also be the cause of the IMEI wake failure as a mac with an iGPU expects AppleIMEI to be loaded.

When I said enable the iGPU as an alternative I meant these as part of the enable/disable process.

More Information

Currently i believe iMacPro1,1 is the preferred model without an iGPU to spoof (Mac-7BA5B2D9E42DDD94) with shiki-id

See FAQ and search for examples of shiki-gva, charts, DRM functionality etc.

You can test different values with

sudo nvram boot-args='keepsyms=1 shiki-gva=* shiki-id=*'

If something works add it to config.plist and reset NVRAM.

I think F7 BIOS is bad, i know you there are problems but try to fix these and upgrade it. Unfortunately such things are out-of-scope here.

vulgo commented 2 years ago

@ants83 i have two mutually-exclusive suggestions

ants83 commented 2 years ago

If you disable the iGPU in BIOS you probably require the shiki WEG boot arguments otherwise apps will try decoding the with IGPU. This may be the cause of the IMEI wake failure.

@vulgo I see that in the WEG boot arguments now you have shiki-id=Mac-7BA5B2D9E42DDD94, which corresponds to a iMacPro1,1 SMBIOS. Do I need to also generate a corresponding serial?

vulgo commented 2 years ago

@ants boot arguments from your most recent IOReg

keepsyms=1 swd_panic=1

No corresponding serial required, WEG just patches the AppleGVA and AppleVPA processes