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 / kernel / gpu / gsp_sim.h

52 lines · 2545 bytes Raw Blame History
1/* gsp_sim.h -- a simulated GB10B SEC2 + GSP falcon for host tests of gsp_mmio (L332, L346). NOT the chip.
2 *
3 * Models only what the driver source says the host sees on BAR0 during the GSP start-up: SEC2 EMEM
4 * channel 0 (1 KiB, EMEMC/EMEMD with write auto-increment), its queue HEAD/TAIL and MAILBOX0/1, and the
5 * GSP falcon's MAILBOX0/1, HWCFG2 (target-mask pattern, lockdown bit 13), FALCON_OS, RISC-V CPUCTL and
6 * QUEUE_HEAD(0). Timing is counted in register reads of the polled register. Every access is logged in
7 * order; accesses the driver never makes, and orders it never uses, are counted as violations.
8 * Choices the source does not settle are marked SIM-CHOICE. */
9#ifndef CK_GSP_SIM_H
10#define CK_GSP_SIM_H
11
12#include <stdint.h>
13#include "gmmu.h"
14
15#define CK_GSPSIM_LOG_MAX 1024u
16#define CK_GSPSIM_NO_END 0xFFFFFFFFu /* a wait that never ends */
17
18struct ck_gspsim_cfg {
19 uint32_t busy_reads; /* HEAD reads during which the SEC2 channel still holds an old message */
20 uint32_t cmd_reads; /* MAILBOX0 reads that return 0xc001cafe after the doorbell */
21 uint32_t mask_reads; /* HWCFG2 reads that return 0xBADF41A7 after the command is handled */
22 uint32_t args_reads; /* GSP MAILBOX0 reads that still return the boot-argument address */
23 uint32_t lockdown_reads; /* HWCFG2 reads with lockdown set after the target mask is released */
24 uint32_t fmc_error; /* non-zero: the FMC writes this code to GSP MAILBOX0 instead of releasing */
25 uint32_t riscv_dead; /* RISC-V never reports ACTIVE */
26 uint32_t emem_no_inc; /* hardware fault: EMEMC does not advance */
27 uint64_t fmc_args_pa; /* what SEC2 stuffs in GSP MAILBOX0/1 (SIM-CHOICE: the driver tolerates it) */
28 uint32_t hwcfg2_zero_reads; /* HWCFG2 reads that return 0 before the target-mask pattern (SIM-CHOICE) */
29};
30
31struct ck_gspsim_ev {
32 uint32_t off, val;
33 uint8_t write;
34};
35
36struct ck_gspsim {
37 struct ck_gspsim_cfg cfg;
38 uint32_t emem[256];
39 uint32_t ememc, qhead, qtail;
40 uint32_t sec2_mb0, sec2_mb1;
41 uint32_t gsp_mb0, gsp_mb1, hwcfg2, os, cpuctl, gsp_qhead_writes;
42 /* phase: 0 idle, 1 command posted, 2 handled (mask), 3 FMC running (lockdown), 4 released, 9 rejected */
43 uint32_t phase, left, zero_left;
44 uint32_t packet_ok, os_written_at_phase;
45 struct ck_gspsim_ev log[CK_GSPSIM_LOG_MAX];
46 uint32_t nlog, violations;
47};
48
49void ck_gspsim_init(struct ck_gspsim *s, const struct ck_gspsim_cfg *cfg);
50struct ck_gpu_regs ck_gspsim_regs(struct ck_gspsim *s);
51
52#endif