Commit Graph
26 Commits
Author SHA1 Message Date
Anees Iqbal 30c7cd604b 🆕 Capture the pointer with the keyboard, held over the image
A click into the image captured only the keyboard: the host's pointer could
still leave the window for the bars, the title bar or another app, where a
click meant for the guest's edge landed on the host instead. Capture now takes
the pointer too, and never one without the other: while captured, the host's
pointer is held over the image, and ⌃⌥⌘ (Ctrl+Alt+Super on Linux), Release
Input, losing focus or closing frees both.

On AppKit's window the hold is NSWindow's mouseConfinementRect, the property
SDL3 confines its macOS windows with, which AppKit leaves out of its headers;
a window that does not answer it leaves the pointer free and logs one line.
On SDL's windows it is SDL's mouse rect, rounded out to whole points so the
image's last row and column stay in reach, which SDL keeps with the
compositor's pointer constraints on Wayland, XFixes barriers on X11 and the
same property on macOS; where SDL has no mouse rect, its mouse grab holds the
pointer in the whole window. In native full screen an image that reaches the
screen's top or bottom edge takes the pointer there, where macOS slides its
own menu bar or Dock in.

features.md, README.md, docs/api.md, docs/architecture.md and the module docs
say so. The macOS walk releases capture wherever a step needs the pointer off
the image, captures before Finder takes focus in C4, and walks the hold at
each edge and corner (C2), at the window's edge (C2e), across Mission Control
(C2m), in full screen (C2f) and after a mode change (M4), which only a
person's own mouse shows: a warped pointer, or one moved by events posted at
the HID tap, is not held.
2026-10-19 02:47:57 +03:00
Anees Iqbal 9f2e1c2c34 🐎 Move metal2vulkan to 62cad6be54: per-sample reads, ANV fits
62cad6be54 lands metal2vulkan's bug-fix wave on its development, 55 commits
past 6b322fb50f (SEMANTICS_VERSION 1759 -> 1798, RUNTIME_VERSION 1314 -> 1496).

What changes for the guest:
- A multisampled fragment function that reads its colour attachment (so runs
  per sample) and [[position]]'s w, [[point_coord]], [[barycentric_coord]] or
  a centroid varying now compiles, those reads taken where Vulkan evaluates
  them for the sample and announced as multisample-position, where link
  refused it, which killed the guest at every launch of Claude Desktop
  (0a34e8c7).
- On ANV, mesh render, tile render and compute pipelines whose largest stage
  passes the compiler's word bound under exact forms are fitted, as render
  pipelines were, where brw's allocator faulted the process (33e89bd4).
- The UHD 770 splits an interlocked pass as every GPU measured does, faster
  there (affd8a5e). lavapipe records a dispatch of a variant that
  bakes samplers in a command buffer of its own, which 26.0.8 sampled as
  Repeat after a copy (ImmutableSamplersLostAfterCopies, 84ba0af3).
- A texture over a no-copy buffer's host pages, padded rows included, is the
  runtime's shadow on every device, MoltenVK too: a CPU write to bytes a
  command buffer does not write is kept, as Metal keeps it, where an image's
  first move could undo it (e35bf78b).
- ASTC LDR, ETC2/EAC and PVRTC textures read through decoded twins where the
  device lacks the format, A8Unorm through R8, and 4:2:2 through a twin on
  every device.
- New fast defaults, each bounded, logged and behind an exact switch, none of
  which applies on MoltenVK: the device's resolve (resolve), the device's tile
  store of loaded snorm and RGB9E5Float attachments (tile_store), compact ASTC
  and EAC twins (decoded_texels), and batches ordered by their ends
  (batch_order).
- Every device takes the runtime's exact completion, each command buffer seen
  complete at its own end as Metal's, not its new default of Mesa's grouped
  submissions: when work completes is the guest's to observe, and ip34
  measured no frame rate gained on the Iris Xe (15.7-17.3 fps grouped,
  16.4-17.6 exact).
- Every device takes uncompressed heap textures too, not the new default of
  ANV's compressed image, which would change the heap size query's answers
  (0x4100 bytes at 0x10000 for a 64x64 BGRA8Unorm texture on the Iris Xe,
  where the guests booted with 0x4080 at 0x1000) and could hide writes through
  aliases.
- A device's teardown no longer races the watch of the program's queue marks
  or the release of freed memory: the last drop tears the device down on its
  own thread before it returns (6898b52e).

Here: REIMS_VGPU_EXACT names four of the new DevicePolicy fields, with their
ledger rows and docs/api.md's list; completion and heap_compression have none,
and the ledger and docs/api.md say every device takes their exact forms, and
why. padded_reads, whose field and fast form are gone, falls to the path
docs/api.md gives a name that is no field: nothing changes, and stderr says so.
Its ledger row goes. The runtime's six new kinds are placed: CarriedDecodedTwin
relayed (a performance kind); DecodedTexelPrecision, HeapTextureCompressed,
SnormMinimumKept, SharedExponentKept and GroupedCompletion in DIES,
GroupedCompletion and HeapTextureCompressed never announced under the exact
forms, DecodedTexelPrecision also relayed on native devices as the runtime's
default sampling. DeviceRoundedResolve moves from HEARD to DIES and is relayed
on native devices too (class (e), the device's rounding of an average, as
measured on RADV, ANV, NVIDIA and lavapipe), so Inexact::RoundedResolve and
device_rounded go: a strict run on Mesa's drivers, this crate's tests among
them, no longer dies at a grouped submission or a resolve the device averages,
and MoltenVK, which resolves as Metal, announces neither. None dies by default.
The retired UnorderedFramebufferFetch and UnrestoredFirstMoveBytes leave DIES.
The docs of the runtime's VK_EXT_metal_objects, the first move's keep and the
fitted pipeline kinds are brought up to date.

