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/aienux/blob/main/native/kernel/tests/gsp_boot_trace.c # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / kernel / tests / gsp_boot_trace.c` 73 lines ยท 3015 bytes Raw Blame History 1 /* gsp_boot_trace: every register access ck_gsp_mmio_boot and ck_gsp_mmio_notify make against the simulated SEC2 + 2 * GSP, in a fixed list of scenarios, printed one per line. Built twice (hand gsp_mmio.c, generated gsb_contract.c); 3 * the two outputs must be byte-identical (make gsp-contract-trace). Host only; nothing here has run on the chip. */ 4 #include "gsp_mmio.h" 5 #include "gsp_sim.h" 6 #include 7 #include 8 9 #define ARGS_PA 0x0000000123456000ull 10 11 static struct ck_gspsim sim; 12 static uint8_t pkt[1024]; 13 14 static void nop(void *ctx) 15 { 16 (void)ctx; 17 } 18 19 static void scenario(const char *name, struct ck_gspsim_cfg c, uint32_t len, uint32_t budget, uint32_t hdr_ok) 20 { 21 static const uint32_t hdr[3] = {0x00000001u, 0x1410DE7Eu, 1u | (860u << 16)}; 22 for (uint32_t i = 0; i < sizeof(pkt); i++) 23 pkt[i] = (uint8_t)(i * 13u + 5u); 24 if (hdr_ok) 25 memcpy(pkt, hdr, sizeof(hdr)); 26 struct ck_gsp_mmio_in in = {pkt, len, ARGS_PA, 0x0005f3a1u, budget, budget, budget, budget, nop, 0}; 27 struct ck_gsp_mmio_out o; 28 ck_gspsim_init(&sim, &c); 29 struct ck_gpu_regs r = ck_gspsim_regs(&sim); 30 int rc = ck_gsp_mmio_boot(&r, &in, &o); 31 if (rc == CK_GSP_OK) 32 ck_gsp_mmio_notify(&r); 33 printf("== %s rc=%d stage=%d polls=%u,%u,%u,%u dwords=%u ememc=%#x sec2=%#x,%#x hwcfg2=%#x gsp=%#x,%#x cpuctl=%#x" 34 " nlog=%u violations=%u phase=%u\n", 35 name, rc, o.stage, o.polls[0], o.polls[1], o.polls[2], o.polls[3], o.dwords, o.ememc_after, o.sec2_mb0, 36 o.sec2_mb1, o.hwcfg2, o.gsp_mb0, o.gsp_mb1, o.cpuctl, sim.nlog, sim.violations, sim.phase); 37 for (uint32_t i = 0; i < sim.nlog && i < CK_GSPSIM_LOG_MAX; i++) 38 printf("%c %06x %08x\n", sim.log[i].write ? 'W' : 'R', sim.log[i].off, sim.log[i].val); 39 } 40 41 int main(void) 42 { 43 const struct ck_gspsim_cfg base = {0, 3, 4, 2, 5, 0, 0, 0, ARGS_PA, 0}; 44 struct ck_gspsim_cfg c; 45 46 scenario("happy", base, 868, 100, 1); 47 c = base; c.busy_reads = 3; 48 scenario("busy3", c, 868, 100, 1); 49 c = base; c.busy_reads = CK_GSPSIM_NO_END; 50 scenario("busy-forever", c, 868, 5, 1); 51 c = base; c.cmd_reads = CK_GSPSIM_NO_END; 52 scenario("sec2-never", c, 868, 5, 1); 53 c = base; c.mask_reads = CK_GSPSIM_NO_END; 54 scenario("mask-never", c, 868, 5, 1); 55 c = base; c.hwcfg2_zero_reads = 2; 56 scenario("hwcfg2-zero2", c, 868, 100, 1); 57 c = base; c.args_reads = CK_GSPSIM_NO_END; 58 scenario("args-never", c, 868, 6, 1); 59 c = base; c.lockdown_reads = CK_GSPSIM_NO_END; 60 scenario("lockdown-never", c, 868, 6, 1); 61 c = base; c.fmc_error = 0x23; 62 scenario("fmc-error", c, 868, 100, 1); 63 c = base; c.riscv_dead = 1; 64 scenario("riscv-dead", c, 868, 100, 1); 65 c = base; c.emem_no_inc = 1; 66 scenario("emem-stuck", c, 868, 100, 1); 67 scenario("bad-header", base, 868, 3, 0); 68 scenario("odd-7", base, 7, 3, 1); 69 scenario("full-1024", base, 1024, 3, 1); 70 scenario("too-long", base, 1025, 3, 1); 71 scenario("budget0", base, 868, 0, 1); 72 return 0; 73 }