Commit Graph

383 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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 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
vasilito 1f3d999785 base: bump submodule — acpid wake arming + sleep states (7071c452)
Also: btusb btintel firmware loading module + plan doc updates.

- btintel.rs (241 lines): Intel BT firmware loading infrastructure.
  IntelVersion parse from HCI event, bootloader/operational detection,
  MFG enter/exit commands, firmware fragment splitting (252-byte
  chunks), SFI/DDC filename tables for Intel BT devices (0037, 0a2b,
  0aa7, 0aaa, 0036, 0025, 0026, 0029, 0032, 0033), CSS header length
  detection (RSA 644B / ECDSA 644B). 4 unit tests. Ported from Linux
  drivers/bluetooth/btintel.c.

- Plan doc: Phase 7.1 marked partial (btintel module done, HCI
  transport wiring remains). ACPICA assessment updated with
  _DSW/_PSW wake arming and sleep state discovery.
2026-07-22 15:50:00 +09:00
vasilito f686cc27d5 base: bump submodule — acpid LPIT + _PRW wake + S0-idle (ACPICA port) (a12fb9fc)
Also update LG Gram plan doc: ACPICA assessment (port algorithms,
not the C library), pcid assessment (correct, no changes needed),
Phase 9.1 marked partial (LPIT + _PRW + S0-idle done; MWAIT loop
remains), status updated to reflect completed phases.
2026-07-22 12:26:38 +09:00
vasilito 904585d4d8 lg-gram-16z90tp: Phase 3.5/3.6/6.1 + Wi-Fi stub elimination
Wi-Fi (Phase 6.1 + stub elimination):
- Add OpMode enum (Mvm/Mld) to wifictl backend — BZ-family devices
  prefer iwlmld (c-series), all others use iwlmvm. Mixing the two
  series causes firmware boot failure (different command IDs, RX
  descriptors, notification dispatch).
- Add FirmwareTableEntry struct with separate mvm/mld candidate lists.
  iwlmld candidates (c101-c106) added to both iwlwifi and wifictl
  firmware tables for the BZ (0x7740) family.
- Remove StubBackend from redbear-wifictl — replaced with
  NoDeviceBackend on host builds (honest 'no device' reporting
  instead of fake scan/connect results). Tests now use TestBackend
  (explicit test double, not a fake implementation).
- Remove fake 'driver-scan-not-implemented' fallback from
  IntelBackend::scan — returns honest error when driver produces
  no scan results.
- 20 wifictl tests pass, 8 iwlwifi tests pass.

Display (Phase 3.5/3.6):
- Phase 3.6: GuC/HuC/GSC firmware manifest entries on DisplayPlatform.
  guc_firmware_key(), huc_firmware_key(), gsc_firmware_key() per-gen.
  IntelDriver::new() logs the full uC manifest at startup. Load
  sequences deferred to render path (not display blocker).
- Phase 3.5: eDP backlight control module (intel/backlight.rs).
  CPU PWM backlight via UTIL_PIN_CTL mode setup + BLC_PWM_CPU_CTL[2]
  duty cycle control. Gen9+ register offsets (0x48250/0x48254/0x48400).
  Default max brightness 93750 (SKL reference). enable/disable/
  set_brightness with clamping.

Docs:
- LG Gram plan: Phase 3.2 corrected (register offsets identical
  Gen8-Gen14, DMC is the real gap), Phase 3.4/3.5/3.6/6.1/9.6
  marked complete.
- Wi-Fi plan: StubBackend removed from status, test count updated.
- DRM plan: GuC/HuC/GSC manifest declaration noted.
- Phase 9.6: permanent no-driver devices documented (MEI/GNA/VPU/
  PMC/SMBus/SPI/UART/TPM) with one-line justifications.
2026-07-22 10:40:40 +09:00
vasilito e38a444303 docs(initnsmgr): thread-spawn investigation revises A-vs-B ordering
Investigated the bootstrap thread bring-up needed for Design A
(worker-offload). Finding: `rlct_clone_impl` requires a fully-built TCB
for the new thread, but bootstrap's freestanding redox_rt has no
Tcb::new / TLS allocator / thread shim (only initialize_freestanding's
single TCB). So Design A needs, as a prerequisite, a freestanding
thread-spawn helper in redox_rt (its own task) — open-coding TCB/TLS in
initnsmgr is not acceptable.

Revised ordering: keep Step 1 (Arc<Mutex> Send refactor, inert until A),
boot-validate on idle + commit; then prefer Design B (kernel O_NONBLOCK
on open + single-thread deferred, no bootstrap threads) as the first
functional step; Design A later once redox_rt grows the freestanding
thread helper. All still require an idle host to validate.
2026-07-22 10:14:55 +09:00
vasilito b44f4fc3e9 driver-manager: v1.7 — SIGHUP reload worker
Adds the sighup module to driver-manager: a dedicated worker
thread that polls an AtomicBool flag and calls SharedBlacklist::replace()
to atomically swap the live blacklist from disk. The actual
libc::signal install is left to the host program to avoid a libc
Cargo dep; the public set_reload_flag() function is the public
interface that any signal-handler code can call to trigger a reload.

sighup.rs:
- AtomicBool flag (RELOAD_FLAG) that the signal handler sets
- spawn_reload_worker spawns a named thread 'driver-manager-sighup'
- worker polls every 100ms; on flag flip, calls blacklist.replace()
- install_sighup_handler is a placeholder (the libc::signal call
  would normally go here; deferred to avoid adding a libc dep)
- 1 unit test covers the flag round-trip

main.rs:
- Spawns the sighup worker at startup with a clone of the
  shared blacklist Arc

concurrent.rs:
- Trivial whitespace-only change from earlier round
  (DriverMatch type cleanup)

Test totals: 67 tests across 4 crates, all passing.
§ 0.5 audit-no-stubs.py: 0 violations across 38 files.

