Much of the work around porting desktop Linux to Apple Silicon (M1 & M2) Mac computers has been under the Asahi Linux project, which already offers a desktop distribution that can boot natively on many models. Even though Linux has supported ARM chips for years, largely due to Google’s use of Linux for the Android kernel and devices like the Raspberry Pi, making everything work on Apple Silicon has been a challenge.
The core operating system and desktop experience has been working on Asahi Linux for a while now, so some developers have moved onto proper graphics support. Alyssa Rosenzweig helped reverse engineer the GPU in the M1 chip to create a user space driver, based on documentation work by Dougall Johnson. However, a kernel-level driver was still missing — a task taken up by VTuber Asahi Linya.
Asahi Lina explained in a blog post, “just like other parts of the M1 chip, the GPU has a coprocessor called an “ASC” that runs Apple firmware and manages the GPU. This coprocessor is a full ARM64 CPU running an Apple-proprietary real-time OS called RTKit… and it is in charge of everything! It handles power management, command scheduling and preemption, fault recovery, and even performance counters, statistics, and things like temperature measurement! In fact, the macOS kernel driver doesn’t communicate with the GPU hardware at all.”
Through much trial and error, Asahi Lina developed an M1 GPU driver for the Linux kernel, written in the Rust programming language. Last month, it became stable enough to run the GNOME desktop environment in the Wayland compositor, and ongoing work on the kernel and user drivers allows some games to work, including the classic shooter Quake. The blog post mentions, “since the GPU power management is handled by the firmware, all that just works. I tested Xonotic at 1080p inside a GNOME session, and the estimated battery runtime was over 8 hours!”
It will still be a few weeks (or months) before the new GPU drivers are easily accessible to anyone trying Linux on an M1 or M2 Mac, but work is progressing at an impressive rate — especially considering Apple hasn’t documented most of its CPU and GPU architecture at all.
Source: Asahi Linux