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

Thunderbolt 3 Hotplug #24

Closed
tylernguyen opened this issue Dec 21, 2019 · 131 comments
Closed

Thunderbolt 3 Hotplug #24

tylernguyen opened this issue Dec 21, 2019 · 131 comments
Labels
I/O USB, SD Card Reader, and/or Thunderbolt Issues

Comments

@tylernguyen
Copy link
Owner

tylernguyen commented Dec 21, 2019

EDIT 11/17/2020:

Thunderbolt 3 Hotplug is works on both ports and is natively detected within System Report by macOS. USB 3.1 Gen2 Hotplug is still work in progress.

Reminder that this should work without a modded BIOS. The only necessary BIOS settings are detailed in https://github.com/tylernguyen/x1c6-hackintosh/blob/master/docs/1_README-HARDWAREandBIOS.md

If you have previous messed with TB3 related settings within the custom firmware, please BIOS + NVRAM reset to revert things back to default. Remember that the Advance Menu can be quite buggy so multiple resets and checks maybe required to make sure things are properly reverted to stock.

Thunderbolt 3 can involve many edges cases and different hardware that I cannot test or do not have the hardware to so please contribute if you experience/fix a problem.

Lastly, all this progress would not have been possible without the hard work of @benbender so thank you!

@velaar
Copy link

velaar commented Jan 10, 2020

Thunderbolt SSDT does not work with OC. (Only with clover)

On OC is causes an immediate freeze once you plug in the device (even if you boot with the device plugged in)

