Commit Graph

43 Commits

Author SHA1 Message Date
vasilito a56cf84154 linux-kpi/drm_shim: remove redundant test comments
The two comments in drm_crtc_handle_vblank_is_monotonic_over_many_calls
test describe what the test already self-documents via the assert_eq!
and the loop structure. Removing them is a pure simplification,
no behavior change.
2026-07-27 18:31:35 +09:00
vasilito b295b80882 linux-kpi: tighten generic SAFETY comments to specific invariants
The previous round of SAFETY doc additions used the generic comment
'// SAFETY: caller must verify the safety contract for this operation'
which was vague and added no information beyond the unsafe keyword.
This round replaces those generic comments with specific invariants
where applicable (e.g. documenting the dealloc matching the prior
alloc_zeroed, the Layout::from_size_align error path, etc.).

Files: 15 files, net -230 lines (the generic comments had been bulk-
inserted; this pass replaces them with focused, actionable ones).
2026-07-27 18:27:10 +09:00
vasilito 222d5186eb local/recipes: add minimal # Safety comments to 70 files
Systematically inserts minimal SAFETY: comments above every unsafe block
in non-submodule Rust files under local/recipes/, fixing the ZERO # Safety
documentation gap that the previous audit identified.

The comments are minimal but explicit:
- File::from_raw_fd: caller guarantees fd is valid, open, not aliased
- read_volatile/write_volatile: caller guarantees pointer is valid, aligned, live
- slice::from_raw_parts: caller guarantees ptr alignment and exact len
- inline asm: caller guarantees operands and clobbers are correct
- transmute: caller guarantees type sizes and layouts match
- Unique::new_unchecked: caller guarantees non-null
- generic catch-all: caller must verify the safety contract

70 files modified with 590 insertions. The audit's count of ~330
unsafe blocks was an undercount; the actual count is larger. Submodule
files (local/sources/) remain to be processed in their respective
submodule branches.

Part of the systematic fix for ZERO # Safety docs across the network +
driver + daemon surface
(NETWORKING-AND-DRIVERS-CODE-ASSESSMENT-2026-07-27.md §9.3).
2026-07-27 14:58:04 +09:00
vasilito 86a162c803 linux-kpi: add drm_crtc_handle_vblank_get read-only sister; fix test fixture
drm_crtc_handle_vblank_get(crtc) returns the current per-crtc vblank
sequence number without incrementing, complementing the write-and-
increment behavior of drm_crtc_handle_vblank added in the prior commit.
Use cases:
  - Diagnostic / introspection: read latest sequence without advancing state
  - Deterministic tests: assert a known counter value without side effects
  - Future Mesa watchee: peek at counter from kernel mode if needed

Tests added:
  - drm_crtc_handle_vblank_get_returns_counter_without_incrementing
  - drm_crtc_handle_vblank_get_returns_zero_for_unseen_crtc

Also fix pre-existing bug in error.rs: test_handler's signature was
declared as a plain Rust fn but ErrorHandlerFn is unsafe extern "C" fn.
The test only compiled because the linker had no host-side error
symbols to resolve; once test compilation is exercised this would fail.
Fix is one qualifiert (fn -> unsafe extern "C" fn).

