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-gpu-driver/blob/main/tests/rmchan_ref.c # omega-gpu-driver aien-dev/omega-gpu-driver 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 `omega-gpu-driver / tests / rmchan_ref.c` 64 lines ยท 3490 bytes Raw Blame History 1 /* Verification-only oracle. Never linked into driver; headers are NVIDIA 2 * open-gpu-kernel-modules 580.173.02@`20e4e6e19cc26ba47b5cbe23130a396be100c427`. 3 * Checks observed RM transitions and queued request identity, class, size, 4 * schedule flags, and free order. Parameter bytes have the existing params oracle. 5 * Policy error values and host peer semaphore progress are not hardware evidence. */ 6 #include 7 #include 8 #include "nvtypes.h" 9 #include "nvmisc.h" 10 #include "class/cl0000.h" 11 #include "class/cl0080.h" 12 #include "class/cl2080.h" 13 #include "class/cl90f1.h" 14 #include "class/cla06c.h" 15 #include "class/cl9067.h" 16 #include "class/clc96f.h" 17 #include "nvos.h" 18 #include "alloc/alloc_channel.h" 19 #include "ctrl/ctrla06c.h" 20 #include "ctrl/ctrla06f/ctrla06fgpfifo.h" 21 #include "vgpu/rpc_global_enums.h" 22 static const uint32_t cli=3254779905u, dev=3254779906u, sub=3254779907u, 23 vas=3254779912u, tsg=3254779913u, ctx=3254779914u, ch=3254779915u; 24 static void step(int id, int state, unsigned f, int rc) 25 { printf("step %d state=%d fn=%u rc=%d\n",id,state,f,rc); } 26 static void cap(int id,int rc) { printf("cap %d rc=%d\n",id,rc); } 27 static void alloc(uint32_t par,uint32_t obj,uint32_t cls,size_t n) 28 { printf("req %u cli=%u par=%u obj=%u cls=%u n=%zu\n", 29 NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,cli,par,obj,cls,n); } 30 static void sched(NvBool en) 31 { NVA06C_CTRL_GPFIFO_SCHEDULE_PARAMS p={0}; p.bEnable=en; 32 printf("req %u cli=%u obj=%u cls=%u en=%u\n", 33 NV_VGPU_MSG_FUNCTION_GSP_RM_CONTROL,cli,tsg, 34 NVA06C_CTRL_CMD_GPFIFO_SCHEDULE,(unsigned)p.bEnable); } 35 static void freeobj(uint32_t obj) 36 { printf("req %u cli=%u obj=%u\n",NV_VGPU_MSG_FUNCTION_FREE,cli,obj); } 37 int main(void) 38 { 39 cap(30,-1); cap(31,-10); cap(29,-5); cap(32,0); cap(33,-3); cap(34,-4); cap(35,-3); 40 step(1,1,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,0); 41 puts("seq 1 rc=2 st=11"); puts("seq 2 rc=2 st=11"); 42 puts("seq 3 rc=-10 st=11"); puts("seq 4 rc=0 st=10"); 43 alloc(0,cli,NV01_ROOT,sizeof(NV0000_ALLOC_PARAMETERS)); step(2,2,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,1); 44 alloc(cli,dev,NV01_DEVICE_0,sizeof(NV0080_ALLOC_PARAMETERS)); step(3,3,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,1); 45 alloc(dev,sub,NV20_SUBDEVICE_0,sizeof(NV2080_ALLOC_PARAMETERS)); step(4,4,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,1); 46 alloc(dev,vas,FERMI_VASPACE_A,sizeof(NV_VASPACE_ALLOCATION_PARAMETERS)); step(5,5,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,1); 47 alloc(dev,tsg,KEPLER_CHANNEL_GROUP_A,sizeof(NV_CHANNEL_GROUP_ALLOCATION_PARAMETERS)); step(6,6,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,1); 48 alloc(tsg,ctx,FERMI_CONTEXT_SHARE_A,sizeof(NV_CTXSHARE_ALLOCATION_PARAMETERS)); step(7,7,NV_VGPU_MSG_FUNCTION_GSP_RM_ALLOC,1); 49 alloc(dev,ch,BLACKWELL_CHANNEL_GPFIFO_A,sizeof(NV_CHANNEL_ALLOC_PARAMS)); step(8,8,0,1); 50 step(9,9,NV_VGPU_MSG_FUNCTION_GSP_RM_CONTROL,0); sched(1); step(10,10,0,1); 51 cap(36,-1); cap(37,-1); cap(38,-3); cap(39,0); cap(40,-5); 52 step(11,11,NV_VGPU_MSG_FUNCTION_GSP_RM_CONTROL,0); cap(41,-3); 53 sched(0); step(12,12,0,1); cap(42,-3); 54 step(13,14,NV_VGPU_MSG_FUNCTION_FREE,0); 55 freeobj(ch); step(14,15,NV_VGPU_MSG_FUNCTION_FREE,1); 56 freeobj(ctx); step(15,16,NV_VGPU_MSG_FUNCTION_FREE,1); 57 freeobj(tsg); step(16,17,NV_VGPU_MSG_FUNCTION_FREE,1); 58 freeobj(vas); step(17,18,NV_VGPU_MSG_FUNCTION_FREE,1); 59 freeobj(sub); step(18,19,NV_VGPU_MSG_FUNCTION_FREE,1); 60 freeobj(dev); step(19,20,NV_VGPU_MSG_FUNCTION_FREE,1); 61 freeobj(cli); step(20,21,0,1); 62 cap(43,-3); cap(44,-3); cap(45,0); cap(46,-3); cap(47,-4); 63 return 0; 64 }