Here is the debug 100 from it (don't see any useful info, just in case) :

panic(cpu 0 caller 0xffffff800526520a): Kernel trap at 0xffffff8005277abf, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x00007fff477ce412, CR3: 0x0000000011a45000, CR4: 0x00000000003626e0
RAX: 0x000000007e008003, RBX: 0xffffff8005a0cec0, RCX: 0x00000000000000e2, RDX: 0x0000000000000000
RSP: 0xffffff81fa6a3ef0, RBP: 0xffffff81fa6a3f20, RSI: 0x000000007e008000, RDI: 0x000000007e008003
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000000000000000, R11: 0x0000000000000000
R12: 0xffffff8005a0cec0, R13: 0x000000000cb37863, R14: 0x00000004852078c6, R15: 0x0000000000000000
RFL: 0x0000000000010046, RIP: 0xffffff8005277abf, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0x00007fff477ce412, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 1, VF: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff8004f51220 : 0xffffff800513bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff8004f51270 : 0xffffff80052733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff8004f512b0 : 0xffffff8005264e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff8004f51300 : 0xffffff80050e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff8004f51320 : 0xffffff800513b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff8004f51420 : 0xffffff800513b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff8004f51470 : 0xffffff80058d24f9 mach_kernel : _panic + 0x61
0xffffff8004f514e0 : 0xffffff800526520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff8004f51660 : 0xffffff8005264f08 mach_kernel : _kernel_trap + 0x598
0xffffff8004f516b0 : 0xffffff80050e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff8004f516d0 : 0xffffff8005277abf mach_kernel : _xcpm_idle + 0x37f
0xffffff81fa6a3f20 : 0xffffff8005266e7a mach_kernel : _machine_idle + 0x1da
0xffffff81fa6a3f40 : 0xffffff80051609b7 mach_kernel : _processor_idle + 0xf7
0xffffff81fa6a3f80 : 0xffffff8005160b78 mach_kernel : _idle_thread + 0x48
0xffffff81fa6a3fa0 : 0xffffff80050e213e mach_kernel : _call_continuation + 0x2e

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x100 

Mac OS version:
19C57

Kernel version:
Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Kernel UUID: C3E7E405-C692-356B-88D3-C30041FD1E72
Kernel slide:     0x0000000004e00000
Kernel text base: 0xffffff8005000000
__HIB  text base: 0xffffff8004f00000
System model name: MacBookPro14,1 (Mac-B4831CEBD52A0C4C)
System shutdown begun: NO
Panic diags file available: YES (0x0)

System uptime in nanoseconds: 19414137417


@Colton-Ko
Copy link

I realized that Thunderbolt 3 controller firmware version could also affect the functionality. @velaar I suggest you may try updating the thunderbolt 3 controller firmware on Windows.

@tylernguyen
Copy link
Owner Author

@velaar

@Colton-Ko 's TB3 hotpatch is working for me under OpenCore. Does it work for you after updating the firmware under windows?

@velaar
Copy link

velaar commented Jan 19, 2020

@tylernguyen
This makes me wonder is the issue is not with the TBT but with the device itself. I have NVM41 firmware and I think it's the latest one from Intel.

Did you test it with an eGPU?

@Porco-Rosso
Copy link
Contributor

I haven't tried with an eGPU, but TB3 hotplugging seems to be working for me.
Once I get my wifi card adaptor I'll go through more thorough testing.

@velaar
Copy link

velaar commented Jan 19, 2020

@Porco-Rosso @tylernguyen
Thank you for your input. I have done some more testing with different GPUs and GPU firmwares so far on all the GPUs (tested with Nvidia GT 660, RX590, RX580) the crash is the same (see below).

I even flashed a "Mac Edition" firmware onto my RX590 but the crash was the same.

The crash happens after the GPU is detected and the respective kext is loaded.
This is a TB3 issue because:

  • the GPU works without issues if we bypass the TB3.aml
  • On windows all the GPUs work fine
  • The crash happens on framebuffer load after connection (? port reset?)
panic(cpu 0 caller 0xffffff801f66520a): Kernel trap at 0xffffff801f677abf, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x00007ff64aa1e000, CR3: 0x000000002be7c000, CR4: 0x00000000003626e0
RAX: 0x000000007e008003, RBX: 0xffffff801fe0cec0, RCX: 0x00000000000000e2, RDX: 0x0000000000000000
RSP: 0xffffff8206a8bef0, RBP: 0xffffff8206a8bf20, RSI: 0x000000007e008000, RDI: 0x000000007e008003
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000000000000000, R11: 0x0000000000000000
R12: 0xffffff801fe0cec0, R13: 0x0000000002c73eaf, R14: 0x00000050d8ddad3a, R15: 0x0000000000000000
RFL: 0x0000000000010046, RIP: 0xffffff801f677abf, CS:  0x0000000000000008, SS:  0x0000000000000010
Fault CR2: 0x00007ff64aa1e000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 1, VF: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff801f351220 : 0xffffff801f53bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff801f351270 : 0xffffff801f6733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff801f3512b0 : 0xffffff801f664e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff801f351300 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f351320 : 0xffffff801f53b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff801f351420 : 0xffffff801f53b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff801f351470 : 0xffffff801fcd24f9 mach_kernel : _panic + 0x61
0xffffff801f3514e0 : 0xffffff801f66520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff801f351660 : 0xffffff801f664f08 mach_kernel : _kernel_trap + 0x598
0xffffff801f3516b0 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f3516d0 : 0xffffff801f677abf mach_kernel : _xcpm_idle + 0x37f
0xffffff8206a8bf20 : 0xffffff801f666e7a mach_kernel : _machine_idle + 0x1da
0xffffff8206a8bf40 : 0xffffff801f5609b7 mach_kernel : _processor_idle + 0xf7
0xffffff8206a8bf80 : 0xffffff801f560b78 mach_kernel : _idle_thread + 0x48
0xffffff8206a8bfa0 : 0xffffff801f4e213e mach_kernel : _call_continuation + 0x2e

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x100

Mac OS version:
19C57

Kernel version:
Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Kernel UUID: C3E7E405-C692-356B-88D3-C30041FD1E72
Kernel slide:     0x000000001f200000
Kernel text base: 0xffffff801f400000
__HIB  text base: 0xffffff801f300000
System model name: MacBookPro14,1 (Mac-B4831CEBD52A0C4C)
System shutdown begun: NO
Panic diags file available: YES (0x0)

System uptime in nanoseconds: 347236532426
last loaded kext at 347168719535: @kext.AMDFramebuffer	3.0.4 (addr 0xffffff7fa4cbd000, size 249856)
last unloaded kext at 39198095337: com.cisco.kext.acsock	4.7.1 (addr 0xffffff7fa2f6c000, size 278528)
loaded kexts:
<nothing unusual> 

With TB3 v1 I was able to get a bit more verbose crash. I'll keep it here for reference:

panic(cpu 2 caller 0xffffff800106520a): Kernel trap at 0xffffff7f84feffdf, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0xffffff81f9015000, CR3: 0x000000000d87c000, CR4: 0x00000000003626e0
RAX: 0xffffff81f9015000, RBX: 0x0000000000005434, RCX: 0x0000000002000000, RDX: 0x0000000003000000
RSP: 0xffffff81f76abb60, RBP: 0xffffff81f76abb80, RSI: 0xffffff802efe4bf0, RDI: 0x0000000000000000
R8:  0x0000000000000001, R9:  0x000000000000000b, R10: 0x00000000f0000000, R11: 0x0000000000000070
R12: 0xffffff8029c01880, R13: 0xffffff81a7bd0000, R14: 0x0000000000000000, R15: 0xffffff802ee4bc30
RFL: 0x0000000000010246, RIP: 0xffffff7f84feffdf, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0xffffff81f9015000, Error code: 0x0000000000000002, Fault CPU: 0x2, PL: 0, VF: 1

Backtrace (CPU 2), Frame : Return Address
0xffffff81f76ab5c0 : 0xffffff8000f3bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff81f76ab610 : 0xffffff80010733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff81f76ab650 : 0xffffff8001064e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff81f76ab6a0 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76ab6c0 : 0xffffff8000f3b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff81f76ab7c0 : 0xffffff8000f3b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff81f76ab810 : 0xffffff80016d24f9 mach_kernel : _panic + 0x61
0xffffff81f76ab880 : 0xffffff800106520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff81f76aba00 : 0xffffff8001064f08 mach_kernel : _kernel_trap + 0x598
0xffffff81f76aba50 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76aba70 : 0xffffff7f84feffdf com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4readEj + 0x53
0xffffff81f76abb80 : 0xffffff7f85027795 com.apple.kext.AMDRadeonX4000 : __ZN28AMDRadeonX4000_AMDVIHardware19getRegisterAperSizeEv + 0x23
0xffffff81f76abba0 : 0xffffff7f84fefeec com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4initEP11IOPCIDeviceP30AMDRadeonX4000_IAMDHWInterface + 0xfa
0xffffff81f76abbe0 : 0xffffff7f8500f5c1 com.apple.kext.AMDRadeonX4000 : __ZN26AMDRadeonX4000_AMDHardware4initEP11IOPCIDeviceP28AMDRadeonX4000_IAMDHWHandlerRjP16_GART_PARAMETERSP14_FB_PARAMETERS + 0x257
0xffffff81f76abc30 : 0xffffff7f84f95b2b com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator17createHWInterfaceEP11IOPCIDevice + 0x7b
0xffffff81f76abc70 : 0xffffff7f84f9350e com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator15configureDeviceEP11IOPCIDevice + 0x10a
0xffffff81f76abd00 : 0xffffff7f83a0d534 com.apple.iokit.IOAcceleratorFamily2 : __ZN22IOGraphicsAccelerator25startEP9IOService + 0x21e
0xffffff81f76abd80 : 0xffffff7f84f918de com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator5startEP9IOService + 0x82
0xffffff81f76abde0 : 0xffffff800161ae46 mach_kernel : __ZN9IOService14startCandidateEPS_ + 0xf6
0xffffff81f76abe40 : 0xffffff800161a9f1 mach_kernel : __ZN9IOService15probeCandidatesEP12OSOrderedSet + 0xb21
0xffffff81f76abef0 : 0xffffff8001619d3e mach_kernel : __ZN9IOService14doServiceMatchEj + 0x2ce
0xffffff81f76abf50 : 0xffffff800161c4dd mach_kernel : __ZN15_IOConfigThread4mainEPvi + 0x15d
0xffffff81f76abfa0 : 0xffffff8000ee213e mach_kernel : _call_continuation + 0x2e
      Kernel Extensions in backtrace:
         com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000->0xffffff7f83a98fff
            dependency: com.apple.driver.AppleMobileFileIntegrity(1.0.5)[2FAEE793-59BC-3ADF-A5E2-3BC8760AFE0B]@0xffffff7f81bf0000
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOReportFamily(47)[E3C37E96-3AFA-301F-B89C-719FB3D4DA53]@0xffffff7f8189f000
         com.apple.kext.AMDRadeonX4000(3.0.4)[829632A7-3E6E-33D0-BC01-A5598CDB2D04]@0xffffff7f84f90000->0xffffff7f854d4fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x144

@tylernguyen
Copy link
Owner Author

@Porco-Rosso @tylernguyen
Thank you for your input. I have done some more testing with different GPUs and GPU firmwares so far on all the GPUs (tested with Nvidia GT 660, RX590, RX580) the crash is the same (see below).

I even flashed a "Mac Edition" firmware onto my RX590 but the crash was the same.

The crash happens after the GPU is detected and the respective kext is loaded.
This is a TB3 issue because:

  • the GPU works without issues if we bypass the TB3.aml
  • On windows all the GPUs work fine
  • The crash happens on framebuffer load after connection (? port reset?)
panic(cpu 0 caller 0xffffff801f66520a): Kernel trap at 0xffffff801f677abf, type 13=general protection, registers:
CR0: 0x000000008001003b, CR2: 0x00007ff64aa1e000, CR3: 0x000000002be7c000, CR4: 0x00000000003626e0
RAX: 0x000000007e008003, RBX: 0xffffff801fe0cec0, RCX: 0x00000000000000e2, RDX: 0x0000000000000000
RSP: 0xffffff8206a8bef0, RBP: 0xffffff8206a8bf20, RSI: 0x000000007e008000, RDI: 0x000000007e008003
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000000000000000, R11: 0x0000000000000000
R12: 0xffffff801fe0cec0, R13: 0x0000000002c73eaf, R14: 0x00000050d8ddad3a, R15: 0x0000000000000000
RFL: 0x0000000000010046, RIP: 0xffffff801f677abf, CS:  0x0000000000000008, SS:  0x0000000000000010
Fault CR2: 0x00007ff64aa1e000, Error code: 0x0000000000000000, Fault CPU: 0x0, PL: 1, VF: 0

Backtrace (CPU 0), Frame : Return Address
0xffffff801f351220 : 0xffffff801f53bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff801f351270 : 0xffffff801f6733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff801f3512b0 : 0xffffff801f664e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff801f351300 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f351320 : 0xffffff801f53b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff801f351420 : 0xffffff801f53b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff801f351470 : 0xffffff801fcd24f9 mach_kernel : _panic + 0x61
0xffffff801f3514e0 : 0xffffff801f66520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff801f351660 : 0xffffff801f664f08 mach_kernel : _kernel_trap + 0x598
0xffffff801f3516b0 : 0xffffff801f4e2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff801f3516d0 : 0xffffff801f677abf mach_kernel : _xcpm_idle + 0x37f
0xffffff8206a8bf20 : 0xffffff801f666e7a mach_kernel : _machine_idle + 0x1da
0xffffff8206a8bf40 : 0xffffff801f5609b7 mach_kernel : _processor_idle + 0xf7
0xffffff8206a8bf80 : 0xffffff801f560b78 mach_kernel : _idle_thread + 0x48
0xffffff8206a8bfa0 : 0xffffff801f4e213e mach_kernel : _call_continuation + 0x2e

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x100

Mac OS version:
19C57

Kernel version:
Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Kernel UUID: C3E7E405-C692-356B-88D3-C30041FD1E72
Kernel slide:     0x000000001f200000
Kernel text base: 0xffffff801f400000
__HIB  text base: 0xffffff801f300000
System model name: MacBookPro14,1 (Mac-B4831CEBD52A0C4C)
System shutdown begun: NO
Panic diags file available: YES (0x0)

System uptime in nanoseconds: 347236532426
last loaded kext at 347168719535: @kext.AMDFramebuffer	3.0.4 (addr 0xffffff7fa4cbd000, size 249856)
last unloaded kext at 39198095337: com.cisco.kext.acsock	4.7.1 (addr 0xffffff7fa2f6c000, size 278528)
loaded kexts:
<nothing unusual> 

With TB3 v1 I was able to get a bit more verbose crash. I'll keep it here for reference:

panic(cpu 2 caller 0xffffff800106520a): Kernel trap at 0xffffff7f84feffdf, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0xffffff81f9015000, CR3: 0x000000000d87c000, CR4: 0x00000000003626e0
RAX: 0xffffff81f9015000, RBX: 0x0000000000005434, RCX: 0x0000000002000000, RDX: 0x0000000003000000
RSP: 0xffffff81f76abb60, RBP: 0xffffff81f76abb80, RSI: 0xffffff802efe4bf0, RDI: 0x0000000000000000
R8:  0x0000000000000001, R9:  0x000000000000000b, R10: 0x00000000f0000000, R11: 0x0000000000000070
R12: 0xffffff8029c01880, R13: 0xffffff81a7bd0000, R14: 0x0000000000000000, R15: 0xffffff802ee4bc30
RFL: 0x0000000000010246, RIP: 0xffffff7f84feffdf, CS:  0x0000000000000008, SS:  0x0000000000000000
Fault CR2: 0xffffff81f9015000, Error code: 0x0000000000000002, Fault CPU: 0x2, PL: 0, VF: 1

Backtrace (CPU 2), Frame : Return Address
0xffffff81f76ab5c0 : 0xffffff8000f3bb1b mach_kernel : _handle_debugger_trap + 0x47b
0xffffff81f76ab610 : 0xffffff80010733e5 mach_kernel : _kdp_i386_trap + 0x155
0xffffff81f76ab650 : 0xffffff8001064e5e mach_kernel : _kernel_trap + 0x4ee
0xffffff81f76ab6a0 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76ab6c0 : 0xffffff8000f3b207 mach_kernel : _DebuggerTrapWithState + 0x17
0xffffff81f76ab7c0 : 0xffffff8000f3b5eb mach_kernel : _panic_trap_to_debugger + 0x21b
0xffffff81f76ab810 : 0xffffff80016d24f9 mach_kernel : _panic + 0x61
0xffffff81f76ab880 : 0xffffff800106520a mach_kernel : _sync_iss_to_iks + 0x2aa
0xffffff81f76aba00 : 0xffffff8001064f08 mach_kernel : _kernel_trap + 0x598
0xffffff81f76aba50 : 0xffffff8000ee2a40 mach_kernel : _return_from_trap + 0xe0
0xffffff81f76aba70 : 0xffffff7f84feffdf com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4readEj + 0x53
0xffffff81f76abb80 : 0xffffff7f85027795 com.apple.kext.AMDRadeonX4000 : __ZN28AMDRadeonX4000_AMDVIHardware19getRegisterAperSizeEv + 0x23
0xffffff81f76abba0 : 0xffffff7f84fefeec com.apple.kext.AMDRadeonX4000 : __ZN29AMDRadeonX4000_AMDHWRegisters4initEP11IOPCIDeviceP30AMDRadeonX4000_IAMDHWInterface + 0xfa
0xffffff81f76abbe0 : 0xffffff7f8500f5c1 com.apple.kext.AMDRadeonX4000 : __ZN26AMDRadeonX4000_AMDHardware4initEP11IOPCIDeviceP28AMDRadeonX4000_IAMDHWHandlerRjP16_GART_PARAMETERSP14_FB_PARAMETERS + 0x257
0xffffff81f76abc30 : 0xffffff7f84f95b2b com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator17createHWInterfaceEP11IOPCIDevice + 0x7b
0xffffff81f76abc70 : 0xffffff7f84f9350e com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator15configureDeviceEP11IOPCIDevice + 0x10a
0xffffff81f76abd00 : 0xffffff7f83a0d534 com.apple.iokit.IOAcceleratorFamily2 : __ZN22IOGraphicsAccelerator25startEP9IOService + 0x21e
0xffffff81f76abd80 : 0xffffff7f84f918de com.apple.kext.AMDRadeonX4000 : __ZN37AMDRadeonX4000_AMDGraphicsAccelerator5startEP9IOService + 0x82
0xffffff81f76abde0 : 0xffffff800161ae46 mach_kernel : __ZN9IOService14startCandidateEPS_ + 0xf6
0xffffff81f76abe40 : 0xffffff800161a9f1 mach_kernel : __ZN9IOService15probeCandidatesEP12OSOrderedSet + 0xb21
0xffffff81f76abef0 : 0xffffff8001619d3e mach_kernel : __ZN9IOService14doServiceMatchEj + 0x2ce
0xffffff81f76abf50 : 0xffffff800161c4dd mach_kernel : __ZN15_IOConfigThread4mainEPvi + 0x15d
0xffffff81f76abfa0 : 0xffffff8000ee213e mach_kernel : _call_continuation + 0x2e
      Kernel Extensions in backtrace:
         com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000->0xffffff7f83a98fff
            dependency: com.apple.driver.AppleMobileFileIntegrity(1.0.5)[2FAEE793-59BC-3ADF-A5E2-3BC8760AFE0B]@0xffffff7f81bf0000
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOReportFamily(47)[E3C37E96-3AFA-301F-B89C-719FB3D4DA53]@0xffffff7f8189f000
         com.apple.kext.AMDRadeonX4000(3.0.4)[829632A7-3E6E-33D0-BC01-A5598CDB2D04]@0xffffff7f84f90000->0xffffff7f854d4fff
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1286D5E5-A6A1-3C44-A244-04C068903DB2]@0xffffff7f81ca5000
            dependency: com.apple.iokit.IOSurface(269.6)[640503DC-6033-3EF6-85F4-F48282EF48DD]@0xffffff7f839a4000
            dependency: com.apple.iokit.IOGraphicsFamily(569.3)[7B5CA52B-0BD1-34AB-BFC9-7D5C3A0DBE7C]@0xffffff7f81f98000
            dependency: com.apple.iokit.IOAcceleratorFamily2(438.2.8)[9176E894-E24A-36BA-AFDA-0DB11F3F512A]@0xffffff7f839d5000

