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

Will it work on post High Sierra macOS? #8

Open
mwkchan opened this issue Jun 22, 2021 · 14 comments
Open

Will it work on post High Sierra macOS? #8

mwkchan opened this issue Jun 22, 2021 · 14 comments

Comments

@mwkchan
Copy link

mwkchan commented Jun 22, 2021

This work on my 2011 iMac 27" under Linux environment. I was wondering if I am able to install a post High Sierra macOS (using OpenCore Patcher) to my 2011 iMac, would this bring back the TDM functionality?

@kgarrels
Copy link

I did a little investigation: on the 2011 iMac, TDM does not go through the SMC, but is handled by Thunderbolt.
So the method described here will not work.

Below show the console log when you enable/disable TDM.

Here is a link that describes Thunderbolt paths:
https://developer.apple.com/library/archive/documentation/HardwareDrivers/Conceptual/ThunderboltDevGuide/Basics/Basics.html#//apple_ref/doc/uid/TP40011138-CH2-SW6

I guess you need some deep Thunderbolt know how to enable these video paths under linux.

Any suggestions?

standard	14:55:10.813548 +0200	kernel	Thunderbolt DP - activating Video path - SRC [0:0x0:0x2] DST [0:0x0:0xb] - Initial Credits [int=0 src=0 dst=0] NFC Credits [int=14 src=5 dst=14]
standard	14:55:10.814050 +0200	kernel	Thunderbolt DP - activating Aux Tx path (A) - SRC [0:0x0:0x2] DST [0:0x0:0x6] - Initial Credits [int=2 src=2 dst=1] NFC Credits [int=0 src=0 dst=0]
standard	14:55:10.814564 +0200	kernel	Thunderbolt DP - activating Aux Tx path (B) - SRC [0:0x0:0x6] DST [0:0x0:0xb] - Initial Credits [int=2 src=2 dst=1] NFC Credits [int=0 src=0 dst=0]
standard	14:55:10.815079 +0200	kernel	Thunderbolt DP - activating Aux Rx path (A) - SRC [0:0x0:0xb] DST [0:0x0:0x6] - Initial Credits [int=2 src=7 dst=1] NFC Credits [int=0 src=0 dst=0]
standard	14:55:10.815594 +0200	kernel	Thunderbolt DP - activating Aux Rx path (B) - SRC [0:0x0:0x6] DST [0:0x0:0x2] - Initial Credits [int=2 src=7 dst=1] NFC Credits [int=0 src=0 dst=0]
standard	14:55:11.986277 +0200	kernel	IOThunderboltSwitch<0x0>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 11 unplug = 0
standard	14:55:11.986318 +0200	kernel	IOThunderboltSwitch<0x0>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 11 unplug = 0
standard	14:59:35.347288 +0200	kernel	IOThunderboltSwitch<0x0>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 11 unplug = 1
standard	14:59:35.347668 +0200	kernel	Thunderbolt DP - destroying Video path - SRC [0:0x0:0x2] DST [0:0x0:0xb]
standard	14:59:35.368898 +0200	kernel	Thunderbolt DP - destroying Aux Rx path (A) - SRC [0:0x0:0xb] DST [0:0x0:0x6]
standard	14:59:35.390523 +0200	kernel	Thunderbolt DP - destroying Aux Rx path (B) - SRC [0:0x0:0x6] DST [0:0x0:0x2]
standard	14:59:35.413360 +0200	kernel	Thunderbolt DP - destroying Aux Tx path (A) - SRC [0:0x0:0x2] DST [0:0x0:0x6]
standard	14:59:35.435888 +0200	kernel	Thunderbolt DP - destroying Aux Tx path (B) - SRC [0:0x0:0x6] DST [0:0x0:0xb]

@protocold
Copy link

protocold commented Oct 13, 2021

wait, I think @mwkchan said this work on his 2011 under linux tho so this method ought to have worked?!

Also, what he was asking is whether there is a way to retrofit all these into the iMac that run later version of MacOS (e.g. Mojave/Catalina/Big Sur etc) which apple removed the TDM feature?

@kgarrels when you did the investigation, did you run it under High Sierra or other Mac OS version?

Any thought?

@kgarrels
Copy link

kgarrels commented Oct 13, 2021

