aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
GitHub aien-dev/aienux#472 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/3f6cb68de87281b5.bundle -o 3f6cb68de87281b5.bundle git fetch 3f6cb68de87281b5.bundle refs/pull/472/head
Provenance
github-import 1
aien-dev/aienux
472
7bc7c84ec2637a8dd570bf00ff9d79db2b3e2346
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":472,"url":"https://github.com/aien-dev/aienux/pull/472","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:31Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index 3f06634c..f8ddc510 100644 --- a/.crumb +++ b/.crumb @@ -28,38 +28,38 @@ }, { "digest": "289309d0e431e95c5866389054925eaa880a4b02b80707e59df48de81d97d559", - "last_commit": "180618ae", + "last_commit": "832bcbd9", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, { - "digest": "a9e7cd3ed2b33ec09a073829681c3e50d764528323e8d34ccf0c8a6a5004c2e9", - "last_commit": "94b77f6c", + "digest": "1b123b34f8e35c22d2aa7aae3d24e0f8b97f14e2e44795c7b568c5a4b831ee8c", + "last_commit": "5cbd4a02", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, { "digest": "8650bf3aae02e1f11fe999a3cd8c1399df071d318e6ecb642bc366a282e75fbf", - "last_commit": "94b77f6c", + "last_commit": "89e296db", "name": "scripts", "purpose": "Directory scripts. Purpose not yet described by a human." }, { "digest": "e891c078bec120c3fdb14e13b7dd25d69054f608c2ea632adf2fd2b6e45d8fa1", - "last_commit": "fa71ca51", + "last_commit": "6c952979", "name": "tools", "purpose": "First-party host artifact preparation tools" } ], - "children_root": "sha256:5a4892774a97ba9670270b9eb2fb6f6eccd117909f0fb4a346f1977e94c5a8bd", - "compiled_at": "2026-10-30T05:15:53Z", + "children_root": "sha256:c1faed4067d60ca6a6eadb22eaec9823bd7372e7598578e7fc6a60e907929c5e", + "compiled_at": "2026-10-30T05:25:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:c56d4c773afacd92c5fbd4abf8dfc1bffff90db2621611b084510e540f31c356", + "digest": "sha256:5dc6dc695eb9226a19c0a7065269729b0cf91cecf3d594c57129c232f9a74b89", "evidence_files": 236, "evidence_root": "sha256:55ef5621f09577ce1ada90d990955aec996d15e16a9b0f6953ecb90f3ca499df", - "files": 3568, - "generated_at_commit": "94b77f6c2c3a43fbd90f7c3d08169dee1ae50fcf", - "source_tree": "sha256:eb29b1c692544e6e1a35e55c73993951be2b9c5b2044106a45d2151b08ecefef" + "files": 3579, + "generated_at_commit": "5cbd4a02d3e3de49d65aa3fd5e1bfc92e7c832ec", + "source_tree": "sha256:070c280b8264c26a1ce9a3c0364722629fa08289da8fc04b6257d1082c2b01d9" }, "owner_lane": "", "provenance": { diff --git a/native/.crumb b/native/.crumb index f7813814..a863515c 100644 --- a/native/.crumb +++ b/native/.crumb @@ -56,7 +56,7 @@ }, { "digest": "6a3433e812a1f8deac469ac30e837c7ee402ab18eb450cf3553bf7c0674544f7", - "last_commit": "94b77f6c", + "last_commit": "89e296db", "name": "boot", "purpose": "Directory native/boot. Purpose not yet described by a human." }, @@ -73,14 +73,14 @@ "purpose": "Directory native/crypto. Purpose not yet described by a human." }, { - "digest": "c4ce5c38d99a4f4fbbaf8f829817511aa6ba94d92318ba4f638eddd485341eb0", - "last_commit": "f45d00ad", + "digest": "d4eef8b6519117abbf055ec498e63df82f7c633c448669b4a160c5688107f0de", + "last_commit": "62393fb2", "name": "disk", "purpose": "Directory native/disk. Purpose not yet described by a human." }, { "digest": "fad98a3a60585ec53f45394e80311344ed58601c892bfd39f779b485872e1e4b", - "last_commit": "94b77f6c", + "last_commit": "c01180eb", "name": "kernel", "purpose": "Directory native/kernel. Purpose not yet described by a human." }, @@ -92,7 +92,7 @@ }, { "digest": "eca6d5cb48d78e40168815ff06122c85860714746afd12dc9402b893d64d9dec", - "last_commit": "87edb053", + "last_commit": "f45d00ad", "name": "net", "purpose": "Directory native/net. Purpose not yet described by a human." }, @@ -115,15 +115,15 @@ "purpose": "Directory native/store. Purpose not yet described by a human." } ], - "children_root": "sha256:1073323fe03fbd0eba8c7d6fd5e64192c9d988cbbf26926d7e2248c720392230", - "compiled_at": "2026-10-30T05:15:53Z", + "children_root": "sha256:cf4933f08af09a4168572ad6506d2f8e53950e32107cbb4818d6fd2a2bf82f7b", + "compiled_at": "2026-10-30T05:25:31Z", "compiler": "crumb-compile/1", - "digest": "sha256:a9e7cd3ed2b33ec09a073829681c3e50d764528323e8d34ccf0c8a6a5004c2e9", + "digest": "sha256:1b123b34f8e35c22d2aa7aae3d24e0f8b97f14e2e44795c7b568c5a4b831ee8c", "evidence_files": 24, "evidence_root": "sha256:ecc7ccf2e924c221a5bac1d91e23b13d8f3c8d78c2a893a882ed7ca5e88d855d", - "files": 665, - "generated_at_commit": "94b77f6c2c3a43fbd90f7c3d08169dee1ae50fcf", - "source_tree": "sha256:5a2958d85af9d8dc775be29ff1e7f0e0da295845fa52d334570de1f1c809facf" + "files": 676, + "generated_at_commit": "5cbd4a02d3e3de49d65aa3fd5e1bfc92e7c832ec", + "source_tree": "sha256:169b2ea5c9bfbf5add1e9e415eae32d1edb73c87acfa72d485b4f48725854933" }, "owner_lane": "", "provenance": { diff --git a/native/disk/.crumb b/native/disk/.crumb index 223e6342..c9f0e703 100644 --- a/native/disk/.crumb +++ b/native/disk/.crumb @@ -18,26 +18,26 @@ "children": [ { "digest": "cf40c4f55bcd87bdcc2d459eb0504e98ede16cd7838d6dcce683c8844cf14c4c", - "last_commit": "621c9e6f", + "last_commit": "f45d00a", "name": "qemu", "purpose": "Directory native/disk/qemu. Purpose not yet described by a human." }, { - "digest": "a84880bebd005b831a55fa76589f0560f602e21cd87329c5f407ad877d04fff3", - "last_commit": "621c9e6f", + "digest": "e78f3758d5e40bf9e4fcce57ec663c7d09b3534d16d3c4d9b625f403795e2d60", + "last_commit": "3b06356", "name": "tests", "purpose": "Directory native/disk/tests. Purpose not yet described by a human." } ], - "children_root": "sha256:4aea14c4d49f640e317a523d6fe5fc9327a9d7b3b0863ecb926390bd655ac1b8", - "compiled_at": "2026-10-24T04:15:32Z", + "children_root": "sha256:4b29ee36b1edd5dc51031d8e0bbda70612b855b89650707b85e4fc0aea35dd44", + "compiled_at": "2026-10-28T23:36:33Z", "compiler": "crumb-compile/1", - "digest": "sha256:c4ce5c38d99a4f4fbbaf8f829817511aa6ba94d92318ba4f638eddd485341eb0", + "digest": "sha256:d4eef8b6519117abbf055ec498e63df82f7c633c448669b4a160c5688107f0de", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 20, - "generated_at_commit": "621c9e6fe430ee689836bee3ee2689d7d32e0f7d", - "source_tree": "sha256:13ce1dfd9111fa9250f38bda90ec132ede441d871f287bb1ad407b57c609f5b7" + "files": 31, + "generated_at_commit": "3b063566de689bc1d26388919e4d67cbc2631b5c", + "source_tree": "sha256:8502112bb016e51c6ee325a4ab42e3311d6beb4ee8077e1b763707443b1566e4" }, "owner_lane": "", "provenance": { diff --git a/native/disk/OMEGA_NVME_READ.md b/native/disk/OMEGA_NVME_READ.md new file mode 100644 index 00000000..ca272c24 --- /dev/null +++ b/native/disk/OMEGA_NVME_READ.md @@ -0,0 +1,293 @@ +# Seeded Omega NVMe read protocol and Path 3 qualification + +## Status and boundary + +IMPLEMENTED and EXERCISED on host fixtures and a disposable QEMU NVMe namespace. +PHYSICAL NOT_RUN. Native kernel/VFIO execution NOT_RUN. This is not a TRUST-1 Gate 7 +pass, a bootable native storage stack, or a replacement for the existing kernel +binding. Nothing in this work opens a live block device, resets a physical +controller, binds VFIO, mounts a filesystem, or touches 18091. + +The protocol engine is `omega_nvme.om`. `omega_nvme_main.om` exposes only bounded +reads. `omega_nvme_transport.om` is an explicitly hosted verification transport: +24-byte little-endian byte-access RPCs on stdin/stdout. The existing C reference +and QEMU are verification oracles, not a C implementation hidden behind an Omega +API. Queue construction, completion polling/correlation, Identify parsing, +identity/extent approval, PRPs and successful copy-out are all Omega code. +The C relay translates memory/register accesses, not NVMe operations. Its C model +contains writes for adversarial verification, but the normal Omega entrypoint +cannot submit them. Host and emulator results establish neither DMA coherence nor +SSD latency/throughput on the Spark. + +## Reuse search and ownership + +Before implementing, searched `*.om` for case-insensitive `nvme` or `submission queue`: +all 5,321 fetched advertised branch refs in all 106 aien-dev repositories, and +190,008 committed-ref instances in 1,933 local common stores under `work`, +`workspace` and `/tmp` (discovery depth four). No matching existing implementation +was found. All twelve no-ref working copies and the current OwnDriver, aienux and +synapse working-copy scopes were searched separately. Three stale alternate-object +stores were resolved through successful redundant scans and an environment-only +existing object directory for their two otherwise-unscanned commits. +`tests/omega_nvme_reuse_search.txt` records exact coverage, branch inventory and +the limits of that finding; the raw command evidence remains with the operator. + +The disk crumb's historical lane11/PR190 is not an active `.om` migration claim. +BOARD assigns this isolated `native/disk` candidate to QualNvmeOm; the GPU +access/lifecycle work remains in its existing driver lane. Synapse #54 owns the +R1/J1 raw-store consumer, not this hardware protocol engine. This change does not +replace or claim the System Store journal or that consumer. + +## Pins and reproducible acceptance + +- Compiler source: aien-dev/omega-mv `397e67040fb74853c6814097fe02ae4e1ebd6f66`, + the existing omega-gpu-driver `feat/vfio-dma-bar` pin, not an invented profile. +- Seeded omc SHA-256: + `bcfa582892afca8f65e551fe56867d918d86e84540c7381be8fa9ef18d0cf0f6`. +- Existing C reference: `disk_nvme.c`; existing model: `tests/nvme_test.c`. + Their exact hashes and the compiled candidate hash are in + `tests/omega_nvme_receipt.txt`. They were not modified by this change. +- Verification dependencies: GCC 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04.1), + QEMU 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18), POSIX shell and ordinary host tools. + These are read-only verification oracles/orchestration, not production runtime + dependencies or an adopted replacement language implementation. + +From the repository root on this Spark: + +```sh +AIEN_OMC=/home/drakestapleton/work/OwnDriver/omega-gpu-driver/build/omc \ +OMEGA_NVME_EVIDENCE=/home/drakestapleton/handoffs/spark-five-20261028/QualNvmeOm/replay \ +sh native/disk/tests/omega_nvme_test.sh +``` + +The gate checks omc's independent hash before compilation. It creates a new, +regular namespace image under a private `/tmp/omega-nvme-*` directory; there is +no block-device filename option. QEMU uses TCG, a stopped CPU, 64 MiB guest RAM, +no network, and no host device passthrough. The verifier alone assigns the emulated +PCI BAR and enables that emulated PCI function. The Omega engine then configures +NVMe admin/IO queues and reads the namespace. Cleanup terminates only its own +QEMU process and removes only its disposable image/socket/log directory. + +The filed receipt has 37 passing host cases, seven killed guard-removal mutants, +and ten passing QEMU cases. Successful payloads are byte-identical to +`nvme_read` through the existing C reference. Both supported LBA sizes (512 and +4096 bytes), one/two PRP pages, repeated IO wrap and repeated admin wrap are +exercised. Refusals cover identity, approval, NSID, extent, request range/count, +metadata, format, queue entry sizes, controller capability, completion CID/SQID/ +SQ-head/phase, timeout, CFS and unsuccessful status. The no-write hostile caller +attempts IO Flush, Write, Write Zeroes, Dataset Management, Format and Sanitize +opcodes, plus administrative Format; all are refused before submission. Removing +the opcode guard makes the existing model observe an IO Write command and kills +the mutant. Removing CID, SQID, SQ-head, status, failed-reopen or retained-DMA +checks also kills their respective mutants. + +The C model does not populate serial/firmware Identify fields. The verifier +supplies those two raw identity fields from the explicit synthetic fixture; +it does not alter queue or data behavior. QEMU supplies its own Identify data. +An inactive NSID is refused differently: the C fixture rejects it against NN +(code 24), while QEMU 8.2.2 returns a zero-size Identify Namespace (code 25). +The initial test expected identical refusal codes; the original failed receipt +is retained in the handoff directory. The final test encodes both independent +controller behaviors and still requires no IO/copy-out. No guard was weakened. + +## Approved identity manifest + +The normal entrypoint reads exactly 80 bytes before performing any operation. +Integer fields are little endian; identity fields are exact space-padded NVMe +Identify bytes, not trimmed string prefixes. The approval word must equal one; +it binds an already reviewed fixture/manifest, and does not grant device access +or replace operator authorization. Blank serial/firmware is refused. The final +reserved word must be zero in the normal read entrypoint. + +| Offset | Bytes | Meaning | +| --- | --- | --- | +| 0 | 20 | Exact approved controller serial (Identify bytes 4..23) | +| 20 | 8 | Exact approved firmware revision (Identify bytes 64..71) | +| 28 | 4 | Explicit NSID; no first-namespace discovery or fallback | +| 32 | 8 | Approved extent start LBA | +| 40 | 8 | Approved extent block count | +| 48 | 8 | Requested start LBA | +| 56 | 4 | Requested block count | +| 60 | 4 | Repetitions, 1..64 | +| 64 | 4 | Reviewed manifest approval marker, exactly 1 | +| 68 | 4 | Reserved, exactly 0 | +| 72 | 8 | Device-visible base of the transport-owned DMA pool | + +The synthetic fixture binds serial `OMEGA-FIXTURE-000001 `, firmware `8.2.2 `, +NSID 1 and extent [8,72). It requests LBA 8, 16 blocks, 40 repetitions for the +512-byte fixture. The 4096-byte host fixture requests two blocks. The DMA IOVA is +`0x123456000` in the C model (tests high address dwords) and `0x40000000` in QEMU. +These are guest/model addresses, never host pointer addresses or approved +physical addresses. The host probe entrypoints under `tests/` are never composed +into the normal read entrypoint. + +## Engine invariants and limits + +- One admin queue and one IO queue, each depth 16; one command outstanding. + SQ tail and CQ head wrap independently; CQ phase starts at one after zeroing. +- The only admin opcodes admitted by the central submit guard are Identify, + Create IO CQ and Create IO SQ. Only Read (2) is admitted on the IO queue. +- Completion phase, CID, SQID, consumed SQ head and success status must all match. + Failed status never copies bounce data to the caller. Wrong correlation or + exhausted poll budget latches failure and retains ownership of DMA storage. + Subsequent reads and reinitialization are refused, without a reset or reuse. + Queue backing is marked retained before CC.EN; readiness timeout/CFS also keeps + it retained. Only a successful ready observation clears that activation marker. +- A 32 KiB transport-owned DMA pool holds ASQ at +0, ACQ +4096, Identify +8192, + IOSQ +12288, IOCQ +16384, one unused page, and bounce pages +24576/+28672. + No PRP list exists. Only aligned, at-most-two-page transfers are admitted. +- CAP must support NVM, 4 KiB minimum pages and at least 16 queue entries; major + VS must be one or two. DSTRD is honored through 12; larger strides are refused + before initialization because the transport's mapped register window is 64 KiB. + SQES/CQES must support 64/16-byte entries. +- Namespace capacity and format are parsed. Only 512/4096-byte LBAs with no + metadata or protection information are accepted. Extent and request bounds are + checked by subtraction before arithmetic; namespace capacity must cover them. +- MDTS zero means no advertised limit. With MPSMIN zero, every nonzero MDTS + permits at least two pages; the fixed 8192-byte software limit cannot exceed it. +- Controller-ready and command waits are bounded to 256 transport polls. This is + a hosted, bounded attempt budget, not a claim of milliseconds or hardware + timeout qualification. Blocking RPCs also have the verifier's wall-clock guard. + Queue/DMA storage stays alive until the verifier tears down its controller. + +## Native transport integration contract (not exercised) + +The existing compiler pin already supplies `vfiomapw`, width-checked +`mapget/mapset` with DSB SY, and checked `IOMMU_MAP_DMA/UNMAP_DMA`; this change does +not claim those words are missing. A native adapter must reuse the existing +omega-gpu-driver device-ownership setup, rather than reimplement it in C or let a +manifest select arbitrary host physical memory. The exact seam is: + +- `load32/load64(addr)`, `store32/store64(addr,value)`: translate the fixed engine + BAR window or the explicitly owned DMA IOVA range into distinct live mapping + handles; one correctly sized aligned access, bounds checked. No integer-to-CPU + pointer conversion. Preserve ordered SQ writes before doorbell and completion + observation before DMA copy-out. +- `zero_dma`, `fetchid`, `fetchdata`, `publish`: operate only on the owned pinned + DMA pool/caller storage. The IOVA is not the CPU map address. Require documented + coherent-DMA support or implement/qualify the required cache-maintenance profile; + DSB alone is not evidence of cache coherence. +- Retain mappings, pinned pages, container and confinement on uncertain completion. + Do not implement a process-exit/error cleanup that silently drops DMA mappings. + Reclaim only after a separately proven controller-quiescence/IOMMU teardown. +- Replace transport-poll timing with a qualified monotonic deadline and a bounded + poll envelope; report timeout together with retained resources. Add raw command + submit/completion/copy timestamps without tuning queue depth, transfer size, + affinity, scheduler, clocks, firmware settings or cache state. + +The host RPC transport is not this adapter. The kernel boot/effects ABI and +coherency/retention proof need a concrete driver-owned integration before the +physical procedure below is executable. In particular, using the existing C +`nvme_bind.c` as a shortcut is forbidden: it reaches the write/flush/restore probe. +No physical command is supplied that pretends an unimplemented native adapter +already exists. + +## Exact physical qualification procedure: measurement first + +### Target and authority + +Current read-only sysfs observation (not a block-device open): controller +`0004:01:00.0`, model `SAMSUNG MZALC4T0HBL1-00B07`, serial `S8C2NG0Y801377`, firmware +`NXHB202Q`. This is the live root NVMe, not a disposable namespace. These facts are +identity observations, NOT an approved physical manifest or permission to reset it. +Sysfs `nvme0/nvme0n1/nsid` is `1`; its `queue/logical_block_size` is `512`. +These are kernel metadata reads only, not Identify commands sent by this candidate. + +The proposed read-only baseline manifest targets **that controller, NSID 1, +extent [0,64) logical blocks**, request start LBA 0, maximum 8192 bytes per command, +64 repetitions. Actual Identify must first confirm NSID, capacity, firmware and +512/4096-byte geometry against Drake's signed-off exact manifest. Use 16 blocks per +command for 512-byte LBAs, or two for 4096-byte LBAs. The sample is deliberately a +fixed repeated read of the initial 8192 bytes, not a sequential-bandwidth or +cold-cache maximum-performance claim. No writes or scratch extent on the NVMe are +needed for these reads. A separate medium is needed for the candidate image and +durable evidence; neither shrinking root nor carving a partition is authorized. +If Drake prefers a scratch NVMe instead, its complete BDF/serial/firmware/NSID and +extent require a new manifest and separate approval; never substitute silently. + +The exact manifest, candidate hash, boot medium and physical action must be +approved afresh by Drake through the parent. Historical issue #336 permission or +backup progress is not authorization today. TRUST-1 Gate 7 prerequisites, including +applicable earlier gates, backup and tested recovery, must be satisfied separately. +A read-only NVMe opcode does not make controller reset, PCI ownership changes or +raw DMA safe while Linux is using the controller. + +### Recovery and 18091 + +The existing recovery USB is **read-only and must be preserved**: Generic Flash +Disk serial `5D0344B4`, PARTUUID `f227357c-1e80-4fd0-a55e-2efbef1dd25c`, label +`AIENOSRECOV`, currently firmware entry **Boot0002**. Parent evidence records an +attended recovery boot on 2026-09-25 with NVMe root/ESP mounted read-only and +`RECOVERY_BOOT_GATE: PASS`; it has not been rebooted for this work. Do not overwrite, +format, mount read/write or repartition it. Do not use obsolete Boot0004 numbering. +A separate blank boot medium for the candidate has not yet been supplied. + +All host/QEMU work in this receipt leaves resident 18091 alone. A native boot on +this sole-root-disk machine necessarily interrupts Linux and 18091; it requires an +explicit downtime/restore window through the parent. Never infer permission to +stop 18091, reboot, unbind root NVMe, bind VFIO, reset, or change firmware entries +from permission for read-only telemetry. A separate authorized scratch controller +could avoid the root-disk reboot, but none is currently approved. + +### Ordered operator run (all steps below NOT_RUN) + +1. Finish and exercise the native transport contract above in disposable emulation. + Freeze compiler/candidate/manifest hashes and the unoptimized baseline policy. + Verify recovery evidence and separate candidate/evidence medium with the parent. + Confirm backup/recovery and the precise downtime/restore authorization. Stop if + any prerequisite or exact identity differs. +2. Parent executes only the separately approved boot/image procedure. Never boot + Boot0000 ALLEN.EFI or Boot0005 CORE.EFI: existing paths include a write probe. + Do not reuse the normal C NVMe binder. Do not touch ESP, BootNext or firmware + entries as part of this read qualification. The approved candidate must own the + NVMe exclusively, with bounded DMA confinement, before queue initialization. +3. Print candidate and manifest hashes, PCI identity, raw serial/firmware, + namespace geometry, IOVA pool bounds, fixed queue depth 16, one outstanding + command, PRP limit, deadline and repetition count. Require exact matches before + issuing reads. Record controller-ready/Identify outcomes separately from reads. +4. **Measure before changing anything.** With the fixed baseline above, preserve + every raw `submit_ns`, `complete_ns`, `copy_done_ns`, LBA, byte count, CID, SQID, + SQ/CQ position/phase and status for all 64 reads. Report both controller + completion and end-to-caller timings and observed bytes. Record cache state as + uncontrolled/repeated-read, not a claimed cold-device workload. No tuning, + warmup suppression, queue-depth experiments, prefetch, affinity or clock changes + precede this immutable baseline receipt. A timeout/error stops the run, with no + reset/retry or DMA reclamation, and produces a retained-resource record. +5. Save raw records to the separately authorized evidence medium, not NVMe. Have + Wolfram evaluate latency distribution and aggregate throughput from those exact + records, quoting query/result and units; never infer numbers from QEMU timings. + Example query shape uses measured integer-nanosecond lists `submit`, `complete`, + `copied` and measured integer byte counts `bytes`: + `With[{d=complete-submit}, {Min[d],Median[d],Quantile[d,95/100],Max[d]}]` in ns; + `Total[bytes]/((Last[copied]-First[submit])/10^9)` in bytes/s. These are procedure + queries only: **NOT_RUN, no fabricated physical result**. Keep controller and + copy-inclusive statistics distinct. Record SSD/model service impact separately. +6. Release DMA/controller ownership only after the native quiescence proof succeeds. + If it fails, retain confinement/pages and use the preapproved attended recovery + route; do not try a reset/rebind loop. Parent returns via the authorized boot + path, verifies normal Linux root and 18091 health, and records restoration. +7. Freeze the baseline receipt as measured, even if slow or failed. Only a later, + separately approved tuning experiment may compare configurations. Do not rewrite + historical atomicity failures, recovery receipts or this NOT_RUN status as PASS. + +### Checked arithmetic and references + +WolframLanguageEvaluator: +`{6*4096+8192,16*64,16*16,BitOr[6*2^16,4*2^20,1],BitOr[15*2^16,15],8192/512,4096/512}` +returned `{32768,1024,256,4587521,983055,16,8}` (byte counts where applicable). +`{2^64-32769,BitOr[1,15*2^16],8*512,64*512,(8+64)*512,8+64-1,Mod[44,16],Mod[40,16],16^^123456000}` +returned `{18446744073709518847,983041,4096,32768,36864,71,12,8,4886716416}`. +`Table[{d,4096+3*4*2^d+4,4096+3*4*2^d+4<=65536},{d,12,13}]` +returned `{{12,53252,True},{13,102404,False}}` (byte window upper endpoints). +These are layout/bounds calculations, not measured device performance. + +- [aienux #31](https://github.com/aien-dev/aienux/issues/31), forward seeded Omega driver. +- [aienux #336](https://github.com/aien-dev/aienux/issues/336), single SSD/backup/recovery decisions. +- [synapse #54](https://github.com/aien-dev/synapse/issues/54), store work, not a queue implementation. +- Existing `disk_nvme.c`, `tests/nvme_test.c` and `scripts/qemu_native_nvme_test.sh` remain oracles. +- [QEMU QTest protocol](https://www.qemu.org/docs/master/devel/testing/qtest.html), + byte-access request/response semantics. No QTest socket exists in production. +- [NVM Express Base Specification 2.0c](https://www.nvmexpress.org/wp-content/uploads/NVM-Express-Base-Specification-2.0c-2022.10.04-Ratified.pdf), + sections 3.3.3.2/3.3.3.2.2 and Figure 275. © 2008 to 2022 NVM Express, Inc. + ALL RIGHTS RESERVED. Used as a reference, not copied implementation code. +- omega-mv at the pin above, `seed/host/MAPPING.md`, exact VFIO/map access contracts. diff --git a/native/disk/README.md b/native/disk/README.md index 8e57d628..989ebf29 100644 --- a/native/disk/README.md +++ b/native/disk/README.md @@ -103,3 +103,19 @@ SDSC, block for SDHC), and any unaligned or out-of-window register access. Not done yet: high-speed (50 MHz) and UHS modes, 1.8 V signalling, ADMA, card removal while running, and the Pi 5 binding (base address and base clock come from the ACPI tables dumped by AIENOS-PI5-ACPI-0). + +## Forward seeded Omega NVMe read path + +`omega_nvme.om` is the bounded, read-only protocol engine for aienux #31. +The existing C driver/model are unchanged verification oracles, not a runtime +implementation behind the Omega interface. The hosted transport exercises real +QEMU NVMe admin/IO queues, exact identity/extent approval, phase/head/tail wrap, +completion correlation, two-page PRPs and fail-stop DMA retention. Host fixtures, +disposable-QEMU refusals and guard-removal mutants are filed in +`tests/omega_nvme_receipt.txt`. + +See [OMEGA_NVME_READ.md](OMEGA_NVME_READ.md) for the pinned compiler, the explicit +manifest byte layout, repeatable gate and exact measurement-first physical +procedure. Physical and native transport qualification remain **NOT_RUN**. +The QTest transport must not be mistaken for a kernel/VFIO adapter or permission +to open/reset the live root NVMe. The existing recovery USB remains read-only. diff --git a/native/disk/omega_nvme.om b/native/disk/omega_nvme.om new file mode 100644 index 00000000..19a60a72 --- /dev/null +++ b/native/disk/omega_nvme.om @@ -0,0 +1,345 @@ +note SPDX-License-Identifier: Apache-2.0 +note Copyright 2026 Drake Stapleton +note Bounded read-only NVMe protocol engine. Host transport is separately composed. +note Queue depth 16, one outstanding command, two aligned PRP pages maximum. +note st: 0 failed, 1 DMA retained, 2 CID, 3 stride, 4 NSID, 5 block bytes, +note 6 namespace blocks, 7 max transfer, 8 approved extent start, 9 extent count. +const PAGE ulong 4096 +const BAR ulong 268435456 +const DEPTH ulong 16 +global st ulong 11 +global tail ulong 2 +global head ulong 2 +global phase ulong 2 +global sqe uint 16 +global ident uchar 4096 +global bounce uchar 8192 +global caller uchar 8192 +global manifest uchar 80 +fn id32 off ulong to ulong +v = ulong 0 +for i ulong 4 +v = or v shl ulong get ident add off i mul i 8 +end +ret v +end +fn id64 off ulong to ulong +ret or id32 off shl id32 add off 4 32 +end +fn man32 off ulong to ulong +v = ulong 0 +for i ulong 4 +v = or v shl ulong get manifest add off i mul i 8 +end +ret v +end +fn man64 off ulong to ulong +ret or man32 off shl man32 add off 4 32 +end +fn fatal code int to int +put st 0 1 +ret code +end +fn clearcmd to void +for i ulong 16 +put sqe i 0 +end +end +fn ready want ulong to int +note Fixed bounded transport polls, not a calibrated hardware time budget. +for i ulong 256 +v = load32 add BAR 28 +if ne and v 2 0 +ret fatal 11 +end +if eq and v 1 want +ret 0 +end +end +ret fatal 12 +end +fn dma off ulong to ulong +ret add get st 10 off +end +fn cmdptr word ulong off ulong to void +addr = dma off +put sqe word uint and addr 4294967295 +put sqe add word 1 uint shr addr 32 +end +fn ring q ulong which ulong value ulong to void +idx = add mul q 2 which +off = add 4096 mul idx get st 3 +store32 add BAR off value +end +fn enqueue q ulong cid ulong to void +put sqe 0 uint or and ulong get sqe 0 65535 shl cid 16 +slot = add add dma 0 mul q 12288 mul get tail q 64 +put st 1 1 +for i ulong 16 +store32 add slot mul i 4 ulong get sqe i +end +put tail q rem add get tail q 1 DEPTH +ring q 0 get tail q +end +fn submit q ulong to int +if ne get st 0 0 +ret 10 +end +op = and ulong get sqe 0 255 +ok = eq op 2 +if eq q 0 +ok = or eq op 6 or eq op 5 eq op 1 +end +if not ok +ret 13 +end +note GUARD opcode is the preceding three-line refusal block. +cid = get st 2 +put st 2 and add cid 1 65535 +enqueue q cid +slot = add add dma PAGE mul q 12288 mul get head q 16 +seen = false +dw3 = ulong 0 +for i ulong 256 +dw3 = load32 add slot 12 +if eq and shr dw3 16 1 get phase q +seen = true +break +end +v = load32 add BAR 28 +if ne and v 2 0 +ret fatal 11 +end +end +if not seen +ret fatal 12 +end +if ne and dw3 65535 cid +ret fatal 14 +end +dw2 = load32 add slot 8 +if ne shr dw2 16 q +ret fatal 15 +end +if ne and dw2 65535 get tail q +ret fatal 16 +end +put head q add get head q 1 +if eq get head q DEPTH +put head q 0 +put phase q xor get phase q 1 +end +ring q 1 get head q +put st 1 0 +if ne and shr dw3 17 2047 0 +ret 17 +end +ret 0 +end +fn identify cns ulong nsid ulong to int +clearcmd +put sqe 0 6 +put sqe 1 uint nsid +cmdptr 6 8192 +put sqe 10 uint cns +r = submit 0 +if ne r 0 +ret r +end +fetchid dma 8192 +ret 0 +end +fn identity to int +serialok = false +firmok = false +for i ulong 20 +v = get manifest i +serialok = or serialok and ne v 0 ne v 32 +if ne get ident add i 4 get manifest i +ret fatal 21 +end +end +for i ulong 8 +v = get manifest add i 20 +firmok = or firmok and ne v 0 ne v 32 +if ne get ident add i 64 get manifest add i 20 +ret fatal 22 +end +end +if not and serialok firmok +ret fatal 20 +end +sqes = get ident 512 +cqes = get ident 513 +if or gt and sqes 15 6 lt shr sqes 4 6 +ret fatal 23 +end +if or gt and cqes 15 4 lt shr cqes 4 4 +ret fatal 23 +end +put st 4 man32 28 +if or eq get st 4 0 gt get st 4 id32 516 +ret fatal 24 +end +put st 7 8192 +note MPSMIN=0 was required. MDTS=0 is unlimited; every nonzero MDTS allows +note at least 8192 bytes (4096 shifted by MDTS). Our fixed two-page limit +note is never larger, so no device-advertised MDTS can enlarge the bound. +ret 0 +end +fn geometry to int +put st 6 id64 0 +if eq get st 6 0 +ret fatal 25 +end +fmt = get ident 26 +if or ne and fmt 240 0 gt fmt get ident 25 +ret fatal 26 +end +lbaf = id32 add 128 mul ulong fmt 4 +if ne and lbaf 65535 0 +ret fatal 26 +end +if ne and get ident 29 7 0 +ret fatal 26 +end +bits = and shr lbaf 16 255 +if not or eq bits 9 eq bits 12 +ret fatal 26 +end +put st 5 shl ulong 1 bits +put st 8 man64 32 +put st 9 man64 40 +if or eq get st 9 0 ge get st 8 get st 6 +ret fatal 27 +end +if gt get st 9 sub get st 6 get st 8 +ret fatal 27 +end +if lt id64 8 add get st 8 get st 9 +ret fatal 27 +end +ret 0 +end +fn initialize to int +if gt get st 0 0 +ret 10 +end +if ne man32 64 1 +ret fatal 20 +end +put st 10 man64 72 +if or ne and get st 10 4095 0 gt get st 10 18446744073709518847 +ret fatal 28 +end +put phase 0 1 +put phase 1 1 +put st 2 1 +cap = load64 BAR +ver = shr load32 add BAR 8 16 +if not or eq ver 1 eq ver 2 +ret fatal 28 +end +if ne and shr cap 48 15 0 +ret fatal 28 +end +if lt and cap 65535 sub DEPTH 1 +ret fatal 28 +end +if eq and shr cap 37 1 0 +ret fatal 28 +end +if gt and shr cap 32 15 12 +ret fatal 28 +end +put st 3 shl ulong 4 and shr cap 32 15 +store32 add BAR 20 0 +r = ready 0 +if ne r 0 +ret r +end +zero_dma dma 0 32768 +store32 add BAR 36 983055 +store64 add BAR 40 dma 0 +store64 add BAR 48 dma PAGE +put st 1 ulong 1 +store32 add BAR 20 4587521 +r = ready 1 +if ne r 0 +ret r +end +put st 1 0 +r = identify 1 0 +if ne r 0 +ret r +end +r = identity +if ne r 0 +ret r +end +r = identify 0 get st 4 +if ne r 0 +ret r +end +r = geometry +if ne r 0 +ret r +end +clearcmd +put sqe 0 5 +cmdptr 6 16384 +put sqe 10 983041 +put sqe 11 1 +r = submit 0 +if ne r 0 +ret r +end +clearcmd +put sqe 0 1 +cmdptr 6 12288 +put sqe 10 983041 +put sqe 11 65537 +ret submit 0 +end +fn readblocks lba ulong count ulong to int +if ne get st 0 0 +ret 10 +end +if or eq count 0 gt count div get st 7 get st 5 +ret 30 +end +if lt lba get st 8 +ret 31 +end +off = sub lba get st 8 +if ge off get st 9 +ret 31 +end +if gt count sub get st 9 off +ret 31 +end +bytes = mul count get st 5 +if gt bytes 8192 +ret 32 +end +clearcmd +put sqe 0 2 +put sqe 1 uint get st 4 +cmdptr 6 24576 +if gt bytes PAGE +cmdptr 8 28672 +end +put sqe 10 uint and lba 4294967295 +put sqe 11 uint shr lba 32 +put sqe 12 uint sub count 1 +r = submit 1 +if ne r 0 +ret r +end +fetchdata dma 24576 bytes +for i ulong bytes +put caller i get bounce i +end +publish bytes +ret 0 +end diff --git a/native/disk/omega_nvme_main.om b/native/disk/omega_nvme_main.om new file mode 100644 index 00000000..290e40f1 --- /dev/null +++ b/native/disk/omega_nvme_main.om @@ -0,0 +1,28 @@ +note SPDX-License-Identifier: Apache-2.0 +note Manifest bytes: serial[20], firmware[8], NSID u32, extent start/count u64, +note request LBA u64, count u32, repetitions u32, approved u32, reserved u32. +note All integers little endian. Approval here is fixture binding, not hardware authority. +fn main to int +getmanifest +if ne man32 68 0 +ret 20 +end +r = initialize +if ne r 0 +report r +ret r +end +n = man32 60 +if or eq n 0 gt n 64 +ret 33 +end +for i ulong n +r = readblocks man64 48 man32 56 +if ne r 0 +report r +ret r +end +end +report 0 +ret 0 +end diff --git a/native/disk/omega_nvme_transport.om b/native/disk/omega_nvme_transport.om new file mode 100644 index 00000000..e6162a89 --- /dev/null +++ b/native/disk/omega_nvme_transport.om @@ -0,0 +1,118 @@ +note SPDX-License-Identifier: Apache-2.0 +note Hosted verification transport ONLY. RPC addresses are QEMU guest addresses, +note not host CPU pointers. The verifier translates byte access, never NVMe commands. +global packet uchar 24 +global reply uchar 8 +fn enc off ulong value ulong to void +for i ulong 8 +put packet add off i uchar and shr value mul i 8 255 +end +end +fn sendreq op ulong addr ulong value ulong to ulong +enc 0 op +enc 8 addr +enc 16 value +n = ulong 0 +while lt n 24 bound 24 +r = write 1 packet n sub 24 n +if le r 0 +exit 90 +end +n = add n ulong r +end +n = ulong 0 +while lt n 8 bound 8 +r = read 0 reply n sub 8 n +if le r 0 +exit 90 +end +n = add n ulong r +end +v = ulong 0 +for i ulong 8 +v = or v shl ulong get reply i mul i 8 +end +ret v +end +fn load32 addr ulong to ulong +ret sendreq 1 addr 0 +end +fn load64 addr ulong to ulong +ret sendreq 2 addr 0 +end +fn store32 addr ulong value ulong to void +r = sendreq 3 addr value +if ne r 0 +exit 90 +end +end +fn store64 addr ulong value ulong to void +r = sendreq 4 addr value +if ne r 0 +exit 90 +end +end +fn zero_dma addr ulong size ulong to void +r = sendreq 5 addr size +if ne r 0 +exit 90 +end +end +fn fetchid addr ulong to void +r = sendreq 6 addr 4096 +if ne r 0 +exit 90 +end +n = ulong 0 +while lt n 4096 bound 4096 +rv = read 0 ident n sub 4096 n +if le rv 0 +exit 90 +end +n = add n ulong rv +end +end +fn fetchdata addr ulong size ulong to void +r = sendreq 6 addr size +if ne r 0 +exit 90 +end +n = ulong 0 +while lt n size bound 8192 +rv = read 0 bounce n sub size n +if le rv 0 +exit 90 +end +n = add n ulong rv +end +end +fn publish size ulong to void +r = sendreq 7 0 size +if ne r 0 +exit 90 +end +n = ulong 0 +while lt n size bound 8192 +rv = write 1 caller n sub size n +if le rv 0 +exit 90 +end +n = add n ulong rv +end +end +fn report code int to void +r = sendreq 8 get st 1 ulong code +if ne r 0 +exit 90 +end +end +fn getmanifest to void +n = ulong 0 +while lt n 80 bound 80 +r = read 0 manifest n sub 80 n +if le r 0 +exit 90 +end +n = add n ulong r +end +end diff --git a/native/disk/tests/.crumb b/native/disk/tests/.crumb index 5ed32fce..6d706b52 100644 --- a/native/disk/tests/.crumb +++ b/native/disk/tests/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-24T04:15:32Z", + "compiled_at": "2026-10-28T23:36:33Z", "compiler": "crumb-compile/1", - "digest": "sha256:a84880bebd005b831a55fa76589f0560f602e21cd87329c5f407ad877d04fff3", + "digest": "sha256:e78f3758d5e40bf9e4fcce57ec663c7d09b3534d16d3c4d9b625f403795e2d60", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 3, - "generated_at_commit": "621c9e6fe430ee689836bee3ee2689d7d32e0f7d", - "source_tree": "sha256:eb912565b6289b88e172f831e32df9133846e79e5b39aaf22ce5373ac0be2adc" + "files": 10, + "generated_at_commit": "3b063566de689bc1d26388919e4d67cbc2631b5c", + "source_tree": "sha256:e4bc727a8bdf7f75243fdd8d2ec63dc797d2ee4e53739d2c42f1d8f4be885b41" }, "owner_lane": "", "provenance": { diff --git a/native/disk/tests/omega_nvme_adminwrap.om b/native/disk/tests/omega_nvme_adminwrap.om new file mode 100644 index 00000000..5e85b6b6 --- /dev/null +++ b/native/disk/tests/omega_nvme_adminwrap.om @@ -0,0 +1,26 @@ +note SPDX-License-Identifier: Apache-2.0 +note Verification-only repeated read-only Identify commands force admin CQ/SQ wrap. +fn main to int +getmanifest +r = initialize +if ne r 0 +report r +ret r +end +for i ulong 40 +r = identify 1 0 +if ne r 0 +report r +ret r +end +end +for i ulong 40 +r = readblocks man64 48 man32 56 +if ne r 0 +report r +ret r +end +end +report 0 +ret 0 +end diff --git a/native/disk/tests/omega_nvme_failstop.om b/native/disk/tests/omega_nvme_failstop.om new file mode 100644 index 00000000..bccffc44 --- /dev/null +++ b/native/disk/tests/omega_nvme_failstop.om @@ -0,0 +1,23 @@ +note SPDX-License-Identifier: Apache-2.0 +note Verification-only: an uncertain completion must reject a second read and reopen. +fn main to int +getmanifest +r = initialize +if ne r 0 +report r +ret r +end +r = readblocks man64 48 man32 56 +if ne get st 0 0 +again = readblocks man64 48 man32 56 +if ne again 10 +ret 91 +end +again = initialize +if ne again 10 +ret 92 +end +end +report r +ret r +end diff --git a/native/disk/tests/omega_nvme_probe.om b/native/disk/tests/omega_nvme_probe.om new file mode 100644 index 00000000..d865ecb3 --- /dev/null +++ b/native/disk/tests/omega_nvme_probe.om @@ -0,0 +1,17 @@ +note SPDX-License-Identifier: Apache-2.0 +note Verification-only hostile caller; never composed into the read-only entrypoint. +fn main to int +getmanifest +r = initialize +if ne r 0 +report r +ret r +end +clearcmd +put sqe 0 uint man32 68 +put sqe 1 uint get st 4 +cmdptr 6 24576 +r = submit man32 60 +report r +ret r +end diff --git a/native/disk/tests/omega_nvme_receipt.txt b/native/disk/tests/omega_nvme_receipt.txt new file mode 100644 index 00000000..a9e0e040 --- /dev/null +++ b/native/disk/tests/omega_nvme_receipt.txt @@ -0,0 +1,84 @@ +IMPLEMENTED + EXERCISED: bounded seeded Omega NVMe read protocol +PHYSICAL: NOT_RUN +NATIVE VFIO/KERNEL ADAPTER: NOT_RUN (not part of hosted transport) +Source base: aienux 832bcbd98fc5 (parent confinement retention fix) +Compiler source: omega-mv 397e67040fb74853c6814097fe02ae4e1ebd6f66 +Command: AIEN_OMC=/home/drakestapleton/work/OwnDriver/omega-gpu-driver/build/omc OMEGA_NVME_EVIDENCE=/home/drakestapleton/handoffs/spark-five-20261028/QualNvmeOm/acceptance-ready-retention sh native/disk/tests/omega_nvme_test.sh +C oracle compiler: cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0 +C oracle disk_nvme.c sha256 c4735e7472f9084eef48aa41feb90aacb741e0fcd848dc0d6aee9c5f320f0e34 +C model nvme_test.c sha256 c61b820bbd4861f3b6b2dee7c6ef12408a21c0a51ccb4d2c3c79419caa0547bc + +--- qemu-version.txt --- +QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18) +Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers + +--- host.log --- +PASS case=healthy transport=C-model result=0 copies=40 retained=0 RPC=973 physical=NOT_RUN +PASS case=singlepage transport=C-model result=0 copies=40 retained=0 RPC=973 physical=NOT_RUN +PASS case=lba4k transport=C-model result=0 copies=40 retained=0 RPC=973 physical=NOT_RUN +PASS case=dstrd transport=C-model result=0 copies=40 retained=0 RPC=973 physical=NOT_RUN +PASS case=serial transport=C-model result=21 copies=0 retained=0 RPC=32 physical=NOT_RUN +PASS case=firmware transport=C-model result=22 copies=0 retained=0 RPC=32 physical=NOT_RUN +PASS case=approval transport=C-model result=20 copies=0 retained=0 RPC=1 physical=NOT_RUN +PASS case=nsid transport=C-model result=24 copies=0 retained=0 RPC=32 physical=NOT_RUN +PASS case=extent transport=C-model result=27 copies=0 retained=0 RPC=53 physical=NOT_RUN +PASS case=range transport=C-model result=31 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=before transport=C-model result=31 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=prp transport=C-model result=30 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=zero transport=C-model result=30 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=metadata transport=C-model result=26 copies=0 retained=0 RPC=53 physical=NOT_RUN +PASS case=format transport=C-model result=26 copies=0 retained=0 RPC=53 physical=NOT_RUN +PASS case=nsze transport=C-model result=25 copies=0 retained=0 RPC=53 physical=NOT_RUN +PASS case=sqes transport=C-model result=23 copies=0 retained=0 RPC=32 physical=NOT_RUN +PASS case=cqes transport=C-model result=23 copies=0 retained=0 RPC=32 physical=NOT_RUN +PASS case=cap transport=C-model result=28 copies=0 retained=0 RPC=3 physical=NOT_RUN +PASS case=stride transport=C-model result=28 copies=0 retained=0 RPC=3 physical=NOT_RUN +PASS case=readytimeout transport=C-model result=12 copies=0 retained=1 RPC=266 physical=NOT_RUN +PASS case=readycfs transport=C-model result=11 copies=0 retained=1 RPC=11 physical=NOT_RUN +PASS case=status transport=C-model result=17 copies=0 retained=0 RPC=113 physical=NOT_RUN +PASS case=adminwrap transport=C-model result=0 copies=40 retained=0 RPC=1813 physical=NOT_RUN +PASS case=cid transport=C-model result=14 copies=0 retained=1 RPC=111 physical=NOT_RUN +PASS case=sqid transport=C-model result=15 copies=0 retained=1 RPC=112 physical=NOT_RUN +PASS case=sqhead transport=C-model result=16 copies=0 retained=1 RPC=112 physical=NOT_RUN +PASS case=phase transport=C-model result=12 copies=0 retained=1 RPC=622 physical=NOT_RUN +PASS case=timeout transport=C-model result=12 copies=0 retained=1 RPC=622 physical=NOT_RUN +PASS case=cfs transport=C-model result=11 copies=0 retained=1 RPC=112 physical=NOT_RUN +PASS case=opcode0 transport=C-model result=13 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=opcode1 transport=C-model result=13 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=opcode8 transport=C-model result=13 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=opcode9 transport=C-model result=13 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=opcode128 transport=C-model result=13 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=opcode132 transport=C-model result=13 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=adminformat transport=C-model result=13 copies=0 retained=0 RPC=93 physical=NOT_RUN + +--- mutants.log --- +PASS killed guard-removal mutant cid (baseline case passed) +PASS killed guard-removal mutant sqid (baseline case passed) +PASS killed guard-removal mutant status (baseline case passed) +PASS killed guard-removal mutant sqhead (baseline case passed) +PASS killed guard-removal mutant reopen (baseline case passed) +PASS killed guard-removal mutant opcode (baseline case passed) +PASS killed retention guard-removal mutant + +--- qemu.log --- +PASS case=healthy transport=QEMU result=0 copies=40 retained=0 RPC=1077 physical=NOT_RUN +PASS case=serial transport=QEMU result=21 copies=0 retained=0 RPC=32 physical=NOT_RUN +PASS case=firmware transport=QEMU result=22 copies=0 retained=0 RPC=32 physical=NOT_RUN +PASS case=approval transport=QEMU result=20 copies=0 retained=0 RPC=1 physical=NOT_RUN +PASS case=nsid transport=QEMU result=25 copies=0 retained=0 RPC=53 physical=NOT_RUN +PASS case=extent transport=QEMU result=27 copies=0 retained=0 RPC=53 physical=NOT_RUN +PASS case=range transport=QEMU result=31 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=before transport=QEMU result=31 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=prp transport=QEMU result=30 copies=0 retained=0 RPC=93 physical=NOT_RUN +PASS case=zero transport=QEMU result=30 copies=0 retained=0 RPC=93 physical=NOT_RUN + +--- sha256.txt --- +bcfa582892afca8f65e551fe56867d918d86e84540c7381be8fa9ef18d0cf0f6 /home/drakestapleton/work/OwnDriver/omega-gpu-driver/build/omc +baf88d2db7666be18359eb1a577dac4f183b10f6454e286f1df48e01d1a4c7ab native/disk/omega_nvme.om +59f5d97f8127e3d14cbf56e6e036fe43271c4b9afb92df310946b7387b3101c4 native/disk/omega_nvme_transport.om +fb7f70a0080ae4b4891303849e08bc86b32c1a2bca1b3952b7b1622e1114f4f6 native/disk/omega_nvme_main.om +99ead236036b663c42f901c999fb0652ba80bf2427b18ba40ac41d0896c57287 native/disk/tests/omega_nvme_runner.c +966239df1ea3da1651a76bd32d6f36935773f568dc02d04def50d586bf8fa98c /home/drakestapleton/handoffs/spark-five-20261028/QualNvmeOm/acceptance-ready-retention/read + +--- result.txt --- +PASS Omega NVMe host + QEMU + guard mutants; physical NOT_RUN diff --git a/native/disk/tests/omega_nvme_reuse_search.txt b/native/disk/tests/omega_nvme_reuse_search.txt new file mode 100644 index 00000000..bf95cc6d --- /dev/null +++ b/native/disk/tests/omega_nvme_reuse_search.txt @@ -0,0 +1,132 @@ +Reuse search, 2026-10-28; no matching existing seeded Omega NVMe/queue implementation found. +Pattern: case-insensitive nvme OR submission queue, *.om at each enumerated commit. +Remote: 106 aien-dev repositories; 5321 advertised branch refs; all fetches rc=0 and all content searches rc=1 (no matches). +Local: 1933 distinct common stores under work, workspace and /tmp, discovered to depth 4; 1921 with refs; 190008 commit-ref instances. +Three stale alternate-object stores failed their initial scan. The aienos store was fully redundant with successful stores; the two Omega stores shared the same two otherwise unsearched tips. Both remaining tips were searched with the existing workspace/omega object directory as an environment-only alternate; git grep exit1, no matches, original stale-alternate warning retained. No source clone was changed. The raw failures stay in the JSON evidence. +Initial failure stores: targets/L793-reuse-gate/aien-pins/omega-reuse-native; targets/L793-w4-gate/aien-pins/omega-w4-native; targets/gates-qwen38/aien-pins/aienos. +Missing alternate: workspace/sc-native-reuse-718/../omega/.git/objects. Remaining tips: 3076b31c206bda07451958e0705f3983fbc9c632 8dfe7788bd599e844a4c00d8d0ae05447b921030. +Working-copy scoped searches: OwnDriver/**/*.om; work/aienux-*/**/*.om excluding this new candidate; workspace/aienux*/**/*.om; workspace/synapse*/**/*.om; work/*/synapse*/**/*.om: no matches. Broad whole-root grep timed out and was replaced by these scoped searches plus the complete committed-ref search. +Ownership: native/disk crumb historical lane11/PR190 is not a current .om claim. BOARD SparkFive/QualNvmeOm owns this isolated candidate; QualGspBoot owns the separate GPU driver work. synapse#54 is R1/J1 raw-store consumer scope, not a queue driver; no store implementation is replaced. +All twelve empty-ref stores were also checked as working copies: no matching *.om source. Their paths are recorded below; they are not treated as scanned commits. + +Remote inventory: URL | branch-ref count | main commit +https://github.com/aien-dev/aien-sovereign-core-mv.git | 825 | b65e00b0652a3b426dce1bf77f7fe4eccf5f7473 +https://github.com/aien-dev/spark-hive.git | 2 | 52f6b9cc1a0c54a0d01ad20f5b94ea3951e29ad0 +https://github.com/aien-dev/aien-harness.git | 2 | 2da4b5a3a010db4b9fc5157fc761efe088b93421 +https://github.com/aien-dev/spark-dream.git | 2 | fc8726847e9f4b7d98acc450580e25b9f27d580d +https://github.com/aien-dev/cortex-rs.git | 2 | 3f9365fb37f1cf3a979d95c740046878ebe20d14 +https://github.com/aien-dev/spark-supervisor.git | 3 | 371ffbebfbd89512d9fc0d76e260e9ade49ea9d8 +https://github.com/aien-dev/spark-debugger.git | 2 | dc907a4ebc0dd6154c483c37efe415d602d8f388 +https://github.com/aien-dev/rad-id-sync.git | 2 | 235666135afd9a014f712f6fefc3cc2b2213d509 +https://github.com/aien-dev/spark-adapters.git | 2 | edd9aa10c0ed3274b0ed8cdab1a1447977fb5df9 +https://github.com/aien-dev/spark-crumbs-mv.git | 2 | 156633e1af13fe4f9819db0064534dd7cf9ae8fb +https://github.com/aien-dev/mobhub.git | 10 | 5e1130654715d9b46a8903d40b52d2035233a47c +https://github.com/aien-dev/crumb-spec-mv.git | 2 | e2dc22ea78df7d12d2ca5f2e74e3b3f064a16c9b +https://github.com/aien-dev/spark-rsi-mv.git | 38 | fc13d3f77e6cfec789fce1b0e15125df8feac3d8 +https://github.com/aien-dev/open-humanity.git | 34 | 2e55682f1797a658d74f21dac382bc75f52433e2 +https://github.com/aien-dev/harvester.git | 2 | 0fa381acd0cf9ed99746932136f25c92dc5a1d52 +https://github.com/aien-dev/aegis-runtime-mv.git | 23 | a39788b0eaaabc694dfa17652420e35b7dc3eda5 +https://github.com/aien-dev/.github.git | 24 | d1932a7393a561b02fe5a4ecd9a85a6647e8f6cc +https://github.com/aien-dev/spark-inquisitor.git | 2 | 0efa3e4dcd269352714134a333d9fe4ca3e6dd8a +https://github.com/aien-dev/MojoLlama.git | 6 | 249949d1c3fe839bb5e156f91e9c5fd8d3dc7990 +https://github.com/aien-dev/benchmarks-mv.git | 26 | 0f369dbc852b2e9364ed55c6e19a7e285cd424c1 +https://github.com/aien-dev/encounter.git | 2 | 4937786098a2cc3011d6ef421cda4259af63bf2e +https://github.com/aien-dev/aienos.com.git | 68 | 07736aa17fd16e862725cf440bcae71527945285 +https://github.com/aien-dev/aien-protocols-mv.git | 23 | e705fdc9c97394f17f32f1dcbcbf038ca556250b +https://github.com/aien-dev/aien-local-stack.git | 2 | 2ef0b913657dbf1d12969b4858fb23979bcd2e7e +https://github.com/aien-dev/aien-architecture-mv.git | 142 | c6512a4c6ae2e8f8babe23fc9f38880d20d25812 +https://github.com/aien-dev/aien-edge.git | 9 | 6d86caf699fd92a7092e97e3e84427e2df79c26a +https://github.com/aien-dev/aienux.git | 410 | 659ddd2d7e3e140cb9bf942c3171cbd9cf3d092e +https://github.com/aien-dev/atlas.git | 14 | +https://github.com/aien-dev/physics-mv.git | 45 | 8e92aa629c945d9574952b49ac4a2b04ef52ab06 +https://github.com/aien-dev/omega-mv.git | 1020 | d94a503f7aae57d09697046405da2e9a5895be6d +https://github.com/aien-dev/aien-sealed.git | 41 | 2cb922986e8405b4d59d7364e77a3c2fb5c39975 +https://github.com/aien-dev/physics0.git | 1 | fe587d2c74336f9032ac7424e0ae6ddc5b540fd6 +https://github.com/aien-dev/aien-yardsticks.git | 4 | 6c66814788b55163e1867fe9c358b424f79a79e1 +https://github.com/aien-dev/readings-window.git | 17 | c1e03543fb256ff7e2a9f077541ebba36c106aa4 +https://github.com/aien-dev/pi-register.git | 10 | f65a67ac86451939b8e2b5e924f8f9e572b81eb9 +https://github.com/aien-dev/agent-archive.git | 11 | 3211d0b88de2f6f40f0cbf9d5e48ffd78410fb30 +https://github.com/aien-dev/interplane-mv.git | 110 | 1de1b0065b2e667d8d7a23ffc3d75aeb65bf864b +https://github.com/aien-dev/odysseus.git | 20 | 934d23c0be29c9721385f34565c0ae2cbd60da04 +https://github.com/aien-dev/interplane.io.git | 9 | 62d5b27beea12c8fb75d266ffc456304af1768ae +https://github.com/aien-dev/aien-receipts.git | 11 | 89e3c8d85e7070492e494db6b4de69f0297528d3 +https://github.com/aien-dev/rpi5-uefi.git | 2 | +https://github.com/aien-dev/arm-trusted-firmware.git | 2 | +https://github.com/aien-dev/edk2.git | 2 | +https://github.com/aien-dev/edk2-platforms.git | 1 | +https://github.com/aien-dev/edk2-non-osi.git | 3 | +https://github.com/aien-dev/t3code.git | 1316 | ecad5ad8fe45e8e512ad11664a6f5e8b1f89cda5,243e8a44a9f2c993232feaa5b4727cdcc32af169 +https://github.com/aien-dev/synapse.git | 84 | 099a980fedab8a6797bbf0358b8c5502c8045142 +https://github.com/aien-dev/aienix.git | 17 | 8f4e31f05ee86b86672fc8bde960c6da23f59bb4 +https://github.com/aien-dev/spark-scrub.git | 8 | cece92400d2be042ef69ac2af5c25a456f2d4ba7 +https://github.com/aien-dev/aien-translate.git | 9 | 7a97bf93eb12d5262cb108bdd1b218a1add2c8e3 +https://github.com/aien-dev/translate.git | 6 | +https://github.com/aien-dev/aien-rig.git | 13 | 3f852a0b26cd811e264b56bea97ede3c9a4d9b14 +https://github.com/aien-dev/spark-connector.git | 10 | 5db49d1c27e816893c09405b42efbe481ea776f3 +https://github.com/aien-dev/aien.git | 15 | 8c7ab655164dd97628c92a053a332918a42ae2ba +https://github.com/aien-dev/aien-train.git | 30 | 5aaeb656070707800517de0557d874d763391ece +https://github.com/aien-dev/CUDApp.git | 138 | d7f330a8a5fc5b6d83e2403549455aa661fe67ff +https://github.com/aien-dev/omega-evidence.git | 7 | a5e1e1a0f491913c280adb50ae746ee15b1dd551 +https://github.com/aien-dev/aien-crypto.git | 4 | 7e2ff003ec0cac8306ccc6ad7a95d480e1b95b47 +https://github.com/aien-dev/omega-research.git | 5 | 414e99745cd2a8a58a42f28d175204c33eed262f +https://github.com/aien-dev/omega-host.git | 5 | 1b07216bf57ef049e8fc71ca2e28310e2f60bfbd +https://github.com/aien-dev/omega-learn.git | 4 | 7c36cde6876dea8497493b2fe4bc092933926e1e +https://github.com/aien-dev/omega-programs.git | 9 | a69009deab3143d920b2058774114364bd27fe13 +https://github.com/aien-dev/omega-bridge.git | 55 | 80baac04294923643f3c0933ea6fd37e0d17f0e8 +https://github.com/aien-dev/omnet.git | 10 | f35dcace0f03a23b254a31f5353d74c2ede1434c +https://github.com/aien-dev/aien-math.git | 5 | b005f054151f0038565ca3930d305fbf3f79915e +https://github.com/aien-dev/omega-harness.git | 89 | af776340b9da0e0ece345d399fa24f82447c2788 +https://github.com/aien-dev/drake-voice.git | 4 | 82811f93246cb852ed576b62dd093d115b9e5146 +https://github.com/aien-dev/omega-projects.git | 10 | 36ba0475e9abdcf4ae82cb98524dee01c044ae6b +https://github.com/aien-dev/AienOS-nv.git | 4 | f60a62a2a5059743c9ebe8628f80f4090c7d6e63 +https://github.com/aien-dev/sovereign-intelligence.git | 10 | b8c26746c2e0cf0adae72af027bcf077a152de8c +https://github.com/aien-dev/cortex.git | 4 | 16068eea346510c6193d2bceb580e2a67ac89ecc +https://github.com/aien-dev/aien-gpu.git | 4 | ec9d6d7601b84ca6178bf23e4b69d095eb358da6 +https://github.com/aien-dev/omtex.git | 3 | 363500c1b010219ce0b22f8e8e53d0aff7c55834 +https://github.com/aien-dev/babel.git | 3 | 13ad42d9c3383774f34caf9087bf5f7d9d3d675c +https://github.com/aien-dev/atlas-harness.git | 103 | 0f2345a35ff57ed586e8e50c79126a5e4f8e9520 +https://github.com/aien-dev/github-atlas-harness.git | 80 | 214ddb716c718ea27b7c9e04939b9cd3cc300bed +https://github.com/aien-dev/atlas-mac-devbox-control.git | 3 | 313c714fc8699ee14aa8d61e9a759895a066b030 +https://github.com/aien-dev/atlas-spark-proof.git | 4 | 6df4fc2f280d31ad7ce8b5f2b9cda647cb7354a7 +https://github.com/aien-dev/omega-seed-challenge.git | 3 | fbbc23026e8cdad2ac752c6bd30e388efe41cd74 +https://github.com/aien-dev/omega-kernel-template.git | 4 | 02050226cf240c9b6fbcd77c7fc4bf12319f1402 +https://github.com/aien-dev/omega-gpu-bench.git | 5 | de6e2f4c0168167a00c5211249db654d19b046cd +https://github.com/aien-dev/compiler-explorer.git | 71 | cbe1d5d9d5b927d15af60f454f6e180a515b7f9c +https://github.com/aien-dev/omega-packages.git | 2 | da121553fab77459320010b439fe06d018047599 +https://github.com/aien-dev/homebrew-omega.git | 2 | 9fcb1c65ce7cf20bb3d7c5e497aed661a22c82a9 +https://github.com/aien-dev/tree-sitter-omega.git | 3 | 33fc2abe55f35b7f2dfea008fc82ee069aca3096 +https://github.com/aien-dev/omega-rosetta.git | 7 | 22e7152473c709662b3c8f0bae39a053f73da06f +https://github.com/aien-dev/BabelStream.git | 51 | 5cb9445483786f3502b12b8faab8414f8c5873b1 +https://github.com/aien-dev/synapse-claims.git | 1 | +https://github.com/aien-dev/synapse-map.git | 2 | +https://github.com/aien-dev/synapse-pulse.git | 2 | +https://github.com/aien-dev/synapse-mcp.git | 2 | +https://github.com/aien-dev/synapse-board.git | 2 | +https://github.com/aien-dev/vscode-omega.git | 3 | b71100fe0a118d2ab54ed649fe66ce3ad1e4c605 +https://github.com/aien-dev/openaccel-lab.git | 3 | 5f8ec51720f7978101601cec29e35e548ac1902f +https://github.com/aien-dev/omega-bridge-kit.git | 3 | +https://github.com/aien-dev/omega-lift.git | 2 | +https://github.com/aien-dev/ggml-omega.git | 4 | 9fcb76d52ddf8b80e4556df781aa0468da86e6e3 +https://github.com/aien-dev/infra.git | 49 | 0d9c67d3d62645442a466e7cedfe22494646d72c +https://github.com/aien-dev/omega-dnn.git | 4 | 2b7e6b3fee48921337f954c6eae102c3df8e41c0 +https://github.com/aien-dev/omega-blas.git | 4 | 178a821d4b9fb2ece22f0ecaa4f4bbd595d95d96 +https://github.com/aien-dev/omega-gpu-driver.git | 8 | 298e4681979bdbe7479fc8655a07784f1641b1fa +https://github.com/aien-dev/gpu-head-to-head.git | 4 | 66eb00db2a164faccc5c3a4169f45aec696f7da2 +https://github.com/aien-dev/truthcleanup-secretscan.git | 2 | 1d003d86759ffd33f3442ff2d4448b64e18e65ca +https://github.com/aien-dev/omega-npu.git | 13 | 9a0f7b9c442e7cf9ffe15aec4cf21519d2cc1452 +https://github.com/aien-dev/omega-mcp.git | 2 | 4f4c8820d9f40baff9c3d05b05938095085cd100 +https://github.com/aien-dev/rtl8127-omega.git | 2 | 4c757d7adb4bd929341324ec2c0f5530d97cf8f8 + +Local no-ref paths: +/home/drakestapleton/work/OmegaNpu/ext/mesa-full +/home/drakestapleton/workspace/l182-clean/aien-demo/src/omega +/home/drakestapleton/workspace/l182-final/aien-demo/src/omega +/home/drakestapleton/work/BridgeAttach/llama.cpp +/home/drakestapleton/workspace/investigations/2026-10-17-SPEED-1G-router-logits/physics +/home/drakestapleton/workspace/l182-clean/aien-demo/src/physics +/home/drakestapleton/workspace/l182-clean/aien-demo/src/sc +/home/drakestapleton/workspace/l182-final/aien-demo/src/physics +/home/drakestapleton/workspace/l182-final/aien-demo/src/sc +/home/drakestapleton/workspace/oq3-v5-build-4770703/physics +/home/drakestapleton/workspace/perf233/crumb-tool-94fffbcf88492c5a1c54211b5126c8a6c370a98d/src +/home/drakestapleton/workspace/perf233/crumb-tool-d0f0b95d344b4c6628c3d868346932fd247ce168/src diff --git a/native/disk/tests/omega_nvme_runner.c b/native/disk/tests/omega_nvme_runner.c new file mode 100644 index 00000000..eb82097d --- /dev/null +++ b/native/disk/tests/omega_nvme_runner.c @@ -0,0 +1,273 @@ +/* SPDX-License-Identifier: Apache-2.0 + * Verification-only byte transport and existing C model/oracle, not a driver. + * Never accepts a block device. QEMU runs stopped with a disposable regular image. + */ +#define _POSIX_C_SOURCE 200809L +#define main original_reference_tests_main +#include "nvme_test.c" +#undef main +#include <sys/socket.h> +#include <sys/un.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <signal.h> +#include <unistd.h> +#include <poll.h> +#include <errno.h> +#include <fcntl.h> +#include <stdarg.h> +#include <time.h> + +static int qfd = -1, outfd, infd, errors, published, reported, retained; +static pid_t qp = -1, child = -1; +static char tempdir[128], image[180], socketpath[180], qlog[180]; +static uint8_t expected[8192]; +static size_t wanted; +static const char *scenario; +static int result_code = -1; +static void die(const char *s) { perror(s); exit(2); } +static void check(int b, const char *s) { if (!b) { fprintf(stderr,"FAIL %s: %s\n",scenario,s); errors++; } } +static int exact(int fd, void *p, size_t n, int writing) +{ + size_t done = 0; + while (done < n) { + struct pollfd f = {fd, writing ? POLLOUT : POLLIN, 0}; + if (poll(&f,1,3000) != 1) return -1; + ssize_t r = writing ? write(fd,(char *)p+done,n-done) : read(fd,(char *)p+done,n-done); + if (r <= 0) return -1; + done += (size_t)r; + } + return 0; +} +static void cleanup(void) +{ + if (child > 0) { kill(child,SIGKILL); waitpid(child,NULL,0); } + if (qp > 0) { kill(qp,SIGTERM); waitpid(qp,NULL,0); } + if (qfd >= 0) close(qfd); + if (*image) unlink(image); + if (*socketpath) unlink(socketpath); + /* Keep QEMU stderr as an artifact when requested by the caller. */ + if (*qlog) unlink(qlog); + if (*tempdir) rmdir(tempdir); +} +static uint64_t qt(const char *fmt,...) +{ + char line[512], response[256]; + va_list a; va_start(a,fmt); vsnprintf(line,sizeof line,fmt,a); va_end(a); + size_t n = strlen(line); line[n++]='\n'; + if (exact(qfd,line,n,1)) die("qtest send"); + n=0; + do { if (n+1 >= sizeof response || exact(qfd,response+n,1,0)) die("qtest response"); } while (response[n++]!='\n'); + response[n]=0; + if (strncmp(response,"OK",2)) { fprintf(stderr,"qtest: %s",response); exit(2); } + return response[2]==' ' ? strtoull(response+3,NULL,0) : 0; +} +static void start_qemu(void) +{ + strcpy(tempdir,"/tmp/omega-nvme-XXXXXX"); + if (!mkdtemp(tempdir)) die("mkdtemp"); + snprintf(image,sizeof image,"%s/namespace.raw",tempdir); + snprintf(socketpath,sizeof socketpath,"%s/qtest",tempdir); + snprintf(qlog,sizeof qlog,"%s/qemu.log",tempdir); + int fd=open(image,O_CREAT|O_EXCL|O_RDWR,0600); if (fd<0) die("image"); + struct stat st; if (fstat(fd,&st) || !S_ISREG(st.st_mode)) die("regular image"); + uint8_t block[4096]; + for (size_t pos=0;pos<4096u*512u;pos+=sizeof block) { + for (size_t j=0;j<sizeof block;j++) block[j]=(uint8_t)(7u*37u+(pos+j)*13u+((pos+j)>>8)); + if (write(fd,block,sizeof block)!=(ssize_t)sizeof block) die("image fixture"); + } + close(fd); + char drive[256], qtest[256]; + snprintf(drive,sizeof drive,"if=none,id=ns,file=%s,format=raw",image); + snprintf(qtest,sizeof qtest,"unix:%s,server=on,wait=off",socketpath); + qp=fork(); if (qp<0) die("fork qemu"); + if (!qp) { + int log=open(qlog,O_CREAT|O_WRONLY,0600); dup2(log,2); close(log); + execlp("qemu-system-aarch64","qemu-system-aarch64","-machine","virt","-accel","tcg","-S","-m","64M","-nodefaults","-display","none","-monitor","none","-serial","none","-qtest",qtest,"-drive",drive,"-device","nvme,drive=ns,serial=OMEGA-FIXTURE-000001,addr=1.0",NULL); + _exit(127); + } + struct sockaddr_un sa={.sun_family=AF_UNIX}; strcpy(sa.sun_path,socketpath); + struct timespec nap={0,10000000}; + for (int i=0;i<300;i++) { + qfd=socket(AF_UNIX,SOCK_STREAM,0); + if (connect(qfd,(struct sockaddr *)&sa,sizeof sa)==0) break; + close(qfd); qfd=-1; nanosleep(&nap,NULL); + } + if (qfd<0) die("QEMU qtest socket"); + /* virt ECAM, bus0/dev1/function0. PCI binding is verifier setup, not .om NVMe logic. */ + uint64_t ecam=0x4010008000ull; + check((qt("readl 0x%llx",(unsigned long long)ecam)&0xffff)==0x1b36,"QEMU NVMe vendor"); + qt("writel 0x%llx 0x10000004",(unsigned long long)(ecam+0x10)); + qt("writel 0x%llx 0",(unsigned long long)(ecam+0x14)); + qt("writew 0x%llx 6",(unsigned long long)(ecam+4)); +} +static int iscase(const char *s) { return !strcmp(scenario,s); } +static void inject_io(void) +{ + if (iscase("cid")) M.bad_cid=1; + if (iscase("sqid")) M.bad_sqid=1; + if (iscase("timeout") || iscase("cfs")) M.stuck=1; + if (iscase("cfs")) M.cfs_on_stuck=1; + if (iscase("status")) M.inject_sc=0x80; +} +static uint64_t access_rpc(uint64_t op,uint64_t addr,uint64_t val) +{ + if (qfd<0 && M.nlog>0 && (iscase("timeout") || iscase("cfs") || iscase("cid") || iscase("sqid") || iscase("phase") || iscase("sqhead"))) { + check(!(op==5 || (op==3 && addr==0x10000014)), "uncertain DMA is not zeroed/reset/reopened"); + } + if (qfd>=0) { + if (op==1) return qt("readl 0x%llx",(unsigned long long)addr); + if (op==2) return qt("readq 0x%llx",(unsigned long long)addr); + if (op==3) return qt("writel 0x%llx 0x%llx",(unsigned long long)addr,(unsigned long long)val); + if (op==4) return qt("writeq 0x%llx 0x%llx",(unsigned long long)addr,(unsigned long long)val); + if (op==5) return qt("memset 0x%llx %llu 0",(unsigned long long)addr,(unsigned long long)val); + return 0; + } + if (addr>=0x10000000 && addr<0x10010000) { + uint32_t off=(uint32_t)(addr-0x10000000); + if (op==1) return m_read32(NULL,off); + if (op==2) return m_read32(NULL,off)|((uint64_t)m_read32(NULL,off+4)<<32); + if (op==3 || op==4) { + if (off==0x1008) inject_io(); + m_write32(NULL,off,(uint32_t)val); + if (off==0x1008 && (iscase("phase") || iscase("sqhead"))) { + uint64_t slot=(M.iocq_tail+M.iocq_size-1)%M.iocq_size; + uint8_t *c=ptr(M.iocq+slot*16,16); + if (iscase("phase")) p32(c+12,g32(c+12)^(1u<<16)); + else p32(c+8,(g32(c+8)&0xffff0000u)|15); + } + if (op==4) m_write32(NULL,off+4,(uint32_t)(val>>32)); + return 0; + } + } else if (addr>=PHYS_BASE && addr-PHYS_BASE<DMA_BYTES) { + uint8_t *p=ptr(addr,op==5?val:op==2||op==4?8:4); + if (!p) die("model DMA bounds"); + if (op==1) return g32(p); + if (op==2) return g64(p); + if (op==3) { p32(p,(uint32_t)val); return 0; } + if (op==4) { p64(p,val); return 0; } + if (op==5) { memset(p,0,(size_t)val); return 0; } + } + fprintf(stderr,"unsupported RPC %llu %llx\n",(unsigned long long)op,(unsigned long long)addr); exit(2); +} +static void payload(uint64_t addr,uint64_t n) +{ + if (n>8192) die("payload bound"); + uint8_t b[8192]; + if (qfd>=0) { + for (uint64_t i=0;i<n;i+=4) { + uint32_t v=(uint32_t)qt("readl 0x%llx",(unsigned long long)(addr+i)); + for (uint64_t j=0;j<4 && i+j<n;j++) b[i+j]=(uint8_t)(v>>(j*8)); + } + } else { + uint8_t *p=ptr(addr,n); if (!p) die("payload map"); memcpy(b,p,(size_t)n); + if (M.nadmin==1) { + memcpy(b+4,"OMEGA-FIXTURE-000001 ",20); + memcpy(b+64,"8.2.2 ",8); + } + } + if (exact(infd,b,(size_t)n,1)) die("payload send"); +} +int main(int argc,char **argv) +{ + if (argc!=3 && argc!=4) { fprintf(stderr,"usage: runner binary case [qemu]\n"); return 2; } + scenario=argv[2]; atexit(cleanup); signal(SIGPIPE,SIG_IGN); + if (posix_memalign((void **)&dma_mem,4096,DMA_BYTES)) die("oracle memory"); + model_reset(); + if (iscase("lba4k")) M.lbads=12; + model_alloc_media(); fill(M.media,(size_t)M.nsze*bsz(),7); + check(init_default()==NVME_OK,"C oracle initialization"); + check(nvme_read(&C,8,iscase("lba4k")?2:16,expected)==NVME_OK,"C oracle read"); + model_reset(); + if (iscase("lba4k")) M.lbads=12; + model_alloc_media(); fill(M.media,(size_t)M.nsze*bsz(),7); + uint8_t manifest[80]={0}; + memcpy(manifest,"OMEGA-FIXTURE-000001 ",20); memcpy(manifest+20,"8.2.2 ",8); + p32(manifest+28,1); p64(manifest+32,8); p64(manifest+40,64); + p64(manifest+48,8); p32(manifest+56,16); p32(manifest+60,40); p32(manifest+64,1); + p64(manifest+72,argc==4?0x40000000:PHYS_BASE); + int expected_code=0, expected_copies=40, expected_retained=0; + wanted=8192; + if (iscase("lba4k")) p32(manifest+56,2); + if (iscase("singlepage")) { p32(manifest+56,8); wanted=4096; } + if (iscase("serial")) { manifest[0]^=1; expected_code=21; } + if (iscase("firmware")) { manifest[20]^=1; expected_code=22; } + if (iscase("approval")) { p32(manifest+64,0); expected_code=20; } + if (iscase("nsid")) { p32(manifest+28,2); expected_code=argc==4?25:24; } + if (iscase("extent")) { p64(manifest+40,4096); expected_code=27; } + if (iscase("range")) { p64(manifest+48,72); expected_code=31; } + if (iscase("before")) { p64(manifest+48,7); expected_code=31; } + if (iscase("prp")) { p32(manifest+56,17); expected_code=30; } + if (iscase("zero")) { p32(manifest+56,0); expected_code=30; } + if (iscase("metadata")) { M.ms=8; expected_code=26; } + if (iscase("format")) { M.lbads=10; expected_code=26; } + if (iscase("nsze")) { M.nsze=0; expected_code=25; } + if (iscase("sqes")) { M.sqes=0x55; expected_code=23; } + if (iscase("cqes")) { M.cqes=0x33; expected_code=23; } + if (iscase("cap")) { M.cap&=~(1ull<<37); expected_code=28; } + if (iscase("dstrd")) M.cap|=1ull<<32; + if (iscase("stride")) { M.cap|=13ull<<32; expected_code=28; } + if (iscase("readytimeout")) { M.never_ready=1; expected_code=12; expected_retained=1; } + if (iscase("readycfs")) { M.cfs_on_enable=1; expected_code=11; expected_retained=1; } + if (iscase("cid")) { expected_code=14; expected_retained=1; } + if (iscase("sqid")) { expected_code=15; expected_retained=1; } + if (iscase("timeout")) { expected_code=12; expected_retained=1; } + if (iscase("cfs")) { expected_code=11; expected_retained=1; } + if (iscase("phase")) { expected_code=12; expected_retained=1; } + if (iscase("sqhead")) { expected_code=16; expected_retained=1; } + if (iscase("status")) expected_code=17; + if (!strncmp(scenario,"opcode",6)) { + expected_code=13; + p32(manifest+60,1); + p32(manifest+68,(uint32_t)strtoul(scenario+6,NULL,0)); + } + if (iscase("adminformat")) { + expected_code=13; p32(manifest+60,0); p32(manifest+68,0x80); + } + if (expected_code) expected_copies=0; + if (argc==4) { + start_qemu(); + /* QEMU 8.2.2 reports its model firmware as 8.2.2 (space padded). */ + } + int input[2], output[2]; if (pipe(input)||pipe(output)) die("pipe"); + child=fork(); if (child<0) die("fork candidate"); + if (!child) { + dup2(input[0],0); dup2(output[1],1); + close(input[0]); close(input[1]); close(output[0]); close(output[1]); + execl(argv[1],argv[1],NULL); _exit(127); + } + close(input[0]); close(output[1]); infd=input[1]; outfd=output[0]; + if (exact(infd,manifest,sizeof manifest,1)) die("manifest"); + uint8_t request[24], response[8]; unsigned requests=0; + while (exact(outfd,request,sizeof request,0)==0) { + if (++requests>50000) die("RPC budget"); + uint64_t op=g64(request),addr=g64(request+8),val=g64(request+16),r=0; + if (op>=1 && op<=5) r=access_rpc(op,addr,val); + else if (op!=6 && op!=7 && op!=8) die("RPC opcode"); + p64(response,r); if (exact(infd,response,sizeof response,1)) die("RPC response"); + if (op==6) payload(addr,val); + if (op==7) { + uint8_t data[8192]; check(val==wanted,"copy-out length"); + if (val>sizeof data || exact(outfd,data,(size_t)val,0)) die("copy-out"); + check(!memcmp(data,expected,(size_t)val),"copy-out equals existing C oracle"); published++; + } + if (op==8) { result_code=(int)val; retained=(int)addr; reported++; } + } + close(infd); close(outfd); + int status=0; waitpid(child,&status,0); child=-1; + check(WIFEXITED(status) && WEXITSTATUS(status)==expected_code,"candidate exit code"); + check(reported==1 && result_code==expected_code,"reported result"); + check(retained==expected_retained,"timeout/correlation DMA retention"); + check(published==expected_copies,"copy-out only after success"); + if (qfd<0) { + check(M.protocol_errors==0,"existing C model protocol checks"); + for (int i=0;i<M.nlog && i<MAXLOG;i++) check(M.log[i].opc==2,"NO WRITE OPCODE REACHABLE"); + if (expected_code && expected_code<30 && expected_code!=14 && expected_code!=15 && expected_code!=16 && expected_code!=12 && expected_code!=11 && expected_code!=17 && expected_code!=13) + check(M.nlog==0,"identity refusal before IO"); + if (!expected_code) { check(M.nlog==40,"IO queue wraps twice"); check(M.last_cq_db[1]==8,"CQ head wraps"); check(M.iocq_phase==1,"CQ phase wraps twice"); } + if (iscase("adminwrap")) { check(M.nadmin==44,"admin commands wrap twice"); check(M.acq_phase==1 && M.last_cq_db[0]==12,"admin CQ phase/head wrap"); } + } + printf("%s case=%s transport=%s result=%d copies=%d retained=%d RPC=%u physical=NOT_RUN\n",errors?"FAIL":"PASS",scenario,qfd<0?"C-model":"QEMU",result_code,published,retained,requests); + free(dma_mem); free(M.media); free(M.cache); free(M.dirty); + return errors?1:0; +} diff --git a/native/disk/tests/omega_nvme_test.sh b/native/disk/tests/omega_nvme_test.sh new file mode 100755 index 00000000..61cec6b0 --- /dev/null +++ b/native/disk/tests/omega_nvme_test.sh @@ -0,0 +1,73 @@ +#!/bin/sh +# SPDX-License-Identifier: Apache-2.0 +# Host/disposable-QEMU verification only; no device path argument exists. +set -eu +cd "$(dirname "$0")/../../.." +: "${AIEN_OMC:?set AIEN_OMC to the existing pinned seeded compiler}" +want=bcfa582892afca8f65e551fe56867d918d86e84540c7381be8fa9ef18d0cf0f6 +actual=$(sha256sum "$AIEN_OMC") +[ "${actual%% *}" = "$want" ] || { echo 'compiler pin mismatch' >&2; exit 2; } +out=${OMEGA_NVME_EVIDENCE:-$(mktemp -d /tmp/omega-nvme-evidence-XXXXXX)} +mkdir -p "$out" +case "$out" in /*) ;; *) echo 'evidence directory must be absolute' >&2; exit 2;; esac +base=native/disk +compose() { cat "$base/omega_nvme.om" "$base/omega_nvme_transport.om" "$1"; } +compile() { nice -n 15 "$AIEN_OMC" < "$1" > "$2"; chmod +x "$2"; } +compose "$base/omega_nvme_main.om" > "$out/read.om" +compile "$out/read.om" "$out/read" +compose "$base/tests/omega_nvme_probe.om" > "$out/probe.om" +compile "$out/probe.om" "$out/probe" +compose "$base/tests/omega_nvme_adminwrap.om" > "$out/adminwrap.om" +compile "$out/adminwrap.om" "$out/adminwrap" +compose "$base/tests/omega_nvme_failstop.om" > "$out/failstop.om" +compile "$out/failstop.om" "$out/failstop" +${CC:-cc} -std=c11 -O2 -Wall -Wextra -Werror -Wno-unused-function \ + "$base/tests/omega_nvme_runner.c" "$base/disk_nvme.c" "$base/disk.c" -o "$out/runner" +: > "$out/host.log" +for c in healthy singlepage lba4k dstrd serial firmware approval nsid extent range before prp zero metadata format nsze sqes cqes cap stride readytimeout readycfs status; do + nice -n 15 "$out/runner" "$out/read" "$c" >> "$out/host.log" +done +nice -n 15 "$out/runner" "$out/adminwrap" adminwrap >> "$out/host.log" +for c in cid sqid sqhead phase timeout cfs; do + nice -n 15 "$out/runner" "$out/failstop" "$c" >> "$out/host.log" +done +for c in opcode0 opcode1 opcode8 opcode9 opcode128 opcode132 adminformat; do + nice -n 15 "$out/runner" "$out/probe" "$c" >> "$out/host.log" +done +# Remove exactly the named three-line refusal block in disposable sources. +# These are verification mutants, never source edits or candidate artifacts. +mutate() { + awk -v target="$1" 'BEGIN {skip=0;hits=0} $0==target {skip=3;hits++} skip>0 {skip--;next} {print} END {if(hits!=1)exit 2}' "$2" > "$3" +} +: > "$out/mutants.log" +for spec in 'cid|if ne and dw3 65535 cid|cid|read' \ + 'sqid|if ne shr dw2 16 q|sqid|read' \ + 'status|if ne and shr dw3 17 2047 0|status|read' \ + 'sqhead|if ne and dw2 65535 get tail q|sqhead|read' \ + 'reopen|if gt get st 0 0|timeout|failstop' \ + 'opcode|if not ok|opcode1|probe'; do + name=${spec%%|*}; rest=${spec#*|}; guard=${rest%%|*}; rest=${rest#*|}; case_name=${rest%%|*}; source=${rest#*|} + mutate "$guard" "$out/$source.om" "$out/mutant-$name.om" + compile "$out/mutant-$name.om" "$out/mutant-$name" + if nice -n 15 "$out/runner" "$out/mutant-$name" "$case_name" > "$out/mutant-$name.log" 2>&1; then + echo "FAIL mutant survived $name" >&2; exit 1 + fi + echo "PASS killed guard-removal mutant $name (baseline case passed)" >> "$out/mutants.log" +done +# Retention negative control: delete only the in-flight ownership marker. +awk '$0=="put st 1 1" {hits++;next} {print} END {if(hits!=1)exit 2}' "$out/read.om" > "$out/mutant-retention.om" +compile "$out/mutant-retention.om" "$out/mutant-retention" +if nice -n 15 "$out/runner" "$out/mutant-retention" timeout > "$out/mutant-retention.log" 2>&1; then + echo 'FAIL retention mutant survived' >&2; exit 1 +fi +echo 'PASS killed retention guard-removal mutant' >> "$out/mutants.log" +: > "$out/qemu.log" +# Firmware identity is intentionally pinned; a different QEMU version refuses. +qemu-system-aarch64 --version > "$out/qemu-version.txt" +for c in healthy serial firmware approval nsid extent range before prp zero; do + nice -n 15 "$out/runner" "$out/read" "$c" qemu >> "$out/qemu.log" +done +sha256sum "$AIEN_OMC" "$base/omega_nvme.om" "$base/omega_nvme_transport.om" \ + "$base/omega_nvme_main.om" "$base/tests/omega_nvme_runner.c" "$out/read" > "$out/sha256.txt" +printf '%s\n' 'PASS Omega NVMe host + QEMU + guard mutants; physical NOT_RUN' | tee "$out/result.txt" +printf 'Evidence: %s\n' "$out"