Fix HDMI audio lag on Retina MacBookPro 2013 (macbook11,1) in Linux

The problem

The HDMI out works just fine out of the box, except that you’ll notice that unless you boot with the HDMI cable connected, you’ll experience some weird audio lag through HDMI. Even worse, after a few seconds, HDMI audio will simply stop working.

Audio drift, lag, and eventually no audio. To rub some salt into the wound, this does not happen under macOS. Classic.

The solution

Well, the good news is that you can get this fixed. Turns out this is because of Linux kernel bug #60769. I can’t comment on the details of how and why the IOMMU feature breaks this particular combination of videocard/HDMI/audio, but I can tell you how to work-around this.

To fix, or at least work-around this, you have to edit your /etc/default/grub and add intel_iommu=on,igfx_off to your kernel boot options:

GRUB_CMDLINE_LINUX_DEFAULT="(...) intel_iommu=on,igfx_off"