good point - I assume the difference lies in "mid 2011" and "late 2011", you can see the difference in the video option:
https://everymac.com/systems/apple/imac/imac-aluminum-faq/differences-between-imac-aluminum-mid-2011-late-2011-education-models.html

not sure though...

my tests were under High Sierra, mid 2011 27'' imac, the relevant SMC registers do not exist on it.

@protocold
Copy link

protocold commented Oct 13, 2021

I have a mid-2010 27" here but I think it doesnt help on the thunderbolt situation that you encountered.

However, I am also trying to see if it is possible to retrofit this in later version of the macos...

From what I understand in the 2010 case, it seems like dpd (under mac os in High Sierra or older) and SmcDumpKey (under linux which Floe modified) are responsible for writing to the smc register and then it is the smc that do the actual switching... is that how you understand it?

I wonder if i can just replace/drop in the dpd and dpaudiothru (which dpd launches) from high sierra into the later version of Mac OS to make this works... all guessing at this point..

@protocold
Copy link

protocold commented Oct 13, 2021

So I dug up this small util called smc that can do read/write to SMC which is part of smcFanControl :
https://github.com/hholtmann/smcFanControl/releases/tag/2.6

Apple System Management Control (SMC) tool 0.01
Usage:
./smc [options]
-f : fan info decoded
-h : help
-k : key to manipulate
-l : list all keys and values
-r : read the value of a key
-w : write the specified value to a key
-v : version

If i ran "smc -l" I could see a list of keys in the SMC which includes MVHR/MVMR.

Macs-iMac:Resources mac$ ./smc -k MVHR -r
MVHR [flag] (bytes 01)
Macs-iMac:Resources mac$ ./smc -k MVMR -r
MVMR [ui8 ] 0 (bytes 00)
Macs-iMac:Resources mac$ ./smc -k MVMR -w 2
Error: value is not valid
Macs-iMac:Resources mac$ ./smc -k MVMR -w 02
Error: SMCWriteKey() = e00002c1

I tried to write the value 2 to it but it doesnt work. Any idea?

@protocold
Copy link

protocold commented Oct 14, 2021

I ran the dtrace script but it didnt work:

mac$ sudo dtrace -qCs powermetrics.d -c 'powermetrics --sampler smc -n 1'
Password:
unable to get smc values
Machine model: iMac11,3
SMC version: 1.59f2
EFI version: 99.0.0
OS version: 17G14042
Boot arguments:
Boot time: Thu Oct 14 00:58:06 2021

*** Sampled system activity (Thu Oct 14 10:25:02 2021 +0800) (5000.94ms elapsed) ***

Did i launch the command correctly? Maybe it only works under Yosemite?

@protocold
Copy link

Ok. I re-run the smc util as root and this time it works!

On the 2010 under High Sierra:

To turn TDM on:
sudo ./smc -k MVHR -w 01
(wait 1 second)
sudo ./smc -k MVMR -w 02

To turn TDM off:
sudo ./smc -k MVHR -w 00
(wait 1 second)
sudo ./smc -k MVMR -w 02

@protocold
Copy link

protocold commented Oct 18, 2021

I can confirm these commands also work under Big Sur on the 2010!!!

@JaggerJo
Copy link

@protocold Thx :)

@mwkchan
Copy link
Author

mwkchan commented Nov 15, 2021 via email

@mwkchan
Copy link
Author

mwkchan commented Nov 15, 2021 via email

@aruizcon
Copy link

You can find smc binary in ./Resources/ folder from smcFanControl repository.

I have an iMac mid 2011 (Model iMac 12,2) with High Sierra. I've installed Gnu Linux distribution as a primary OS but I need TDM functionality too. In Mac OS High Sierra it is still working. But this method doesn't work because MVHR and MVMR registers doesn't exists in keys list from smc utility.

@strick
Copy link

strick commented Jul 25, 2022

Was anyone able to overcome the Thunderbolt issue regarding iMac mid 2011?

@BeauSlim
Copy link

Great stuff! This repo's Linux tool is working great under Ubuntu 22.02 and protocold's smc method works great under OCLP Monterey. iMac 11,3 (Mid 2010).
If anybody is having trouble installing smc, just "brew install smcfancontrol" and you will find it under /Applications/smcFanControl.app/Contents/Resources/

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

7 participants