BSD process name corresponding to current thread: kernel_task
Boot args: keepsyms=1 darkwake=0 debug=0x144

I tested my TB3 hotplug with the CalDigit Plus Dock and it worked. Unfortunately, I do not have an eGPU enclosure nor the proper graphics card to test that.

@Porco-Rosso
Copy link
Contributor

TB3 hotplugging seems to have stopped working for me.
I have tried with the latest version of the EFI files on this repo (5 days ago), and my external USB-C Lenovo dock only seems to work if I boot my computer with it plugged in. If I unplug it and replug it in, it stops working.

This may be tied to the fact that I enabled Filevault, but cannot confirm that is the root cause.
Other changes might be tied to: Enabling the security chip to get Bitlocker in windows working, and Thunderbolt3 BIOS assist mode being enabled.
Has anyone experienced a similar problem? How can I go about debugging it?

The Thunderbolt 3 section of the system profiler is blank even with the device working

Screen Shot 2020-02-09 at 6 11 04 PM

Screen Shot 2020-02-09 at 6 11 30 PM

Screen Shot 2020-02-09 at 6 11 11 PM

@velaar
Copy link

velaar commented Feb 9, 2020

@Porco-Rosso
This is a thunderbolt bios assist issue, it completely changes the way that the ports are allocated.
I use it with TB3v1 to get the hot unplug.
Thunderbolt will work if you plug the device pre-boot.

