Asahi Linux Progress Linux 7.3

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Well here we are again. Linux 7.3 is out and it’s been an eventful few months, so let’s get stuck in to another Asahi Linux progress report!

我们又见面了。Linux 7.3 已经发布,这几个月发生了很多事,让我们开始阅读这份新的 Asahi Linux 进展报告吧!

As always, upstreaming work continues to progress. Aside from the usual patches for low-level SoC blocks, two major drivers made it on to the list this cycle: macaudio and avd. Getting macaudio ready for submission has been a challenge. The audio subsystem on Apple Silicon devices is rather special, and required quite a number of core ALSA changes to properly support it. Apple also uses special variants of speaker and headset amplifiers that were already supported upstream, and these drivers also needed some pretty significant modifications. We have previously discussed a lot of this work at length, and we are finally in a position where we can submit the main driver for review. The driver and Devicetree changes represent a hefty chunk of our total patchset, about 3100 lines.

一如既往,上游化工作持续推进。除了针对底层 SoC 模块的常规补丁外,本周期有两个主要驱动程序进入了列表:macaudio 和 avd。让 macaudio 准备好提交是一项挑战。Apple Silicon 设备上的音频子系统非常特殊,需要对核心 ALSA 进行大量更改才能提供适当支持。苹果还使用了已在上游获得支持的扬声器和耳机放大器的特殊变体,这些驱动程序也需要进行相当重大的修改。我们之前已经详细讨论过很多此类工作,现在终于可以提交主驱动程序以供审查了。驱动程序和设备树(Devicetree)的更改占了我们总补丁集的一大部分,约 3100 行。

AVD is a whole different beast. The AVD driver has spent barely 3 months in our downstream tree and is already on the list. This is our shortest turnaround time yet for a major SoC component and bodes well for a transition to upstream-first development some time in the future. This is fantastic news, as the AVD driver and related Devicetree changes are around 13000 lines of code.

AVD 则完全不同。AVD 驱动程序在我们的下游树中仅存在了不到 3 个月就已经进入了列表。这是我们迄今为止针对主要 SoC 组件的最短周转时间,预示着未来向“上游优先”开发模式过渡的良好前景。这是一个极好的消息,因为 AVD 驱动程序及相关的设备树更改代码量约为 13000 行。

Also making an appearance on the list this cycle are initial Devicetrees not only for M4 Pro and Max devices but also M5 thanks to Yureka’s tireless efforts. As usual these initial Devicetrees are barebones and only sufficient to boot the SoC to a TTY, however work is progressing on further enablement. Watch this space!

本周期出现在列表中的还有 M4 Pro 和 Max 设备以及 M5 的初始设备树,这要归功于 Yureka 的不懈努力。像往常一样,这些初始设备树非常简陋,仅足以将 SoC 引导至 TTY,但进一步的启用工作正在进行中。敬请关注!

We have also begun shifting to an upstream-first approach where practical. Changes to the TI USB-PD and SPMI drivers required for new devices, as well as initial support for Thunderbolt, were all developed upstream-first. We are so thrilled to see our focus on upstreaming starting to pay off!

我们还开始在可行的情况下转向“上游优先”的方法。新设备所需的 TI USB-PD 和 SPMI 驱动程序的更改,以及对 Thunderbolt 的初步支持,都是首先在上游开发的。看到我们对上游化的关注开始取得成效,我们感到非常激动!

Last time, we announced initial support for M3 series machines via the EXPERT flag on the Asahi installer. We are pleased to announce that we received almost no issues from early adopters, so M3 support is now generally available without the EXPERT flag!

上次,我们宣布通过 Asahi 安装程序上的 EXPERT 标志初步支持 M3 系列机器。我们很高兴地宣布,我们几乎没有收到早期采用者的反馈问题,因此 M3 支持现在已全面可用,无需再使用 EXPERT 标志!

We have also made a number of improvements to M3 support, most notably enabling DCP. On top of performance and battery life improvements, this also allows us to enable sleep on M3 series devices and make the area around the notch useable on the MacBooks! Keep an eye out for m1n1 and kernel updates in the coming days.

我们还对 M3 支持进行了一些改进,最显著的是启用了 DCP。除了性能和电池寿命的提升外,这还使我们能够在 M3 系列设备上启用睡眠功能,并使 MacBook 上刘海屏周围的区域变得可用!请留意未来几天的 m1n1 和内核更新。

Last time, we teased support for virtualising SPTM-enabled versions of macOS in m1n1, which enables reverse engineering on M4 series machines. M5 presents a new challenge, as the versions of macOS which support it all require the use of Exclaves.

上次,我们预告了在 m1n1 中对虚拟化启用 SPTM 的 macOS 版本提供支持,这使得在 M4 系列机器上进行逆向工程成为可能。M5 带来了新的挑战,因为支持它的 macOS 版本都需要使用 Exclaves。

Exclaves are small applications running in an isolated environment controlled by the Secure Kernel. On M5 series SoCs and above, macOS uses them for sensitive tasks such as drawing the “camera in use” indicator to the screen. XNU communicates with the Secure Kernel and its Exclaves via SPTM, using yet another IPC protocol called Tightbeam. Much as with SPTM, XNU will panic if it cannot find the running Exclaves. This is all starting to look very similar in concept to Arm’s own TrustZone feature.

