Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/omega_accelerator.h # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / omega_accelerator.h` 152 lines ยท 6088 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef OMEGA_ACCELERATOR_H 18 #define OMEGA_ACCELERATOR_H 19 20 #include "omega_types.h" 21 #include "omega_machine.h" 22 #include 23 #include 24 #include 25 26 #define OMEGA_ACCEL_MAX_WINDOWS 8 27 #define OMEGA_ACCEL_MAX_QUEUES 2 28 29 /* Resource Type for Accelerator Capability (M3/M15) */ 30 #define RES_ACCELERATOR 0x00000005 31 32 /* Accelerator Operations */ 33 #define ACCEL_OP_PROBE 0x00000001 34 #define ACCEL_OP_MAP_DMA 0x00000002 35 #define ACCEL_OP_UNMAP_DMA 0x00000004 36 #define ACCEL_OP_ALLOC_QUEUE 0x00000008 37 #define ACCEL_OP_SUBMIT 0x00000010 38 #define ACCEL_OP_SYNC 0x00000020 39 #define ACCEL_OP_RESET 0x00000040 40 41 /* DMA Permission Flags */ 42 #define DMA_PERM_READ 0x00000001 43 #define DMA_PERM_WRITE 0x00000002 44 #define DMA_PERM_COHERENT 0x00000004 45 46 /* Decision Codes in EffectReceipt */ 47 #define DEC_ADMITTED 1 48 #define DEC_REJECTED 2 49 50 /* DMA Window Descriptor */ 51 typedef struct { 52 uint64_t iova_base; 53 uint64_t phys_base; 54 uint64_t size_bytes; 55 uint32_t permissions; 56 uint32_t stream_id; 57 uint32_t window_id; 58 uint32_t reserved; 59 } OmegaDmaWindow; 60 61 /* Accelerator Capability */ 62 typedef struct { 63 uint32_t slot; 64 uint32_t generation; 65 uint64_t principal_id; 66 uint32_t resource_type; 67 uint32_t allowed_ops; 68 uint64_t iova_bound_base; 69 uint64_t iova_bound_size; 70 uint32_t queue_id_mask; 71 uint32_t revocation_state; /* 1 = ACTIVE, 2 = REVOKED */ 72 uint8_t provenance_digest[32]; 73 } OmegaAccelCapability; 74 75 /* Canonical EffectIntent (64 bytes) */ 76 typedef struct { 77 uint16_t version; /* 1 */ 78 uint16_t length; /* 64 */ 79 uint32_t reserved0; /* 0 */ 80 uint64_t request_id; /* Caller-generated request ID */ 81 uint64_t principal_id; /* Principal ID */ 82 uint32_t capability_slot; /* Capability slot index */ 83 uint32_t capability_generation; /* Capability generation */ 84 uint32_t resource_type; /* RES_ACCELERATOR */ 85 uint32_t operation; /* ACCEL_OP_* */ 86 uint64_t target_base; /* Target IOVA or Queue ID */ 87 uint64_t target_size; /* Byte span or command length */ 88 uint64_t param0; /* Descriptor address or doorbell parameter */ 89 } OmegaEffectIntent; 90 91 /* Canonical EffectReceipt (192 bytes) */ 92 typedef struct { 93 uint16_t version; /* 1 */ 94 uint16_t length; /* 192 */ 95 uint32_t decision; /* 1 = ADMITTED, 2 = REJECTED */ 96 uint32_t rejection_reason; /* Specific reason code if rejected */ 97 uint32_t reserved0; /* 0 */ 98 uint64_t request_id; /* Mirrored from EffectIntent */ 99 uint8_t intent_digest[32]; /* SHA-256 of 64-byte EffectIntent */ 100 uint64_t actual_effect; /* Physical result or mapped address */ 101 uint64_t output; /* Submitted packet count or status */ 102 uint32_t capability_slot; /* Presented slot */ 103 uint32_t capability_generation; /* Presented generation */ 104 uint64_t machine_generation; /* Monotonic machine counter */ 105 uint64_t measurement; /* Timestamp / cycle measurement */ 106 uint8_t previous_receipt_digest[32]; /* Rolling SHA-256 seal chain */ 107 uint8_t receipt_digest[32]; /* SHA-256 seal over fields + previous */ 108 uint8_t reserved1[32]; /* Padding to 192 bytes */ 109 } OmegaEffectReceipt; 110 111 /* Omega Accelerator Port Client Context */ 112 typedef struct { 113 OmegaAccelCapability capability; 114 uint32_t active_window_count; 115 OmegaDmaWindow windows[OMEGA_ACCEL_MAX_WINDOWS]; 116 uint32_t assigned_queue_id; 117 bool has_active_queue; 118 uint8_t expected_seal[32]; 119 uint64_t requests_issued; 120 uint64_t receipts_validated; 121 bool is_bound_to_physics; 122 } OmegaAccelPort; 123 124 /* Initialize Omega accelerator port client with Physics capability */ 125 int omega_accel_port_init(OmegaAccelPort *port, 126 const OmegaAccelCapability *cap); 127 128 /* Formulate an EffectIntent for DMA mapping request */ 129 int omega_accel_port_build_dma_intent(const OmegaAccelPort *port, 130 uint64_t iova_base, 131 uint64_t phys_base, 132 uint64_t size_bytes, 133 uint32_t permissions, 134 OmegaEffectIntent *out_intent); 135 136 /* Formulate an EffectIntent for queue submission */ 137 int omega_accel_port_build_submit_intent(const OmegaAccelPort *port, 138 uint32_t queue_id, 139 uint64_t cmd_iova, 140 uint64_t cmd_len, 141 OmegaEffectIntent *out_intent); 142 143 /* Validate a unkeyed EffectReceipt digest (no signature/MAC) and update rolling seal state */ 144 int omega_accel_port_verify_receipt(OmegaAccelPort *port, 145 const OmegaEffectIntent *intent, 146 const OmegaEffectReceipt *receipt); 147 148 /* Ingest Physics accelerator topology into OmegaMachineGraph */ 149 int omega_accel_port_bind_machine_graph(const OmegaAccelPort *port, 150 OmegaMachineGraph *mg); 151 152 #endif /* OMEGA_ACCELERATOR_H */