Files
reims-vgpu/docs
Anees Iqbal ba4f1a31ee 🐎 Set the guest PAT's entry 2 to write-back on every CPU
xnu's x86-64 pmap maps every page it does not manage through PAT entry 2
for any ask but write-combined, and xnu's PAT holds UC- there. So the
device's region, which QEMU backs with host RAM, was uncached wherever the
kext asked for write-back: its rings, the cursor, the device info and every
block the bundle maps write-back. AMD's nested paging and WHP apply the
guest's memory type: through entry 2 the region ran at 78-202 MB/s on AMD
KVM and on WHP, against 43-46 GB/s and 16.5/8.8 GB/s write-back. KVM on an
Intel host ignores it for RAM-backed pages and ran at write-back speed
either way.

ReimsGraphics' start now sets entry 2 to write-back on every online CPU,
before the region's first mapping, in an mp_rendezvous_no_intrs action
with the SDM's sequence for a PAT change, and leaves entry 6 write-combining
as xnu sets it. A priority sleep/wake interest runs it again at each wake,
for a wake from S3, which resets every CPU's PAT; reims-ctl keeps S3 off, and
through its dark wake and a CPU's offline and online the measured guests
kept the rewrite and xnu wrote no PAT, so no CPU-start hook is needed. What
the guest observes: the region's write-back mappings are write-back on AMD
and Windows hosts. Every other user of entry 2 is device registers the host
traps, or RAM a driver asks uncached, which QEMU reads write-back.

The calls are com.apple.kpi.unsupported's (mp_rendezvous_no_intrs) and
IOKit's, which the kext links already. The comments and design.md that
called the region uncached now say under which PAT it is.
2026-11-17 08:56:29 -08:00
..