Access macbook drive to boot vm over tb

Hello Forum,

my goal is to boot the mac OS from my macbook over tb with my pc. Now I’ve decided it would be best practice to setup linux on the pc with quemu and use the macbook drive to boot the mac OS as a VM. As most of you know there are guides to setup OSX as a VM.
My question is rather: how can I make the macbook accessible to the clover bootloader in the VM?

I have 2 ideas how that might be possible:

  1. Boot the macbook into target disc mode, connect it to the thunderbolt pcie card of the pc and pass the pcie device through to the clover vm.
  2. boot linux from a usb drive on the macbook and create a smb share to pass through the internal drive. The connection would be made via ethernet over thunderbolt.

Since it is my boot device I’m a little bit concerned with speed. How does a smb share impact drive performance?
@mods is this the correct subforum or does the topic belong in a linux subforum?

If i get this working I might write a little guide:)
Thanks for reading, consider sharing your knowledge if you happened to know something about this topic.

Definitely try target disc mode first, otherwise iSCSI or NBD would make more sense than SMB. This sounds cool so I’m looking forward to seeing how it goes.

Hi freqlabs,
yes target disc mode would be the “easier” way to do this. Also if I would use ethernet over thunderbolt it would limit the bandwidth to 10gbit/s. While I’m not concerned with bandwidth, the latency might be a little bit lower in target disc mode. Still depends on the protocol and link used in the target disc mode.

Now I set up my host pc. First with windows to test the card and update(maybe) the firmware.
I use the thunderbolt3ex card from asus with a z390 a prime mobo. The NVM is V.26 which also supports e-gpus and seems to be the newest firmware available from asus. (no firmware update required.)
The thunderbolt peripherals I’ve used worked flawlessly.
Only the macbook in targed disc mode wasn’t detected in any way. Though that might be a UEFI settings issue or the “macbookdrive” needs some kind of special apple drivers.

In anycase I then setup the host pc with arch linux and qemu etc. I think arch is good choice since I want to use the linux side purely as a hypervisor and I’m told arch is a very light distro. I have a windows vm running which is my guinea pig for the vm side of things. There is still a lot of work to be done, like passing through the host cpu architecture and passing through the pcie video and tb card.

It seems like the thunderbolt interface will be most difficult to set up right. There are a lot of UEFI options which are not explained in the manual or anywhere else.

So Ethernet over TB works. But only if the PC is powered on while the mac is already powered on and connected. After that hot plug worked. Even if I rebooted the pc.
The link speed is 20gbit/s over tb2.

The following UEFI settings are used:

Discrete TB support = enabled
TBT Vt-d base security = enabled
Thunderbolt boot support = enabled
Tbt dynamic AC/DC L1 = enabled
Wake from TB devices = On
Security Level = No Security(for testing purposes might turn on later, see also:
https://www.youtube.com/watch?v=0XhRBILQIsE )
SW SMI on TBT hot-plug = enabled (seems to be a shutdown/power toggle thingy, nut sure)
ACPI notify on tbt hot-plug = enabled (power saving feature)

GPIO3 Force Pwr = On (This forces the tb card to provide power to the tb chip, even if no device
is connected. This is useful for firmware update without a tb device attached to the tb card.)
GPIO filter = disabled (this reduces electrical noise when plugging 12V usb devices)
Enable CLK REQ = enabled (This seems to be a clocking relevant feature)
Enable ASPM = disabled (warning this setting “=enabled” prevented windows from booting)
(This is a pcie power saving feature meant for mobile pcs.) ->
https://en.wikipedia.org/wiki/Active_State_Power_Management
Enable LTR = enabled
Enable PTM = enabled
Enable TBT ASPM = disabled (this sets the supported levels of the power saving feature, does
nothing if the “Enable ASPM” is “=disabled”)

DTBT Controller 0/1 = enabled (I guess you can configure the two ports individually)
TBT Host Router = two port

Thunderbolt OS select:
Windows 10 Thunderbolt support = Enable + RTD3 (Enable is also called “TB native hot plug
support” while RTD3 is a kind of low power mode also is connected to hot plug support ->
http://h20195.www2.hp.com/v2/getpdf.aspx/4AA7-4375ENW.pdf)

I still don’t know what all of these settings do but if yes I’ll document it here.

Edit1: Okay if you put another tb device between the mac and the pc and create a daisy chain it will
detect either of the devices(which ever initializes first) and won’t recognize the other.
If you then reboot the windows pc will detect both the mac and the tb device. If you then try to hotplug the mac it will be recognized again. If you terminate the connection to the tb device in the middle both the tb device and the mac will not be recognized properly.(though the tb device might work despite that.)

This leads me to believe that the behviour of the thunderbolt card is very dependent on the devices connected at boot time of windows.

Now lets try why I’m here in the first place: targed disk mode, brb.

Edit2: When booting the mac into target disc mode the mac shows itself as a drive. While I tried using thunderbolt the mac wasn’t detected at all(why???).
But I have an old firewire 400 pcie card and a thunderbolt to firewire dongle. When using wirewire this method works and the mac shows up as a firewire drive- Btw- this is still windows.

Edit3: Target disc mode doesn’t show up in linux as well. The mac isn’t even detected at all. Maybe there is some special apple sauce like a proprietary driver which I don’t have under linux. Maybe it would show up under macOS(hopefully it’s not dependent on mac firmware). Have to try with a VM.

If someone knows more let me know. All Google knows is how to activate the target disc mode.

Networking over thunderbolt works fine between linux<->macOS and windows<->macOS.
While in Windows the link speed is advertised as 20gbit/s but speed testing shows 8-9gbit/s. Under linux it was closer to 9,5-9,8gbit/s.

Edit4: regarding the target disc mode which I will from now on abbreviate as “tdm”

This book mentions that the drive will be presented as a SCSI drive:
https://books.google.de/books?id=pgYvDwAAQBAJ&lpg=PA291&ots=XO8URxBqq4&dq=target%20disc%20mode%20thunderbolt%20pc&pg=PA31#v=onepage&q=target%20disc%20mode%20thunderbolt%20pc&f=false

Edit5: I dropped the target disc drive approach, nothing I did made the drive show up and I’m out of ideas.
So I installed arch linux on a USB drive and booted the macbook from it. This worked out fine.
Now I need to get ethernet over thunderbolt between the two linux machines working.
This documentation suggests that I have to manually trigger the loading of the “thunderbolt-net” kernel module via:
sudo modprobe thunderbolt-net
This command gives me no output and doesn’t the support a verbose -v flag. Also the thunderbolt network device doesn’t show up in the network manager. I will post some questions in the linux subforum and report back here.