interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / disk / OMEGA_NVME_READ.md

293 lines · 19043 bytes Raw Blame History Source

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

From the repository root on this Spark:

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.

OffsetBytesMeaning
020Exact approved controller serial (Identify bytes 4..23)
208Exact approved firmware revision (Identify bytes 64..71)
284Explicit NSID; no first-namespace discovery or fallback
328Approved extent start LBA
408Approved extent block count
488Requested start LBA
564Requested block count
604Repetitions, 1..64
644Reviewed manifest approval marker, exactly 1
684Reserved, exactly 0
728Device-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

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:

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.