@Porco-Rosso
Copy link
Contributor

Thanks @velaar, that does seem to fix it.
I should have checked more thoroughly and tried it before posting. Well, at least it might help someone in the future..

As I understand, this will increase power consumption however, correct?
Also still nothing under the Thunderbolt section in the system profiler... I guess that's just because of how the kext works.

@velaar
Copy link

velaar commented Feb 9, 2020

@Porco-Rosso
Yes, it will cut the battery life by about 50%. You should see the controller under PCI.

@noclee
Copy link

noclee commented Feb 13, 2020

Can someone confirm if the power-assist mode works with Ethernet port on thunderbolt hub standard one that comes with the laptop, tried connecting before and reconnecting after and tried both ports with no luck. HDM and usb ports work ok on the hub.

@velaar
Copy link

velaar commented Feb 13, 2020

@noclee I'm not sure what is the question. Maybe I'm missing something but I did not have any thunderbolt hubs coming with the laptop nor heard of the power-assist mode.

@noclee
Copy link

noclee commented Feb 13, 2020

@velaar Sorry let me try this way, query is on Ethernet port not working when thunderbolt BIOS power-assist is enabled. Anyone have this working

@Porco-Rosso
Copy link
Contributor

@noclee with my lenovo-brand usb-c dock (like this one but with lenovo branding), the Ethernet jack works, but only if it is connected while booting if BIOS-assist is enabled.

