interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / omega / slices / kmod.osc

84 lines · 2738 bytes Raw Blame History
1// slice-entry: kmod_bind kmod_rd kmod_wr kmod_fw kmod_ring
2// Our GPU kernel module, in Omega. This is the policy aien-gpu enforces.
3// It is not nvidia.ko and it is not loaded here. One chip: vendor 4318
4// (0x10de), device 11794 (0x2e12). Bind refuses if the NVIDIA module is
5// loaded or allow_bind is off. A register write is permitted only for the
6// six start-up offsets. A read is permitted only for the identity registers
7// and the start-up registers. Firmware length must be 75012080. The SEC2
8// doorbell may be written once per load.
9// slice-run: kmod_bind bytes: 4318 11794 0 1 -> 0
10// slice-run: kmod_bind bytes: 4318 11794 1 1 -> 18446744073709551615
11// slice-run: kmod_bind bytes: 4318 11794 0 0 -> 18446744073709551615
12// slice-run: kmod_bind bytes: 4318 0 0 1 -> 18446744073709551615
13// slice-run: kmod_wr bytes: 1117184 -> 0
14// slice-run: kmod_wr bytes: 8653824 -> 0
15// slice-run: kmod_wr bytes: 64 -> 18446744073709551615
16// slice-run: kmod_rd bytes: 0 -> 0
17// slice-run: kmod_rd bytes: 2560 -> 0
18// slice-run: kmod_rd bytes: 64 -> 18446744073709551615
19// slice-run: kmod_fw bytes: 75012080 -> 0
20// slice-run: kmod_fw bytes: 1 -> 18446744073709551615
21// slice-run: kmod_ring bytes: 0 -> 0
22// slice-run: kmod_ring bytes: 1 -> 18446744073709551615
23
24fn kmod_bind(b: bytes, vendor: u64, device: u64, nvidia_up: u64, allow: u64) -> u64 {
25 if b.len > 0 {
26 return 18446744073709551615;
27 }
28 if vendor != 4318 || device != 11794 {
29 return 18446744073709551615;
30 }
31 if nvidia_up != 0 || allow != 1 {
32 return 18446744073709551615;
33 }
34 return 0;
35}
36
37fn kmod_rd(b: bytes, off: u64) -> u64 {
38 if b.len > 0 {
39 return 18446744073709551615;
40 }
41 if off == 0 || off == 2560 {
42 return 0;
43 }
44 if off == 8650816 || off == 8650820 || off == 8653504 || off == 8653824 || off == 8653828 {
45 return 0;
46 }
47 if off == 1114176 || off == 1114180 || off == 1114240 || off == 1114356 || off == 1117184 || off == 1119112 {
48 return 0;
49 }
50 return 18446744073709551615;
51}
52
53fn kmod_wr(b: bytes, off: u64) -> u64 {
54 if b.len > 0 {
55 return 18446744073709551615;
56 }
57 if off == 8653504 || off == 8653508 || off == 8653824 || off == 8653828 {
58 return 0;
59 }
60 if off == 1114240 || off == 1117184 {
61 return 0;
62 }
63 return 18446744073709551615;
64}
65
66fn kmod_fw(b: bytes, size: u64) -> u64 {
67 if b.len > 0 {
68 return 18446744073709551615;
69 }
70 if size != 75012080 {
71 return 18446744073709551615;
72 }
73 return 0;
74}
75
76fn kmod_ring(b: bytes, already: u64) -> u64 {
77 if b.len > 0 {
78 return 18446744073709551615;
79 }
80 if already != 0 {
81 return 18446744073709551615;
82 }
83 return 0;
84}