Strapping an RTX 5090 to an M4 MacBook Air via Thunderbolt eGPU and a Linux VM
A developer documents the absurd-but-functional project of connecting an NVIDIA RTX 5090 to an M4 MacBook Air through a Thunderbolt-to-PCIe dock. Because macOS ships no NVIDIA or AMD GPU drivers for Apple Silicon, and tinygrad’s recent eGPU drivers only work within its own AI stack and run roughly 10x slower than native Metal inference, the author routes around the limitation by running an arm64 Linux VM on the Mac host and passing the GPU through to the guest. The Linux kernel itself can’t yet talk to Thunderbolt on Apple Silicon, so macOS handles the device while the VM gets the working NVIDIA driver.
The technical core is PCI passthrough plumbing on Hypervisor.framework. The author uses PCIDriverKit and IOConnectMapMemory64 to map the GPU’s BAR0 into the host process, then wires QEMU’s hvf_set_phys_mem() to expose that mapping to the guest. Reading BAR0[0] correctly returns the GB202 die identifier for the 5090, but the moment the guest actually touches the mapped BAR memory, the host kernel panics and reboots. The fallback is to trap every BAR access and forward it through QEMU — correct but slow on command-submission paths, though DMA (the dominant GPU workload) is less affected.
The writeup is a hands-on exploration of the undocumented edges of Apple’s virtualization stack, including a minimal repro the author prepared for an Apple bug report. It illustrates both how close Apple Silicon comes to supporting real eGPU passthrough and the specific kernel-level gaps that still block it.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.