@lubixxx96
Copy link

lubixxx96 commented Mar 4, 2020

Hi guys,
I was able to get fully working usb-c with hotplug support and good battery performance.
Cpu pkg cat get into sub 1W draw, and my usb-c dock is properly initialized even on first usb-c port (near the joint)

If interested, here you have my setup:
SSDT-TYPC.aml.zip

  • activate assisted mode of Thunderbolt3 in bios
  • disable IOElectrify.kext
  • disable all TB3 related .amls and add the one attached here

Let me know if it works.

EDIT:
ok, it doesnt work. I had luck for a few times but it is definitely not stable solution.
I am looking for USB-C hotplug without tb3 and with good battery life.
If anyone has an idea, please share.

thanks

@tylernguyen
Copy link
Owner Author

@lubixxx96 Have you tested it with a thunderbolt device?

@lubixxx96
Copy link

no, I don't have a thunderbolt device. But I dont see thunderbolt in ioreg so I suppose it wont work.
I am OK with USB-C and good battery life for now.

@tylernguyen
Copy link
Owner Author

tylernguyen commented Mar 24, 2020

@velaar @Colton-Ko @Porco-Rosso @noclee Can you guys please try my new EFI folder? I added a new TB3 hotplug patch that is functioning much smoother than before.

For my machine at least, TB3 hotplug now works with both Thunderbolt 3 ports. Fyi, if TB3 hotplug isn't working for you after updating the newest EFI folder, please try editing the SSDT-Z390-TB3HP.aml file with your appropriate TB3 controller path.

