Commit Graph
8111 Commits
Author SHA1 Message Date
Garvit Surana 0e458bf4e7 test(compiler): opt-in checks of every 32-bit word at five PCs that the direct integer path goes past no decoder of the lift or of the block parse that would take the word, where upstream PR #247's own tests sample a million words and its full check was never committed
every_direct_word_skips_every_decoder_before_the_integer_one and
every_direct_word_skips_the_block_decoders run on all host threads in
release, at PCs 0, 0x1000, a user and a kernel address and the highest
word, where branch and literal targets overflow. They are the proof to
rerun when a decoder is added before the integer one or to the parse.
2026-11-22 19:52:01 +00:00
justpainful 84a3106593 perf(compiler): translate blocks 32% faster with byte-identical code
Profiled on 8 MiB of the macOS 26B123 kernel's __TEXT_EXEC (269,195
blocks): decoding took 23% (the common integer, load/store and branch
classes reached their decoder after ~25 refusals), allocation 18% (the
block buffer and parse list grew from empty; link-slot checks allocated),
and the vector cache rebuilt its occupied mask on every `Code::asm`.
- `skips_decoders` routes the common classes straight to their decoder
  in `lift` and the block parse (STGP excluded: the parse takes it as a
  tag access); the parse reserves 24 instructions;
- the block buffer starts at 1 KiB (`Code::new`), fault sites and
  relocations at 8;
- the vector cache keeps `held` current, so `occupied` does not scan;
- `jump`/empty-link checks no longer allocate.
compile-throughput: 4368 -> 2972 ns/block; native_bytes unchanged
(87196315); the --emit dump of every block is SHA-256-identical, and the
new `lift` matches the old for all 2^32 words at 5 PCs. Linux: compiler
1568 passed, engine 1921 passed, 0 failed.

