From c3d6f2c852eb046e9d4f4f1e6527b52c746b2693 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Sun, 29 Oct 2023 14:37:51 -0400 Subject: Print Ampere+ device_info fields with correct offsets/widths Everything now has been checked against how nvgpu handles it --- device_info_procfs.c | 21 ++++++++++++++------- nvdebug.h | 10 +++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/device_info_procfs.c b/device_info_procfs.c index e94bef5..b139c36 100644 --- a/device_info_procfs.c +++ b/device_info_procfs.c @@ -156,23 +156,30 @@ static int device_info_file_seq_show_ga100(struct seq_file *s, void *iter_raw) { } // Parse and print the data + // Note: The goal of this interface is to present useful information to + // a human user, NOT to provide a stable format for scripts to parse. + // Because of this, we favor accurately printing the data in each entry, + // rather than providing stable (if imperfectly correct) field names switch(iter->type_of_next_entry) { case 0: - seq_printf(s, "| instance %d\n", curr_info.inst_id); - seq_printf(s, "| Fault ID: %3d\n", curr_info.fault_id); - seq_printf(s, "| Engine Type: %2d (", curr_info.engine_type); + seq_printf(s, "| Engine Type: %3d (", curr_info.engine_type); if (curr_info.engine_type < ENGINE_TYPES_LEN) seq_printf(s, "%s)\n", ENGINE_TYPES_NAMES[curr_info.engine_type]); else seq_printf(s, "Unknown, introduced post-Lovelace)\n"); + seq_printf(s, "| instance %d\n", curr_info.inst_id); + seq_printf(s, "| Fault ID: %4d\n", curr_info.fault_id); break; case 1: - seq_printf(s, "| BAR0 Base %#.8x\n", curr_info.pri_base << 12); - seq_printf(s, "| Reset ID: %2d\n", curr_info.reset_enum); + seq_printf(s, "| BAR0 Base %#.8x\n", curr_info.pri_base << 8); + seq_printf(s, "| Reset ID: %3d\n", curr_info.reset_id); + seq_printf(s, "| Is Engine: %1d\n", curr_info.is_engine); + break; case 2: - seq_printf(s, "| Host's Engine ID: %2d\n", curr_info.engine_enum); - seq_printf(s, "| Runlist ID: %2d\n", curr_info.runlist_enum); + seq_printf(s, "| Runlist Eng. ID: %1d\n", curr_info.rleng_id); + // Theoretically, we could extract an ID from the runlist RAM + seq_printf(s, "| RL Base: %#.8x\n", curr_info.runlist_pri_base << 10); break; default: printk(KERN_WARNING "[nvdebug] Skipping unexpected continuation of device_info entry (idx: %d, raw: %#0x)\n", iter->idx, curr_info.raw); diff --git a/nvdebug.h b/nvdebug.h index e91763e..d882124 100644 --- a/nvdebug.h +++ b/nvdebug.h @@ -567,7 +567,9 @@ static const char* const ENGINE_TYPES_NAMES[ENGINE_TYPES_LEN] = { "FLA: Fabric Logical Addressing", }; +// These field are from nvgpu/include/nvgpu/hw/ga100/hw_top_ga100.h typedef union { + // _info type fields struct { uint32_t fault_id:11; uint32_t padding0:5; @@ -575,22 +577,24 @@ typedef union { enum ENGINE_TYPES engine_type:7; // "type_enum" bool has_next_entry:1; } __attribute__((packed)); + // _info2 type fields struct { - uint32_t reset_enum:8; // "reset_id" + uint32_t reset_id:8; uint32_t pri_base:18; // "device_pri_base" uint32_t padding1:4; uint32_t is_engine:1; uint32_t padding2:1; } __attribute__((packed)); struct { - uint32_t engine_enum:2; // "rleng_id" + uint32_t rleng_id:2; uint32_t padding3:8; - uint32_t runlist_enum:16; // "runlist_pri_base" + uint32_t runlist_pri_base:16; uint32_t padding4:6; } __attribute__((packed)); uint32_t raw; } ptop_device_info_ga100_t; +// These field are from open-gpu-doc/manuals/volta/gv100/dev_top.ref.txt typedef union { // DATA type fields struct { -- cgit v1.2.2