After one or two of you guys can verify that it is working, I will mark it as working on the repo.

@tylernguyen
Copy link
Owner Author

tylernguyen commented Mar 24, 2020

Quick update, after some extended testing, it seems that I arrived at the same problem before. Hotplugging on the ethernet-TB3 port works flawlessly. Though hotplugging on the TB3 power port only works if the machine was booted with the TB3 device attached.

It seems that this is as far as we can get without flashing the actual chip on the Thinkpad to use Apple's Thunderbolt firmware. If someone is willing to investigate, try, and document this, please check https://osy.gitbook.io/hac-mini-guide/details/thunderbolt-3-fix-part-3

@velaar
Copy link

velaar commented Mar 24, 2020

@tylernguyen

I still get higher power consumption and crash on AMDFramebuffer.kext on hotplug/coldplug of the GPU without Thunderbolt Bios Assist. So no luck for me here.

@Porco-Rosso
Copy link
Contributor

@tylernguyen your newest set of commits, as of 2f5361d have triggered some problems.
Not sure if I should split them over different issues, or just include them here. Let me know if you want seperate them.

  1. Hotplug of my USB-C dongle was working on both ports. Now only on the bottom one. If I plug in to the top both screens just go black. More worryingly, connecting my HDMI plug directly leads to two black screens as well... I need to force the laptop off, and reboot to get back to normal

  2. The Audio jack had a lot of noise and interference, at least the first time I rebooted with the new EFI. This included a worrying loud pop on my external speakers. Now it seems to be better, but will keep an eye out.

  3. Filevault previously required me to only enter my password once, now it must be entered twice. (Once with the high DPI loginscreen, and once with the scaled screen.)

  4. All function keys seem to be working well apart from F7 and F12, which need to be used in conjunction with the fn key to register any event in Karabiner-EventViewer.

I'd like to stay as closely in-sync with your EFI, so hoping we can resolve some of these.

@tylernguyen
Copy link
Owner Author

@Porco-Rosso I cannot replicate these issues. Please reach out to me via Signal at (202)-644-9951. Hopefully, we can get them debugged.

@Porco-Rosso
Copy link
Contributor

Porco-Rosso commented Mar 31, 2020

Thanks for the help @tylernguyen 👍

For others reading this:

  • Setting AuthRestart to false in config.plist fixed the filevault issue.
  • Hotplug and HDMI issue was fixed by rebooting the laptop several times. It may be tied to the 15.10.4 update.
  • Similarly, audiojack issues were resolved with some reboots.
    It seems I jumped the gun with reporting these issues.

