Contribute
Register

[FIX] Coffee Lake Intel UHD Graphics 630 on macOS Mojave: Kernel panic due to divide-by-zero

Joined
Apr 9, 2015
Messages
59
Motherboard
OS X 10.10.3
CPU
i7-4790K
Graphics
GTX970
Mac
Classic Mac
Mobile Phone
So I think some of you may experience the same issue with me when trying to make the UHD630 work on your laptop with 4K display.

You may find that a kernel panic happens after the gIOConsoleUser line, due to division by zero.

The kernel panic report may look like this.

Code:
Anonymous UUID: A6C52317-1B2D-E00D-241C-DBCE7C091990

Sat Sep 29 13:17:09 2018

*** Panic Report ***
panic(cpu 8 caller 0xffffff80004d781d): Kernel trap at 0xffffff7f837537d0, type 0=divide error, registers:
CR0: 0x0000000080010033, CR2: 0xffffff81f645e000, CR3: 0x00000004512ce05c, CR4: 0x00000000003626e0
RAX: 0x017d68fdc0000000, RBX: 0x017d68fdc0000000, RCX: 0x0100000100000000, RDX: 0x0000000000000000
RSP: 0xffffff81e8ba3540, RBP: 0xffffff81e8ba3570, RSI: 0xffffff81e8ba3388, RDI: 0xffffff81c816c000
R8: 0x00000003169e9807, R9: 0x0000000000000000, R10: 0xffffff81c8178d00, R11: 0x0000000000000000
R12: 0x000000001fc8bfd0, R13: 0x0000000000000000, R14: 0xffffff81e8ba3588, R15: 0x0000000009a7ec80
RFL: 0x0000000000010246, RIP: 0xffffff7f837537d0, CS: 0x0000000000000008, SS: 0x0000000000000010
Fault CR2: 0xffffff81f645e000, Error code: 0x0000000000000000, Fault CPU: 0x8, PL: 0, VF: 0

Backtrace (CPU 8), Frame : Return Address
0xffffff81e8ba3010 : 0xffffff80003aba9d
0xffffff81e8ba3060 : 0xffffff80004e5bd3
0xffffff81e8ba30a0 : 0xffffff80004d75fa
0xffffff81e8ba3110 : 0xffffff8000358ca0
0xffffff81e8ba3130 : 0xffffff80003ab4b7
0xffffff81e8ba3250 : 0xffffff80003ab303
0xffffff81e8ba32c0 : 0xffffff80004d781d
0xffffff81e8ba3430 : 0xffffff8000358ca0
0xffffff81e8ba3450 : 0xffffff7f837537d0
0xffffff81e8ba3570 : 0xffffff7f837514bb
0xffffff81e8ba3990 : 0xffffff7f837296e5
0xffffff81e8ba3a00 : 0xffffff7f814dd7c6
0xffffff81e8ba3a40 : 0xffffff7f814dd67b
0xffffff81e8ba3a90 : 0xffffff8000a83f68
0xffffff81e8ba3ae0 : 0xffffff7f814e3c79
0xffffff81e8ba3b30 : 0xffffff8000a8d3ef
0xffffff81e8ba3c70 : 0xffffff8000492234
0xffffff81e8ba3d80 : 0xffffff80003b118d
0xffffff81e8ba3dd0 : 0xffffff800038bb45
0xffffff81e8ba3e50 : 0xffffff80003a04fe
0xffffff81e8ba3ef0 : 0xffffff80004bed4b
0xffffff81e8ba3fa0 : 0xffffff8000359486
   Kernel Extensions in backtrace:
       com.apple.iokit.IOGraphicsFamily(530.9)@0xffffff7f814c1000->0xffffff7f8150bfff
           dependency: com.apple.iokit.IOPCIFamily(2.9)@0xffffff7f80c95000
       com.apple.driver.AppleIntelCFLGraphicsFramebuffer(12.0.2)@0xffffff7f83711000->0xffffff7f83912fff
           dependency: com.apple.iokit.IOPCIFamily(2.9)@0xffffff7f80c95000
           dependency: com.apple.iokit.IOACPIFamily(1.4)@0xffffff7f80d10000
           dependency: com.apple.iokit.IOAcceleratorFamily2(400.25)@0xffffff7f82ef0000
           dependency: com.apple.iokit.IOReportFamily(47)@0xffffff7f80ddb000
           dependency: com.apple.AppleGraphicsDeviceControl(3.22.18)@0xffffff7f817d8000
           dependency: com.apple.iokit.IOGraphicsFamily(530.9)@0xffffff7f814c1000