Exclaves 是在由安全内核(Secure Kernel)控制的隔离环境中运行的小型应用程序。在 M5 系列及以上的 SoC 上,macOS 使用它们来执行敏感任务,例如在屏幕上绘制“摄像头正在使用”指示器。XNU 通过 SPTM 与安全内核及其 Exclaves 进行通信,并使用另一种名为 Tightbeam 的 IPC 协议。与 SPTM 一样,如果 XNU 找不到正在运行的 Exclaves,它就会崩溃(panic)。这一切在概念上开始看起来与 Arm 自己的 TrustZone 功能非常相似。

While some Exclaves can be bypassed by changing some settings on the command line, we predict that this will not always be the case. As such, Sven started looking at how we could fit all of this in to m1n1. First line of investigation, try putting the Secure Kernel and Exclave userspace in another VM next to SPTM and macOS.

虽然可以通过更改命令行中的某些设置来绕过某些 Exclaves,但我们预计这种情况不会一直持续。因此,Sven 开始研究如何将所有这些整合到 m1n1 中。首要调查方向是尝试将安全内核和 Exclave 用户空间放在与 SPTM 和 macOS 并行的另一个虚拟机中。

Oh, that worked, and we’re now up to spawning three VMs in EL1 under m1n1! Maybe we can start selling m1n1 to companies fleeing VMWare… With that, we can now virtualise and reverse engineer macOS on both M4 and M5 series machines.

哦,成功了,我们现在可以在 m1n1 下的 EL1 中生成三个虚拟机了!也许我们可以开始向逃离 VMWare 的公司推销 m1n1 了……有了这个,我们现在可以在 M4 和 M5 系列机器上虚拟化并逆向工程 macOS。

While M3 support is now mostly at feature parity with M1 and M2, the very obvious exception to this is the GPU. Apple’s GPU team seems to follow a tick-tock model, and the M3’s GPU was a very significant departure from the models found on M1 and M2 SoCs. We mentioned quite some time ago that the M3 GPU was being reverse engineered by a new group of contributors, however not much has been said since.

虽然 M3 的支持现在在功能上基本与 M1 和 M2 持平,但一个非常明显的例外是 GPU。苹果的 GPU 团队似乎遵循“嘀嗒”(tick-tock)模型,M3 的 GPU 与 M1 和 M2 SoC 上的模型有很大不同。我们很久以前就提到过,M3 GPU 正由一组新的贡献者进行逆向工程,但此后并没有太多消息。

At XDC this year, Alyssa Millburn, Anna Maniscalco and TellowKrinkle gave a talk on their progress reverse engineering the M3 GPU. Work has progressed far enough for m1n1 to successfully initialise the GPU and for the team to draw a triangle! Fans of the “Think Different” sections of these progress reports will find the talk edifying; Apple have once again made a number of… interesting choices which will require significant engineering effort to integrate into upstream Mesa. It is well worth a watch if you’re interested in more detail.

在今年的 XDC 大会上,Alyssa Millburn、Anna Maniscalco 和 TellowKrinkle 就他们在 M3 GPU 逆向工程方面的进展发表了演讲。工作进展已经足够让 m1n1 成功初始化 GPU,团队也已经画出了一个三角形!这些进展报告中“Think Different”部分的粉丝会觉得这次演讲很有启发性;苹果再次做出了一些……有趣的决定,这将需要大量的工程努力才能集成到上游 Mesa 中。如果你对更多细节感兴趣,非常值得一看。

A huge thanks goes out to everyone who has made this work possible. More progress is on the way, so stay tuned.

非常感谢所有使这项工作成为可能的人。更多进展正在路上,敬请期待。

All the way back in January of 2024, we made the mistake of promising Thunderbolt support within the year. It’s a mistake we won’t quickly repeat. We’ve said almost nothing about Thunderbolt in the two years since, which begs the question: where is it?

早在 2024 年 1 月,我们犯了一个错误,承诺在年内提供 Thunderbolt 支持。这是一个我们不会轻易重犯的错误。自那以后的两年里,我们几乎没有提到过 Thunderbolt,这就引出了一个问题:它在哪里?

It’s on the mailing list!

它在邮件列表中!

Thunderbolt was originally developed by Apple and Intel, with Intel handling the design and fabrication of the hardware required. Since Intel made these controllers available to anyone who wanted them at a (mostly) reasonable price, no one else bothered to design their own. It is only very recently — largely coinciding with the transfer of the standard to the USB-IF — that companies like AMD have decided to roll their own controllers. Apple is of course no exception.

Thunderbolt 最初由苹果和英特尔共同开发,英特尔负责所需硬件的设计和制造。由于英特尔以(大多)合理的价格向任何想要的人提供这些控制器,其他人也就懒得自己设计了。直到最近——很大程度上与该标准转移到 USB-IF 同时发生——像 AMD 这样的公司才决定推出自己的控制器。苹果当然也不例外。

As part of their push for insourcing most silicon IP, Apple made the choice to design their own Thunderbolt controller before most others. Surprising no one, the controller is of course a Cortex-M3 running RTKit coupled with a bespoke Thunderbolt/USB4 router. There is one of these for each Thunderbolt-enabled USB-C port on all Apple Silicon Macs.

作为其推动大部分硅片 IP 内包计划的一部分,苹果选择在大多数其他公司之前设计自己的 Thunderbolt 控制器。不出所料,该控制器当然是一个运行 RTKit 的 Cortex-M3,并配有一个定制的 Thunderbolt/USB4 路由器。所有 Apple Silicon Mac 上的每个支持 Thunderbolt 的 USB-C 端口都有一个这样的控制器。

Since Intel supplie

由于英特尔供应