@tylernguyen
Copy link
Owner Author

@Porco-Rosso
I investigated the audio a bit further, since it has been reported similarly before. See Issue #36. So I added ALCPlugFix patch to address this issue. Even if you don't have any audio issues, I recommend installing this patch anyway as it enables automatic audio switching between speaker/headphone upon plug/unplug.

@Porco-Rosso
Copy link
Contributor

@velaar I just acquired an external GPU (Core X) and an AMD card. Did you ever manage to get it to work on MacOS, with any configuration (hotplug, non-hotplug, TB-BIOS assist, additional kexts etc..)?
The card and egpu should be natively compatible with OSX, so I imagine this is related the the TB port issue. (Related, I get a ton of interference on the jack with the GPU connected, but I believe this is some grounding issue I need to investigate, regarding my speakers and eGPU)

@tylernguyen thanks for the patch. Automatic switching appears to be working. As I understand this is done in the OS and not EFI?

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

I wanted to add that I updated to the latest, tried this, and it worked. It shows a different menu bar icon to what I'd expect on a macbook but I got instant and smooth display output over an RX 570 eGPU.

image

Great work! Thank you!

@benbender
Copy link
Contributor

benbender commented Nov 16, 2020

@parndt is it to be expected to see the individual devices of the eGPU? Never had one and was asked today and wasn't sure by myself.

// cc @velaar

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

@parndt is it to be expected to see the individual devices of the eGPU? Never had one and was asked today and wasn't sure by myself.

nope.. in the past I've seen this (which is a picture I found on the Internet)
image

It is worth noting that the USB ports on the eGPU don't work but I'll try updating it to the latest commit on the repo as I see there are more.

It presents 100% properly in system report:
image
image

@benbender
Copy link
Contributor

Love to hear more feedback / reports. Problem is that there are plenty of configurations and edgecases which I can't see or test because of missing hw...

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

Problem is that there are plenty of configurations and edgecases which I can't see or test because of missing hw...

100%. Can't be expected to test everything, and what we now have is outstanding. 👍 🥇

@benbender
Copy link
Contributor

benbender commented Nov 16, 2020

@parndt As you seem to have an original Macbook and the X1 - could you post an IOReg-dump of both with the eGPU-attached? (done with https://github.com/vulgo/IORegistryExplorer)

If I got both, I may be able to replicate a more native-handling on the X1

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

@parndt As you seem to have an original Macbook and the X1 - could you post an IOReg-dump of both with the eGPU-attached? (done with https://github.com/vulgo/IORegistryExplorer)

unfortunately I don't have the macbook with TB3 with me at the moment 😦 I can however get access to it, so I'll see if I can get this for you at some point. 😄 would love to help.

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

one data point - powering off the card by unplugging it, or by clicking the menu bar option "power off card" seems to completely disable the built in trackpad until rebooted.

@benbender
Copy link
Contributor

one data point - powering off the card by unplugging it, or by clicking the menu bar option "power off card" seems to completely disable the built in trackpad until rebooted.

Wtf? :) You are on the latest version of this repo? Could you post an ioreg-dump of the state when that happened?

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

Wtf? :) You are on the latest version of this repo? Could you post an ioreg-dump of the state when that happened?

pretty weird huh! Yes, this was after updating to the latest. I'll get this for you as soon as I can.
I'm also going to make sure I have all the right BIOS settings set.

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

Is this accurate:

image

If I set both to disabled as per the below because I do want hotplug, I get no eGPU at all, which makes sense but it is what the README says.. 😕

@benbender
Copy link
Contributor

@tylernguyen see above ;)

@tylernguyen tylernguyen reopened this Nov 16, 2020
@tylernguyen
Copy link
Owner Author

Is this accurate:

image

If I set both to disabled as per the below because I do want hotplug, I get no eGPU at all, which makes sense but it is what the README says.. 😕

What Thunderbolt BIOS settings do you have eGPU working under?

@benbender
Copy link
Contributor

@tylernguyen

  • the lower one doesn't disable hotplug, but TB entirely.
  • Correct setup for my patches is to disable bios assist, enable native mode, disable Thunderbolt security & - preboot.
  • But nevertheless, my setup recognizes Bios assist + disabled TB and should not interfere with other setups.

@parndt
Copy link
Contributor

parndt commented Nov 16, 2020

Correct setup for my patches is to disable bios assist, enable native mode, disable Thunderbolt security & - preboot.

by native mode do you mean "Windows 10 Thunderbolt support" without RTD3?

@benbender
Copy link
Contributor

benbender commented Nov 16, 2020

with RTD3 (= Runtime D3, aka runtime-disable) ;)

@tylernguyen
Copy link
Owner Author

tylernguyen commented Nov 17, 2020

@tylernguyen

* the lower one doesn't disable hotplug, but TB entirely.

* Correct setup for my patches is to disable `bios assist`, enable `native mode`, disable Thunderbolt security & - preboot.