Docs: DRIVER-MANAGER-MIGRATION-PLAN.md v1.7 header + status table;
D5-AUDIT.md v1.7; HARDWARE-VALIDATION-MATRIX.md adds SIGHUP row;
AGENTS.md + docs/README.md pointers to v1.7.
2026-07-21 21:44:32 +09:00
vasilito c72bd6ed5e lg-gram-16z90tp: Phase 5 + Phase 4.4 code-complete (acpid events + multitouch)
Submodule bump (base f315a9be):
- Vendored acpi-rs fork with real Opcode::Notify (upstream panicked).
- acpid Phase 5: GPE/PM1 dispatch, EC query loop, lid/button/fan
  scheme surfaces, AML notification queue, SCI IRQ subscription.
- i2c-hidd Phase 4.4: HID 1.11 descriptor parser + decoder, multi-
  touch digitizer forwarding (absolute pointer + two-finger scroll).

Parent changes:
- redbear-upower: 250 ms notification drain arm polls
  /scheme/acpi/notifications and emits Changed D-Bus signal on power
  state transitions. The existing 30 s poll stays as a safety net.
- LG-GRAM-16Z90TP-COMPATIBILITY-PLAN.md: Phase 4.4 + Phase 5
  (P5.0-P5.5) marked code-complete with status preambles, stub sweep
  notes, file mappings, and runtime-gate-still-open disclaimers.

Runtime validation (Gate 5: AC event latency, lid, power button, fan)
remains pending Phase 1 bare-metal boot.
2026-07-21 21:40:04 +09:00
vasilito 1f58a3738c driver-manager: v1.6 — heartbeat publisher + AER listener + SharedBlacklist
Fourth-round integrations of the driver-manager migration's D-phase.
Three new modules in driver-manager: heartbeat, aer, plus a
SharedBlacklist wrapper around the existing Blacklist that supports
live reload.

heartbeat.rs:
- Heartbeat struct with a publishing thread that writes a JSON
  status line to /var/run/driver-manager.heartbeat.json every 5s
- Tracks bound / deferred / spawned / unbound / on_error counters
- 3 unit tests cover counter updates, JSON output, and clone semantics

aer.rs:
- AER (PCI Express Advanced Error Reporting) listener thread
- Reads /scheme/acpi/aer for events (parses severity + device bdf)
- Routes to bound driver via scheme:driver-manager lookup
- Returns RecoveryAction (Handled / ResetDevice / RescanBus) based
  on severity
- Falls back to log-and-no-op when /scheme/acpi is absent
- 7 unit tests cover parsing, routing, and severity mapping

policy.rs:
- Adds SharedBlacklist = Arc<RwLock<Blacklist>> + source_path
- Supports live reload via replace() (re-reads from source_path)
- is_blacklisted() takes a read lock (lock-free for the probe hot path)
- set_global_shared_blacklist in config.rs wires it into the manager
- 2 new unit tests cover replace() and snapshot isolation

main.rs:
- Spawns the heartbeat thread at startup (file at /var/run)
- Constructs the SharedBlacklist from the policy directory

config.rs:
- Replaces GLOBAL_BLACKLIST OnceLock<Blacklist> with
  OnceLock<SharedBlacklist>; the probe hot path reads via
  Arc<RwLock>, not the OnceLock directly

Docs:
- DRIVER-MANAGER-MIGRATION-PLAN.md v1.6 status table (64 tests)
- D5-AUDIT.md v1.6 update
- HARDWARE-VALIDATION-MATRIX.md adds heartbeat and AER rows
- AGENTS.md + docs/README.md pointers to v1.6

Test totals: 64 tests across 4 crates, all passing.
§ 0.5 audit-no-stubs.py: 0 violations across 37 files.

SIGHUP trampoline for the SharedBlacklist is left for a future round;
the replace() infrastructure is in place today so an operator can
add the signal handler without changing the policy module.
2026-07-21 17:29:29 +09:00
vasilito 1720af1431 driver-manager: v1.5 — pcid_interface env-vars + observability flags
Third-round integrations of the driver-manager migration's D-phase.
The pcid_interface crate (in local/sources/base submodule, see
upstream commit ddcd0870) now reads REDBEAR_DRIVER_PCI_IRQ_MODE
and REDBEAR_DRIVER_DISABLE_ACCEL at connect_default time, exposing
them as PciFunctionHandle accessors. The quirk integration is
end-to-end: driver-manager emits the env vars on spawn, pcid_interface
parses them, and the child driver reads the hints from its
PciFunctionHandle.

driver-manager (16 tests, unchanged count + 3 new for observability):
- main.rs: --list-drivers prints the config table, --dry-run
  prints how many drivers would-bind/defer/blacklisted without
  spawning, --export-blacklist prints the loaded blacklist.
- policy.rs: adds blacklist_module_names() iterator for export.

driver-manager v1.5 quirks.rs (created earlier at v1.4 PciQuirkFlags
work) is in the staging area and is unchanged this round.

local/scripts/driver-manager-audit-no-stubs.py:
- Drops R4 (was: 'let _ = ...' no-op detection) because Rust's
  'let _ = expression' is idiomatic and not actually a stub.
- Adds R5 (stub-macro callbacks: unimplemented!/todo!/unreachable!
  in callback / fn bodies) to detect dead-end fallbacks.
- Audit gate now reports 0 violations across 35 files (was 34,
  pcid_interface is now in scope).

local/sources/base submodule pointer: updated to upstream commit
ddcd0870 (the pcid_interface env-var-reading commit).

Test totals: 58 tests across 4 crates, all passing.
§ 0.5 audit-no-stubs.py: 0 violations across 35 files.
2026-07-21 12:16:00 +09:00
vasilito b050b28598 lg-gram-16z90tp: review-fix round — firmware op-mode honesty + docs
Base submodule bump (6db0f481): hardware-correct DesignWare engine
(disable/program/enable ordering, abort-first polling, corrected SCL
timing, recovery, validation) and proper Intel LPSS PCI bring-up.