Rebased by Garvit Surana onto Stambha's base (upstream main of 11-20):
kept the direct integer path (skips_decoders, lift_direct, lift_integer)
in Decoder::lift and in the parse's Words::decode, the parse's room for
24 instructions, the 1 KiB buffer and room for 8 sites and relocations,
and the next instruction's vector use kept for its turn. Dropped as
upstream already covers them: the link slot, patch jump and empty-link
helpers (329b54fc3 writes them on the stack), the vector cache's held
mask (96fb55ad3 asks it only where needed, and occupied() returns early
when nothing is held), and the block buffer from Code::new (Code::asm
reserves room at a buffer's first instruction). Dropped as they no longer
fit: the padding byte filters of exit_word_of and is_direct_exit, whose
byte offsets upstream's exit layout (290ba1138) moved.

(upstream PR #247 by justpainful)
2026-11-22 19:38:26 +00:00
Garvit Surana 5a81c900fd test(xtask): the oracle manifest names stela-engine's run_loop_costs, upstream PR #246's opt-in run loop timing, where manifest_covers_every_ignored_test_in_tracked_sources failed on its unbound #[ignore] 2026-11-22 19:03:22 +00:00
Garvit Surana d1cb43c865 test(engine): the run loop's timing reads the fake host's real_counter, the TSC upstream's fixture already gives host timing benches, where upstream PR #246 added a second stamped counter beside it
lock_path_costs times eight PEs on real_counter; run_loop_costs set its
own stamped flag to read the same TSC shifted seven bits. One switch is
enough, and the bench was rerun on it: every timing makes its two million
runs, one block a run.
2026-11-22 19:02:55 +00:00
justpainful 5e23b4a28f perf(engine): borrow the parallel hub around a step instead of cloning it
`step` cloned the hub's Arc around `act_on` on every run: a locked
increment and decrement of one reference count every PE wrote at each
of its runs, a cache line the PEs then passed between them. perf put a
quarter of a run's cycles there with two PEs or more. The hub is now
borrowed before the act and again for `leave_active`; a machine's hub is
set once (`enter_parallel`/`start_parallel` refuse one that has it) and
nothing the act does takes it. No memory ordering changed.
New ignored `run_loop_costs` benchmark, ns per run (mean of 3):
br 2 PEs 234 -> 192, 4 PEs 274 -> 196; mrs+br 2 PEs 277 -> 210,
4 PEs 302 -> 230. Linux: engine 1921 passed; parallel x20 clean.

Rebased by Garvit Surana: the fake host's counter keeps upstream's
real_counter ahead of the stamped one this adds.

(upstream PR #246 by justpainful)
2026-11-22 18:58:47 +00:00
justpainful ca4eb6326f perf(engine): a full ITLB set puts out a dead context's page first
`LookupTable::insert_over` treats an entry whose context no lookup
reaches any more as a free place: the resident moves over a dead
neighbour, and a dead resident is the one out, before a live entry is
put out at random. A busy desktop's ITLB evicted live pages while dead
contexts' entries sat in their sets (16% of its misses). The eviction
counter no longer counts a live entry as lost when the dead resident
leaves. stela-engine on Linux: 1921 passed, 0 failed.

Rebased by Garvit Surana: insert_over keeps upstream's removal of the entry's
older self beside it (6a1fe6e33) ahead of the dead-context rule, so
keep_resident is beside empty, older self or dead, then dead resident out.

(upstream PR #248 by justpainful)
2026-11-22 18:57:04 +00:00
justpainful 817e589e29 perf(compiler): a 1024-entry jump cache per PE
A lookup site over many targets (returns and indirect calls into shared
libraries) missed the 256-entry jump cache for most transfers and went
through the table probe: `transfer_path_costs` over 1024 targets ran
14.4 ns a transfer with 0.75 table probes; with 1024 entries 8.8 ns and
none (4096 gains nothing more). 64 KiB a PE; `forget_all_jumps`, the one
whole-cache walk, runs only on a table clear. Linux: engine 1921,
compiler 1568 passed, 0 failed.

(upstream PR #249 by justpainful)
2026-11-22 18:55:38 +00:00
Garvit Surana 1b36715e99 fix(engine): a full mailbox's merge is a bridge across a PE's global pages by the granule of the smallest global leaf it took, where a fixed 16 KiB granule hid a 4 KiB global page between the TLBIs of the pages on its two sides and the merge dropped it
A TLBI by VA removes the whole leaf at its address. Of 4 KiB leaves, the
TLBIs of the pages at 0x1000 and 0x3000 leave the global page at 0x2000,
but their merged range takes it in, and bridges() rounded both spans to
16 KiB and saw nothing between them. That is the finding an automated
review left on upstream PR #245, which the PR never answered. A fixed
4 KiB granule would instead count neighbouring 16 KiB pages, as macOS
maps them, as a bridge where the merge adds no entry. GlobalSpan now also
keeps the smallest leaf widen() took in, and bridges() rounds to it: a
global leaf the merged range reaches and neither TLBI does is at least
that size and aligned to it, so it lies between the granules the two
spans touch. Perf only: every kept scope still covers the TLBIs it
stands for, whatever the granule.
2026-11-22 18:55:26 +00:00
justpainful ff9a535a71 perf(engine): a full TLB mailbox merges no scope across the PE's global pages
Once a PE's mailbox held 256 scopes, a new TLBI merged with the narrowest
of the last 16 at any distance, so an ASID-tagged scope below the shared
region and one above it became one range over it; global entries match
any ASID, and the mail read dropped every global ITLB entry the PE held
(about 874k drops per 10 s per PE on an i7-12700KF desktop, mostly on
idle PEs). Merges now prefer one that leaves the PE's lower-half global
span alone, falling back to the old choice; every kept scope still
covers the TLBIs it stands for. Two-PE benchmark: drop_global and
refills 1280 -> 0. stela-engine on Linux: 1921 passed, 0 failed.

(upstream PR #245 by justpainful)
2026-11-22 18:51:38 +00:00
justpainful f21c28f754 fix(audio): keep refusing a GTS unit with a nonzero descriptor count
The walk measures GTS as its fixed 0x40 bytes. A nonzero descriptor
count makes the unit longer, so a later capability inside that tail
would pass the overlap check, and if it decoded as ML its LCTL could be
written there. Until the descriptor geometry is known, such a layout is
refused again; the version-0 headers and the skipped alternate links
stay accepted.

(upstream PR #244 by justpainful)
2026-11-22 18:29:51 +00:00
justpainful dbb879a83e fix(audio): a Raptor Lake HDA's version-0 capability headers start it
8086:7a50 reports its multi-link capability header as version 0, which
the preflight refused, so no HD Audio controller started ("HOST DEVICE
FAILED ... UnsupportedExtendedCapability { id: 2, version: 0 }"). Linux
never checks the version. GTS geometry is never touched, and only the
first link is clocked, so later alternate links are left alone.

(upstream PR #244 by justpainful)
2026-11-22 18:29:51 +00:00
BluePhi09 95e216ad43 fix(boot): the BSP's fixed MTRRs are admitted when firmware leaves the legacy VGA hole write-back with MMIO routing, as Linux runs with them, where Stela stopped with 'unsupported BSP memory-type register fields' on a Lenovo IdeaPad Pro 5 16AKP10 (Ryzen AI 7 350)
(upstream PR #222 by BluePhi09)
2026-11-22 18:29:51 +00:00
BluePhi09 6c841def87 fix(ps2): a controller config write the embedded controller acknowledges with an ACK ahead of the CTR is read past that ACK, where the PS/2 keyboard of a Lenovo IdeaPad Pro 5 16AKP10 was left out with ControllerReply { command: 96, received: 250 }
(upstream PR #226 by BluePhi09)
2026-11-22 18:29:51 +00:00
BluePhi09 f1fb28a30c fix(i2c): a STOP the DesignWare controller reports before any command of the transaction is queued is cleared and ignored, where an AMD I2C HID touchpad (Lenovo IdeaPad Pro 5 16AKP10) failed with UnexpectedStop right after enable and was left out
(upstream PR #223 by BluePhi09)
2026-11-22 18:29:51 +00:00
Garvit Surana 82bd050991 fix(boot): call none of the firmware's variable services after its exit in a boot that only checks the disk chosen for macOS, where a stop there could still write its record to NVRAM 2026-11-21 20:24:15 +00:00
Garvit Surana 4a56ad302d fix(drivers): fill an NVMe read's data pages with a poison at each run, so a read the controller reports done without moving its data reads as 0xa5, where the bounce pool could hand it the pages a write had just filled and a read-back of a write the disk did not take passed 2026-11-21 20:24:15 +00:00
Garvit Surana 993b10b0c0 fix(install): stop before the primary GPT is written when a write of the backup changed any of the primary's blocks, and say a plan's blocks without overflow before it is checked, where only the backup was read back before the log said the primary was as it was, and a range of no blocks, one past the last LBA or a disk no GPT uses panicked the check 2026-11-21 20:24:15 +00:00
Garvit Surana 779d12b39f fix(boot): write neither the USB's chosen-disk record nor BootNext in a boot that only checks the disk chosen for macOS, where Check only would have replaced the record and could set BootNext before the firmware's exit 2026-11-21 19:43:00 +00:00
Garvit Surana 6a14fb719d fix(install): add macOS only in free space beside a disk's partitions, check the plan against both GPT copies as Stela's own driver reads them before anything is written, keep a valid protective MBR, read every write back before the next and offer Check only, which reads the disk, says every write and writes nothing, where one key in the picker deleted a partition or erased the disk, only LBA 0-1 were compared, nothing was read back until all five writes were made and 11 bytes of the MBR changed 2026-11-21 19:43:00 +00:00
Garvit Surana 2451a35253 feat(formats): give a GPT's entry blocks and the protective MBR test to its callers, so the disk plan can keep a disk's own MBR and check its writes against the GPT's blocks 2026-11-21 19:43:00 +00:00
Garvit Surana 7f67ae7f9e fix(drivers): refuse a discard of no ranges where a command meets its device, and an NVMe Deallocate of none or more than 256 ranges before it takes a tag, where an empty one went out as 256 ranges of a stale bounce page, which could free any block 2026-11-21 19:43:00 +00:00
Garvit Surana 7b33d729b8 fix(boot): show an install's system image as all sent once its ASR job is gone, count only the payload's offset as sent, keep the rows of a frame the screen refused pending for a later turn, count the lines under the running step as shown only once the console's text took them and clear them with a finished line, and read the counter for the progress only in an install, where one service turn that sent the last chunk and ended the job left the reading below 100% as waiting for data, the guest's out-of-band reads showed as the image's progress, a frame a busy console refused left the progress panel up until macOS drew again and a hand-back marked a kept console's progress lines as drawn 2026-11-21 19:38:28 +00:00
Garvit Surana 111d932c77 feat(boot): log an install's progress once a minute and at each new restore step, and show it on Stela's console when macOS has drawn no new frame on the firmware's screen for a minute, until its next frame takes the screen back whole, where the console gave the screen up for good at macOS's first frame and an install showed only Apple's progress bar, which could sit at 0% for hours 2026-11-21 18:59:56 +00:00
Garvit Surana c1f6f96a0e feat(boot-core): model an install's progress from its restore step and the system image's bytes, with a smoothed rate, the time left, a stall said as waiting, a once-a-minute INSTALL PROGRESS line, an INSTALL STAGE line per new step, the console's progress panel and when the console takes the screen from macOS's frames, where an install had no measure of how far it had come 2026-11-21 18:59:56 +00:00
Garvit Surana a885a57b17 Merge upstream/main 140ffaf71 into fork/install for the macOS install build
The install build is the RTL8852CE Wi-Fi branch (wifi/rtw8852c-m3, 999c0d361)
with upstream's GPT slot, TRIM and 32 MiB log fixes.

One conflict, in crates/stela-boot/src/engine/network.rs (HostNetwork::open):
the Wi-Fi adapter's address wait still runs through network_link::address,
so its connection keeper's failures are retried until the cut, and upstream's
DHCP and DNS notes (Stack::take_notes) are logged after that wait, before the
keeper's retry line. This matches wifi/rtw8852c-m3-test, without its
host-check-only `pub(crate) mod security`.
2026-11-21 18:25:36 +00:00
Garvit Surana 999c0d361a fix(boot): drive a Wi-Fi adapter's wait for an address past its connection keeper's failures until its carrier wait and then the network stack's DHCP wait, now exported, have passed, as the host check drives its station, where the keeper's first failure, reaching the stack as the link's, ended the wait and gave the adapter up while the keeper's next attempt could still join 2026-11-21 16:34:10 +00:00
Garvit Surana 5cd5570a3e fix(boot): hide the configured Wi-Fi network's name in what a Wi-Fi adapter's link says, its errors and state lines, where the connection keeper's failures named it on the boot's NETWORK adapter failed line, its screen account and the guest network's lines 2026-11-21 16:28:40 +00:00
Garvit Surana 4e0ba3fe8c fix(drivers): print an RTL8852CE's MAC address in its running firmware's warning masked, its vendor half and last byte, as the engine prints an adapter's, where the normal boot's HOST WARNING line held the chip's whole address 2026-11-21 16:24:12 +00:00
Garvit Surana 50cd7ef64e feat(wifi): count an RTL8852CE station's data in its progress line, the MSDUs delivered, the protected frames left sealed or under a key ID with no key, those the station refused and the data frames sent, and drop KEYS_BEFORE_M3B, where a station with its keys and port open but no traffic could not tell an undecrypting key from silence and M3a's refusal outlived its last reader 2026-11-21 15:12:07 +00:00
Garvit Surana 1ef2420880 fix(wifi): drop an RTL8852CE's frames failing their FCS or ICV before the duplicate check, as mac80211's should_drop_frame drops them before any handler, where such a frame recorded its sequence control and the AP's good retry of it was dropped as a duplicate 2026-11-21 15:10:42 +00:00
Garvit Surana 8c1cc3fdb8 docs: name ps.c, regd.c, sar.c, sar.h and the mac80211 and cfg80211 sources among the rtw89 RTL8852C station's Linux sources in NOTICE, where they were unlisted 2026-11-21 14:48:24 +00:00
Garvit Surana bc26901d5f docs(wifi): describe the RTL8852CE station in the ax and realtek module docs, cite mac80211 at the donor commit, name ADDR_CAM_ENT_SHORT_SIZE, and state where a failed key install's rollback leaves Linux's, Stela's own key delete order, what a keeper's into_radio drops, that an AP's country element moves no TX power index and that the RTL8852CE alone waits 30 s for carrier, where the docs said it had no station, cited mac80211 7.2.12 or by name only and claimed rtw89's rollback and mac80211's delete order exactly 2026-11-21 14:48:24 +00:00
Garvit Surana b7b3e94650 feat(drivers): attach an RTL8852CE with a configured network as a Wi-Fi station NIC, where it was brought up, reported and left unsupported 2026-11-21 14:48:24 +00:00
Garvit Surana 221e45c933 fix(wifi): name an RTL8852CE bring-up's read of its firmware's TX power tables the "firmware elements" step, where a file without one failed as "tx power: tx power: firmware lacks …" 2026-11-21 14:48:24 +00:00
Garvit Surana bcffc0edff fix(wifi): reorder an RTL8852CE's protected frames before dropping the ones it cannot open, PN-check each frame as it is drained, and close its port while a replaced key's successor is not installed, as mac80211 and rtw89 do, where an undecryptable frame held its agreement's later frames up to 100 ms, a key install's reset outran the frames its own waits drained, and a refused rekey left the port open without its key 2026-11-21 13:46:05 +00:00
Garvit Surana c8b0dc527e feat(wifi): end an RTL8852CE's association when its firmware reports the AP's beacons lost and give it 30 s to bring carrier up, where a silent AP was never noticed and the link had a wired PHY's 10 s 2026-11-21 13:30:42 +00:00
Garvit Surana df753ca513 fix(wifi): keep an RTL8852CE's SAE exchange going through a deauthentication and take only SAE frames addressed to it, as mac80211 does, where a stray deauthentication ended a WPA3 join and another station's SAE frame failed the keeper 2026-11-21 13:15:29 +00:00
Garvit Surana 7a9620ed93 feat(wifi): authenticate an RTL8852CE to WPA3 networks with SAE through the keeper's external authentication and protect its management frames, where only WPA2-PSK could connect 2026-11-21 12:57:14 +00:00
Garvit Surana d91740c071 feat(wifi): accept an AP's RX Block Ack agreements on an RTL8852CE, program its BA CAM and reorder what they deliver as rtw89_ops_ampdu_action and rtw89_fw_h2c_ba_cam do, where every ADDBA went unanswered 2026-11-21 12:27:15 +00:00
Garvit Surana dcf9c2a2ca feat(wifi): run an RTL8852CE's station data under hardware CCMP with host packet numbers in the TX descriptor, its group key, its port and host-side PMF, where the handshake stopped at the first key 2026-11-21 11:28:02 +00:00
Garvit Surana 8b7028fe5a feat(wifi): install and remove an RTL8852C's CCMP keys in its security CAM and point its address CAM at them, waiting for the firmware's receipt and acknowledgement, as rtw89_cam_sec_key_install and rtw89_cam_sec_key_del do, where no key could reach the hardware 2026-11-21 09:36:53 +00:00
Garvit Surana f531e5446c feat(wifi): attach an RTL8852CE as a kept station from its firmware, regulatory database, network and entropy, where it could only be brought up and powered off 2026-11-21 00:23:06 +00:00
Garvit Surana 6257b03d2b feat(wifi): keep an RTL8852CE connected through the shared connection keeper as an rtw89 radio that scans, authenticates, associates and runs the EAPOL handshake over its chip, where the chip had no station 2026-11-21 00:03:03 +00:00
Garvit Surana acc955c6ee feat(wifi): drive a live RTL8852CE through a chip-neutral station interface for channels, scans, management and data frames, association and its TX reports, where its MAC could only be brought up and scanned 2026-11-20 23:17:19 +00:00
Garvit Surana 48ec81fea1 feat(wifi): associate an RTL8852C's station with its AP and leave it again through the CMAC table, join info, address CAM, rate adaptation, beacon filter, port and EDCA H2Cs as rtw89_core_sta_link_assoc and rtw89_core_sta_link_disconnect do, where the firmware only ever had an unassociated role 2026-11-20 22:30:04 +00:00
Garvit Surana 84b43ae1c4 feat(wifi): run an RTL8852C firmware scan over any list of channels on a live chip and restore its channel, RX filter, CAM, EDCCA, TSF sync and DIG afterwards as rtw89_hw_scan_complete does, where a scan ran once before the power-off 2026-11-20 21:21:27 +00:00
Garvit Surana 25faa2834f feat(wifi): keep an RTL8852CE powered after its bring-up as a live chip with its TX power set and stop it on request, where every bring-up ended in a power-off 2026-11-20 20:36:57 +00:00
Garvit Surana b4b9ab57e8 feat(wifi): deliver every frame an associated RTL8852C receives with its decryption status, read its beacon filter reports and wait for an H2C's receipt by sequence as rtw89_core_rx and rtw89_mac_c2h_bcn_fltr_rpt do, where only beacons and scan reports were kept 2026-11-20 19:36:55 +00:00
Garvit Surana 1cdf8cffdc feat(wifi): build an RTL8852C's TX WD body and info for management and data frames, with the CCMP packet number in the descriptor, as rtw89_core_fill_txdesc_v1 and rtw89_core_tx_update_sec_key do, where no frame but an H2C had a descriptor 2026-11-20 19:10:38 +00:00
Garvit Surana 49f3a4005c fix(wifi): refuse an RTL8852C TX reclaim while its data and management rings are stopped, restart every host index as soon as pre_init has cleared the hardware's, count an RXQ or RPQ buffer consumed once it has been delivered even when handing it back fails, and refuse a WD head without WD_INFO_EN, where a hardware index zeroed by deinit or a failed pre_init passed for TXBDs read, a failed pre_init left RX host indices that read the zeroed index as filled entries, a failed give-back redelivered a buffer and wp_info sat at byte 56 for a head whose info Linux would have left out 2026-11-20 18:48:10 +00:00