You may see an example in this thread: https://www.tonymacx86.com/threads/uhd-630-either-not-booting-or-no-acceleration.261101/

So I dug it up a little bit and found that the number of lanes cannot be detected correctly on my laptop.

>> Update on Nov 11th, 2018:

I have found that the kernel panic happens because the built-in display does not report a valid link rate value.


This might be a common issue on laptops with Coffee Lake UHD630 and builtin 4K display.

If you want to know the theory behind this issue, here is the NEW long story.

Coffee Lake Intel UHD Graphics 630 on macOS Mojave: A nearly ultimate solution to the kernel panic due to division by zero in the framebuffer driver

The below is the previous long story, but you might also need it to know the background.
Coffee Lake Intel UHD Graphics 630 on macOS Mojave: A compromise solution to the kernel panic due to division by zero in the framebuffer driver

>> Update on April 9, 2019:

I have implemented the fix in WhateverGreen, so all binary patches are now deprecated.

Please remove any previous binary patches (Set the number of active lanes, Set the maximum link rate V1, V2, ALT, etc.) from your config.plist and install the latest WhateverGreen (>=1.2.8).

You could enable the fix by adding `-igfxmlr` to the boot arguments.

The default link rate is 0x14 which is for 4K laptop display.

You could specify a custom value via the `dpcd-max-link-rate` property.

Detailed usage could be found in the manual.

In short, you can fix this issue by applying the following patch.

Note that these two patches are mutually exclusive.

Supported OS: macOS 10.14, 10.14.1, 10.14.2

(Text)
Code:
Info: Set the maximum link rate in DPCD buffer to 0x14 (HBR2) for laptops with 4K display (by FireWolf)
Name: AppleIntelCFLGraphicsFramebuffer
Find: E8 00 00 00 00 48 83 C3 04 48 83 FB 08 72 D0
Repl: 41 83 BC 24 DC 01 00 00 00 75 04 C6 45 C1 14
Code:
Info: Set the maximum link rate in DPCD buffer to 0x0A (HBR) for laptops with 1080p or below display (by FireWolf)
Name: AppleIntelCFLGraphicsFramebuffer
Find: E8 00 00 00 00 48 83 C3 04 48 83 FB 08 72 D0
Repl: 41 83 BC 24 DC 01 00 00 00 75 04 C6 45 C1 0A
In case you still get kernel panic after applying the above patch, try to use this one.
(This issue might be related to the framebuffer port and I will investigate it when I am free.)
(Again, replace the last byte 0x14 with 0x0A if you need lower link rate.)

Code:
Info: ALT: Set the maximum link rate in DPCD buffer to 0x14 (HBR2) for laptops with 4K display (by FireWolf)
Name: AppleIntelCFLGraphicsFramebuffer
Find: 4883C304 4883FB08 72D0
Repl: 807DC100 7504C645 C114
(Plist)
Code:
<key>KextsToPatch</key>
<array>
    <dict>
        <key>Comment</key>
        <string>Set the maximum link rate in DPCD buffer to 0x14 (HBR2) for laptops with 4K display (by FireWolf)</string>
        <key>Disabled</key>
        <false/>
        <key>Find</key>
        <data>
        6AAAAABIg8MESIP7CHLQ
        </data>
        <key>InfoPlistPatch</key>
        <false/>
        <key>Name</key>
        <string>AppleIntelCFLGraphicsFramebuffer</string>
        <key>Replace</key>
        <data>
        QYO8JNwBAAAAdQTGRcEU
        </data>
    </dict>
    <dict>
        <key>Comment</key>
        <string>Set the maximum link rate in DPCD buffer to 0x0A (HBR) for laptops with 1080p or below display (by FireWolf)</string>
        <key>Disabled</key>
        <false/>
        <key>Find</key>
        <data>
        6AAAAABIg8MESIP7CHLQ
        </data>
        <key>InfoPlistPatch</key>
        <false/>
        <key>Name</key>
        <string>AppleIntelCFLGraphicsFramebuffer</string>
        <key>Replace</key>
        <data>
        QYO8JNwBAAAAdQTGRcEK
        </data>
    </dict>
</array>

Wish you good luck!
- FireWolf (Austere.J)
 
Last edited:

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,692
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
So I think some of you may experience the same issue with me when trying to make the UHD630 work on your laptop with 4K display.

