Repository navigation
Conversation
Design round only: an empty commit for review of the input service, generic PCI identity constraints, per-architecture claim capacity, compositor input consumption, and isolated virtio input devices.
|
Design review: #868 at BLOCKER
NOTE
SEND BACK |
|
Closed on the owner's ruling: ARM gets input through the USB keyboard and tablet that |
Problem and result
The ARM shipping image initializes graphics and starts the compositor, but
the compositor exits because no input source can supply its keyboard and
mouse handles. Input should have one userland owner on both architectures.
The kernel should retain device claims, DMA isolation and interrupt delivery;
it should neither drive virtio input nor interpret its event records.
Design
Add
system/inputserverand have the compositor receive itsinputport.The same
images/system.tomlstarts it on both architectures. It owns theexisting keyboard/mouse device handles where those are present and any
virtio input PCI functions its manifest names. The compositor consumes one
input protocol regardless of which devices the machine has. This moves
source selection and state merging into userland, and gives the future USB
driver an existing destination rather than another kernel injection API.
Use
toyos-pci-claimandtoyos-virtiofor transport, register bounds,isolated grants and split queues. Virtio input configuration is read and
validated before accepting events; the driver handles key transitions,
relative or absolute pointer reports, and
SYN_REPORTbatches. Keyboardcodes become the HID usages the SDK already exposes. A malformed device
record ends that source by name. The service merges held keys, modifiers
and buttons across its live sources and releases the state of a source that
ends. Events and initial state reach only the compositor's endowed
connector; the server bounds pending handshakes and never blocks on a
client. A slow reader is ended by name rather than silently losing a
release. Reconnection starts from an explicit state snapshot.
Extend the generic PCI selector with an optional exact class/subclass
constraint. Vendor/device matches alone continue to require a unique
function; a constrained request also requires a unique function. Never
choose by enumeration order or hard-coded slot. QEMU's keyboard and tablet
share
1af4:1052, but its PCI binding declares keyboard and other-inputclasses respectively (QEMU's PCI input binding).
That discriminator is standard PCI identity, not an emulator override.
The driver still validates the input capabilities after the claim.
Replace the shared four-slot assumption with claim capacity derived from
each architecture's interrupt allocation. Every admitted function keeps its
own remapped interrupt and domain; no shared device interrupt broadcasts
activity to unrelated holders. The allocation remains bounded by the
architecture's available interrupt identifiers, with exhaustion refused.
This is required by ordinary machines with several userland drivers, not
just by the two virtual input devices.
The ARM interactive QEMU shape adds
virtio-keyboard-pciandvirtio-tablet-pci, each withiommu_platform=on. Both are driven fromisolated PCI claims with ITS interrupts. The x86 machine keeps its existing
input sources and feeds them through the same service. No program contains
an architecture-specific input path.
Roast and alternatives
The largest cost is introducing a service and an IPC protocol while the
kernel still owns the older input drivers. That layer earns its place by
giving all physical input one userland owner and keeping hardware details
out of the compositor. It also moves the merge policy to the place that
can manage source death and reconnection. Growing the kernel's virtio
driver set or manufacturing keyboard availability would get a frame
sooner but would leave input ownership wrong. Moving all of USB before
ARM input would entangle this with mass storage and its ongoing track.
This design keeps the existing x86 drivers' move in that track, while
providing the destination they will eventually feed.
The PCI selector and interrupt allocator are general prerequisites and
should be reviewed as separate, bounded changes before the driver. They
must not relax ambiguity, per-function interrupt identity, isolation or
release ordering. A service split that duplicates decoding or adds a
fallback instead of owning every live source would be sent back.
Verification and scope
ambiguous matching, interrupt allocation exhaustion, virtio event and
configuration refusal, batch boundaries, merged modifiers/buttons,
source death, client disconnect and snapshot state. Existing register
and DMA boundary implementations stay one instruction deep.
events must reach a running compositor and an application's window.
calc,snakeanddoommust each map a window and present a frame.The same input path is exercised on x86 without changing its visible
or audible quality.
filtering, queue replenishment, batch commit, source release, and input
delivery to the compositor. Each must build and fail its corresponding
check; complete patches and logs accompany the implementation PRs.
and transport oracles. QEMU supplies the event device in guest tests;
it supplies no timing or audio-quality verdict.
Scope: the PCI selector and per-architecture claim capacity, the userland
input owner and protocol, compositor input consumption, the common
manifest, ARM QEMU shape, and their tests. This does not claim the whole ARM
track complete: TLS/cache proofs, persistent USB-backed
/log, full guestcoverage and the LLVM self-hosting comparison keep their existing exits.
Design only: no production implementation has been started for this PR.