aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2024-04-09 11:37:03 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2024-04-09 11:37:03 -0400
commit31964208e4dc0243b6b31b9967c77a791aeb995c (patch)
treeab8c8a3f80788742488ef07877359cc336b48360
parenteeeba53923ea236007e1e807efa69cb03d195044 (diff)
Return const pointers to string constants.
Also update how Instance Pointers are aligned in the runlist output to make them more easily distinguishable from other fields.
-rw-r--r--nvdebug.h8
-rw-r--r--runlist_procfs.c13
2 files changed, 10 insertions, 11 deletions
diff --git a/nvdebug.h b/nvdebug.h
index 926419d..f0662cd 100644
--- a/nvdebug.h
+++ b/nvdebug.h
@@ -67,7 +67,7 @@ struct gk20a;
67*/ 67*/
68enum ENTRY_TYPE {ENTRY_TYPE_CHAN = 0, ENTRY_TYPE_TSG = 1}; 68enum ENTRY_TYPE {ENTRY_TYPE_CHAN = 0, ENTRY_TYPE_TSG = 1};
69enum INST_TARGET {TARGET_VID_MEM = 0, TARGET_SYS_MEM_COHERENT = 2, TARGET_SYS_MEM_NONCOHERENT = 3}; 69enum INST_TARGET {TARGET_VID_MEM = 0, TARGET_SYS_MEM_COHERENT = 2, TARGET_SYS_MEM_NONCOHERENT = 3};
70static inline char* target_to_text(enum INST_TARGET t) { 70static inline const char *target_to_text(enum INST_TARGET t) {
71 switch (t) { 71 switch (t) {
72 case TARGET_VID_MEM: 72 case TARGET_VID_MEM:
73 return "VID_MEM"; 73 return "VID_MEM";
@@ -76,7 +76,6 @@ static inline char* target_to_text(enum INST_TARGET t) {
76 case TARGET_SYS_MEM_NONCOHERENT: 76 case TARGET_SYS_MEM_NONCOHERENT:
77 return "SYS_MEM_NONCOHERENT"; 77 return "SYS_MEM_NONCOHERENT";
78 default: 78 default:
79 printk(KERN_WARNING "[nvdebug] Invalid aperture!\n");
80 return "INVALID"; 79 return "INVALID";
81 } 80 }
82} 81}
@@ -855,7 +854,7 @@ enum PD_TARGET {
855 PTE_AND_TARGET_SYS_MEM_COHERENT = 5, // b101 854 PTE_AND_TARGET_SYS_MEM_COHERENT = 5, // b101
856 PTE_AND_TARGET_SYS_MEM_NONCOHERENT = 7, // b111 855 PTE_AND_TARGET_SYS_MEM_NONCOHERENT = 7, // b111
857}; 856};
858static inline char* pd_target_to_text(enum PD_TARGET t) { 857static inline const char *pd_target_to_text(enum PD_TARGET t) {
859 switch (t) { 858 switch (t) {
860 case PD_AND_TARGET_INVALID: 859 case PD_AND_TARGET_INVALID:
861 return "INVALID"; 860 return "INVALID";
@@ -871,8 +870,7 @@ static inline char* pd_target_to_text(enum PD_TARGET t) {
871 case PTE_AND_TARGET_SYS_MEM_NONCOHERENT: 870 case PTE_AND_TARGET_SYS_MEM_NONCOHERENT:
872 return "SYS_MEM_NONCOHERENT"; 871 return "SYS_MEM_NONCOHERENT";
873 default: 872 default:
874 printk(KERN_WARNING "[nvdebug] Invalid aperture!\n"); 873 return "UNKNOWN";
875 return NULL;
876 } 874 }
877} 875}
878 876
diff --git a/runlist_procfs.c b/runlist_procfs.c
index 7dedee3..e50c34a 100644
--- a/runlist_procfs.c
+++ b/runlist_procfs.c
@@ -15,8 +15,9 @@
15#ifdef DETAILED_CHANNEL_INFO 15#ifdef DETAILED_CHANNEL_INFO
16static int runlist_detail_seq_show_chan(struct seq_file *s, struct nvdebug_state *g, uint32_t chid, char *prefix) { 16static int runlist_detail_seq_show_chan(struct seq_file *s, struct nvdebug_state *g, uint32_t chid, char *prefix) {
17 channel_ctrl_t chan; 17 channel_ctrl_t chan;
18 char *loc_txt; 18 const char *loc_txt;
19 u64 instance_ptr; 19 uint64_t instance_ptr;
20
20 chan.raw = nvdebug_readq(g, NV_PCCSR_CHANNEL_INST(chid)); 21 chan.raw = nvdebug_readq(g, NV_PCCSR_CHANNEL_INST(chid));
21 loc_txt = target_to_text(chan.inst_target); 22 loc_txt = target_to_text(chan.inst_target);
22 if (!loc_txt) 23 if (!loc_txt)
@@ -34,8 +35,8 @@ static int runlist_detail_seq_show_chan(struct seq_file *s, struct nvdebug_state
34 seq_printf(s, "%s| Status: %2d|\n", prefix, chan.status); 35 seq_printf(s, "%s| Status: %2d|\n", prefix, chan.status);
35 seq_printf(s, "%s| Busy: %d|\n", prefix, chan.busy); 36 seq_printf(s, "%s| Busy: %d|\n", prefix, chan.busy);
36 seq_printf(s, "%s| Instance PTR: |\n", prefix); 37 seq_printf(s, "%s| Instance PTR: |\n", prefix);
37 seq_printf(s, "%s| %#018llx |\n", prefix, instance_ptr); 38 seq_printf(s, "%s| %#018llx|\n", prefix, instance_ptr);
38 seq_printf(s, "%s| %-20s|\n", prefix, loc_txt); 39 seq_printf(s, "%s| %20s|\n", prefix, loc_txt);
39 seq_printf(s, "%s| Instance bound: %d|\n", prefix, chan.inst_bind); 40 seq_printf(s, "%s| Instance bound: %d|\n", prefix, chan.inst_bind);
40 // START TEMP 41 // START TEMP
41 // "runlist_id -1 is synonym for the ENGINE_GR_GK20A runlist id" 42 // "runlist_id -1 is synonym for the ENGINE_GR_GK20A runlist id"
@@ -155,8 +156,8 @@ static int runlist_file_seq_show(struct seq_file *s, void *raw_rl_iter) {
155 seq_printf(s, "%s| Runqueue Selector: %d|\n", indt, 156 seq_printf(s, "%s| Runqueue Selector: %d|\n", indt,
156 ((struct gv100_runlist_chan*)entry)->runqueue_selector); 157 ((struct gv100_runlist_chan*)entry)->runqueue_selector);
157 seq_printf(s, "%s| Instance PTR: |\n", indt); 158 seq_printf(s, "%s| Instance PTR: |\n", indt);
158 seq_printf(s, "%s| %#018llx |\n", indt, instance_ptr); 159 seq_printf(s, "%s| %#018llx|\n", indt, instance_ptr);
159 seq_printf(s, "%s| %-20s|\n", indt, target_to_text(inst_target(g, entry))); 160 seq_printf(s, "%s| %20s|\n", indt, target_to_text(inst_target(g, entry)));
160 seq_printf(s, "%s+---------------------+\n", indt); 161 seq_printf(s, "%s+---------------------+\n", indt);
161#endif 162#endif
162 } 163 }