Tests: the resolve test, a_device_resolve_ends_its_pass, ends passes under both
resolve policies (device_with_policy). A texture over a surface's memory is now
the runtime's shadow, so the runtime may free the surface buffer's import as it
goes, a command buffer still running; the Linux test of the surface's memory
hold, renamed
a_released_surface_texture_keeps_the_surfaces_memory_while_imported, checks that
the memory stays mapped while the device imports it, in place of until the
command buffer completed. a_type_9_hang_is_in_flight_as_long_as_metals commits
its queue's command buffer right after the hang's, before another queue's runs:
under the suite's load that run took 42 to 98 ms on the Iris Xe, past the 40 ms
hang, on 6b322fb50f too.

Checked at this tree, built on c662e1c78b, metal2vulkan's commit whose tree
62cad6be54's equals. On the M3 Max: cargo xtask check, 3517 of 3528 tests
passed; the 11 that failed under its load (nine YCbCr sampling sweeps, and
detach_backing's detached_in_flight on Metal and on Vulkan) passed alone. On the
Iris Xe (homelab-ms01, ANV, Mesa 26.2.4, strict): the Vulkan crate's tests, 388
of 388. Cold boots on the M3 Max's Vulkan platform (MoltenVK), each with an
empty translation cache: arm64 macOS 27 to its login window and macOS 26 to its
desktop, with no fatal line or refusal. x86-64 macOS 26 with the ported GPU
kexts, headless at 1920x1080, opened 69 apps in turn on the Iris Xe (ANV), the
RTX 5080 Laptop and the Radeon 780M (RADV), the last two from an empty
translation cache: no QEMU death, fatal line, refusal or crash report on any of
the three. Not run here: the suite, which drives the Metal platform alone.
2026-10-19 01:04:01 +03:00
Anees Iqbal a0b288ed52 🐎 Move metal2vulkan to 6b322fb50f: YCbCr filter, ANV halves
6b322fb50f is metal2vulkan's development, three commits on 29d3ebb22e's line:
the fetched 8-bit blend for every factor, mask and blend color (01841476dd),
the device's filter of a two-plane YCbCr texture by default (b7da00074a), and
the cut of ANV's and RADV's cold making of half-heavy shaders (6b322fb50f).

What changes for the guest:
- Intel (ANV) builds the guest's big A2X pipelines cold in about 4 s, where
  it took about 14 s plus two 38 s remakes at a draw, past the guest's 10 s
  GPU watchdog: a cold first boot of the x86-64 port on Iris Xe stalled with
  19,572 FIFO resumes, and now boots with none. RADV's 780M takes 0.39-0.43 s
  where it took 0.80 s. A computed half rounds through an f32->f16->f32 pair
  under Vulkan's 16-bit float controls, exact by the spec, and a half read
  from its bits widens by the device's conversion, every value but a NaN
  exact (its bits the device's, announced as NativeNanEncoding). NVIDIA keeps
  its forms (DriverWorkaround::HalfConversionPairFolded).
- A linear sample of a two-plane YCbCr texture is the device's own filter by
  default (the owner's ruling, 2026-10-17: the fast form, logged, the exact
  one behind a switch): within 1.18 codes of Metal's on the RTX 3090, 0.88 on
  RADV, 1.06 on ANV and 0.1245 on MoltenVK on the M3 Max, so a draw binding
  one makes no pipeline of its own. REIMS_VGPU_EXACT=ycbcr_filter, and `all`,
  take Metal's filter, byte for byte as before.

Here: the switch's name in platform.rs, its docs in docs/api.md and its row
in the accuracy ledger, with the half-rounding and NaN rows brought up to
date. The runtime's seven new kinds are placed (AttachmentReadInPlace,
NotMipmappedAnisotropicSampler and -Filter, UnmeasuredGroupSpeculation and
DeviceSampleLevel in DIES, DeviceSampleLevel also relayed on native devices;
FloatTininessAfterRounding and ExactFormsOverCompilerLimit relayed); none dies
by default. The Mac's YCbCr comparisons run on a device under
YCbCrFilterPolicy::Exact, compared exactly, and a new test holds the default
to its bound and its notices.

Checked at this tree (metal2vulkan's e742fe531c, the same tree): cargo xtask
check on the M3 Max (the 11 load-sensitive failures passed alone), the
Vulkan crate's tests on um780's RX 7900 XTX and 780M (388/388 each), and the
port's cold boots on ms01's Iris Xe and gem10's 780M with no fatal line.
2026-10-17 11:18:09 +03:00
Anees Iqbal afdb76f844 🆕 Give every x86-64 VM the IOSurface device over PCI
An x86-64 macOS guest running Apple's arm64 GPU driver, ported, needs the
IOSurface host device vmapple has as apple-gfx-mmio's second region: the
driver's start waits for its mapper's service, and every texture over an
IOSurface is a mapper texture. reims-ctl now gives every x86-64 VM on
reims-vgpu that device, with no opt-in, and Apple's own x86-64 driver keeps
running as before.

For the guest:
- apple-gfx-iosurface-pci (106b:eeef, ours) sits at 00:06.0 next to the GPU
  at 00:04.0: its registers in BAR 0 at 0x1000, 8-byte accesses passed
  whole, one MSI vector per completed command. A reset returns its
  registers to 0, ring size aside.
- 0x1028 offers the second, 0x400-byte descriptor form only where its table
  holds all 8192 mapping ids (16 KiB pages); on x86-64's 4 KiB pages it
  reads 0, and the guest's mapper takes the first form, which fills them.
- On apple-gfx-pci, a task other than task 0 runs isolated only if the
  IOSurface device has a descriptor table when the guest defines it, and
  device info offers argument buffers (key 33 bit 0x20, key 42) only while
  it has one. Apple's x86-64 driver, stock (binary version 6) or patched by
  reims-util (245), never programs the IOSurface device and makes ref
  textures whose backing is in task 0, which an isolated task does not
  serve (testing.md 6.20); its tasks stay in process and its device info
  is as without isolation. The ported driver's mapper programs the device
  before its GPU driver starts, and its tasks run isolated, which its info
  replies need. apple-gfx-mmio still isolates every task.

For the host:
- apple-gfx-pci has no option for this: adding apple-gfx-iosurface-pci is
  the only switch, and a VM without it runs as before. Its gpu link is
  optional, the machine's only apple-gfx-pci when unset. vendor/qemu moves
  to bd95509a.
- RvgDeviceConfig gains process_isolation_follows_guest at its end (64
  bytes; a host that passes 56 reads it false), and the Rust API's
  DeviceConfig the same field; apple-gfx-pci always sets it with
  use_iosurface_mapper and process_isolation. Each task made under it logs
  whether it runs isolated or in process, and device info logs each change
  of its argument-buffer answer.
- reims-ctl's q35-x86_64 profile adds
  apple-gfx-iosurface-pci,id=iosfc,gpu=gfx,addr=0x6; vmware-svga and
  vmapple VMs are unchanged. reims-ctl and QEMU from this commit go
  together, as its installer installs them.
- On Linux, the detach heap's temporary and a writable alias with zeros
  past its pages come from a range of a file of the library's own, so the
  Vulkan platform can alias and import them; QEMU no longer ends at an
  x86-64 guest's first such heap. macOS is unchanged.
- The first command given to a task whose service has died writes one
  warning naming the task.
- scripts/qtest_iosurface_pci.py checks the device under qtest (27 checks).

Checked: cargo xtask check and the suite on the M3 Max; reims-ctl's install
and a cold boot on um780; stock, reims-util and ported-driver guests booted
on gem10 and ms01 with the isolation rule, Apple's driver's tasks in
process at about 62 fps, the port's isolated.
2026-10-17 06:43:31 +03:00
Anees Iqbal 6ebfb6d9d9 🐛 Move metal2vulkan to 29d3ebb22e: no boot death, no Mac hang
29d3ebb22e is metal2vulkan's development: one commit on 0175289314 whose
tree is development-fast c66863112e's. It fixes what 0175289314 broke here:
- An image's first move wrote its kept bytes back over the host's pages
  unconditionally, so on read-only pages it raised SIGBUS (7 Vulkan tests on
  the Mac) and hung the Mac's Vulkan boots of arm64 macOS 26 and 27 under
  QEMU. It now writes back only the bytes the move changed, and only where
  the pages are writable.
- A no-copy buffer released with a keep-alive under a live buffers' table
  announced host-deallocator-delayed, which dies by default, so a cold
  x86-64 macOS 26 boot on Intel (ANV) died. With a keep-alive the
  deallocator now runs at the release, unannounced.

Two new kinds go in DIES (strict mode dies, the default relays): each lets a
value Metal's never gives reach the guest, and each has an exact form the
hardware allows, so a native device does not relay them either.
- UnrestoredFirstMoveBytes: a first move's changed byte on pages the host may
  not write, left as the move wrote it. Not among DIES_BY_DEFAULT: the
  driver's move writes the bytes, and no run has met it.
- The note TessellationTriangleOrder: the device tessellator's triangle
  order, on every device but MoltenVK on an Apple GPU. A patch draw there now
  dies of it first, ahead of TessellationFactorEdgeCases, so the two
  patch-draw tests expect the kind the device's tessellator decides.

HostDeallocatorDelayed's doc and the ledger's padded_reads row say what the
runtime now does.

For the guest and the host: x86-64 guests boot on Intel again, and the Mac's
Vulkan path boots again. In strict mode a patch draw off Apple's GPUs dies of
the tessellator's note.

Checked at c66863112e, the same tree: cold boots of x86-64 macOS 26 on the
780M and Iris Xe and of arm64 macOS 26 and 27 on the Mac's Vulkan path, with
no fatal line; Vulkan and core tests 2711/2711 on both Linux hosts; the
Mac's cargo xtask check, whose only failures pass run alone.
2026-10-16 13:07:17 +03:00
Anees Iqbal e946214f8f 🐛 Match metal2vulkan 0175289314's kinds, levels and resolves
The pin move to 0175289314 left the Vulkan platform out of step with the
runtime: seven new degradation kinds unplaced (so
every_degradation_kind_is_placed_once failed and the notice path relayed
them unreviewed), a changed macOS 27.0.1 level, resolve rules that now cover
every 16-bit float resolve, and a 16-bit float blend the runtime now
announces.

New kinds, placed by the answer layer's rules, with docs from the runtime's
text at the pin:
- In DIES (strict mode dies, the default relays), where a value the guest
  reads can differ from Metal's: unorm-depth-slope, signed-depth-test,
  visibility-count-per-color and the note color-attachment-groups.
- Relayed as Metal's answer at a cost: shader-unorm-depth,
  synthesized-geometry-stage and emulated-tessellation-draws, whose
  records-pool overflow now dies named (TessellationRecordsOverflow).
- The docs of the kinds the pin changed say what the runtime does now
  (Depth16 deviations, FunctionStorageAssumed, DeviceInterpolation,
  CubeGradientFootprint, DepthDenormals, HostDeallocatorDelayed).

The MacOS27_0_1 level answers as the M3 Max under 27.0.1 (26A434), where it
answered as an Apple M4: 630 to 645 are described by neither level, and
newSharedTextureWithDescriptor: of 630 to 650 at Private storage answers
nil there, as Metal on the M3 Max does, where it died at the creator. The
tests assert the levels as the runtime answers them.

The runtime's resolve rules now cover R16Float, RG16Float and RGBA16Float at
2 and 4 samples, so device_rounded's exemption for them could match no pass;
it now relays (strict mode: dies) every DeviceRoundedResolve it hears.

A safe-math output blended One and Zero into a 16-bit float attachment is
announced as HalfOutputPrecision, as Metal keeps the zero factor's product
there; half_apart now counts every 16-bit float blend but Min and Max as
past the bound.

The accuracy ledger's padded_reads row says the runtime now keeps an image's
bytes over host pages across its first move, with its known gap.

For the guest and the host: by default nothing changes but the nil answer at
the 27.0.1 level. In strict mode a draw announcing one of the four DIES
kinds, or a One/Zero 16-bit float blend, dies at its selector, naming the
kind.
2026-10-16 12:10:23 +03:00
Anees Iqbal c03936edfc 🐛 Boot arm64 macOS 27 guests: virtio capabilities in address order
A macOS 27.0.1 (26A434) guest showed a black screen on vmapple: each of its
virtio devices read the PCI_CFG capability at 0x84, then the notify
capability at 0x70, then started over, about 100 000 config reads a second.
QEMU links the capabilities from high offsets to low, and macOS 27's virtio
transport never starts a device whose list runs that way. No device's status
left 0, the root disk saw no I/O, and the kernel never reached its GPU
driver. macOS 26 walks the same list once and goes on.

vendor/qemu's d235e51310, Jesus Martínez's change, relinks the capabilities
in address order on vmapple-virtio-blk-pci, and on virtio-net-pci under
x-ascending-capabilities, and gives the disks Apple's vendor capability;
fbda9c8b28 turns x-ascending-capabilities on in vmapple's defaults.

What the guest sees: the same capabilities at the same offsets, linked in
ascending order, and on its disks one more, Apple's. A macOS 27.0.1 guest
reaches Setup Assistant and its login window on the library's Metal
platform, and a macOS 26 guest still reaches its desktop, each booted with
reims-ctl's command unchanged. reims-ctl's QEMU takes this at its next
update; no VM's settings change.

docs/qemu.md lists the commits and records the measurements.
2026-10-14 23:51:03 +03:00
Anees Iqbal 2631a11edc 🐛 Move metal2vulkan to 720ef1ce9a: exact padded surfaces
metal2vulkan fd22785008..720ef1ce9a (18 commits, one per work packet) brings:
- padded guest surfaces, whose rows lie with bytes between them (a browser's
  tiles): on every device but MoltenVK, one a pass draws into or a shader
  writes is the runtime's shadow, as a render pass may write back any byte of
  its attachment and Metal never writes those bytes (measured on the M3 Max);
  a loaded colour attachment copies back only the rectangle bounding its draws'
  scissors, and a pass that reaches no tile copies nothing. One that only reads
  stays an image over the buffer's bytes, and REIMS_VGPU_EXACT's new
  `padded_reads` takes the shadow for it too;
- scheduler fixes: a commit left to the scheduler is taken in before its next
  check, and a commit's passes are bounded;
- function storage measured on the RTX 3090 (128 KiB) and RX 7900 XTX (96 KiB),
  where FunctionStorageAssumed no longer fires;
- threads a runtime thread starts no longer inherit its utilization floor;
- the execution status through a binding where the device addresses no
  buffer, the macOS 27 fixes on the M3 Max, and a half texel's NaN as Metal's
  under nan_and_min_max on MoltenVK, which the docs now say MoltenVK answers
  only under that switch;
- RUNTIME_VERSION 1211, SEMANTICS 1698.

Checked on the same runtime sources before metal2vulkan squashed its history:
cargo xtask check on the M3 Max (only the known macOS 27 failures); the Vulkan
and core crates' tests on Iris Xe, two 780Ms, the RX 7900 XTX, the RTX 3090
and the RTX 5080 Laptop GPU (nothing new but load flakes that pass alone); and
a cold boot of the x86-64 guest on each, with no fatal line. Iris Xe's steady
frames/s at the users' scheduling class matched the last round's.
2026-10-14 20:32:08 +03:00
Anees Iqbal 06f3069b34 🐛 Keep the trace's diagnostics quiet, flushed and documented
The review of the surface crash fix (be81ac03c) and the trace (9b93b71db)
found nothing wrong with either one's behaviour. It did find places where the
trace's diagnostics misbehave, or where the docs say something the code does
not do.

- REIMS_VGPU_TRACE_DEGRADE asked the runtime to announce every occurrence of
  every kind as soon as REIMS_VGPU_TRACE was set. The sink writes those to
  the trace, and relays a once-only kind only once, but only where the
  trace's file opened. With a path that could not be created, every
  occurrence went to stderr, some once per draw. The request now takes the
  sink's own condition, trace::on(). The variable is now on only at "1",
  like REIMS_VGPU_STRICT; before, any value turned it on, "0" included.
- A death aborts without running Drop, so a trace lost up to its last
  quarter second of events, the ones a hunt like the DEVICE_LOST one needs
  most. Core's one death path now flushes the trace after its stderr line
  and before abort(). The flush takes the file's lock only with try_lock,
  so a death never waits on it. trace.rs's doc now says when lines are
  written: a write flushes once a quarter second has passed since the last
  flush.
- a_line_per_event checks every line the trace writes, an imp/impfree pair
  included, flushed the way a death flushes.
- A surface over a single range of pages lies in the host's RAM, which the
  host maps and unmaps and core never unmaps through VulkanVm. So its unmap
  hold defers nothing under QEMU. surface.rs, remap.rs and the device
  test's doc now say so. The hold stays: it costs one leaf lock per import,
  and the test's second case still pins it.
- docs/api.md lists REIMS_VGPU_TRACE and REIMS_VGPU_TRACE_DEGRADE as
  diagnostics of the Vulkan platform; the Metal platform writes no trace.
- trace_degradations' doc gives the runtime's rule for announcing every
  occurrence: inside a program call or a host step only. A breach is the
  runtime's: a build with debug assertions aborts there, and the dist's
  release build logs a misplaced-notice line.

Nothing the guest or host observes changes, with or without the variables.
Checked: core's trace:: and raise::death tests, the Vulkan crate's answer::
and platform:: tests on the M3 Max, and clippy for macOS and x86-64 Linux.
2026-10-14 14:11:53 +03:00
Anees Iqbal b1058d16fb 🆕 Say "click to capture input" in an uncaptured window's title
The title said nothing until input was captured, so someone new to the
window had no hint that a click into the image captures the keyboard, or
that it was not captured yet. Uncaptured, the title now ends " — click to
capture input", on macOS (AppKit's and SDL's window) and on Linux, and it
says so again after a release. Captured, it reads as before.

features.md's entries for the title now say both states, guarded by the
renamed capture::the_title_says_whether_input_is_captured; docs/api.md and
the macOS walk name the new title.
2026-10-14 12:23:53 +03:00
Anees Iqbal 7685e5027a 🆕 Let x86-64 VMs run on VMware SVGA in QEMU's own window
An x86-64 VM's edit form (e) and reims-ctl set --graphics now choose between
reims-vgpu and QEMU's VMware SVGA II, for when a guest should come up without
the library: the firmware's framebuffer, one display, no GPU acceleration.

With VMware SVGA the library takes no part: vmware-svga takes apple-gfx's slot
and its id, gfx, which the terminal viewer's screendumps and input name, the
library's window and GPU variables and warnings are left out, and QEMU's own
GTK window shows the display. install-ctl.sh builds Linux QEMU with GTK for
it; on a QEMU without it, start refuses and names reims-ctl update. With no
Wayland compositor or X server in QEMU's environment (reims-ctl's, under the
VM's extra environment), GTK would end QEMU at its start, so the VM runs
headless under -display none there, as the library's window does. The edit
form hides the display and GPU fields on VMware SVGA and keeps their values
for a switch back; a test pins that a field following one the form lacks (an
arm64 VM's, with no graphics choice) still shows.

Booted on msi-laptop (docs/qemu.md): macOS 26.6.1 reaches its desktop at
1280x720 in QEMU's window, the viewer's screendump and input work, and stop
shuts it down.
2026-10-14 00:33:10 +03:00
Anees Iqbal 9ec90bb632 🐛 Give x86-64 VMs no ACPI S3, so a sleeping guest's display wakes
An x86-64 macOS guest that system-sleeps never gets its display back. Idle
sleep or Apple menu > Sleep puts it in S3, and in QEMU only PS/2 input
requests a wakeup: the USB keyboard and tablet on qemu-xhci leave it
suspended behind a black window. A wake that does come (an RTC alarm,
QMP system_wakeup) resets every device, and the guest's GPU driver
restores none of the device's state, so WindowServer waits on the GPU
for good and the guest hangs.

q35 VMs now run with ICH9-LPC.disable_s3=1. The guest's sleep then stops
at a dark wake: the display turns off and input through the window turns
it on again, in all 8 rounds measured on um780 (docs/qemu.md, "x86-64
macOS guests: sleep").
2026-10-13 23:27:37 +03:00
Anees Iqbal a5777987ef 🔥 Drop the 2048-pixel warning for x86-64 VMs
An x86-64 VM's details warned that a display wider than 2048 pixels, or
resolution = "host", crashes its WindowServer. With ReimsVgpu.kext in its
OpenCore image and the host's real-extent check, macOS 26 runs such a display,
so the warning would steer people off a resolution that works; an image
without the kext now gets its own line (opencore.rs), which says how to
replace it.

docs/qemu.md's section says what fixes it and what was measured with the kext,
and the README no longer says there is no kext.
2026-10-13 19:34:48 +03:00
Anees Iqbal b859025495 🐛 Stop PerfPowerServices spinning on x86-64 guests' SMC
macOS 15.4 and later walk the SMC's keys at boot, asking isa-applesmc for
key after key by index until it answers that the index is out of range.
QEMU's device took reads alone and answered every other command "bad
command", so the walk never ended: on an x86-64 macOS 26.6.1 guest behind
reims-util's OpenCore, PerfPowerServices ran a vCPU at 100% from boot on,
and QEMU used more than a host core with the desktop idle, as a user
reported.

vendor/qemu's 8d795445f2 answers GET_KEY_BY_INDEX, listing four keys in
the order of their names and answering 0xb8 past the last. The walk now
ends: PerfPowerServices used under 1 s of CPU in its first 3 minutes, and
QEMU 15% to 25% of a core once the guest settled, from 119%.

What the guest sees: GET_KEY_BY_INDEX answered where it was refused.
Every other command, every key and every value are as before. reims-ctl's
QEMU takes this at its next update; no VM's settings change.

docs/qemu.md describes what the device answers and what the boots measured.
2026-10-13 15:47:45 +03:00
Anees Iqbal 0d44fea30a 🐛 Keep QEMU alive when a guest process dies with work queued
A guest empties a task's object list when the process that owns it ends,
without waiting for the execs that process queued. On an x86-64 macOS 26
guest the icon services abort as they start (Metal's nil device
architecture, docs/qemu.md), and the host, still compiling pipelines for
earlier execs, reaches their last execs after the lists are gone. Most
lookups then fail and fault the exec, but two answered nil where nil ends
the process:
- A pipeline descriptor's function: Metal aborts on a render descriptor
  with no vertex function, and QEMU died at Setup Assistant on a new
  install (2 of 10 boots on an RTX 5080 Laptop GPU host). A function whose
  entry is empty now raises the function lookup's failure.
- A resource named by UseResources in a concurrent compute encoder, where
  Metal ends the process at a nil entry. Such a reference whose entry is
  empty now raises too. Serial encoders, barriers and the render lists
  keep the nil, which Metal skips.
The Vulkan platform ended the process at a nil entry of
useResources:count:usage:stages:, which nothing had measured on Metal.
Metal skips it (measured here), and so does the platform now.

reims-ctl adds dump-guest-core=off to the q35 machine on Linux hosts. With
guest RAM in the core, a crash took QEMU 26 s to go away (a 2.7 GB core)
while its window stayed frozen; with the option, 1 to 4 s. QEMU refuses
the option on macOS, so the vmapple command line is unchanged.

What the guest and host observe: an exec whose pipeline function, or whose
concurrent UseResources reference, has an empty entry faults instead of
ending the process. interplay_lifetime_held_pipeline_function_retyped is
recorded again; interplay_lifetime_emptied_resource and
interplay_lifetime_emptied_resource_render are new. Six boots of the new
install to Setup Assistant on the fixed builds kept QEMU alive, though
none reached an empty function entry. docs/qemu.md records the race's
measurements and why no value the host answers avoids the nil
architecture.
2026-10-13 01:24:15 +03:00
Anees Iqbal 4a8bfb4ebd 🆕 Give x86-64 guests VMX where the host's KVM offers it
With VMX in its CPU, a macOS guest's Hypervisor.framework works, so Docker,
UTM and other VMs run inside it. reims-ctl adds vmx=on to -cpu only where
kvm_intel is loaded with nested on, the one place KVM can give it: AMD's KVM
offers SVM, which macOS does not drive, and HVF offers neither. Elsewhere the
command is unchanged, so QEMU's check never drops the flag with a warning.

It is vmx=on, not +vmx, so a VM's vmx=off or -vmx in cpu_flags takes it away:
QEMU applies name=value flags in order and + and - ones after them, so a +vmx
would outlive a vmx=off.

Booted on homelab-ms01 (i9-13900H, nested Y) from overlays of its macOS 26.6.1
guest, on Haswell-noTSX and on Skylake-Client-noTSX-IBRS: no dropped feature,
kern.hv_support 1 in the guest, and a clean desktop and shutdown
(docs/qemu.md).
2026-10-12 22:30:53 +03:00
Anees Iqbal 39d6ca78ef 🆕 Make new x86-64 VMs from reims-util's macOS downloads
A new x86-64 VM needed an OpenCore image and an installer made by hand with
OSX-KVM or ULTMOS. reims-ctl now runs reims-util for both: pick a macOS
version (n in the interface, create --macos on the command line) and it
downloads the installer from Apple, makes the VM's OpenCore image with OVMF
and a Mac identity of its own, and makes the disk.

- create --macos VERSION downloads Apple's recovery image (about 1 GB), or
  with --offline an installer of one release (13 to 20 GB). Installers are
  kept in the data directory's installers for the next VM, one reims-util at
  a time writes there, and a stopped download continues. The download comes
  before the VM's directory, so stopping it leaves no VM half made, and
  reims-util ends with reims-ctl on Linux. What create is given (a disk, an
  installer, an OpenCore image and the OVMF beside it, reims-util itself) is
  checked before the download and the disk's copy, and the VM list is read
  again before the VM joins it, so VMs made or deleted during a download
  stay as they are.
- --opencore is optional: without it reims-util makes the image, with the
  VM's MAC as its ROM, and an iMacPro1,1 for macOS 10.13 and 10.14. An image
  of the user's brings OVMF_CODE.fd and OVMF_VARS.fd beside it, as
  reims-util writes them.
- The interface's form asks where macOS comes from, the version first; with
  no name, the VM takes the version's, skipping names a VM or a leftover
  directory has. A VM with an installer says in its details, and create
  prints, how to install macOS from it; one made from a disk is reminded to
  set Metal's error mode.
- A new disk needs an installer or a download: a VM of an empty disk and no
  installer is refused.
- Every installer attaches as a read-only disk (snapshot=on), a DMG
  converted to a raw image in the VM's directory, so the CD drive is gone: a
  change of installer applies at the next start. vm.toml's installer_kind
  is no longer written, and is ignored where an older vm.toml has it. A
  missing installer says how to eject it.
- reims-ctl __record-install, which scripts/install-ctl.sh runs last,
  installs reims-util at the commit reims_util.rs pins, so the update that
  brings this reims-ctl installs it too, though it runs the script it
  started with. doctor checks for it in place of the system's OVMF, and the
  install no longer adds the ovmf or edk2-ovmf package.
- vm.max_map_count: a new VM's default of up to 16 GiB needs about 1.13
  million mappings, more than the 1048576 suggested (CachyOS's stock
  value). The README, the install script, doctor and the start warning
  suggest 2097152, which covers 30 GiB, and check against what the VM, the
  largest VM or a new one's default needs.
- Updating from the interface while a create runs says the restart stops
  it, as quitting does.

Dropped, as reims-util's images leave nothing for them to cover:
- create --from-script and the interface's launch-script import, which read
  OSX-KVM's and ULTMOS's QEMU scripts. A VM made from one keeps working; its
  vm.toml names its own copies.
- The search for OVMF beside a user's OpenCore image in those projects'
  layouts, QEMU's edk2 build and the distributions' packages, and
  --firmware-code and --firmware-vars.
- create --disk-mode overlay: copy, a reflink where the file system can, or
  in-place covers an existing disk. A VM made with an overlay keeps working.
- --cpu-model and --cpu-flags on create and set, and the edit form's CPU
  fields: new VMs take Skylake-Client-noTSX-IBRS. vm.toml keeps cpu_model
  and cpu_flags, so an older VM keeps its model; docs/qemu.md says how to
  change it there.
- --installer's --iso and --cdrom aliases.

README, the help and the docs no longer point at OSX-KVM or ULTMOS. README
step 3 describes reims-util's OpenCore picker (5 seconds, which an arrow key
stops, measured on homelab-ms01), and architecture.md 11.4 counts its image
among those that keep AvoidRuntimeDefrag on.
2026-10-12 19:37:12 +03:00
Anees Iqbal 8b00782076 📝 Record why x86-64 guests' WindowServer dies above 2048 px
A tester's x86-64 macOS 26 guest crashed WindowServer at boot at 2736x1704,
with METAL_ERROR_MODE set. The cause is the guest's own: x86-64 SkyLight
draws a large window in 1024-pixel tiles over a no-copy buffer, the guest's
Metal plugin refuses every bottom-row tile but the first, and SkyLight then
indexes its shorter texture list unchecked. At three tiles across the reads
leave the list's allocation and WindowServer dies.

Record the code read, the plugin's refusals in the guest's log and the
measured death rates by width, so that the 2048-pixel limit has its reason.

[ci skip]
2026-10-12 14:49:21 +03:00
Anees Iqbal 24b37c9ac5 🐛 Keep host-copied textures out of incoherent memory on Intel
Arrow Lake-S's iGPU shares no last-level cache with the host, and ANV's one
host-cached memory type there is not coherent. metal2vulkan placed Shared and
Managed textures in it for their host copies, and the GPU read stale 64-byte
lines of them: an x86-64 macOS guest showed sparse, fully transparent 4x4-pixel
blocks in its boot logo, Dock icons and widgets, a third of the logo's interior.

metal2vulkan edb5ffd8cc takes a host-cached type for those textures only where
it is also coherent, and never one the host maps without coherence; on such a
GPU they lie in its coherent type, whose host reads are slower. Every GPU whose
cached types are coherent (NVIDIA's, RADV's, MoltenVK's, lavapipe's) keeps its
placement. A cold boot of the guest on that iGPU shows no blocks; docs/qemu.md
records the measurements.
2026-10-12 13:47:08 +03:00
Anees Iqbal dd1934ca1f 🐛 Give new x86-64 VMs the Skylake-Client-noTSX-IBRS CPU model
Haswell-noTSX is model 60, stepping 1, and XNU panics on Haswell steppings
below 3. It booted only behind an OpenCore that replaces CPUID leaf 1, as
ULTMOS's image does; OSX-KVM's current image, which the README points to
first, does not. Skylake-Client-noTSX-IBRS is a model XNU knows, so the guest
boots with or without that spoof, and it is what OSX-KVM's launcher now uses.

Cascadelake-Server, the other model suggested, was ruled out: on AMD hosts
it exposes AVX-512, whose state XNU saves at Intel's XSAVE offsets only, and
a macOS 26 guest on a Zen 4 host lost mask registers across a signal handler.
docs/qemu.md records the measurements.

Existing VMs keep the model their vm.toml names.
2026-10-12 13:09:33 +03:00
Anees Iqbal 36102ed710 Merge branch 'development' into steelbrain/x86-metal-error-mode-docs 2026-10-12 11:54:05 +03:00
Anees Iqbal 88c9d3e72d 🐛 Import pages RADV refuses as host memory as udmabuf dma-bufs
RADV imports host memory as an amdgpu userptr, which Mesa asks for with
AMDGPU_GEM_USERPTR_ANONONLY, so the kernel refuses every page with a file
behind it. The guest's RAM and every view the library makes are memfd pages,
so on an AMD GPU a macOS guest died at its first no-copy buffer.

The runtime (metal2vulkan 11715e2a3f) now asks the caller for dma-bufs of
the pages wherever the pointer import is refused, on any driver. The library
answers with /dev/udmabuf: it resolves the range through the backing table,
gives the shared block of zeros' pieces a file of the import's own, cuts the
runs into chunks within udmabuf's limits as the host has them (1024 pieces
and 64 MiB by default, which no one is asked to raise) at the runtime's bind
granule, and pads several chunks to the granule. The runtime binds them
behind one sparse buffer, and asks again for a texture's own pages. Its own
memfds are sealed against shrinking, which udmabuf requires. A refusal names
its cause in the death line.

reims-ctl and the installer warn when a VM that would run on an AMD GPU
cannot open /dev/udmabuf (the kvm group's on Ubuntu), and reims-ctl's logs
show the device and its limits.

On the Radeon 780M (RADV of Mesa 26.0.8, udmabuf at its defaults) the guest
now cold-boots to its desktop, and Safari loads a page and quits: 5,119
dma-buf requests, none refused. NVIDIA, which imports the pointer, and macOS
are unchanged.
2026-10-12 11:50:33 +03:00
Anees Iqbal b3dc2d2728 📝 Set Metal's error mode from Recovery on new x86-64 installs [ci skip]
A beta tester's new x86-64 macOS 26 install showed only its wallpaper: no
menu bar, no Dock. The README's step was a command for the guest's Terminal,
which a new install never reaches. Without METAL_ERROR_MODE, iconservicesagent
ends as it starts, and the Dock and the menu bar wait on it with no timeout;
a guest that ran before has icon caches to draw from, a new install has none.

Reproduced on an RTX 3090 host with a macOS 26.6.1 guest on an overlay: with
the icon caches deleted and no key, only the wallpaper at 5 min, the Dock's
main thread in a synchronous XPC call to iconservicesagent. The key written
from Recovery brought the desktop back, once two traps were out of the way:
a defaults path with a glob that matches no file writes a literal path in
Recovery's RAM disk, and defaults leaves the file at mode 0600, which the
user's processes cannot read. The README now gives the Recovery steps,
checked as written, and the Dock cache step for an icon left blank;
docs/qemu.md records the measurements.
2026-10-12 03:44:12 +03:00
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 2624fe619b 📝 Move the README's developer reference to docs/development.md [ci skip]
The README now speaks to people running VMs through reims-ctl. The repository
layout, the tests and the Rust library's crates, commands, profiles and
features move to docs/development.md, which the README's Developing section,
AGENTS.md and the docs that cited those sections now point to. The QEMU and VM
section is gone (docs/qemu.md covers it), as are History, whose tags AGENTS.md
now names itself, and the interoperability note under Legal.
2026-10-11 22:10:39 +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