diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-26 03:07:57 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-09-26 03:07:57 -0400 |
| commit | 929d537d13c8a84130bcb73875b081ee1577504e (patch) | |
| tree | 787a3c56ac63f1ed149482a8a91af345e9c6303e /tools/guest-diag | |
| parent | ae2bd4def95997ff7198b1bad21a73a267eea604 (diff) | |
| download | open-iov-929d537d13c8a84130bcb73875b081ee1577504e.tar.gz open-iov-929d537d13c8a84130bcb73875b081ee1577504e.zip | |
tools/guest-diag: decode engine-list, classlist and CE-cap RM control replies in the ioctl tracer
Diffstat (limited to 'tools/guest-diag')
| -rw-r--r-- | tools/guest-diag/ioctl_trace.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/tools/guest-diag/ioctl_trace.c b/tools/guest-diag/ioctl_trace.c index 04fea05..661636f 100644 --- a/tools/guest-diag/ioctl_trace.c +++ b/tools/guest-diag/ioctl_trace.c @@ -63,6 +63,93 @@ static void dump_free(pid_t pid, unsigned long arg) fprintf(stderr, "[iot] free old=0x%x st=0x%x\n", v[2], v[3]); } +/* Decode the interesting RM control replies (params buffer read at syscall + * exit, so for OUT params this is the answer the client received). */ +static void decode_ctrl_reply(pid_t pid, unsigned int cmd, + unsigned long long pParams, unsigned int size) +{ + unsigned int w[8]; + unsigned long long listPtr; + unsigned int i, n; + + if (!pParams || !size) + return; + + switch (cmd) { + case 0x20800123: /* GPU_GET_ENGINES (V1): {count, ptr} */ + if (size < 16 || read_child(pid, pParams, w, 16)) + return; + memcpy(&listPtr, &w[2], sizeof(listPtr)); + n = w[0]; + fprintf(stderr, "[iot] V1 engineCount=%u list@0x%llx:", n, listPtr); + if (n > 0x54) + n = 0x54; + for (i = 0; i < n; i++) { + unsigned int e = 0; + if (listPtr && read_child(pid, listPtr + i * 4, &e, 4)) + break; + fprintf(stderr, " 0x%x", e); + } + fprintf(stderr, "\n"); + break; + case 0x20800170: /* GPU_GET_ENGINES_V2: {count, list[]} */ + if (size < 4 || read_child(pid, pParams, w, 8)) + return; + n = w[0]; + fprintf(stderr, "[iot] V2 engineCount=%u:", n); + if (n > 0x54) + n = 0x54; + for (i = 0; i < n; i++) { + unsigned int e = 0; + if (read_child(pid, pParams + 4 + i * 4, &e, 4)) + break; + fprintf(stderr, " 0x%x", e); + } + fprintf(stderr, "\n"); + break; + case 0x20800124: /* GPU_GET_ENGINE_CLASSLIST: {engineType, n, ptr} */ + if (size < 16 || read_child(pid, pParams, w, 16)) + return; + memcpy(&listPtr, &w[4], sizeof(listPtr)); + n = w[2]; + fprintf(stderr, "[iot] classlist eng=0x%x n=%u:", w[0], n); + if (n > 64) + n = 64; + for (i = 0; i < n; i++) { + unsigned int c = 0; + if (listPtr && read_child(pid, listPtr + i * 4, &c, 4)) + break; + fprintf(stderr, " 0x%x", c); + } + fprintf(stderr, "\n"); + break; + case 0x20802a07: /* CE_GET_PHYSICAL_CAPS: {type, caps[8]} */ + case 0x20802a01: /* CE_GET_CAPS: {type, capsTblSize, capsTbl ptr...} */ + case 0x20802a02: { /* CE_GET_CE_PCE_MASK: {type, pceMask} */ + if (size < 8 || read_child(pid, pParams, w, 8)) + return; + fprintf(stderr, "[iot] ce ctrl 0x%x type=0x%x w4=0x%x w5=0x%x\n", + cmd, w[0], w[4], w[5]); + break; + } + case 0x20802a0a: /* CE_GET_ALL_CAPS */ + case 0x20802a0b: { /* CE_GET_ALL_PHYSICAL_CAPS: 128 caps + 8 present */ + unsigned int present_lo = 0, present_hi = 0; + if (size < 136) + return; + if (read_child(pid, pParams + 128, &present_lo, 4)) + return; + if (read_child(pid, pParams + 132, &present_hi, 4)) + return; + fprintf(stderr, "[iot] ce all-caps 0x%x present=0x%x%08x\n", + cmd, present_hi, present_lo); + break; + } + default: + break; + } +} + static void dump_control(pid_t pid, unsigned long arg) { unsigned int v[8]; @@ -78,6 +165,7 @@ static void dump_control(pid_t pid, unsigned long arg) fprintf(stderr, "[iot] control client=0x%x object=0x%x cmd=0x%x params=0x%llx size=%u st=0x%x\n", v[0], v[1], cmd, pParams, v[5], v[7]); + decode_ctrl_reply(pid, cmd, pParams, v[5]); } int main(int argc, char **argv) |
