virtio-gpu: the scanout device arrives with the spawn

Third driver converted. It no longer claims the id from argv[1] — the
manager holds the device and names it in the call that creates the process,
so it is held before the driver's first instruction.

display-reattach is the case that matters here: it kills the driver and
watches the compositor re-attach to the fresh scanout. It passes, so the
restart path survives the fused grant — the manager re-takes the device when
the driver dies and hands it to the replacement.

ps2-bus and discovery are NOT converted, and the reason is recorded as open
question 9 rather than worked around. Both need a device nobody assigned
them. ps2-bus ignores its argv[1] entirely: it finds the controller by
walking the table for PNP0303, then claims a second device, the PNP0F13
mouse node, which it also finds itself — so it holds two devices and was
assigned at most one, while system_spawn carries one. discovery claims the
acpi-tables node it locates itself, because it is what produces the device
tree and there is nothing to assign at that point.

One thing worth checking before designing an answer: devices.csv maps both
PS/2 hardware ids to ps2-bus, so the manager may already be spawning two
instances where the driver expects one. If so the fix is smaller than it
looks.

D6 stays blocked — closing device_claim with these two still depending on it
would stop the machine booting.

Suite 118/118.
This commit is contained in:
Daniel Samson
2026-08-08 19:48:00 +01:00
parent f23f073624
commit 2ebfccc8ed
3 changed files with 34 additions and 5 deletions
+3 -4
View File
@@ -200,10 +200,9 @@ fn testPixel(index: u32) u32 {
fn initialise(endpoint: ipc.Handle) bool {
_ = endpoint;
device.claim(device_id) catch |e| {
std.log.info("unable to claim device {d}: {s}", .{ device_id, @errorName(e) });
return false;
};
// The device arrived with the spawn — the manager holds it and names it in the call
// that creates this process, so it is ours before the first instruction here
// (docs/os-development/device-authority.md). Nothing to claim.
var descriptors: [64]device.DeviceDescriptor = undefined;
const total = device.enumerate(&descriptors);