- iwlwifi candidate tables: remove the c-prefixed iwlmld series from
  the current Mini-MVM candidate lists — the MVM transport cannot
  drive MLD firmware, and selecting it would fail firmware boot
  instead of falling back to a compatible image (review MAJOR). c-series
  returns with the MLD op-mode (Phase 6/W). Fallback TOML chains no
  longer mix MLD and MVM series.
- redbear-iwlwifi + redbear-wifictl candidate detection now probes
  both the flat /lib/firmware/iwlwifi-* and the post-2026
  /lib/firmware/intel/iwlwifi/ layouts (review MAJOR).
- plan doc: review-fix round recorded; precision fixes — amd-mp2-i2cd
  remains registration-only until its mailbox engine lands, and the
  system-quirk flags parse but have no consumers until Phase 5.

Validation: iwlwifi 8 + wifictl 21 tests pass, base cooks for
x86_64-unknown-redox.
2026-07-21 12:06:21 +09:00
vasilito 0ddc032202 acpid hardening + initnsmgr concurrency design
- Bump submodule/base to the acpid AML-handler hardening (bounded stall,
  mutex owner-check, static _PSS/_PSD/_CST/_CPC cache, panic-free scheme
  path, observability). Proven NOT a regression: a mutex-only baseline
  wedges identically under load in a 3/3 framebuffer-ground-truth test,
  so the residual under-load boot wedge is head-of-line blocking in
  initnsmgr, not acpid.

- Add local/docs/INITNSMGR-CONCURRENCY-DESIGN.md: the concrete
  worker-offload design (Design A) that decouples the blocking openat
  from the initnsmgr dispatch loop, plus Design B (kernel O_NONBLOCK +
  deferred single-thread), a staged plan, and validation rules. Key
  finding baked in: redox_rt's Mutex is a spinlock, so the cap_fd must be
  resolved under a short lock and the openat run with the lock released.

