Commit Graph
2 Commits
Author SHA1 Message Date
Anees Iqbal a811de7fd0 🐛 Show installers and recovery the EFI framebuffer in BAR 2
macOS installers and recovery images ship no AppleParavirtGPU, so the only
driver that binds the device is IOGraphics' IONDRVFramebuffer, which takes
the EFI boot framebuffer over only when it lies inside one of the device's
memory BARs. The option ROM gave the Graphics Output Protocol its
framebuffer in guest RAM, and the device had one register BAR, so the
installer's WindowServer found no usable display, aborted and started
again and again, the screen frozen on the Apple logo's progress bar.

vendor/qemu's 1a72df98 gives apple-gfx-pci a BAR 2: a 64 MiB window (the
efi-framebuffer-bar property, on by default) holding one alias of the
machine's RAM. After a guest write to 0x1210, QEMU reads the start back
from the library and shows the run of RAM there, up to 64 MiB and never
past what the guest sees of that RAM (so not SMRAM); only the next 0x1210
write and a reset change it.

The option ROM, after it writes the framebuffer's start and length (0x1210,
0x1214), asks PCI I/O for BAR 2's attributes: a memory BAR at least as long
as the buffer, below 4 GiB and with no address translation. It then writes
a pattern and its complement into the buffer's first and last dwords and
reads each back through BAR 2, restoring the dwords. When all four read
back, the GOP's FrameBufferBase is BAR 2's address; otherwise it is the
buffer's own, as before. The buffer stays runtime services data in RAM:
Blt draws into it, the registers name it, and the device presents it, so
the library, its C API, the suite and the pins are unchanged. Those pages
stay the framebuffer's only while the loader keeps boot.efi from moving
runtime data, as OpenCore's AvoidRuntimeDefrag does; the ROM's comment and
architecture.md 11.4 say so.

What the guest sees: one more memory BAR on apple-gfx-pci, which shows the
EFI framebuffer from the ROM's 0x1210 write until the next one or a reset,
and a GOP framebuffer at that BAR's address, which boot.efi hands the
kernel; on a device without BAR 2, the RAM address as before. The ROM's
size is unchanged (5,632 bytes); its bytes change.

docs/qemu.md and docs/architecture.md 11.4 describe BAR 2 and the ROM's
probe, and what the boots measured on the RTX 5080 Laptop GPU host: the
macOS 26.6.2 BaseSystem reaches its Recovery UI (kernel framebuffer at BAR
2, WindowServer started once), and the installed macOS 26 guest reaches
its desktop with BAR 2 on and off, its late draws to the boot framebuffer
landing in RAM.
2026-10-12 00:48:55 +03:00
Anees Iqbal 98fe2a3bd5 🆕 Replace the tree with libreims_vgpu and its C API
This repository now holds libreims_vgpu, a Rust library that is the host
side of the paravirtualized GPU macOS guests drive, in place of Apple's
ParavirtualizedGraphics.framework: the library and its C API
(reims_vgpu.h), the PCI device's option ROM, QEMU's apple-gfx on that API
(vendor/qemu), the behaviour-lock suite that drives the C API as QEMU
does, and reims-ctl, the VM manager users run. README.md says what it is
and how it is laid out, and AGENTS.md how to change it.

Every file of the earlier tree is replaced. vendor/qemu moves to the
steelbrain/reims-vgpu branch of the same public repository.
2026-10-11 20:27:17 +03:00