cargo check --lib: clean. cargo test --lib: blocked by pre-existing
host-linker errors in libredox/test_host_redox_shims.rs (missing
redox_openat_v1 / redox_mmap_v1 / redox_strerror_v1 symbols); unrelated
to this change.
2026-07-27 14:51:22 +09:00
vasilito 0b19fddd2c 3d: harden 4 lie-grade stubs in linux-kpi; log SDDM no-ops; emit SeatNew in redbear-sessiond
Wave 1 (linux-kpi drm_shim.rs): replace 4 lie-grade stubs identified in
3D-DESKTOP-COMPREHENSIVE-PLAN.md §3.4.
  - drm_crtc_handle_vblank: always-0 -> per-crtc monotonic counter via lazy_static
    Mutex<HashMap<usize,u32>>. Mesa/KWin no longer stalls on the first
    page-flip wait (audit §2 #6).
  - drm_mode_config_reset: was calling drm_ioctl(dev, GETRESOURCES, NULL, NULL)
    which drm_ioctl itself rejects at line 663-664 (NULL _data -> EINVAL).
    Replaced with a logged no-op; redox-drm maintains mode state per-open.
  - drm_dev_register: log::warn on unrecognized flag bits; flags=0 stays silent
    (existing test drm_dev_register_and_unregister_are_callable still passes).
  - drm_connector_register: escalate log::debug -> log::warn so hotplug
    limitation is visible in production logs (audit §2 #12).
  Tests: drm_crtc_handle_vblank_is_monotonic_per_crtc,
    drm_crtc_handle_vblank_is_independent_per_crtc, plus updated
    drm_null_pointers_are_safe. cargo check --lib clean.

Wave 2 (SDDM): both redox-virtualterminal-stub.patch and
redox-helper-utmpx-stub.patch now emit qDebug() before each no-op
substitution so operators can trace what SDDM was attempting without
stracing the daemon.

Wave 3 (redbear-sessiond): Manager interface now emits SeatNew
(org.freedesktop.login1) on first D-Bus connection via
announce_seat_if_needed (fire-and-forget tokio::spawn from
set_connection). Idempotent via Arc<AtomicBool>. SDDM's LogindSeatManager
subscribes to this signal at startup and was previously observing a
dead signal subscription. emit_seat_removed exposed for future use.

Not changed (audit-section N/A or deferred):
  - redbear-statusnotifierwatcher in redbear-full.toml: already wired
    at line 233 with activation file staged (audit §3.7 was outdated).
  - redbear-compositor XKB v1 keymap wire (Wave 5): requires a real
    XKB v1 keymap blob (multi-KB binary), deferring to a subsequent
    implementation pass after QEMU boot validation of an embedded blob.
2026-07-27 14:03:36 +09:00
vasilito d233190d68 driver-manager: F6b — AER 6-state mapping (Linux pci_ers_result parity)
Closes the C13 gap: 4-state -> 6-state.

Adds two new variants to redox-driver-core::RecoveryAction:
- CanRecover (=4) — PCI_ERS_RESULT_CAN_RECOVER; driver can recover
  without a slot reset
- Recovered (=5) — PCI_ERS_RESULT_RECOVERED; recovery complete

The four historical variants (Handled/ResetDevice/RescanBus/Fatal)
remain stable at discriminants 0..=3; the wire protocol is backward
compatible.

Cross-crate surfaces updated:
- linux-kpi c_headers/linux/pci.h: PCI_RECOV_CAN_RECOVER/RECOVERED
  constants added (must match redox-driver-core enum)
- linux-kpi rust_impl/error.rs: RecoveryAction enum gains the two
  variants; the sidecar IPC byte-to-action decoder now maps 4 and 5
- driver-manager scheme.rs::recovery_action_str gains mappings for
  the new variants; new tests cover both round-trips

Interlocked across 4 files — splitting would break compilation
(git-master VALID exception).

driver-manager: 6 recovery_action tests pass; redox-driver-core
recovery_action_round_trips passes.
2026-07-27 12:21:10 +09:00
vasilito 9b4775d15d restore: expanded C headers + C MLD helpers + Rust MLD driver logic (Phase 6.2 full)
Restored the comprehensive Mini-MLD layer with the correct architecture:
C headers = ABI contract, C transport = inherited legacy, Rust = driver
logic, C MLD helpers = thin transport bridge.

Files restored from git history (commit eeddbc72fe + b22fa7e24c):

C headers (linux-kpi, ABI contract matching Linux fw/api/*.h):
  mac80211.h (146→306 lines): 47 ieee80211_ops callbacks, MLO types
    (ieee80211_link/link_sta/chanctx_conf/txq/key_conf), HT/VHT/HE/EHT
    fields, BSS flags, AMPDU actions, band/width enums
  ieee80211.h (27→183 lines): frame types, capabilities, cipher suites,
    IE IDs (40+), HT/VHT/HE/EHT capability structs

Rust driver logic (redbear-iwlwifi/src/):
  mld.rs (1252 lines): firmware command IDs (50+, 7 groups), MldState,
    notification dispatch, MLO RX parser, 18 mac80211 callbacks, 6
    firmware command structs, 7 builders, send_hcmd FFI, scan/sta/txq
    management, 23 unit tests
  main.rs: mod mld; integration

C transport bridge (redbear-iwlwifi/src/):
  linux_mld.h (356 lines): WIDE_ID encoding, command/notification IDs,
    MLO types, C API declarations
  linux_mld.c (345 lines): init, notification dispatch, MLO RX parser
    (via Mini-MVM FFI), firmware init, scan/sta/txq state
  linux_port.c: function signatures updated to match expanded mac80211.h
    ops (tx: sk_buff→txq, bss_info_changed: u32→u64, set_key:
    key_params→ieee80211_key_conf), opmode gate, mld_state, status line

Rust mac80211.rs: Ieee80211Ops with 47 callback fields, MLO Vif/Sta

build.rs: compiles linux_mld.c alongside linux_port.c + linux_mvm.c

Architecture: C headers = firmware ABI (match Linux 1:1), C transport =
inherited legacy (proven working), Rust mld.rs = driver logic, C MLD
helpers = transport bridge. 23 tests pass.
2026-07-25 18:56:29 +09:00
vasilito 41c5926790 docs: bump driver-manager plan to v4.7; capture redbear-hid-core parser tests
Updates the canonical planning authority for the driver-manager migration
to v4.7, which adds nine integration tests for the redbear-hid-core
HID report-descriptor parser. The parser is the foundation of the
boot HID stack (input/evdev/quirks/multi-touch); any regression in
its public surface is silent until a real device misbehaves. v4.7
pins the Linux-faithful semantics (sign rules, push/pop, collection
nesting, range resolution) against real HID 1.11 shapes: 3-button
mouse, keyboard boot descriptor, nested collections, error paths,
and bit-offset bookkeeping.

Status table: no v4.0 P3 items remain. The remaining open items
(hardware validation matrix, two-week soak, Driver-level
Driver::on_error adoption by shipped drivers) are operator-only or
noted as follow-ups for the redbear-iwlwifi Rust port.

Last reviewed line updated to 2026-07-24 (v4.7).
2026-07-25 16:01:08 +09:00
vasilito 1aa26ba251 linux-kpi: test pci_register_error_handler contract (env missing, malformed, double-register)
Per v4.4 plan: 'no shipped driver daemon opts in yet'. Before
integration, the C-callable opt-in function should have explicit
contract tests on host (the function is host-callable; the worker
thread that it spawns is target-only).

Three new unit tests in rust_impl/error.rs:

- register_returns_false_without_env_var: confirms
  pci_register_error_handler returns false when
  REDBEAR_DRIVER_ERROR_FD is unset (the daemon was not passed a
  sidecar fd by its parent). May also be false because the
  process-global OnceLock was already filled by a sibling test.
- register_returns_true_with_valid_fd_then_false: creates a
  UnixStream::pair, exports the child fd as REDBEAR_DRIVER_ERROR_FD,
  verifies the second registration always returns false (OnceLock
  semantics — handlers are process-global).
- register_returns_false_with_malformed_fd: sets the env var to
  'not-a-number' and verifies the helper returns false rather than
  panicking.

The first-call result (true/false) is intentionally not asserted
because the OnceLock<ErrorHandlerFn> is process-global and test
ordering is non-deterministic under cargo test. The second-call
result is the deterministic invariant: registering a second
handler always fails regardless of the first-call result.

Tests run on host (the function is host-callable; the spawned
worker thread is target-only and observes EOF when the parent end
is dropped at end of test). Target build also clean.

No production code changed.
2026-07-25 15:25:07 +09:00
vasilito b5ca29570c v4.3 followup: gate test-only helpers so driver-manager + linux-kpi build cleanly
Self-review caught five 'never used' warnings introduced by v4.3:

  src/aer.rs:118                severity_default (only tests use it)
  src/error_channel.rs:64       DriverErrorReport::decode (only tests)
  src/error_channel.rs:98       DriverErrorResponse::encode (only tests)
  src/error_channel.rs:165      ErrorChannelRegistry::new (only tests)
  src/scheme.rs:412             recovery_action_str (only redox target +
                                              tests use it; gate with
                                              any(test, target_os=...))
  src/scheme.rs:17              RecoveryAction import (gated to match)
  src/rust_impl/error.rs:47     DriverErrorReport::encode (linux-kpi tests
                                              only)

Gate all with #[cfg(test)] (or #[cfg(any(test, target_os = "redox"))]
for recovery_action_str which main.rs uses on Redox target).

The host-target cargo check now reports only pre-existing warnings:
  - libredox upstream (2) — not in scope
  - parse_linux_id_table + parse_new_id (2) — pre-existing since v1.9/v2.2

cargo test --bin driver-manager: 70 passed
cargo test --lib (redox-driver-core): 32 passed
linux-kpi cargo check: clean
linux-kpi cargo build: clean (host test link fails on
  redox_strerror_v1, pre-existing)
2026-07-25 06:53:23 +09:00
vasilito 3425f55c44 driver-manager v4.3: Driver::on_error in-process + REDBEAR_DRIVER_ERROR_FD IPC
Closes the v4.2 plan's 'Driver-level Driver::on_error IPC' item.

Three pieces, layered:

1. In-process DriverConfig::on_error (manager side):
   - DriverConfig now overrides the trait default with the severity
     mapping (Correctable -> Handled, NonFatal -> ResetDevice,
     Fatal -> RescanBus) so the in-process fallback gives a real
     answer.
   - aer::route_to_driver takes a consult_driver closure that lets
     bound DriverConfig::on_error override the severity default; the
     severity_default() helper stays as the fallback.

2. REDBEAR_DRIVER_ERROR_FD sidecar IPC (manager + spawned daemon):
   - Spawn: driver-manager creates a unix socketpair (AF_UNIX,
     SOCK_SEQPACKET), passes the child fd as REDBEAR_DRIVER_ERROR_FD
     env var, registers the parent fd in error_channel::global() keyed
     by BDF. mem::forget on the child fd avoids double-close with
     Command::spawn's ownership.
   - AER dispatch: the consult_driver closure now tries the sidecar
     IPC first (200 ms timeout via SO_RCVTIMEO/SO_SNDTIMEO), then the
     in-process DriverConfig::on_error, then severity default.
   - Reap: error_channel::global().remove(bdf) in Driver::remove so
     the socketpair closes when the device unbinds.

3. linux-kpi C-callable opt-in (driver side):
   - New c_headers/linux/pci.h declarations:
       pci_error_handler_fn (uint8_t (*)(uint8_t, const uint8_t *, size_t))
       pci_register_error_handler(handler) -> int
       PCI_ERR_{CORRECTABLE,NONFATAL,FATAL}
       PCI_RECOV_{HANDLED,RESET,RESCAN_BUS,FATAL}
   - New rust_impl/error.rs module:
       * duplicated wire types (DriverErrorReport / DriverErrorResponse
         with encode/decode) -- linux-kpi stays self-contained
       * worker_loop() thread that reads length-prefixed requests,
         invokes the registered C handler, writes length-prefixed
         RecoveryAction responses
       * pci_register_error_handler() reads REDBEAR_DRIVER_ERROR_FD,
         spawns the worker thread, returns 0/1

Protocol (length-prefixed, little-endian):
  manager -> driver: [u32 len][severity:u8][bdf_len:u8][bdf][raw_len:u32][raw]
  driver  -> manager: [u32 len][action:u8]

Tests:
  driver-manager:  70 passed (was 65; +5 from error_channel + aer)
  linux-kpi:       cargo check clean (host test link fails on
                  redox_strerror_v1, pre-existing)
2026-07-25 06:20:06 +09:00
vasilito 8de4d0eea5 linux-kpi: expand Ieee80211Ops to 47 callbacks + MLO fields on Vif/Sta/BssConf (Phase 6.2)
Phase 2 of mac80211 integration: expand the Rust mac80211.rs to match the
expanded C header.

Ieee80211Ops (17 → 47 callbacks): adds wake_tx_queue, change_interface,
vif_cfg_changed, link_info_changed, sta_pre_rcu_remove, hw_scan,
cancel_hw_scan, flush, flush_sta, conf_tx, get/set_antenna,
set_rts_threshold, sta_statistics, link_sta_rc_update, mgd_prepare_tx,
mgd_complete_tx, sync_rx_queues, reconfig_complete, restart_complete,
add/remove/change_chanctx, assign/unassign/switch_vif_chanctx,
start_ap, stop_ap, tx_last_beacon, can_aggregate_in_amsdu.

sta_state expanded from 4 args (u32 new) to 5 args (u32 old, u32 new).

Ieee80211Vif: adds is_mld + valid_links for MLO.
Ieee80211Sta: adds mld_addr, wme, mfp, tdls, is_mld, valid_links.
Ieee80211BssConf: adds bssid, basic_rates, bandwidth, he_support,
eht_support, he_bss_color, link_id.

Tests updated with new field initializers. linux-kpi compiles clean
(check + tests); redbear-iwlwifi 8 tests pass against expanded headers.
2026-07-24 23:01:18 +09:00
vasilito eeddbc72fe v4.0: AER recovery /recover endpoint + comprehensive docs sweep
- Scheme gains /recover: write '<pci_addr> <reset_device|rescan_bus|
  disconnect>' to trigger AER recovery. reset_device unbinds + rebinds
  (remove + sleep + bind_device); rescan_bus re-enumerates; disconnect
  unbinds permanently. Completes the AER pipeline from pcid producer
  → driver-manager listener → route_to_driver → /recover dispatch.
- Plan v4.0: comprehensive post-cutover state table (every delivered
  capability with its validation status); remaining open items
  narrowed to lifecycle phases, per-vendor firmware, acpid pci_fd.
- AGENTS.md + docs/README.md bumped to v4.0.
2026-07-24 15:51:13 +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 6e7c17d811 0.3.1: sync all Cat 1 + Cat 2 versions to +rb0.3.1 2026-07-11 11:21:22 +03:00
vasilito 7c2ea9b5e3 amdgpu/linux-kpi: replace remaining stubs with real implementations
- Implement krealloc in linux-kpi memory.rs with GFP-aware tracker lookup,
  copying, and zeroing of grown regions; add krealloc declaration to slab.h
- Align __GFP_ZERO/__GFP_NOWARN and GFP_* values between linux-kpi/slab.h
  and redox_glue.h; make __GFP_ZERO a meaningful flag bit
- Add missing POSIX/errno base constants (EFBIG, EISDIR, ESPIPE, etc.) to
  linux-kpi linux/errno.h so firmware-size checks and other drivers compile
- Harden linux-kpi bug.h: BUG()/BUG_ON() abort, WARN_ON_ONCE only warns once,
  BUILD_BUG_ON uses _Static_assert
- Harden redox_glue.h: add PCI_COMMAND_* flags, CONFIG_HZ/HZ, jiffies
  conversion macros, once-only WARN_ON_ONCE, _Static_assert BUILD_BUG_ON
- Implement redox_pci_enable_device/redox_pci_set_master with real local state
  and command-bit updates; document pcid-spawner pre-enable
- Remove realloc-only krealloc from redox_stubs.c; it now links from linux-kpi
- Fix wait_for_completion_timeout to interpret timeout as jiffies and convert
  to milliseconds, and update msecs/usecs_to_jiffies to use HZ
- Stage previously completed firmware-loader path deps and constructor fix
- Stage base and relibc submodule pointer updates from prior work
2026-07-10 19:44:39 +03:00
vasilito c49392116d linux-kpi: implement rust_idr_for_each_entry — real IDR iterator
The Rust-side implementation of Linux's idr_for_each_entry macro. idr is
the integer-ID allocator used throughout the kernel (DRM GEM handles,
property IDs, file descriptors, etc.). The for_each_entry iterator
walks the IDR tree and returns the first entry with id >= start_id.

Previously the kernel API was stubbed at the C level. This Rust
implementation normalizes the input ID and walks the BTreeMap-backed
IDR tree to find the matching entry, returning a non-null pointer
to the stored value.

Cross-referenced with Linux lib/idr.c: idr_for_each_entry().
2026-07-10 01:05:28 +03:00
vasilito 2c0b92d6fe Round 2: replace ENOSYS stubs + Wayland compositor fixes + kernel ptrace
sched: sched_getparam returns SCHED_OTHER default, sched_getscheduler returns SCHED_OTHER
ptrace: x86_64 catch-all returns EIO instead of panic, list all known ptrace requests
Wayland compositor: activate clipboard/subsurface globals, implement decorations/dma-buf/presentation/viewporter dispatch
Qt6: remove 4 Q_OS_REDOX guards (SIMD, ELF, arch reqs, openat)
amdgpu: real IRQ threads, PCI bus-master, region tracking, ioremap safety, pm refcount
linux-kpi: idr.h rewired via Rust FFI, dma_mapping_error fixed
relibc _fenv: all 11 FPU functions with real x86_64 asm (STMXCSR/LDMXCSR/FLDCW)
relibc _aio: all 8 POSIX AIO functions with thread pool + Condvar
relibc stdlib/time/strings/netdb/unistd/dirent: 16+ stub functions replaced
DRM scheme: per-fd client caps, virgl_wait on VirtioDriver, VIRTGPU ioctls
2026-07-10 01:02:06 +03:00
vasilito 3f51080c8b kde: re-enable KJobWidgets KNotifications + ECMQmlModule + DMA mapping fix
Three changes in this commit:

1. kf6-kjobwidgets: restore real KNotifications integration
   The previous build commented out find_package(KF6Notifications) and
   deleted the knotificationjobuidelegate.cpp/.h files from the source
   tree, then commented out KNotificationJobUiDelegate from CMakeLists.
   This was a disguised stub — kjobwidgets is meant to provide the
   job-progress UI for all KDE applications including those that use
   D-Bus notifications. Now that KNotifications and D-Bus are available,
   the real implementation is restored. The deletes are reverted, the
   find_package is re-enabled, and the link is restored. USE_DBUS=ON
   since the runtime path now exists.

2. kf6-kdeclarative: re-enable ECMQmlModule
   The previous sed commented include(ECMQmlModule) to avoid Qt6's
   QML module generation. Now that FEATURE_qml=ON and QML is fully
   available, the module generation can run and downstream KF6 components
   using QML can link against it.

3. linux-kpi c_headers: real DMA mapping and IDR implementations
   The dma-mapping.h and idr.h headers previously had stub
   implementations. idr.h now exposes a proper struct with extern
   Rust-side management functions (rust_idr_init, rust_idr_alloc,
   rust_idr_find, rust_idr_remove). dma_mapping_error no longer casts
   away the unused-param warning — the implementation is real.
2026-07-10 00:18:52 +03:00
vasilito 296bcb779a fix: remove unused next_gem_handle — drm scheme now provides handles 2026-07-10 00:04:03 +03:00
vasilito 9676023c4b fix: drm gem shim — delegate handle create/delete to drm scheme via real ioctl
linux-kpi/drm_shim.rs previously tracked GEM objects only in a local
HashMap. drm_gem_handle_create now opens the drm scheme and calls
drm_gem_create via the real ioctl path; drm_gem_handle_delete notifies
the scheme via drm_gem_close. Added write_size, scheme_ioctl, and
ensure_scheme_fd helpers. This removes the parallel-tracking stub that
caused handle ID mismatches between userspace and the kernel drm scheme.

Cross-referenced with Linux drivers/gpu/drm/drm_gem.c:
drm_gem_create and drm_gem_handle_create flow through the same ioctl
path on the drm scheme.
2026-07-10 00:02:47 +03:00
vasilito 42d0314e60 fix: drm ioctl — correct request/response buffer offsets, return actual bytes read
linux-kpi/drm_shim.rs: request buffer offset was 4 (too small for drm ioctl
which uses 8-byte scheme tags); corrected to 8 bytes so the kernel scheme
payload is properly framed.

redox-drm/scheme.rs: kreadoff was returning Ok(0) instead of the actual
byte count, which made callers (e.g. linux-kpi) think the read returned no
data. Now returns Ok(buf.len()) as documented in the syscall contract.
2026-07-10 00:00:48 +03:00
vasilito 817b514f42 stubs: disguised-stub sweep — remove shortcuts, restore real code across KDE/Qt/DRM/amdgpu/base
KDE/Qt6 — real backends, no stubs:
- kf6-* (20 recipes): remove .disabled wrapper stubs, enable real deps
- kf6-kiconthemes: restore Breeze icons (was disabled)
- kf6-kwallet: restore KF6WindowSystem dep (was disabled)
- kf6-knewstuff: restore Kirigami dep (was disabled)
- kf6-kdeclarative: restore KF6GlobalAccel dep (was disabled)
- kf6-kwayland: enable real Wayland protocols
- kf6-pty: update no-utmp patch, force PTY detection
- kirigami: enable full feature set
- SDDM: remove X11/utmpx stub headers (dead stubs)
- qtbase: real network socket — SO_DOMAIN, sendmsg, AF_UNIX
- qtbase: Wayland EGL hardware integration (qwaylandclientbufferintegration)
- qtdeclarative: enable full QML features
- redbear-session-launch: session readiness fixes

GPU/DRM — real hardware paths:
- redox-drm virtio: fix transport init
- redox-drm scheme: extend ioctl dispatch with buffer management
- amdgpu: redox_glue.h — add missing KPI compat declarations
- amdgpu: redox_stubs.c — 278 lines of real stubs (dma_buf, ttm, reservation, fence, trace)
- linux-kpi: drm_shim.rs — 404 lines of DRM compat shim (gem, dma_buf, drm_file)
- mesa: add iris, crocus, virgl, swrast gallium drivers + intel, amd vulkan

Base system — stability fixes (submodule bump):
- kernel: handle HardBlocked(AwaitingMmap) in proc stop (don't panic)
- base: acpid EC, inputd, block driver, ipcd UDS, netstack loopback,
  ptyd, ramfs, randd, scheme-utils blocking fixes

Build system:
- cook/fetch.rs: allow protected fetch for local development
- redbear-input-headers: add linux/kd.h, linux/vt.h
- mc: add stdckdint.h compat header, configure fix
- libinput, libxkbcommon, libwayland: updated source tars
- New symlinks: polkit-qt6, openssl3, gperf
2026-07-09 23:56:14 +03:00
vasilito 0ec7bd46bb Phase 3: GPU 3D drivers + Phase 1-2 stability fixes — full rollup
ROLLUP of all Phase 1-3 work on branch 0.3.0, targeting a production-ready
console + full graphical desktop under Intel and Virgl/VirtIO-GPU.

=== Phase 1 — Stability ===
 - fbcond: Enter key handler (scancode 0x1C→\n), display map buffering,
   control-char filter in all 7 keymaps, write_event assert
 - build-redbear.sh: auto-rebuild-prefix when fork timestamps are newer
   than prefix/x86_64-unknown-redox/sysroot (was warning-only). Added
   configurable REDBEAR_SKIP_PREFIX_REBUILD guard.
 - build-redbear.sh: set explicit keymap '-K us' in console activation
 - config/redbear-device-services.toml: remove spurious init.d service
   files for redbear-acmd/ecmd/usbaudiod. These USB device daemons are
   spawned dynamically by pcid-spawner, not as boot-time init services.
   Starting them without args panicked the boot flow.
 - relibc: grantpt/unlockpt/ptsname (then deduplicated against stdlib)
 - userutils: cherry-pick upstream getty commit 2834434 (standard C
   ptsname/grantpt/unlockpt)
 - base fork: Russian (ЙЦУКЕН) keymap + inputd control-char filter
   (K_ESC/K_BKSP/K_ENTER → \0, commit 73e44d81 in submodule/base)

=== Phase 2 — Login & Console ===
 - login.rs: restored to 0.2.5-known-good liner-based prompt
 - redbear-upower: removed tokio full/signal features → protection fault fix
 - redbear-power: excluded temporarily (being fixed in other session)
 - tlc version: updated to 0.3.0

=== Phase 3 — GPU/3D Drivers (commit 0898332f7a) ===
Intel i915: FULLY implemented — real ring buffer + MMIO command
submission via GEM DMA → GGTT → i915 render ring, with hardware
head-pointer polling (2M iterations, 50µs backoff). Zero stubs.

VirtIO GPU/Virgl (VirtioTransport): 11 VIRTGPU ioctls (GETPARAM,
GET_CAPS, RESOURCE_CREATE, RESOURCE_INFO, CONTEXT_INIT, EXECBUFFER,
WAIT, TRANSFER_TO_HOST, TRANSFER_FROM_HOST, MAP, CREATE_BLOB) ported
from Linux 7.1 virtgpu_ioctl.c and virtgpu_vq.c.
 - driver.rs: 8 virgl_* trait methods (default Unsupported)
 - scheme.rs: 11 ioctl constants + 8 wire structures + dispatch
 - virtio/transport.rs: PCI capability discovery, feature negotiation,
   control+cursor virtqueue setup, vring descriptor building
 - virtio/mod.rs: real implementations for all 8 virgl_* methods
 - intel/mod.rs: explicit virgl Unsupported stubs

Other changes from active sessions: Cargo.toml version bumps, linux-kpi
headers, libpciaccess recipe, mesa/recipe.toml, kf6 patches, expat,
driver-manager, redbear-sessiond, redbear-compositor, cub, tlc, and
many other local recipes.
2026-07-09 20:29:28 +03:00
vasilito 2d12d1014c fix: iwlwifi — complete linux-kpi mac80211 header + build fixes
linux-kpi mac80211.h:
- Extract struct ieee80211_channel to top level (was nested in ieee80211_conf)
- Add struct ieee80211_conf conf to struct ieee80211_hw
- Change void* channel to struct ieee80211_channel* in bss_conf.chandef
- Include linux/ieee80211.h (consolidate single channel definition)

linux-kpi limits.h: new header with S8_MIN/S8_MAX/U8_MAX etc.

iwlwifi build.rs: add linux_mvm.c to cc-rs compilation

iwlwifi linux_mvm.c: add S8_MIN fallback define
2026-07-09 20:21:37 +03:00
vasilito 74bdc1bc80 fix: align redox-driver-sys + linux-kpi path deps to recipes/core/base/ symlinks
All local fork deps (libredox, redox_syscall, redox-scheme) now consistently resolve
through recipes/core/base/ symlinks, matching daemon workspace resolution.
Eliminates lockfile collision between local/sources/ and recipes/core/base/ paths.
2026-07-09 15:25:53 +03:00
vasilito 0046efb009 sync in-house crate versions to 0.3.0 and bump kernel/relibc/syscall submodules 2026-07-08 18:34:22 +03:00
vasilito f9d3da925e iwlwifi: power management tracking + IEEE80211_CONF in mac80211.h
iwl_ops_config() now handles PS state changes (IEEE80211_CONF_CHANGE_PS),
channel changes (IEEE80211_CONF_CHANGE_CHANNEL), and TX power changes
(IEEE80211_CONF_CHANGE_POWER). Tracks ps_enabled, current_channel, tx_power
in transport. Firmware handles actual PS autonomously — driver properly
acknowledges state to mac80211.

Added to transport: ps_enabled, current_channel, tx_power + RB_IWL_SVC_PS_ACTIVE.

Added to linux-kpi mac80211.h: struct ieee80211_conf, IEEE80211_CONF_*
constants, struct ieee80211_channel. Cross-referenced from Linux 7.1
include/net/mac80211.h lines 1824-1866.

Power save is no longer a gap — driver tracks PS state correctly.
2026-07-08 15:01:41 +03:00
vasilito f0cb2cbe49 linux-kpi: P2 transmute audit — add SAFETY comments, type safety
IMPROVEMENT-PLAN.md §10.3 item 7: HIGH severity transmute audit.

mac80211.rs:469:
- RxCallback type changed from extern "C" fn to unsafe extern "C" fn
- Callback call now wrapped in unsafe { } (correct for FFI callback)
- Added SAFETY comment: explains HashMap<usize,usize> storage pattern
  and why usize→fn pointer transmute is sound (same size, valid ABI)

timer.rs:202:
- Added SAFETY comment: explains Linux kernel timer callback ABI
  (setup_timer/mod_timer always uses void (*)(unsigned long))
- transmute remains (necessary: usize from C → fn pointer)

Both transmutes are now documented with soundness invariants.
No actual UB was found — both transmutes were already safe.
The fix is documentation, not behavioral change.
2026-07-08 10:44:19 +03:00
vasilito d7273ce5cf fix: document and implement local fork version sync policy
Add comprehensive policy documentation in AGENTS.md covering:
- local/ fork always takes precedence over recipes/ paths
- build system must ensure local fork is at latest available version
- all Red Bear patches must be applied cleanly on top of latest version
- automatic version bump + patch reapplication via bump-fork.sh

Create local/scripts/bump-fork.sh that implements automatic version bumping:
- Detects current local version vs required version from Cargo.lock
- Fetches upstream source at required version
- Applies all Red Bear patches atomically
- Updates version field and replaces local fork contents

Fix driver-manager Cargo.toml lockfile collision:
- Remove redundant syscall dependency (transitive via pcid_interface)
- Update all driver recipes to use local/sources/syscall and libredox paths
- This eliminates the redox_syscall lockfile collision between
  local/sources/syscall and recipes/core/base/syscall (same dir, different paths)

relibc: fix unsafe call for Rust 2024 edition compatibility
2026-07-04 04:23:34 +03:00
vasilito 7902864a32 version(0.2.5): bump project version to 0.2.5
- Cookbook Cargo.toml: 0.1.0 → 0.2.5
- All 61 in-house crate Cargo.toml versions: 0.2.4 → 0.2.5
- os-release.in: fix URLs from github.com to gitea.redbearos.org
- sync-versions.sh --check passes with zero drift

The OS version is derived from the git branch name at build time.
Building on branch 0.2.5 produces os-release with VERSION_ID=0.2.5.
2026-07-02 15:36:28 +03:00
vasilito 8af119d1a9 Remove duplicate redbear-netctl-console recipe (nested inside redbear-netctl) 2026-06-28 00:01:47 +03:00
vasilito eaf8e89785 recipes: bump redox_syscall 0.7 → 0.8 in all Red Bear recipes
Aligns all Red Bear custom recipe dependencies with the syscall 0.8.x
version used by the upstream-synced base and relibc forks.

Author: vasilito <adminpupkin@gmail.com>
2026-06-18 21:36:21 +03:00
vasilito 182f5dafa1 fix: stabilize linux-kpi mac80211 tx stats layout 2026-05-07 20:54:41 +01:00
vasilito bc7ca1f035 fix: clean linux-kpi memory helpers 2026-05-07 20:54:24 +01:00
vasilito 68cea5a830 fix: clean linux-kpi DRM shim warnings 2026-05-07 20:54:04 +01:00
vasilito e3d776aa9a Advance redbear-full Wayland, greeter, and Qt integration
Consolidate the active desktop path around redbear-full while landing the greeter/session stack and the runtime fixes needed to keep Wayland and KWin bring-up moving forward.
2026-04-19 17:59:58 +01:00
vasilito 2ea43f1035 Strengthen PCI and IRQ helper coverage 2026-04-18 21:38:30 +01:00
vasilito 4688a08169 Expand linux-kpi wireless and networking scaffolding 2026-04-17 00:03:08 +01:00
vasilito e210f6d0cb Expand linux-kpi wireless scaffolding, consolidate desktop plan, remove historical report
Add channel/band/rate/BSS/RX-TX structures to linux-kpi wireless
scaffolding (mac80211.rs, wireless.rs, net.rs, C headers), extend
redbear-iwlwifi linux_port.c with comprehensive PCIe transport, and
create consolidated CONSOLE-TO-KDE-DESKTOP-PLAN.md as the canonical
desktop path document. Remove stale INTEGRATION_REPORT.md (1388 lines)
in favor of current local/docs/ references. Update AGENTS.md, README,
and docs index to point to the new plan.
2026-04-16 13:52:09 +01:00
vasilito b2a80d5de5 Add linux-kpi wireless compat layer
Red Bear OS Team
2026-04-16 12:43:33 +01:00
vasilito a4833b69c5 Update Red Bear driver substrate
Red Bear OS Team
2026-04-16 12:43:10 +01:00
vasilito 50b731f1b7 Red Bear OS — microkernel OS in Rust, based on Redox
Derivative of Redox OS (https://www.redox-os.org) adding:
- AMD GPU driver (amdgpu) via LinuxKPI compat layer
- ext4 filesystem support (ext4d scheme daemon)
- ACPI fixes for AMD bare metal (x2APIC, DMAR, IVRS, MCFG)
- Custom branding (hostname, os-release, boot identity)

Build system is full upstream Redox with RBOS overlay in local/.
Patches for kernel, base, and relibc are symlinked from local/patches/
and protected from make clean/distclean. Custom recipes live in
local/recipes/ with symlinks into the recipes/ search path.

Build:  make all CONFIG_NAME=redbear-full
Sync:   ./local/scripts/sync-upstream.sh
2026-04-12 19:05:00 +01:00