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 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'device_info_procfs.c') 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); -- cgit v1.2.2