You may find that a kernel panic happens after the gIOConsoleUser line, due to division by zero.

The kernel panic report may look like this.

Code:
Anonymous UUID: A6C52317-1B2D-E00D-241C-DBCE7C091990

Sat Sep 29 13:17:09 2018

*** Panic Report ***
panic(cpu 8 caller 0xffffff80004d781d): Kernel trap at 0xffffff7f837537d0, type 0=divide error, registers:
CR0: 0x0000000080010033, CR2: 0xffffff81f645e000, CR3: 0x00000004512ce05c, CR4: 0x00000000003626e0
RAX: 0x017d68fdc0000000, RBX: 0x017d68fdc0000000, RCX: 0x0100000100000000, RDX: 0x0000000000000000
RSP: 0xffffff81e8ba3540, RBP: 0xffffff81e8ba3570, RSI: 0xffffff81e8ba3388, RDI: 0xffffff81c816c000
R8: 0x00000003169e9807, R9: 0x0000000000000000, R10: 0xffffff81c8178d00, R11: 0x0000000000000000
R12: 0x000000001fc8bfd0, R13: 0x0000000000000000, R14: 0xffffff81e8ba3588, R15: 0x0000000009a7ec80
RFL: 0x0000000000010246, RIP: 0xffffff7f837537d0, CS: 0x0000000000000008, SS: 0x0000000000000010
Fault CR2: 0xffffff81f645e000, Error code: 0x0000000000000000, Fault CPU: 0x8, PL: 0, VF: 0

Backtrace (CPU 8), Frame : Return Address
0xffffff81e8ba3010 : 0xffffff80003aba9d
0xffffff81e8ba3060 : 0xffffff80004e5bd3
0xffffff81e8ba30a0 : 0xffffff80004d75fa
0xffffff81e8ba3110 : 0xffffff8000358ca0
0xffffff81e8ba3130 : 0xffffff80003ab4b7
0xffffff81e8ba3250 : 0xffffff80003ab303
0xffffff81e8ba32c0 : 0xffffff80004d781d
0xffffff81e8ba3430 : 0xffffff8000358ca0
0xffffff81e8ba3450 : 0xffffff7f837537d0
0xffffff81e8ba3570 : 0xffffff7f837514bb
0xffffff81e8ba3990 : 0xffffff7f837296e5
0xffffff81e8ba3a00 : 0xffffff7f814dd7c6
0xffffff81e8ba3a40 : 0xffffff7f814dd67b
0xffffff81e8ba3a90 : 0xffffff8000a83f68
0xffffff81e8ba3ae0 : 0xffffff7f814e3c79
0xffffff81e8ba3b30 : 0xffffff8000a8d3ef
0xffffff81e8ba3c70 : 0xffffff8000492234
0xffffff81e8ba3d80 : 0xffffff80003b118d
0xffffff81e8ba3dd0 : 0xffffff800038bb45
0xffffff81e8ba3e50 : 0xffffff80003a04fe
0xffffff81e8ba3ef0 : 0xffffff80004bed4b
0xffffff81e8ba3fa0 : 0xffffff8000359486
   Kernel Extensions in backtrace:
       com.apple.iokit.IOGraphicsFamily(530.9)@0xffffff7f814c1000->0xffffff7f8150bfff
           dependency: com.apple.iokit.IOPCIFamily(2.9)@0xffffff7f80c95000
       com.apple.driver.AppleIntelCFLGraphicsFramebuffer(12.0.2)@0xffffff7f83711000->0xffffff7f83912fff
           dependency: com.apple.iokit.IOPCIFamily(2.9)@0xffffff7f80c95000
           dependency: com.apple.iokit.IOACPIFamily(1.4)@0xffffff7f80d10000
           dependency: com.apple.iokit.IOAcceleratorFamily2(400.25)@0xffffff7f82ef0000
           dependency: com.apple.iokit.IOReportFamily(47)@0xffffff7f80ddb000
           dependency: com.apple.AppleGraphicsDeviceControl(3.22.18)@0xffffff7f817d8000
           dependency: com.apple.iokit.IOGraphicsFamily(530.9)@0xffffff7f814c1000
You may see an example in this thread: https://www.tonymacx86.com/threads/uhd-630-either-not-booting-or-no-acceleration.261101/

So I dug it up a little bit and found that the number of lanes cannot be detected correctly on my laptop.

This might be a common issue on laptops with Coffee Lake UHD630 and builtin 4K display.

