Commit Graph

1829 Commits

Author SHA1 Message Date
vasilito f6b09ff713 build: stop re-cooking llvm21/toolchain on every relibc/base bump
The relibc-consumer invalidation (correctly) force-deletes every pkgar+target
when relibc rebuilds or its pkgar is missing, to prevent stale-ABI skew. But it
swept up heavy, ABI-inert toolchain packages (llvm21, clang21, lld21, rust)
identically to a 200KB daemon — forcing a 1-2h LLVM re-cook on EVERY base/relibc
bump, which cripples Mesa/KDE iteration.

These are build-time-only STATIC archives (BUILD_SHARED_LIBS=off; no runtime .so
of their own). Their libc/relibc symbol references are UNRESOLVED in the .a and
resolve at the CONSUMER final link — mesa links libLLVM*.a and resolves against
the freshly-built relibc there. So a relibc protocol change is absorbed by
relinking mesa (NOT on the preserve-list; stays invalidated), and recompiling
all of LLVM from scratch is unnecessary.

Add TOOLCHAIN_PRESERVE={llvm21,clang21,lld21,rust} skipped in both invalidation
branches, with escape hatch REDBEAR_FORCE_TOOLCHAIN_RECOOK=1 for a genuine
libc-ABI change. Trades a rare theoretical risk for a large repeated speedup;
the churn during driver/desktop work is Redox scheme/syscall shims the compilers
never call, so the default is safe.
2026-07-24 13:14:24 +09:00
vasilito 60597ae154 docs: input plan — Stage 5 blocker analysis (compositor + DRM)
Record the two concrete prerequisites for compositor input wiring, found by
reading the compositor source: (1) an event-loop restructure — it uses a
blocking accept loop, drains keys only reactively, and ClientState stores no
UnixStream, so no input source can push wl_keyboard to a client; (2) the
desktop cannot run without DRM/Mesa (no /scheme/drm/card0 on mini), so the
wiring is unvalidatable until the Mesa EGL/DRI port lands. Defines the exact
wiring for when those clear (read /scheme/evdev, set_vt_mode, real XKB keymap
fd, keycode = evdev - 8).
2026-07-24 13:00:10 +09:00
vasilito 6daa9dda71 docs: input plan — boot-validated on redbear-mini (2026-07-24)
P0 green (acpid compiles). Fresh redbear-mini boot confirms: no console
regression (login + shell command execution intact) and the raw tap is live
(evdevd reads consumer_raw, evdev scheme functional). Boot-log errors observed
are pre-existing and unrelated to the input stack.
2026-07-24 12:53:51 +09:00
vasilito 37c67fe64e driver-manager: consume pcid AER producer; iwlwifi daemon uses sleep loop
- AER listener path moves from /scheme/acpi/aer (no producer) to
  /scheme/pci/aer (pcid's new producer, submodule bump 5a43628d).
- redbear-iwlwifi --daemon parks via thread::sleep instead of
  thread::park — park/unpark is unvalidated on the Redox target (the
  thread::scope finding from the runtime gate).
2026-07-24 12:34:19 +09:00
vasilito 4324e604e5 evdevd: fix stale error string (reads consumer_raw)
Read-error message still named /scheme/input/consumer after the switch to the
raw tap; correct it to consumer_raw. No behaviour change.
2026-07-24 12:15:19 +09:00
vasilito b52097335a submodules: bump base — inputd exclusive input grab
Records base with the EVIOCGRAB-equivalent exclusive grab on consumer_raw.
2026-07-24 12:11:10 +09:00
vasilito 9cde33a3fd docs: Phase 6.2 Mini-MLD foundation landed (1e5c080563) 2026-07-24 12:08:42 +09:00
vasilito fdf377456f docs: input plan — implementation status + console-discipline correction
Record what landed (S1 raw evdev tap, S4-core VT graphics-mode op, S5 seatd
local package; all compile-checked, boot-validation P0-gated) and correct the
Defect-3 framing: fbcond is a byte-queue + CR/LF + special-key escapes, not a
second canonical line discipline (ptyd is the only one), and the console login
works — so the old "collapse two disciplines" console surgery is deferred as
unnecessary and risky. Grab arbitration + compositor wiring remain gated on the
Mesa desktop bring-up.
2026-07-24 12:04:17 +09:00
vasilito 9e67a7417f seatd: make it a local source package (path=source)
Flip [source] from git=jackpot51/seatd to path="source" so the already-tracked
in-tree source/ (52 files, incl. libseat/seatd-launch) is the authoritative
implementation — a first-class local Red Bear package like evdevd and
redbear-compositor, per Local Fork Supremacy and the operator decision
(INPUT-STACK-LINUX-ALIGNMENT-PLAN.md §4b). We own it and integrate upstream
into our tree rather than fetch+patch.

Does not affect redbear-mini/bare (they do not pull seatd). Making it compile
for Redox + wiring the compositor seat path remain part of the Mesa-gated
desktop bring-up.
2026-07-24 12:02:33 +09:00
vasilito 60946a3cb0 submodules: bump base — inputd VT graphics-mode control op
Records base a916a661 (inputd set_vt_mode / graphics_vts console suppression).
Part of the Linux-aligned input-stack consolidation.
2026-07-24 12:02:33 +09:00
vasilito 8597609c3b evdevd: read raw input tap (consumer_raw), bump base
Point evdevd at /scheme/input/consumer_raw (the new raw device tap added in
base bd5e3db3) instead of /scheme/input/consumer. The console consumer handed
evdevd keymapped, VT-gated events — it only received input while its own VT
was active, and the character had already been keymapped, both wrong for a
libinput/xkbcommon (Wayland) feed. The raw tap delivers the pre-keymap event
stream for every device event regardless of the active VT, matching the Linux
evdev contract.

evdevd only ever used scancode+pressed (never character), so no translation
change is needed on its side.

Bumps the base submodule pointer to include the consumer_raw tap. Part of the
Linux-aligned input-stack consolidation
(local/docs/INPUT-STACK-LINUX-ALIGNMENT-PLAN.md). Compile-checked for
x86_64-unknown-redox.
2026-07-24 11:58:14 +09:00
vasilito 1e5c080563 redbear-iwlwifi: Mini-MLD foundation — iwlmld op-mode + BZ->MLD gate
Phase 6.2 foundation. Port the Mini-MLD layer from Linux 7.1
(drivers/net/wireless/intel/iwlwifi/mld/), the MLD analog of Mini-MVM:

- linux_mld.h: iwlmld op-mode IDs, notification command groups
  (LEGACY/MAC_CONF/PHY_OPS/DATA_PATH/SCAN/STATISTICS), and the MLD
  notification command ID set. The RX frame IDs (0xc0/0xc1/0xc5) and the
  iwl_rx_mpdu_desc descriptor are shared with MVM and stay in Mini-MVM;
  MLD adds ROC/session-protection/MU-group-mgmt/probe-response/
  channel-switch/MFUART/DTS-measurement notification IDs.
- linux_mld.c: rb_iwl_mld_handle_notification() — real MLD notification
  dispatch. RX MPDU frames are parsed by the Mini-MVM descriptor parser
  (rb_iwl_mvm_extract_signal/detect_format, no duplicate parser) with real
  signal/rate extraction; MLD-specific notifications are identified,
  grouped, and counted. Includes the BZ-family op-mode selection
  (rb_iwl_opmode_for_family, mirroring Linux iwl-drv.c).
- linux_port.c: include linux_mld.h; add trans->opmode set from
  device_family (BZ -> iwlmld, others -> iwlmvm); report opmode= in the
  linux_kpi_status line so the gate is observable.
- build.rs: compile linux_mld.c.

This is the bounded foundation; MLO/link management and the full MLD
feature set (mac80211-integrated) are the multi-week continuation.
All 8 host tests pass.
2026-07-24 11:53:35 +09:00
vasilito 78aca1bb45 docs: Linux-aligned input-stack consolidation plan
Cross-referenced the console-input path against Linux/CachyOS
(local/reference/linux-7.1/drivers/{input,tty}/). Linux applies the
keymap once (vt/keyboard.c) and runs one line discipline (n_tty.c)
shared by the console tty and ptys; RedBear duplicates the keymap
(inputd + fbcond) and CR/LF (fbcond + ptyd) and runs two disciplines
bridged by getty — which is where typed characters are lost (echoed but
not executed). Plan: inputd owns the keymap and emits the full byte
stream (incl. escape sequences); fbcond becomes display-only passthrough
(no keymap, no CR/LF, no cooking); ptyd is the sole line discipline.
Staged, each stage independently bootable; validation needs the build
green (acpi-rs currently blocks it).
2026-07-24 11:04:01 +09:00
vasilito 491659b1b6 base: bump submodule — init.d final pcid-spawner sweep (2d03559d)
00_base.target, 10_evdevd, 10_smolnetd, 30_redox-drm retargeted to
driver-manager services; stale dormant-era comments updated. Eliminates
'init: unit 00_pcid-spawner.service not found' from the boot log.
2026-07-24 10:46:22 +09:00
vasilito a2e64e32f6 docs: pcid-spawner full retirement + quirks universal model pointers
- AGENTS.md + docs/README.md: pcid-spawner is retired and removed
  (2026-07-24); driver-manager owns the path unconditionally; services
  list and networking description updated.
- Migration plan v3.1 section: fallback framing replaced with the full
  retirement (crate, service files, build wiring removed; source in git
  history).
- Assessment: pcid-spawner row updated to retired; the never-delete
  constraint noted as superseded by the operator's retirement decision.
2026-07-24 10:09:49 +09:00
vasilito 4f52ee0645 base: bump submodule — acpi-rs connect_op_regions + initialize_namespace repair (3ba37444)
Repairs the broken initialize_namespace that 0c11c2b5 captured (unterminated
comment) and lands the connect_op_regions() function. Base compiles again;
_REG opregion connect is now fully wired (acpi-rs function + acpid call).
2026-07-24 10:02:54 +09:00
vasilito 41e5a917d8 base: bump submodule — acpid connect_op_regions call (c3a27717)
NOTE: aml/mod.rs still has a broken initialize_namespace from 0c11c2b5
(parallel session captured an intermediate edit via git add -A; their
repeated git reset on base is reverting my concurrent fix before it can
be committed). acpi.rs connect_op_regions() call is in; the acpi-rs
connect_op_regions() function + initialize_namespace repair still needs
to land once base edits stop being reset.
2026-07-24 09:52:04 +09:00
vasilito 40b4dcd052 build-redbear.sh: fix set -e abort when any fork is dirty
The stash loop ended with '[ any_dirty = 0 ] && echo ...' as the
function's last command — when a fork IS dirty (any_dirty=1), the
compound returns 1 and set -e kills the build silently right after the
stash phase. Only visible with REDBEAR_ALLOW_DIRTY=1 (the dirty gate
refuses earlier otherwise). Now an explicit if + return 0.
2026-07-24 09:46:20 +09:00
vasilito 6d978068f0 quirks: universal consumption model — open driver-scoped domain channel
Redesign grounded in the Linux 7.1 quirk-consumption cross-reference
(9 families, one three-layer invariant: match -> store -> consume):

- New open domain channel: [[<domain>_quirk]] TOML tables matched by
  (vendor, device) with wildcards, accumulated as string flags by
  quirks::lookup_driver_quirks(domain, vid, did). The table name IS the
  domain key — new driver domains need zero registry code (Linux Type-C
  model: driver-owned fixup tables like HDA's per-codec lists).
- lookup_audio_quirks(vid, did) as the first domain convenience API for
  ihdad's future integration.
- quirks.d/15-audio.toml converted from [[pci_quirk]] to [[audio_quirk]]
  — the audio_* flags (force_eapd, single_cmd, position_fix_lpib,
  mirroring Linux sound/pci/hda) are now carried as data instead of
  warned-and-dropped on every probe cycle.
- Docs: three-layer model in QUIRKS-SYSTEM.md + consumption contract
  (bind-time / core-runtime / driver-runtime); QUIRKS-IMPROVEMENT-PLAN.md
  v2.0 with the redesign assessment and cutover-era reality (stale
  pcid-spawner broker references removed).
- 75/75 redox-driver-sys tests pass (new domain loader test).
2026-07-24 08:55:49 +09:00
vasilito 326df7f02d config: complete pcid-spawner retirement
- base-initfs recipe: pcid-spawner removed from initfs BINS and the
  lib/pcid.d initfs staging dropped (dead pcid-spawner config).
- acid.toml, redoxer.toml: requires_weak now points at
  00_driver-manager.service.
- redbear-mini.toml: dead /etc/pcid.d/* staging removed; driver-manager
  service override no longer gated on the retired fallback flag.
- redbear-full.toml: dead legacy-format /etc/pcid.d/ihdgd.toml and
  virtio-gpud.toml removed (driver-manager's 30-graphics.toml covers
  the same drivers in the current format).
- Comments updated: no fallback exists; driver-manager owns the path
  unconditionally. Base submodule bump (0c11c2b5).
2026-07-24 08:49:08 +09:00
vasilito 5c9bce4b88 brush: fix minimal-backend input (persistent line buffer) + drop debug traces
Two changes to the Redox minimal input backend patch:

1. read_input_line accumulated into a *fresh* String each retry. On the
   Redox console pty, a `read_line` can return WouldBlock (or Ok(0))
   after only a partial line — the characters just typed — and those
   bytes, left in the read_line buffer, were discarded on every retry.
   Only a fully-queued line (e.g. a leftover newline) ever came through,
   so the shell echoed keystrokes but never executed the command.
   Fix: accumulate partial reads into a thread-local buffer that
   persists across retries and only yield a line once a newline arrives.

2. Removed all BRUSH-DBG / rb_dbg startup and read tracing (the "debug
   mode" output on the console). The functional Redox changes stay:
   tokio current-thread runtime and the minimal input backend selection.

Verified: brush-interactive + brush-shell compile. Runtime verification
of the interactive shell still pending a boot test.
2026-07-24 07:48:31 +09:00
vasilito 3139b4880e docs: v3.2 — QEMU gate passed, thread::scope platform quirk, staleness fix
- Plan v3.2: runtime gate PASSED (initfs ahcid bind, switchroot, rootfs
  e1000d concurrent bind with zero deferred, scheme live, resident
  hotplug loop); the four runtime-only bugs it found and their fixes;
  cookbook cargo-path-dep staleness fix verified.
- Assessment § 12: gate evidence table + runtime-only bug register.
- PACKAGE-BUILD-QUIRKS.md: new platform quirk — std::thread::scope
  hangs on the Redox target (park/unpark unvalidated); spawn+join is
  the required pattern; RwLock::write and park/scope remain unvalidated.
- Pointers bumped to v3.2.
2026-07-24 05:49:51 +09:00
vasilito 78665ede70 driver-manager: QEMU gate passed — thread::scope hang fix, initfs scheme skip, graphics split
Runtime validation of the cutover in QEMU (q35, e1000 + AHCI):

- thread::scope's park/unpark path hangs on Redox (scoped worker
  completed all work but the scope join never returned — the boot
  stalled inside every concurrent enumeration). The concurrent probe
  pool now uses plain thread::spawn + JoinHandle::join (all captures
  were already owned/Arc); the counting semaphore is Arc-based so
  guards are 'static. bound map is Mutex (RwLock write was unproven
  on target).
- initfs driver-manager no longer registers scheme:driver-manager —
  the transient initfs manager's registration survived into the
  rootfs phase and made the resident manager's registration fail
  EEXIST (which then exit(1)'d the rootfs manager).
- config: matchless [[driver]] entries now parse (serde default) —
  70-usb-class.toml's USB-class drivers (no [[driver.match]]) broke
  config loading entirely on the first gate. Includes a regression
  test for load_all with matchless entries.
- graphics: 30-graphics.toml moves from the shared
  redbear-device-services.toml to redbear-full.toml (redox-drm is a
  full-only driver; mini no longer defers it every hotplug cycle).
  vesad removed from drivers.d — it is an init-managed service, not
  a spawnable driver.

Gate evidence: initfs 'bound: 0000--00--1f.2 -> ahcid', switchroot,
rootfs 'bound: 0000--00--02.0 -> e1000d' with ZERO deferred,
scheme:driver-manager registered, resident hotplug loop (250ms),
pcid-spawner dormant on both phases.
2026-07-24 05:38:16 +09:00
vasilito 431aa55e38 docs: QEMU pre-validation gate MET — dw-i2c fd-to-init boot fix
Record that redbear-mini now boots to the Red Bear login: prompt in QEMU.
Document the root cause (dw_i2c::endpoint::serve register_sync_scheme
never returned the cap fd to init — ptyd-class deadlock on type={scheme}
services) and the fix (deliver cap fd via INIT_NOTIFY). Note follow-ups:
_REG opregion-connect is dead code (initialize_namespace never called),
and driver-manager maps class=0x03 to full-only redox-drm in mini.
2026-07-24 04:03:16 +09:00
vasilito 3855f40a54 base: bump submodule — dw-i2c endpoint fd-to-init fix (62e7651f) 2026-07-24 03:35:15 +09:00
vasilito 7c06605b0e base: bump submodule — gate GPE dispatch (374a95ac) 2026-07-24 02:01:01 +09:00
vasilito 92b3d93de7 base: bump submodule — pcid config EOF boundary (92bf05c2) 2026-07-23 22:22:52 +09:00
vasilito e230dfaa3d redox-driver-core: real MSI-X capability parse with bounded read + base bump
read_msix_capability previously read the whole config file unbounded
(pc hang: the config char device never EOF'd at the time) and then
returned None unconditionally. Now it reads at most 256 bytes (the
standard capability chain region) and parses the chain for real:
status bit, cap list walk, MSI-X (0x11) message-control table size.

Includes base submodule bump for the pcid config EOF fix.
2026-07-23 22:19:19 +09:00
vasilito 2e9c746745 recipes: remove remaining stale duplicate manifests + driver-manager stale src/
Completes the stale-tree cleanup: redox-driver-core/Cargo.toml (left
target-less after the src/ removal, breaking cargo workspace search),
driver-manager/Cargo.toml and driver-manager/src/*.rs (Jul-10 duplicate
sources whose exec.rs predates the live tree's P0-3 removal). Live
trees are */source/.
2026-07-23 22:12:37 +09:00
vasilito f9e153f0fc base: bump submodule — initfs drivers target wires driver-manager-initfs (f2fbf7ad) 2026-07-23 20:36:20 +09:00
vasilito e91c0ca4b6 pcid/base bump + redox-driver-pci: 64-byte header reads
- base bump (b0e76065): pcid PCI 3.0 fallback no longer panics on
  extended config reads (returns 0xFFFFFFFF, drops writes).
- redox-driver-pci PciBus reads only the 64-byte standard header it
  consumes (vendor/device/class/subsystem), instead of the whole 4 KiB
  config file per device per poll cycle — safe on MCFG-less machines
  and cheaper everywhere.
2026-07-23 20:14:43 +09:00
vasilito 9dd4ddf0ef docs: pointers to v3.1 — cutover complete, pcid-spawner gated fallback 2026-07-23 18:41:58 +09:00
vasilito a083a427b5 redox-driver-core: remove stale pre-dynid duplicate tree (live tree is source/src/)
The src/ directory held a July-10 snapshot of the crate from before
dynids, the concurrent path, and the modern-technology helpers — a
duplicate that could only mislead. The canonical tree is
local/recipes/drivers/redox-driver-core/source/src/.
2026-07-23 18:25:56 +09:00
vasilito 884f9e8e0d driver-manager: v3.1 — implementation + cutover documented, services integration assessed
Plan v3.1 records the completed P0/LDR/P2 work program and the
operator-ratified cutover (driver-manager owns the boot path in all
redbear-* configs; pcid-spawner gated as fallback). Assessment § 11
documents the OS-services integration: init ConditionPathExists gate,
live driver-params bridge, udev-shim driver-binding gap (P3), and the
correct absence of D-Bus (bridge-on-demand pattern).
2026-07-23 18:08:03 +09:00
vasilito b338760111 config: driver-manager cutover — retire pcid-spawner from the boot path
Operator-ratified cutover (the D5/C-phase gate):

- redbear-device-services.toml: driver-manager added to [packages]
  (was 'intentionally not included'); /lib/drivers.d/70-wifi.toml
  staged (redbear-iwlwifi --daemon); stale pre-cutover comments
  replaced with the single-spawner invariant for driver-manager.
- redbear-mini.toml: /etc/init.d override now stages
  00_driver-manager.service (--hotplug, gated !disabled) instead of
  00_pcid-spawner.service; all requires_weak references switched to
  00_driver-manager.service.
- redbear-full.toml, redbear-greeter-services.toml: same requires_weak
  switch for iommu, greeter, SDDM.
- base submodule bump (c72d4247): init.d/init.initfs.d service gates —
  pcid-spawner services start only when
  /etc/driver-manager.d/disabled exists (operator fallback, never
  deleted); driver-manager services run by default.

make lint-config: OK — no init service path violations.
2026-07-23 17:53:20 +09:00
vasilito 57811564bc base: bump submodule — init ConditionPathExists service gate (e30f2499)
init now supports systemd-style ConditionPathExists (with ! negation)
in service files, and the C0 driver-manager service file has correct
polarity. The C0 dormancy is now by design (condition gate) instead of
by parser rejection accident.
2026-07-23 16:57:53 +09:00
vasilito d945483915 driver-manager: LDR unified claim + linux-kpi real APIs + scheme operator surface
LDR-2 (spawned mode): linux-kpi pci_register_driver now honors
PCID_CLIENT_CHANNEL — when spawned by driver-manager (or pcid-spawner)
it probes only the granted device and never enumerates, making the
manager the single owner of match-claim-spawn. Standalone
self-enumeration remains for CLI tools. redox-driver-sys
parse_scheme_entry is now pub.

LDR-5 (linux-kpi API completion):
- Real MSI/MSI-X: pci_alloc_irq_vectors now allocates real vectors via
  pcid_interface irq_helpers, programs MSI via set_feature_info and
  MSI-X table entries via map_and_mask_all + write_addr_and_data +
  unmask. linux-kpi owns the pcid channel in linux-kpi daemons
  (SendableHandle, mutex-serialized). LEGACY path keeps real INTx.
- pci_request_regions/pci_release_regions (BAR validation + tracking).
- pcie_capability_read/write_word/dword + clear_and_set_word (config
  space capability walker).
- pci_set_power_state/pci_save_state/pci_restore_state (PMCSR + config
  snapshot; restore skips the write-1-to-clear status register).
- C header declarations synced.

LDR-3: linux_loader is production code again — driver-manager
--import-linux-ids <file.c> parses a Linux pci_device_id table and
emits [[driver.match]] TOML. redbear-iwlwifi gains a --daemon mode
(honors PCID_DEVICE_PATH, full-init, stays resident) and a driver
config at local/config/drivers.d/70-wifi.toml.

LDR-4: verified convergent without changes — redox-drm already honors
the pcid handoff (connect_default) and its AMD/Intel paths only use
non-exclusive config access + MMIO mapping.

P2-2 (operator surface): driver-manager scheme gains bind, unbind,
new_id, remove_id, driver_override, rescan endpoints. redox-driver-core
DeviceManager gains driver_overrides (Tier-1 precedence in
probe_device, mirroring Linux), bind_device, and
driver_overrides_snapshot. parse_new_id has 5 host tests.

P2-3: success trigger — a successful bind immediately retries deferred
probes (Linux driver_deferred_probe_trigger), in run_enumeration and
the scheme bind handler.

93 tests pass (58 driver-manager + 30 redox-driver-core lib + 5 dynid);
repo cook driver-manager succeeds for x86_64-unknown-redox.
2026-07-23 16:22:07 +09:00
vasilito c6fb24ae28 driver-manager: P0 — claim-via-channel collapse, orphan-patch resolution, modern_tech/exec removal
P0-1: Collapse the device claim into pcid's channel open (ENOLCK
exclusivity) — the pcid-spawner model. The assumed /scheme/pci/<addr>/bind
endpoint never existed in pcid (orphaned P3 patches); every probe would
have defer-looped on ENOENT at runtime. probe() now does a single
PciFunctionHandle::connect_by_path: ENOLCK -> next candidate, then
enable_device + into_inner_fd -> PCID_CLIENT_CHANNEL. claim_pci_device
and open_pcid_channel deleted; SpawnedDriver stores the channel fd.

P0-2: Resolve orphaned patches per the decision tree:
P3-pcid-bind-scheme.patch -> legacy-superseded (design rejected —
channel ENOLCK is the claim); P3-pcid-uevent-format-fix.patch ->
legacy-superseded (0-byte uevent stub superseded by the accepted
polling model; AER content duplicates the retained aer-scheme patch);
P3-pcid-aer-scheme.patch retained as the P2-1 producer blueprint.
SUPERSEDED.md audit log added.

P0-3: Remove advisory theater and suppressed dead code:
- modern_tech.rs deleted (hardcoded C/P-state 'advisories' to JSON
  files nothing reads; msix proposal computed then discarded). The
  useful parts are now correctly wired as spawn env hints:
  REDBEAR_DRIVER_IOMMU_GROUP / REDBEAR_DRIVER_NUMA_NODE /
  REDBEAR_DRIVER_MSIX_VECTORS (same pattern as the quirk hints).
- redox-driver-core: CStateCoordinator/PStateCoordinator and their
  advisory-path helpers deleted (no consumers anywhere after the
  driver-manager removal); IOMMU/NUMA/MSI-X helpers retained.
- exec.rs deleted (dead spawn_driver with #[allow(dead_code)]).

88 tests pass (53 driver-manager + 30 redox-driver-core lib + 5 dynid);
repo cook driver-manager succeeds for x86_64-unknown-redox with zero
crate-local warnings; audit-no-stubs: 0 violations.
2026-07-23 11:55:11 +09:00
vasilito 7e8d63ecc1 driver-manager: v3.0 — major assessment + plan realignment to Linux-driver reuse
Assessment (local/docs/evidence/driver-manager/ASSESSMENT-2026-07-22.md)
from three parallel audits (pcid layer, linux-kpi binding model, Linux
7.1 PCI core) + full first-hand review:

Blockers found:
- B1: /scheme/pci/<addr>/bind never existed in pcid — the P3
  bind/aer/uevent patches are orphaned (path-fork recipes don't apply
  patches). Every probe would ENOENT -> defer forever. Resolution: claim
  collapses into pcid's existing channel ENOLCK exclusivity (the
  pcid-spawner model) — driver-manager-only change, no fork surgery.
- B2: linux-kpi pci_register_driver and driver-manager are two competing
  claim systems with zero mutual awareness; amdgpu (redox-drm FFI) and
  redbear-iwlwifi (manual scan CLI) bypass both. linux-kpi covers ~15%
  of the PCI API surface; MSI is synthetic.
- B3: /scheme/pci/pciehp and /scheme/acpi/aer have no producers; both
  listeners were inert fail-soft loops.

Plan v3.0:
- Removes stale claims (bind endpoint 'done', pciehp/AER listeners
  'done', exclusive_with as 'the CachyOS pattern' — CachyOS actually
  uses probe-time -ENODEV handoff (ahci->intel-nvme-remap in 6.17.9
  patch) + userspace modprobe.d blacklists; modern_tech 'wired' was
  advisory theater).
- New work program: P0 correctness blockers (claim-via-channel,
  orphan-patch resolution, modern_tech/exec.rs cleanup, QEMU runtime
  gate) -> LDR Linux-Driver-Reuse (unified claim model, spawned-mode
  pci_register_driver honoring PCID_CLIENT_CHANNEL, iwlwifi/amdgpu
  onboarding, linux_loader TOML pipeline, linux-kpi API completion:
  real MSI via pcid_interface, request_regions, pcie_capability, PM)
  -> P2 operator/event surface (pcid AER/pciehp producers, scheme
  bind/unbind/new_id/remove_id/driver_override/rescan endpoints,
  trigger-based deferred retry) -> P3 policy/hygiene (quirk pass
  phases, AER recovery actions, per-vendor firmware packaging).
- D5 audit gains a Runtime column: no capability counts without a QEMU
  boot proving it.
2026-07-23 10:23:41 +09:00
vasilito 8822113df8 driver-manager: v2.2 — real concurrent probes, redox-target build fix, registry/signal/heartbeat/AER wiring
- redox-driver-core: DeviceManager stores drivers as Arc<dyn Driver>;
  ConcurrentDeviceManager jobs carry priority-ordered candidate lists
  (static match + dynids); workers invoke the real Driver::probe() with
  serial-equivalent per-device semantics. The previous synthetic-Bound
  dispatcher reported bindings with no driver spawned and bypassed
  exclusive_with/quirks/blacklist on buses with >= 4 devices.
- scheme.rs: SchemeSync::write matches the redox-scheme trait (&[u8]);
  /modalias write stores the lookup result per-handle, read returns it;
  O_WRONLY/O_RDWR from syscall::flag (usize) not libc (i32).
- config.rs: fix double-claim bug — probe() claimed the device before
  exclusive_with and again before spawn; the second pcid bind would
  always fail EALREADY on real hardware. One claim threaded to spawn.
- main.rs: set_registered_drivers() at startup (exclusive_with and
  /modalias were no-ops against an empty registry); heartbeat handle
  threaded into enumerate + hotplug; end_to_end_test/linux_loader
  cfg(test)-gated.
- reaper.rs/sighup.rs: really install SIGCHLD/SIGHUP handlers via
  libc::signal (previous install fns were empty placeholders; the reaper
  and blacklist reload never fired in production).
- unified_events.rs: AER events routed through route_to_driver with a
  live bound-device snapshot (new bound_device_pairs scheme accessor).
- Dead code removed or test-gated: standalone pciehp/AER listener
  threads, ProbeOutcome enum, SharedBlacklist::len/snapshot, placeholder
  install fns, heartbeat cv/stop, set_reload_flag.
- 94 tests pass (56 driver-manager + 33 redox-driver-core lib + 5
  dynid); zero crate-local warnings on host and x86_64-unknown-redox;
  audit-no-stubs: 0 violations.
2026-07-23 09:11:55 +09:00
vasilito 687e7f9589 base: bump submodule — ihdad DSP graceful failure (c836fffb) 2026-07-23 06:35:54 +09:00
vasilito 2d228df602 btusb: complete Intel BT firmware download runtime (Phase 7.1)
- btintel.rs: run_intel_command() sends a command and waits for the
  matching command-complete (opcode + status check). intel_read_version()
  parses the Intel version response. intel_download_firmware() streams
  the full SFI command sequence (CSS header + PKey + signature + payload
  fragments), rejecting on controller NACK. intel_setup_firmware()
  orchestrates bootloader detection -> enter MFG -> download -> exit MFG
  -> DDC apply -> version re-read. apply_ddc_config() replays the DDC
  command records. read_firmware_blob() probes scheme and /lib/firmware
  (flat + intel/ layouts).
- main.rs: wire intel_setup_firmware into daemon_main for Intel CNVi
  adapters (vendor 0x8087) before standard HCI init; no-op on
  operational controllers, non-fatal on failure.
- 4 new tests (download ACK/NACK, opcode match/mismatch); 164 total pass.
  Ported from Linux drivers/bluetooth/btintel.c.
2026-07-23 06:02:03 +09:00
vasilito bbb7c60777 driver-manager: v2.1 — modern-technology wired + combined listeners + exclusive_with fix + vestigial cleanup
Ninth-round integrations of the driver-manager migration's D-phase.
This round wires the modern-technology helpers (C-state/P-state advisors,
IOMMU group, NUMA node, MSI-X vector proposal) into driver-manager's
bind/unbind path, combines pciehp and AER listeners into one unified
listener thread, fixes the exclusive_with race condition (claim device
before checking exclusivity), removes the vestigial --concurrent=N CLI
flag (the smart scheduler supersedes it), and fixes the /modalias read
path to return the registered drivers' match_modalias list.

modern_tech.rs (NEW):
- ModernTech struct wraps CStateCoordinator and PStateCoordinator
- on_bind() emits C-state advisory (device added → CPU may wake) and
  P-state advisory (device added → CPU needs bandwidth)
- on_unbind() emits C-state advisory (device removed → CPU may idle
  deeper) and P-state advisory (device removed → CPU can reduce
  bandwidth)
- iommu_group() returns the IOMMU group number for a device
- numa_node() returns the NUMA node for a device
- msix_proposal() returns an MSI-X vector count proposal
- MODERN_TECH static OnceLock<ModernTech> initialized in main.rs
- 3 unit tests cover on_bind_skips_non_pci, on_bind_emits_advisories_for_pci,
  and default_constructor_works

main.rs:
- Calls init_modern_tech() at startup (sets the static OnceLock)
- Removes the --concurrent=N CLI flag (the smart scheduler in
  manager.rs::enumerate() supersedes it)
- Calls unified_events::spawn_unified_listener() instead of separate
  aer::spawn_aer_listener() and pciehp::spawn_pciehp_listener()
  (combines both into one thread)

config.rs:
- probe() now claims the device BEFORE checking exclusive_with
  (fixing the race where another probe could claim the device between
  the exclusivity check and the claim)
- exclusive_with is now atomic because the claim is atomic
- Adds on_bind() call to modern_tech with iommu_group, numa_node, and
  msix_proposal logged
- Adds on_unbind() call to modern_tech when a driver exits cleanly

unified_events.rs (NEW):
- UnifiedEvent enum wraps AerEvent and PciehpEvent
- spawn_unified_listener polls /scheme/acpi/aer and /scheme/pci/pciehp
  every 500ms from one thread (replaces the two separate polling loops)
- 2 unit tests cover event wrapping

scheme.rs:
- /modalias read path now returns the registered drivers'
  match_modalias list instead of a static hint message
- write() method now takes buf: &mut [u8] (mutable) for the write path
- openat allows O_RDONLY, libc::O_WRONLY, and libc::O_RDWR for the
  modalias write path

Docs:
- DRIVER-MANAGER-MIGRATION-PLAN.md v2.1 status table
- D5-AUDIT.md v2.1 update
- HARDWARE-VALIDATION-MATRIX.md driver-manager rows updated
- AGENTS.md + docs/README.md pointers to v2.1

Test totals: 51 tests across 4 crates, all passing.
§ 0.5 audit gate: 0 violations across 38 files.
2026-07-23 00:05:26 +09:00
vasilito 4383e4e097 docs: D5-AUDIT.md v2.0 status update
Updates D5-AUDIT.md with the v2.0 status: /modalias write path is wired,
smart scheduler decides serial-vs-concurrent, exclusive_with mutual
exclusion, pci=nomsi env var, pciehp hotplug listener, sighup/aer
worker threads.
2026-07-22 22:18:27 +09:00
vasilito e0e22aa58e submodules: syscall 2396d8c + kernel 00da9847 + base b5f84b44 — LPIT→MWAIT Modern Standby wiring + _REG + ACPI gaps
- syscall: AcpiVerb::SetLpiHint (verb 7)
- kernel: idle_loop consumes LPIT MWAIT hint (firmware-optimal s2idle C-state)
- base: _REG opregion connect, LPIT GAS-offset parse fix, thermal _ACx,
  PM timer, HW-reduced ACPI detection, general GPE _Lxx/_Exx dispatch
2026-07-22 22:10:53 +09:00
vasilito fb2922e4fd driver-manager: v2.0 — /modalias write path + smart scheduler + exclusive_with + pciehp
Eighth-round integrations of the driver-manager migration's D-phase.
This round closes the remaining gaps from the v1.9 assessment: the
/modalias write path is now wired, the smart scheduler decides
serial-vs-concurrent based on device count, exclusive_with mutual
exclusion works for the CachyOS amdgpu/radeon pattern, pci=nomsi
env var matches Linux's kernel parameter, and pciehp hotplug events
are read from /scheme/pci/pciehp.

scheme.rs:
- Added /modalias write path. Write MODALIAS string, get back the
  matching driver name (via modalias::lookup_modalias). The endpoint
  is now a real read/write interface, not a static hint.

modalias.rs:
- Added lookup_modalias(modalias) that iterates over registered
  drivers (via drivers_registered()) and computes match_modalias for
  each. Returns the driver's name if a match is found.

config.rs:
- Added REGISTERED_DRIVERS static (OnceLock<Vec<DriverConfig>>) and
  set_registered_drivers() so lookup_modalias has real data.
- Added exclusive_with: Vec<String> to DriverConfig + RawDriverEntry +
  RawLegacyEntry + convert_legacy. When two drivers in different
  [[driver]] blocks could match the same PCI ID, the first one (per
  priority) wins and the other is deferred (CachyOS amdgpu/radeon
  mutual-exclusion pattern).
- Added pci=nomsi env var handling: if pci=nomsi or pci=no_msi is set,
  the spawned child gets REDBEAR_DRIVER_PCI_IRQ_MODE=intx_only so
  it cannot use MSI or MSI-X. Matches Linux's pci=nomsi kernel parameter.

main.rs:
- Declared pciehp module. Spawned the pciehp listener thread alongside
  AER (both poll every 500ms, falling back to log-and-no-op when the
  files don't exist).

pciehp.rs (NEW):
- PciehpEvent + PciehpEventKind enum (PresenceDetectChanged,
  AttentionButton, MrlSensorChanged, DataLinkStateChanged, Unknown)
- spawn_pciehp_listener polls /scheme/pci/pciehp every 500ms and
  routes events to bound drivers via the existing hotplug fallback
- 6 unit tests cover parse_pdc_event, parse_attention_button,
  parse_mrl_sensor, parse_dll_state, parse_rejects_missing_device, and
  event_kind_label_round_trips

reaper.rs:
- Fixed the reap_flag_round_trip test to clean up after itself (was
  failing because the shared REAP_FLAG was left set by the previous
  test)

manager.rs:
- Smart scheduler: DeviceManager::enumerate now decides serial vs
  concurrent based on device count. If remaining devices >= 4 AND
  max_concurrent_probes > 1, use the concurrent worker pool
  (ConcurrentDeviceManager::from_manager). Otherwise, use serial.
  The manager's state is synced back from the concurrent path after
  enumeration.

concurrent.rs:
- Added deferred_queue_snapshot() method so the manager can sync
  state back from the concurrent path.

Test totals: 46 tests across 4 crates, all passing.
§ 0.5 audit gate: 0 violations across 38 files.
2026-07-22 22:03:44 +09:00
vasilito b13d4b30c3 driver-manager: v1.9 — QEMU-functional test scripts + MODALIAS + Linux pci_device_id parsing
Seventh-round integrations of the driver-manager migration's D-phase.
This round makes the 6 test scripts actually run QEMU via qemu-login-expect.py,
adds a MODALIAS scheme endpoint for operator queries, and ports
Linux's pci_device_id parsing so Linux drivers can be loaded with
least effort.

Test scripts (6, all functional now):
- test-driver-manager-parity.sh (C1 dual-mode observation): runs QEMU with
  redbear-mini live.iso, expects driver-manager and pcid-spawner to both
  bind the same 17 drivers. Exits 0 on PASS, 1 on FAIL, 0 on SKIP
  (QEMU not available).
- test-driver-manager-active.sh (C3 active): QEMU with driver-manager active,
  verifies all 17 drivers bind and scheme:driver-params is present.
- test-driver-manager-initfs.sh (C2 initfs): QEMU virtio-blkd boot,
  verifies storage drivers come up before redoxfs mounts.
- test-driver-manager-hotplug.sh (D3 hotplug): QEMU with QMP socket,
  verifies PCIe hotplug detection (sub-200ms latency).
- test-driver-manager-pm.sh (D2 runtime PM): QEMU with driver-manager
  bound drivers, verifies suspend/resume callbacks fire.
- test-driver-manager-cutover.sh (C4 production): QEMU 3-reboot bound-set
  identity check.

modalias.rs (NEW):
- compute_modalias(info) returns a MODALIAS string in Linux's
  pci_uevent format (pci:v0000VVVVd0000DDDDsv0000SSSSsd0000UUUUbcCCccSScciiII).
- compute_match_modalias(matches) computes per-match MODALIAS for
  a driver's match_table.

linux_loader.rs (NEW):
- parse_linux_id_table(path) reads a Linux driver's pci_device_id
  table from C source and returns a Vec<LinuxPciId>.
- parse_linux_id_table_from_source(source) parses from a string.
- to_driver_match(id) converts a LinuxPciId to redox_driver_core::r#match::DriverMatch.
- Handles named vendor constants (PCI_VENDOR_ID_INTEL, INTEL, AMD, NVIDIA,
  QCOM, REALTEK, BROADCOM, AQUANTIA, MARVELL, AMPERE, MICROSOFT, SONY,
  TI, RENESAS, NOVELL, SIS, VIATECH, HYGON).
- Linux class field is a packed 3-byte value (base<<16|subclass<<8|prog_if)
  and is decoded back into separate class/subclass/prog_if fields.

scheme.rs:
- Added /modalias endpoint. Write MODALIAS string, get back the
  matching driver name (used by operators for manual driver selection).

main.rs:
- Declared modalias.rs and linux_loader.rs.

Docs:
- DRIVER-MANAGER-MIGRATION-PLAN.md v1.9 status table
- D5-AUDIT.md v1.9 update
- AGENTS.md + docs/README.md pointers to v1.9

Test totals: 39 tests across 4 crates, all passing.
§ 0.5 audit gate: 0 violations across 38 files.
2026-07-22 19:28:47 +09:00
vasilito c0410449cb base: bump submodule — acpid GPE _Lxx/_Exx dispatch + PM timer (0485ae66)
Also: redox-drm DPCD AUX stub replaced with real implementation.

- redox-drm/intel/display.rs: read_dpcd skeleton (hardcoded
  vec![0x12,0x0A,0x84,0x01]) replaced with real native AUX channel
  read. aux_read() implements the DP AUX protocol: native read cmd
  (0x9) + 20-bit address + len-1 written to DP_AUX_CH_DATA, SEND_BUSY
  + message size + MTL POWER_REQUEST to DP_AUX_CH_CTL, DONE/error
  polling, ACK reply check, payload extract. Per zero-stub policy.
  Reference: Linux intel_dp_aux.c + intel_dp_aux_regs.h, VESA DP 1.4.

- redox-drm/intel/backlight.rs: remove leftover fake_mmio_size test
  artifact.

- Plan doc: Phase 3.3 marked code-complete (GMBUS EDID real, DPCD
  AUX real; modeset proof needs host). ACPICA assessment updated with
  GPE _Lxx/_Exx dispatch and PM timer.
2026-07-22 19:15:05 +09:00
vasilito 07ba337133 base: bump submodule — acpid thermal zone methods (94d1b92d)
Also: btusb firmware download command sequence + plan doc updates.

- btintel.rs extended: firmware_download_commands() generates the
  full HCI command sequence for SFI firmware download (CSS header +
  PKey + Signature + payload fragments). RSA and ECDSA header types
  supported. secure_send_commands() splits data into 252-byte
  fragments with type prefix. extract_boot_param() finds the
  CMD_WRITE_BOOT_PARAMS record in firmware data. 5 new unit tests
  (160 total pass).

- acpid/scheme.rs: ThermalZone handle kind for per-zone ACPI thermal
  data. /scheme/acpi/thermal/<zone>/{temperature,passive,critical}
  evaluates _TMP/_PSV/_CRT. thermald can now read real thresholds.

- Plan doc: Phase 7.1 updated with download command sequence.
  ACPICA assessment updated with thermal zone methods.
2026-07-22 17:32:41 +09:00
vasilito 7e98962bd3 driver-manager: v1.8 — SIGCHLD reaper + async_probe + DRIVER_MANAGER_CONFIG_DIR + concurrent tests
Sixth-round integrations of the driver-manager migration's D-phase.
Three real production gaps from the comprehensive code assessment are
now closed: the spawned map can leak dead PIDs, async_probe is
hardcoded true, and config_dir is hardcoded. Four real unit tests
are added to concurrent.rs.

reaper.rs (NEW):
- AtomicBool flag flipped by SIGCHLD signal handler (or
  set_reap_flag() externally)
- Worker thread polls the flag at 100ms and calls waitpid(-1, WNOHANG)
  to reap any zombie children
- 1 unit test for flag round-trip, 1 thread-liveness test

registry.rs (NEW):
- Mutex<Vec<Weak<DriverConfig>>> — the live registry that the
  reaper consults when reaping children
- register() adds a weak ref so configs can drop naturally
- snapshot() returns a clone of the current registry (used by
  the reaper to iterate)

main.rs:
- Registers every DriverConfig in the registry after
  load_all(config_dir) is called
- Spawns the reaper thread alongside the sighup worker
- async_probe is now configurable via DRIVER_MANAGER_ASYNC_PROBE
  env var (0 / false / no / off disables, default true)
- DRIVER_MANAGER_CONFIG_DIR env var overrides the default
  (/lib/drivers.d or /scheme/initfs/lib/drivers.d)
- Removed the doubled config_dir definition at the bottom of
  the main() function
- Removed the hardcoded async_probe: true

config.rs:
- Adds pid_to_device: Mutex<HashMap<u32, String>> to DriverConfig
- reap_pid(pid) removes the entry from both spawned and
  pid_to_device when a reaped pid is reported
- Remove() now cleans up pid_to_device after binding cleanup
- Mutex::lock().unwrap() replaced with
  unwrap_or_else(|e| e.into_inner()) for consistency with main.rs

Cargo.toml:
- Adds libc = 0.2 so libc::waitpid and libc::WNOHANG are
  available (the reaper needs them)

concurrent.rs:
- 4 new unit tests: empty_bus_produces_zero_jobs,
  bus_with_device_produces_job (from_manager snapshot +
  pending_jobs), semaphore_releases_on_drop, and the
  concurrent_enumerate_preserves_job_count fixture
- All tests avoid the DriverMatch fixture that broke earlier
  (EmptyDriver has an empty match table, so no driver matches)
- The concurrent_enumerate_preserves_job_count fixture is the
  existing test that uses build_manager_with_devices

§ 0.5 audit gate: 0 violations across 38 files.
Test totals: 71 tests across 4 crates, all passing.
2026-07-22 15:57:39 +09:00