* But nevertheless, my setup recognizes `Bios assist` + disabled TB and should not interfere with other setups.

@benbender

There seems to be some confusion. The lower settings is Pre Boot support for Thunderbolt. Note the sub menu that it's under.

@Porco-Rosso
Copy link
Contributor

Porco-Rosso commented Nov 17, 2020

@parndt As you seem to have an original Macbook and the X1 - could you post an IOReg-dump of both with the eGPU-attached? (done with https://github.com/vulgo/IORegistryExplorer)

If I got both, I may be able to replicate a more native-handling on the X1

I have a Macbook on hand so I will try to provide this 👍

However I am also getting confused on the BIOS settings now...

@benbender
Copy link
Contributor

I have a Macbook on hand so I will try to provide this 👍

yeah! :)

However I am also getting confused on the BIOS settings now...

+1 - but however, "preboot" should be disabled. We want the BIOS and TB-firmware to stay out of TB as far as possible and handle connection-control in ACPI + OSX.

@Porco-Rosso
Copy link
Contributor

Hi @benbender here are the IOReg dumps. I hope I did them correctly. You will find 4 files, real Macbook with and without eGPU and X1 with and without eGPU.

IOreg dumps.zip

Here is how the eGPU works (hot-plug working!)

System Profile and menubar

GPU TBT egpu

Here is the BIOS config, in line with what I could understand - we really should clear this up.

BIOS

photo_2020-11-17_19-45-47
photo_2020-11-17_19-45-45
photo_2020-11-17_19-45-44
photo_2020-11-17_19-45-42
photo_2020-11-17_19-45-39

I will note, that under this current config the ethernet on my usb-c dock does not work (HDMI does...) and this is quite important to me, so any tips would be appreciated. I suspect something in the BIOS?

The link to IORegistryExplorer no longer works, but I managed to grab the latest release before it went down. Let me know if anyone needs it.

@benbender
Copy link
Contributor

@Porco-Rosso Thanks! Thats a huge help, will have a closer look as soon as possible!

For your questions:

  • I don't mess with the advanced menu more then the absolute bare minimum as I found it to be disturbing any attempt to get to a stable, reproduceable system. All my TB-settings are are stock with TB in Native/Windows 10-mode, disabled security and disabled preboot in the "normal" menu. I can't even say whats "stock" in the adv. menu atm, as I don't have access to it. Besides of setting DVMT for the iGPU to 64mb, disable the cfg lock and a slight undervolt I didn't change one setting in the advanced menu. I try to drive my machine as stock and compatible as possible.

  • For the usb-c-dock: can you give me link to the model? I have a suspicion.

@tylernguyen
Copy link
Owner Author

@Porco-Rosso @parndt

I've updated documentation to make things clearer about the new TB3 hotplug patches:

As @benbender stated and newly noted in the docs, the new patches do not require a modded BIOS.
Hence, please reset/revert any Thunderbolt 3 related changes within Advance Menu.

The only changes need are adjustable within the stock BIOS and are detailed in the docs.

@Porco-Rosso
Copy link
Contributor

Ok, I haven't changed any of the settings in the more advanced settings, apart from the same ones you mentioned @benbender. ( The ones in the repo )
But just to be clear when you say TB in "Native/Windows 10-mode" you mean BIOS Assist Mode - "Disabled"?

The USB dock is a rebranded version of this one: https://www.amazon.com/dp/B0841T9KC9 . Don't want to detract too much, so if I can't figure it out myself, I will open another issue.

@parndt
Copy link
Contributor

parndt commented Nov 17, 2020

But just to be clear when you say TB in "Native/Windows 10-mode" you mean BIOS Assist Mode - "Disabled"?

I found this setting under the Intel advanced menu -> Thunderbolt(TM) Configuration -> "Thunderbolt(TM) OS select" right down the bottom

@tylernguyen
Copy link
Owner Author

tylernguyen commented Nov 17, 2020

@Porco-Rosso

I'm quite sure that's what @benbender means.

@parndt
You should not have to make any TB3 related changes within the Advance Menu. The patches were intended/tested to go without a modded BIOS. Please reset BIOS settings + NVRAM and test again.

EDIT: Remember that the Advance Menu can be quite buggy so multiple resets and checks maybe required to make sure things are properly reverted to stock.

@benbender
Copy link
Contributor

But just to be clear when you say TB in "Native/Windows 10-mode" you mean BIOS Assist Mode - "Disabled"?

Absolutely yes.

The USB dock is a rebranded version of this one: https://www.amazon.com/dp/B0841T9KC9 . Don't want to detract too much, so if I can't figure it out myself, I will open another issue.

Please test the latest fixes in this repo and report back.

@Porco-Rosso
Copy link
Contributor

The latest changes seem to have worked, thanks @benbender!

@huyhoang8398

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I/O USB, SD Card Reader, and/or Thunderbolt Issues
Projects
None yet
Development

No branches or pull requests