If you want to read the long story, please take a look at my blog post.
Coffee Lake Intel UHD Graphics 630 on macOS Mojave: A compromise solution to the kernel panic due to division by zero in the framebuffer driver

In short, you can fix this issue by applying the following patch.


Note that these two patches are mutually exclusive.
And I really don't think those who have a laptop with 1080p display would have this issue.
Anyway, please leave some comments if you have similar issue.

(Text)
Code:
Comment: Set the number of active lanes to 4 (for laptop with 4K display) (by FireWolf)
Find: 55 48 89 E5 48 FF 05 BD 4A 07 00 8B 96 C0 25 00 00 8A 8E
Repl: 55 48 89 E5 B8 04 00 00 00 89 86 BC 25 00 00 31 C0 5D C3
Code:
Comment: Set the number of active lanes to 2 (for laptop with 1080p or below display) (by FireWolf)
Find: 55 48 89 E5 48 FF 05 BD 4A 07 00 8B 96 C0 25 00 00 8A 8E
Repl: 55 48 89 E5 B8 02 00 00 00 89 86 BC 25 00 00 31 C0 5D C3
(Plist)
Code:
<key>KextsToPatch</key>
       <array>
           <dict>
               <key>Comment</key>
               <string>Set the number of active lanes to 4 (for laptop with 4K display) (by FireWolf)</string>
               <key>Disabled</key>
               <false/>
               <key>Find</key>
               <data>
               VUiJ5Uj/Bb1KBwCLlsAlAACKjg==
               </data>
               <key>InfoPlistPatch</key>
               <false/>
               <key>MatchOS</key>
               <string>10.14</string>
               <key>Name</key>
               <string>AppleIntelCFLGraphicsFramebuffer</string>
               <key>Replace</key>
               <data>
               VUiJ5bgEAAAAiYa8JQAAMcBdww==
               </data>
           </dict>
           <dict>
               <key>Comment</key>
               <string>Set the number of active lanes to 4 (for laptop with 1080p or below display) (by FireWolf)</string>
               <key>Disabled</key>
               <false/>
               <key>Find</key>
               <data>
               VUiJ5Uj/Bb1KBwCLlsAlAACKjg==
               </data>
               <key>InfoPlistPatch</key>
               <false/>
               <key>MatchOS</key>
               <string>10.14</string>
               <key>Name</key>
               <string>AppleIntelCFLGraphicsFramebuffer</string>
               <key>Replace</key>
               <data>
               VUiJ5bgCAAAAiYa8JQAAMcBdww==
               </data>
           </dict>
       </array>
Wish you good luck!
- FireWolf (Austere.J)
Seems like an opportunity to add yet another patch/feature to WhateverGreen.kext.
 
Joined
Aug 13, 2013
Messages
22
Motherboard
MSI GL62M 7REX-1650 (Clover)
CPU
Core i7 7700HQ + HM175 Chipset
Graphics
nVidia GT1050Ti + Intel HD630 (1920 x 1680)
Mac
MacBook Pro
Mobile Phone
Android
I have HD630 (not UHD630)nearly same problem with you,but got black screen when boot into system with ig-platform-id 0x00001b59,could you help me solve these problem!
 
Joined
Jun 25, 2018
Messages
9
Motherboard
Dell XPS 15 9370 FHD
CPU
i5 8300h
Graphics
UHD 630 / GTX 1050 MaxQ
Thanks for sharing this. Just a heads up, the 10.14 1080p plist example doesn't match up with the find and replace values beforehand.

Unfortunately this doesn't fix a similar issue on the XPS 9350 where the system reboots immediately after verbose logging (no kernel panic visible).
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,692
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Thanks for sharing this. Just a heads up, the 10.14 1080p plist example doesn't match up with the find and replace values beforehand.

Unfortunately this doesn't fix a similar issue on the XPS 9350 where the system reboots immediately after verbose logging (no kernel panic visible).
No "Problem Reporting" files attached.
Read FAQ, "Problem Reporting" again. Carefully. Attach all requested files/output.
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/
Use the gen_debug.sh tool mentioned in the FAQ, that way it is less likely you'll omit something.

Please also fill out your profile as per FAQ (your profile is missing screen resolution).
 
Joined
Jun 25, 2018
Messages
9
Motherboard
Dell XPS 15 9370 FHD
CPU
i5 8300h
Graphics
UHD 630 / GTX 1050 MaxQ
Top