- Update INIT-NAMESPACE-MANAGER-SCALABILITY-PLAN.md with the acpid
  hardening section (done vs the still-deferred #1 transport decoupling).

- Add local/patches/wip-initnsmgr/step1-send-refactor.patch: the
  compiled-but-not-yet-boot-validated Step 1 (Rc<RefCell> -> Arc<Mutex>
  Send refactor) of initnsmgr, saved durably. It is intentionally NOT in
  the base gitlink: bootstrap is the earliest-boot component and this
  must be boot-validated on an idle host (the current host is under heavy
  external load) before landing. Steps 2-5 (worker bring-up) likewise
  need an idle host.
2026-07-21 08:34:22 +09:00
vasilito 5fd2e16b8e driver-manager: v1.4 — second-round integrations
Round-two integrations of the driver-manager migration's D-phase.
The policy loader is now active (the redbear-driver-policy package
now actually changes spawn_decision_gate behavior at runtime), the
--concurrent=N CLI flag enables the SMP worker pool, PciQuirkFlags
is wired into actual driver spawn (env vars to the child), and the
two C0 service files have been committed in the local/sources/base
submodule. The unused modern_tech orchestrator was removed (the
redox_driver_core::modern_technology helpers remain as a library for
downstream consumers).

driver-manager (16 tests, was 13):
- config.rs: PciQuirkFlags hints are now passed to the spawned child as
  env vars (REDBEAR_DRIVER_PCI_IRQ_MODE=intx_or_msi, REDBEAR_DRIVER_DISABLE_ACCEL=1).
  Adds blacklist_match() consult at probe time before spawn_decision_gate.
- main.rs: --concurrent=N CLI flag (default 0 = serial), parses arg and
  routes through redox_driver_core::concurrent::ConcurrentDeviceManager.
  Loads /etc/driver-manager.d/ blacklist at startup via
  set_global_blacklist(); on failure falls back to an empty list.
- policy.rs: new file. BlacklistFile / BlacklistEntry TOML schema,
  load_dir() reads .toml/.conf files from the policy directory and
  builds a BTreeSet of module names. Missing directory returns empty
  (opt-in). Tests cover missing / valid / invalid-file paths.

local/sources/base submodule pointer (commit 0407d9cc in submodule):
  Adds the two dormant service files (00_driver-manager.service in
  init.d/ and 40_driver-manager-initfs.service in init.initfs.d/).
  Both are gated by ConditionPathExists=!/etc/driver-manager.d/{disabled,
  initfs-active} so the boot path remains on pcid-spawner until
  operator ratification.

redox-driver-core: unchanged library. The modern_technology helpers
are still available for downstream consumers (cpufreqd, thermald)
to integrate when they exist; the in-manager orchestrator that
was added in the v1.3 round has been removed because it wrote JSON
files that nothing read.

§ 0.5 audit-no-stubs.py: 0 violations across 34 files. 52 tests pass
across the three crates.
2026-07-21 07:39:45 +09:00
vasilito 075dce8b46 lg-gram-16z90tp: Phase 4.1-4.3 — I2C-HID touchpad chain (real implementations)
Base submodule bump (452452e4): the I2C transfer chain was stubbed
end-to-end and is now real code — dw-i2c DesignWare engine ported from
Linux 7.1, intel-lpss-i2cd PCI discovery for ARL-H/MTL-P, i2cd provider
routing.

Config fixes for the chain:

- drivers.d spawn paths: six entries pointed at /usr/lib/drivers/ for
  binaries staged at /usr/bin/ (i2cd, gpiod, dw-acpi-i2cd, intel-gpiod,
  i2c-gpio-expanderd, i2c-hidd) — those drivers would never spawn.
- init services: add 00_intel-lpss-i2cd.service
  (type = { scheme = "i2c-lpss" }, absolute cmd path since init PATH
  covers only /usr/bin); dw-acpi-i2cd upgraded from oneshot_async to
  type = { scheme = "dw-acpi-i2c" } now that it serves a scheme
  forever; i2c-hidd requires_weak gains 00_intel-lpss-i2cd.service so
  the touchpad adapter exists before HID probing.

Validation: base cooks for x86_64-unknown-redox; staged binary paths
verified against spawn configs; make lint-config clean.

Refs: local/docs/LG-GRAM-16Z90TP-COMPATIBILITY-PLAN.md Phase 4
2026-07-21 06:04:31 +09:00
vasilito 9f1a10937f docs(init-nsmgr): add co-victim audit — acpid was the only active trigger
Systematic audit of all 18 scheme-serving daemons for the acpid failure
class (single-threaded daemon that can wait unboundedly in its serving
thread). Findings recorded in INIT-NAMESPACE-MANAGER-SCALABILITY-PLAN.md:

- acpid was the ONLY software unbounded wait in the boot-critical path
  (fixed). No other boot-path handler has an unbounded software wait or a
  reentrant blocking open of another scheme.
- Hardware busy-waits (rtcd/ps2d/audio/gpu register polls) are
  hardware-bounded or in daemons pcid does not spawn without the device.
- ucsid is the one remaining co-victim: it reads /scheme/acpi in
  build_state() before publishing its scheme and is the only blocking,
  acpi-dependent boot unit in redbear-mini. It already degrades on EAGAIN
  and works with acpid fixed. It must NOT be flipped to oneshot_async
  (that breaks ucsi scheme registration, which init performs via the
  {scheme=…} type); the correct hardening is a source refactor
  (publish-then-discover), done with runtime validation, not blind.
2026-07-21 05:26:52 +09:00
vasilito 18c892a136 mini: fix acpid AML-mutex wedge so redbear-mini logs into brush
redbear-mini now reaches a working brush login and executes commands
(framebuffer ground truth: login -> MOTD -> `user@redbear: $` ->
`echo RB=$((21*2))=OK` -> `RB=42=OK`; login ~12s, brush ~16s in QEMU
q35/KVM). This is the console-login floor of the desktop path.

Root cause was NOT in login/brush/pty/spawn (16+ prior sessions chased
those). cpufreqd reads /scheme/acpi/processor/CPUn/pss; evaluating that
AML ran `_ACQ` on an ACPI mutex whose acquire handler (a) multiplied
the millisecond timeout by 1000 (0xFFFF "wait forever" became ~18h) and
(b) tracked no owner, so a nested acquire by acpid's single AML thread
self-deadlocked. Because acpid is single-threaded and also serves the
`acpi` scheme socket, and because the single-threaded init namespace
manager does a blocking openat in its dispatch loop, a stuck acpid
froze EVERY open in the system. Fixed in submodule/base d78fd44a
(bumped here), verified against local/reference/linux-7.1 ACPICA.

Docs:
- Add local/docs/INIT-NAMESPACE-MANAGER-SCALABILITY-PLAN.md: the
  residual architectural root (initnsmgr head-of-line blocking + kernel
  ignoring O_NONBLOCK on open) that still lets one slow daemon wedge the
  whole open path, with a worker-offload / deferred-open / kernel
  O_NONBLOCK execution plan. This is the answer to "use SMP where it's
  justified": the parallelism that matters is fault isolation of the
  namespace-open path, not throughput.
- CONSOLE-TO-KDE-DESKTOP-PLAN.md v5.9: record the mini-login result and
  point at the new plan.

Note: submodule/base worktree also carries in-progress i2c/driver-manager
work (not part of this commit); the acpid fix is isolated.
2026-07-21 04:55:02 +09:00
vasilito 4dc51bd61f driver-manager: v1.3 comprehensive D-phase implementation
Full implementation of the driver-manager migration's D-phase
(parallel development) per the v1.3 plan. The § 0.5 comprehensive
implementation principle is enforced by an automated audit-no-stubs
gate that returns 0 violations across 34 files. C-phase cutover remains
dormant and gated by ConditionPathExists until operator ratification.

redox-driver-core (28 unit + 5 integration tests):
- concurrent.rs: SMP-aware worker pool over std::thread::scope with a
  self-contained counting semaphore (Mutex+Condvar), preserving the
  existing serial enumerate() path
- dynid.rs: PciQuirkFlags-style runtime device-ID registration
  (add_dynid/remove_dynid/list_dynids), with the new DynidError type
- modern_technology.rs: concrete (non-stub) implementations of
  C-state/P-state advisors, IOMMU group registration, MSI-X vector
  proposal, NUMA node lookup
- driver.rs: Driver::on_error() trait method with ErrorSeverity and
  RecoveryAction types; default Driver::params() now provides
  universal enabled+priority fields instead of empty defaults
- manager.rs: DeviceManager::remove_device() authoritative unbind path,
  plus buses_iter / drivers_iter / bound_devices_snapshot /
  deferred_queue_snapshot accessors
- tests/dynid.rs: integration tests for the DeviceManager API

redox-driver-pci (3 tests, unchanged):
- pre-existing PciBus; no breakage

driver-manager (13 tests):
- Cargo.toml: adds redox-driver-sys path dep
- quirks.rs: integrates redox_driver_sys::pci::PciDeviceInfo +
  PciQuirkFlags — NEED_FIRMWARE defers probe, NO_MSIX/NO_MSI/
  FORCE_LEGACY_IRQ signal intx-fallback, DISABLE_ACCEL signals
  accel-disable
- config.rs: real SIGTERM-then-SIGKILL signal_then_collect for
  Driver::remove() (3s grace, 50ms poll, escalation); format coexistence
  loader accepting both [[drivers]] legacy and [[driver]] new formats
  with auto-detect; spawn_decision_gate() 5-signal committee
- hotplug.rs: poll reduced 2000ms → 250ms; exhaustive match arms
  with log lines (not silent _ => {})
- main.rs: 250ms hotplug poll, exhaustive match arms with log lines

redox-driver-sys quirks:
- dmi.rs: log instead of silent _ => {} catch-all

Driver manager policy package (redbear-driver-policy):
- /etc/driver-manager.d/00-blacklist.conf (4 driver blacklist entries)
- /etc/driver-manager.d/50-amdgpu.toml (AMD GPU driver policy)
- /etc/driver-manager.d/initfs.manifest (ordered initfs driver list)
- /etc/driver-manager.d/autoload.d/ntsync.conf (autoload ntsync module)
- /etc/driver-manager.d/README.md (explanation)
- recipe.toml: custom install script that stages into /etc/driver-manager.d/

Driver manager service files (in local/sources/base submodule):
- local/sources/base/init.d/00_driver-manager.service — dormant
  (oneshot_async, ConditionPathExists=!/etc/driver-manager.d/disabled)
- local/sources/base/init.initfs.d/40_driver-manager-initfs.service —
  dormant (oneshot, ConditionPathExists=!/etc/driver-manager.d/initfs-active)

Audit gate:
- local/scripts/driver-manager-audit-no-stubs.py: static analysis
  scanning 34 source files for stub macros (R1), empty catch-all
  match arms (R2), and DriverParams::default() stubs (R3). Returns
  0 violations at v1.3.
- local/scripts/driver-manager-audit-no-stubs.sh: thin wrapper
- local/scripts/test-driver-manager-no-stubs-qemu.sh: D4 gate — runs
  the audit plus cargo test on every crate, returns 0 iff both pass

Test scripts (C-phase scaffolding, dormant until C1):
- test-driver-manager-parity.sh (C1)
- test-driver-manager-active.sh (C3)
- test-driver-manager-initfs.sh (C2)
- test-driver-manager-hotplug.sh (D3)
- test-driver-manager-pm.sh (D2)
- test-driver-manager-cutover.sh (C4)

Docs:
- local/docs/DRIVER-MANAGER-MIGRATION-PLAN.md: v1.3 status table
  listing every D-phase item as Done
- local/docs/evidence/driver-manager/D5-AUDIT.md: capability-by-
  capability matrix + verbatim audit output
- local/docs/HARDWARE-VALIDATION-MATRIX.md: driver-manager rows
  added with v1.3 status
- local/AGENTS.md: PLANNING NOTES pointer updated to v1.3
- docs/README.md: Related Red Bear-local plans row updated to v1.3

Test totals: 49 tests across the three crates, all passing.
Audit totals: 0 violations across 34 files, all clean.

Note: local/sources/base service files (00_driver-manager.service and
40_driver-manager-initfs.service) live in a submodule and need a
separate commit there. They are NOT included in this commit.
2026-07-21 00:30:55 +09:00
vasilito 8060a9640b lg-gram-16z90tp: Phase 0 — collision fixes, quirks pipeline, firmware tables
Host: LG Gram 16Z90TP-G.AL89C (Arrow Lake-H, Core Ultra 7 255H).
Plan: local/docs/LG-GRAM-16Z90TP-COMPATIBILITY-PLAN.md

- drivers.d: scope e1000d + rtl8168d matches to subclass 0 (Ethernet);
  the vendor+class wildcard also claimed Intel/Realtek Wi-Fi (subclass
  0x80) and collided with redbear-iwlwifi (e.g. BE201 8086:7740)
- xhci_table: add universal SPURIOUS_SUCCESS rule for hci_version > 0x96
  (Linux xhci.c:5477); LG Gram 8086:7ec0/777d now get exactly Linux's
  flag set (0x200009810); flag-parity test added
- quirks: repair system-quirk pipeline — dmi_system_quirk entries with
  flags like force_s2idle silently parsed to empty sets. Add
  SystemQuirkFlags (4 flags), DmiSystemQuirkRule, dual-namespace TOML
  parsing, quirks::system_quirks() consumer API, and the LG 16Z90TP
  DMI anchor (board_name match)
- firmware: iwlwifi candidate tables prefer the c-prefixed iwlmld
  series (c106..c101) for BE201/CNVi; gf-a0 capped at 100 per
  host/linux-firmware evidence; fallback chains updated
- firmware-loader: map flat iwlwifi-* requests into the post-2026
  linux-firmware intel/iwlwifi/ layout (builtins + TOML fallbacks)

Tests: redox-driver-sys 72, firmware-loader 11, redbear-iwlwifi 8,
redbear-wifictl 21 all pass; all four components cook for
x86_64-unknown-redox; make lint-config clean.
2026-07-20 23:41:18 +09:00
vasilito c89898f1f4 docs: drop resolved SYSCALL-MIGRATION-PLAN, fix stale reference, refresh README
- Delete local/docs/SYSCALL-MIGRATION-PLAN.md — migration complete
  (syscall fork at 0.9.0+rb0.3.1 with SETNS and data/flag updates);
  its resolution is already recorded in archived/IMPLEMENTATION-MASTER-PLAN.md
- local/AGENTS.md: remove reference to non-existent
  DESKTOP-STACK-CURRENT-STATUS.md (superseded by CONSOLE-TO-KDE plan)
- README: status table — shared-IRQ re-arm sweep (11 drivers), USB 2.0
  HW LPM implemented, endpoint-indexing bug class fixed, hub-child
  enumeration proven; correct frozen versions to Mesa 26.1.4 +
  wayland-protocols 1.49 (was: Mesa 24.0.8)
2026-07-20 21:23:55 +09:00
vasilito 233ccc41f4 docs: record P6-A completion + endpoint-indexing bug-class audit (2026-07-20)
acmd global-index fix + serial-state/SEND_BREAK (f505d18a89), ecmd/usbaudiod
address-vs-index fix (08097d5a2d), usbhidd per-config reset (94a99f02).
bot.rs assigned to UAS workstream. Multi-port IAD remains open.
2026-07-20 21:10:19 +09:00
vasilito cd9b225e39 docs: scope USB P7-B — real work is SEL/PEL timeout computation, not register writes
Upstream xhci_calculate_lpm_timeout needs SuperSpeed endpoint companion
SEL/PEL parsing across the hub tree + tier policy + XHCI_LPM_SUPPORT
vendor quirk. Defaults-only timeout writes would be speculative and can
break device links. P7-B assigned a dedicated workstream.
2026-07-20 19:27:00 +09:00
vasilito 1aae92524f docs: re-scope USB P7-A EHCI task — no generic EHCI HW LPM exists in Linux 7.1
Audit: set_usb2_hw_lpm is xHCI-only upstream; EHCI PM is vendor-specific
TDI PHY LPM only. Correct EHCI power path is legacy L2 port suspend
(host-agnostic); deferred until a concrete device need arises.
2026-07-20 19:24:32 +09:00
vasilito a83be41585 usb: bump base fork — P7-A USB 2.0 HW LPM implemented in xhcid
base -> 2a3b0d4e: per-device USB 2.0 hardware LPM (L1) enablement at
attach in xhcid (full Linux xhci.c:4650 gate chain, BESL/HIRD params,
MEL Evaluate Context, PORTHLPMC/PORTPMSC sequence). Plan P7-A updated:
xhcid side done; ehcid USBCMD.HIRD and hardware L1 validation remain.
2026-07-20 19:22:18 +09:00
vasilito 9245ad426a irq: shared-IRQ re-arm bug-class sweep across base drivers + plan update
Bump base fork to 28afc1fe:
- ad40fffd ahcid: always re-arm the IRQ line, even for foreign interrupts
  (from the UAS workstream)
- 92924224 e1000d/ihdad/vboxd/xhcid: unconditional ack
- 28afc1fe sb16d/ac97d/rtl8139d/rtl8168d/ixgbed/ihdgd: unconditional ack
- 54e89a33 fbcond: perform the display handoff open off the console loop
  (concurrent session's root-cause fix for the '-vga std' boot freeze)

Bug class: kernel masks the IRQ line on delivery and only re-arms on the
userspace write-back; conditional acks wedged shared INTx lines forever.
Explains a class of 'works in QEMU, wedges on real hardware' failures.
Full audit + unaffected-driver rationale recorded in the IRQ plan P3
section.
2026-07-20 18:52:34 +09:00
vasilito e4c4cb59e4 docs: Qt6 Wayland null+8 static diagnosis — patch verdict + instrumented runbook
Phases A-C static diagnosis of the wl_proxy_add_listener null+8 crash.
Evidence-backed root cause, candidate patch verdict, ruled-out hypothesis
cross-check, and a copy-pasteable instrumented-rebuild runbook for the
orchestrator.

Verdict: candidate patch qtwaylandscanner-null-guard-listeners.patch guards
the CORRECT site (every generated init_listener). Necessary but not
sufficient alone — complementary to libwayland redox.patch hunk 1.
v5.5 'verified FIXED' claim overstated: never tested in isolation,
kded6 workaround masked it, stale-sysroot risk documented.
2026-07-20 09:52:08 +09:00
vasilito 865beb82d5 docs: reconcile USB plan P6 preamble with P1-D driver reality
P6 claimed acmd/ecmd/usbaudiod were 32-line stubs; P1-D (2026-07-08)
resolved that they are real implementations. Verified 2026-07-20:
redbear-acmd 186 LoC (line coding, DTR/RTS, scheme), redbear-ecmd 314,
redbear-usbaudiod 367. P6-A remaining scope is CTS/DSR flow control,
break signaling, and multi-port modem support; NCM/audio/serial-chip
families remain missing entirely.
2026-07-20 09:42:24 +09:00
vasilito 376fe3a05c docs: record 2026-07-20 A2 re-confirmation state in validation matrix
Log-grep legs (MSI-X, xHCI IRQ) re-confirmed again this morning; login-based
legs still blocked by the concurrent .claude QEMU workload (SIGKILL of
competing guests); retry loop armed; IOMMU leg needs a redbear-full image.
2026-07-20 09:26:25 +09:00
vasilito 923697887c docs: record python harness migration; drop superseded policy docs
- 06-BUILD-SYSTEM-SETUP: note which QEMU proof scripts use
  qemu-login-expect.py vs host expect
- 01-REDOX-ARCHITECTURE, LOCAL-FORK-SUPREMACY-POLICY,
  SYSTEM-STABILITY-AND-UPSTREAM-SYNC-PLAN, UPSTREAM-SYNC-PROCEDURE:
  sync with current fork-model and sync-procedure state
- Delete archived/SOURCE-ARCHIVAL-POLICY.md and
  fork-push-status/2026-07-12-Round-5-phase-4.1.md — superseded by the
  current local-fork model docs and newer fork-push-status rounds
- config/redbear-mini.toml: trailing newline
2026-07-20 09:06:25 +09:00
vasilito 8801805031 docs: record expect-to-python harness migration and 2026-07-20 runtime-proof status
IRQ plan + validation matrix: the login-based QEMU proofs (PS/2 + serio,
monotonic timer, IOMMU first-use, USB storage BOT) now run through
local/scripts/qemu-login-expect.py (stdlib python) instead of the host expect
tool. MSI-X (virtio-net) and xHCI interrupt-driven mode were re-confirmed on
the current redbear-mini ISO. Re-confirmation of the login-based legs with the
new harness is pending an uncontended host (parallel QEMU workload kills QEMU
processes and stalls guest boots). Also record the fbcond Performing-handoff
boot freeze observed with -vga std (separate graphics-path issue).
2026-07-20 05:56:39 +09:00
vasilito a6c7d1d9c6 docs: 'reactor startup race' root cause = startup latency under load
Correct the P3-A runtime-validation note and matrix row: the
intermittent apparent boot freeze is startup latency under load (guest
clock ~10-15x slower than wall), not a deadlock or an xhcid bug. A short
50-60s test timeout occasionally cuts the spawn+enumerate sequence,
producing a 'frozen' log while the guest is still running — proven by
18 boots (one apparent short-timeout loss), a 12s log-quiet 'freeze'
the guest resumed from, and every >=180s run enumerating fully. No fix
required beyond adequate test timeouts; no speculative kernel-deadlock
fix was implemented.
2026-07-19 23:13:46 +09:00
vasilito 6446d440bf usb: hub-child enumeration proven end-to-end in QEMU + tighten hub test
The usb-kbd behind the QEMU usb-hub now enumerates fully: debounce ->
port reset -> enable -> second debounce -> pre-attach -> attach ->
ATTACH 5.2 -> slot 3 -> addressed -> descriptors read -> HID class match
-> 'Loading subdriver "USB HID" for port 5.2' (class 3.1 proto 1,
keyboard boot protocol).

Root cause of the final stall: an unconditional SetPortFeature
(PORT_INDICATOR) for every connected+enabled port NAK-hung on QEMU's
indicator-less hub (no control-transfer timeout), blocking the flow
before the post-enable debounce. Now gated on
wHubCharacteristics.HUB_CHAR_PORTIND like Linux has_indicators.

test-usb-hub-qemu.sh: check #5 now requires the hub-child subdriver
line ('Loading subdriver "USB HID" for port <root>.<child>') so a
root-port HID (tablet) can no longer satisfy it — closes a false-
positive hole. Timeout raised to 360s for slow TT-path driver bring-up.

Docs (plan P3-A runtime validation + matrix): full hub + hub-child
chain recorded as QEMU-proven; remaining items (intermittent reactor
startup race, slow TT-path Evaluate Context) noted.
2026-07-19 19:55:27 +09:00
vasilito e55e0f186b docs: P3-A runtime validation — hub chain proven, hub-child gap recorded
USB-IMPLEMENTATION-PLAN.md P3-A: record the 2026-07-19 QEMU runtime
validation (test-usb-hub-qemu.sh) — full usbhubd chain proven
(descriptor, EP1 change detection, initial scan, debounce, reset to
port-enable), the five latent bugs it surfaced and that were fixed
(scheme attach bootstrap, bitmap off-by-one, missing initial scan,
unbounded EP1 wait, debounce clear deadlock), QEMU's ClearPortFeature
stall handled gracefully by P2-C recovery, and the remaining gap:
hub-child device enumeration (usb-kbd to HID driver) blocked on
xhcid's hub-child attach path (debug-level; TT/route investigation)
plus an intermittent xhcid IRQ-reactor startup race.

HARDWARE-VALIDATION-MATRIX.md: hub row to QEMU-validated for the
enumeration chain, with the hub-child gap noted.
2026-07-19 11:17:21 +09:00
vasilito ba46a4c715 base fork sync (upstream 59cf8189) + P3-B/C doc closure + hub proof script
Base fork:
- Merged upstream/main 59cf8189 (13 upstream commits) into submodule/base
  as 9bbdc2ca; 3 conflicts resolved by hand (irq_reactor.rs process_one_event
  refactor + SPURIOUS_REBOOT reapply; randd simplification + fcntl reapply;
  Makefile /dev symlink block). verify-fork-functions gate now passes for
  base. kernel (11 fns) and relibc (2 fns) remain behind upstream — tracked
  as T-7d82cf6f / T-a5699340 / T-f5b7a0ea for dedicated sessions.
- Also landed earlier: upgrade-forks.sh cd-back bug fix (7e7ef73a).

Docs:
- P3-B marked COMPLETE (premise was stale: usbhubd is interrupt-driven
  with polling fallback today).
- P3-C marked hub-side COMPLETE (PortIndicator set in event loop);
  keyboard LED sync remains P5-C scope.
- README USB/Bluetooth row upgraded from red/in-progress to reflect
  P2-A/B/C + P3-A/B/C reality.

Validation:
- New test-usb-hub-qemu.sh (P8-B): boots QEMU with usb-hub + usb-kbd
  behind it, validates usbhubd spawn, 8-port descriptor read, change-
  detection mode, HID registration behind the hub, no panics. Cannot
  run until kernel+relibc syncs unblock the image build.
2026-07-19 05:48:45 +09:00
vasilito bfd56bac7e usb: P3-A complete — Linux hub.c enumeration state machine in usbhubd
Track base pointer to bd379e07 (usbhubd debounce/reset-wait/U0-wait/
wHubDelay + SET_ISOCH_DELAY, HubDescriptorV3 device_removable fix).

USB-IMPLEMENTATION-PLAN.md: P3-A marked CORE COMPLETE with the full
Linux equivalence inventory and documented follow-ups (USB 2.0 bitmaps,
SS.Inactive warm-reset loop, multi-TT, hub LPM). Hub gap-table row
updated (249 -> ~700 LoC with Linux state machine).

HARDWARE-VALIDATION-MATRIX.md: hub row updated — enumeration core
complete with 14 unit tests; runtime hub proof tracked under P8-B.
2026-07-19 00:28:29 +09:00
vasilito efd745c073 docs: USB/quirks/low-level doc consolidation + P2-C recovery completion
Documentation pass (staleness audit across 5 docs):

USB-IMPLEMENTATION-PLAN.md:
- P2-A marked COMPLETE (canonical 51-flag table in redox-driver-sys,
  ~85 entries, real HCIVERSION reads, BROKEN_MSI pre-gate)
- P2-C marked CORE COMPLETE: full 36-code recovery matrix documented
  (maybe_recover_transfer_error scheme.rs:559-925) with Linux xhci-ring.c
  equivalences, restart_endpoint bug fixes, known simplifications, and
  remaining P8-C injection-test scope
- Gap table corrected (quirks done, error recovery core done, PM substrate)
- P7-A corrected: HLC lives in Supported Protocol capability port_info
  DWORD, NOT HCCPARAMS1 (driver bug fixed in P2-B)
- §12 rewritten: runbook is live v3, not archived; lineage consolidated

IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md:
- xHCI section rewritten: 'restored' -> hardened/gated (BROKEN_MSI
  pre-gate, quirk convergence, real HCIVERSION, handle/method agreement)
- Priority 6 refocused from 'keep path healthy' to runtime validation
  (BROKEN_MSI controller proof, event-ring under sustained load)
- 26 stale recipes/core/*/source paths -> local/sources/* fork paths
- duplicate ACPI-IMPROVEMENT-PLAN.md reference removed
- xhcid evidence class upgraded to quirk-hardened
- USB plan cross-reference added (feature ownership boundary)

QUIRKS-AUDIT.md:
- xHCI tombstone removed: lookup_xhci_controller_quirks_full is now a
  real implementation over XHCI_QUIRK_TABLE (was stub returning empty())
- 'broken TOML mappings' section marked RESOLVED (all 4 flag names now
  in PCI_FLAG_NAMES)
- Implementation-status section re-assessed: xhcid consumes 51-flag
  XhciControllerQuirkFlags in ~40 paths (was: only PciQuirkFlags)
- test inventory +38 xhci_table.rs tests

QUIRKS-SYSTEM.md:
- xhci_table.rs added to compiled-in tables inventory and file layout
- implementation status: canonical xHCI table row added (P2-A)
- driver consumption: xhcid xHCI-controller-path flag list documented

QUIRKS-IMPROVEMENT-PLAN.md:
- Task 3.1 (USB device quirks in xhcid) marked DONE (13 flags consumed)
- exit criteria 3/4/5/7 marked met; deliverables 1/3/4 completed
- reassessment summary updated for XhciControllerQuirkFlags consumption

Also: chmod +x test-xhci-irq-qemu.sh, test-msix-qemu.sh,
test-usb-storage-qemu.sh (were non-executable).

Track base pointer to 26000333 (P2-C restart_endpoint fixes).
2026-07-18 23:15:00 +09:00
vasilito d3e5fc0a82 usb: P2-B complete — HCCPARAMS2 capability gating in xhcid
Track base pointer to d20557f7 (xHCI 1.1+ feature gating: LEC/U3C/CIC
gates, HW LPM substrate with protocol-caps HLC detection, PORTPMSC
register-target fix, bogus HCCPARAMS1-HLC accessor removed).

Mark P2-B COMPLETE in USB-IMPLEMENTATION-PLAN.md with the full gating
inventory and Linux 7.1 cross-references. Per-device L1 enablement
(BESL, MEL Evaluate Context) explicitly deferred to P3 hub work.
2026-07-18 22:34:28 +09:00
vasilito fdcb2f5fbc fix: complete remaining Tier 1 messages and Tier 2 doc consolidation
Tier 1 message fixes (Part 5.3):
- M18/M19 (build-redbear.sh:523-524): reworded patch-application messages
  to reflect local fork model (forks have patches committed; recipe patches
  for non-fork recipes applied atomically by repo fetch)
- M46 (build-redbear.sh:923): 'immutable archives' → 'local forks'

Tier 2 doc consolidation (Part 7):
- GRUB-INTEGRATION-PLAN.md: updated all 'make all CONFIG_NAME=' commands
  to canonical './local/scripts/build-redbear.sh' equivalents
- SLEEP-IMPLEMENTATION-PLAN.md: archived (referenced 0.2.4 branch, pre-0.3.1)

Assessment doc Part 7 updated: all Tier 1 (items 1-6) and Tier 2 (items 7-13)
marked as verified complete with per-item status.

All Q1-Q10 quality improvement opportunities from Part 6.2 and all Tier 1-3
items from Part 7 are now resolved.
2026-07-18 17:44:16 +09:00
vasilito d9b2f69213 feat: build-system binary store integrity (per-pkgar BLAKE3 manifest + post-restore verify)
Q1 from assessment Part 6.2 — closes the largest robustness gap (Mechanism #2):
corrupt cached pkgar that passes mtime check was previously not detected
until runtime.

Publish side (repo_builder.rs):
- Accumulates BLAKE3 hash of each published file (pkgar, toml, dep_hashes,
  auto_deps) into a BinaryStoreManifest
- Writes <recipe>.manifest.toml alongside published artifacts in repo/

Restore side (cook_build.rs):
- BinaryStoreManifest struct with read() returning Result<Option<Self>, String>
  (same pattern as DepHashes: Ok(None) for missing = backward compat,
  Err for corrupt TOML = loud WARN + skip)
- After restoring from binary store, verifies each file's BLAKE3 against
  the manifest. On mismatch or missing file: WARN + all_restored=false
  (forces rebuild). Missing manifest = backward compatible (older cookbook
  published without one).

Helper (fs.rs):
- compute_file_blake3_hex(): 64KB chunked BLAKE3 hash, avoids loading
  entire pkgar into memory

Tests: 3 new (roundtrip, missing-file Ok(None), corrupt-TOML Err).
Total: 38/38 pass. cargo check clean. No new clippy warnings.

Assessment doc Part 6.2/6.3/7 updated: Q1-Q6 all marked resolved.
Auto-correction table updated: transient network failure (Q2 retry) and
corrupt cached pkgar (Q1 BLAKE3 manifest) moved from 'does NOT auto-correct'
to 'auto-corrects'.
2026-07-18 17:28:09 +09:00