.. | .. |
---|
32 | 32 | * @file: The seq_file for printing to |
---|
33 | 33 | * @data: The debugfs dentry private data, a pointer to kbase_context |
---|
34 | 34 | * |
---|
35 | | - * Return: Negative error code or 0 on success. |
---|
| 35 | + * Return: 0 in any case. |
---|
36 | 36 | */ |
---|
37 | 37 | static int kbasep_csf_tiler_heap_debugfs_show(struct seq_file *file, void *data) |
---|
38 | 38 | { |
---|
.. | .. |
---|
65 | 65 | return 0; |
---|
66 | 66 | } |
---|
67 | 67 | |
---|
| 68 | +/** |
---|
| 69 | + * kbasep_csf_tiler_heap_total_debugfs_show() - Print the total memory allocated |
---|
| 70 | + * for all tiler heaps in a context. |
---|
| 71 | + * |
---|
| 72 | + * @file: The seq_file for printing to |
---|
| 73 | + * @data: The debugfs dentry private data, a pointer to kbase_context |
---|
| 74 | + * |
---|
| 75 | + * Return: 0 in any case. |
---|
| 76 | + */ |
---|
| 77 | +static int kbasep_csf_tiler_heap_total_debugfs_show(struct seq_file *file, void *data) |
---|
| 78 | +{ |
---|
| 79 | + struct kbase_context *kctx = file->private; |
---|
| 80 | + |
---|
| 81 | + seq_printf(file, "MALI_CSF_TILER_HEAP_DEBUGFS_VERSION: v%u\n", |
---|
| 82 | + MALI_CSF_TILER_HEAP_DEBUGFS_VERSION); |
---|
| 83 | + seq_printf(file, "Total number of chunks of all heaps in the context: %lu\n", |
---|
| 84 | + (unsigned long)kctx->running_total_tiler_heap_nr_chunks); |
---|
| 85 | + seq_printf(file, "Total allocated memory of all heaps in the context: %llu\n", |
---|
| 86 | + (unsigned long long)kctx->running_total_tiler_heap_memory); |
---|
| 87 | + seq_printf(file, "Peak allocated tiler heap memory in the context: %llu\n", |
---|
| 88 | + (unsigned long long)kctx->peak_total_tiler_heap_memory); |
---|
| 89 | + |
---|
| 90 | + return 0; |
---|
| 91 | +} |
---|
| 92 | + |
---|
68 | 93 | static int kbasep_csf_tiler_heap_debugfs_open(struct inode *in, struct file *file) |
---|
69 | 94 | { |
---|
70 | 95 | return single_open(file, kbasep_csf_tiler_heap_debugfs_show, in->i_private); |
---|
71 | 96 | } |
---|
72 | 97 | |
---|
| 98 | +static int kbasep_csf_tiler_heap_total_debugfs_open(struct inode *in, struct file *file) |
---|
| 99 | +{ |
---|
| 100 | + return single_open(file, kbasep_csf_tiler_heap_total_debugfs_show, in->i_private); |
---|
| 101 | +} |
---|
| 102 | + |
---|
73 | 103 | static const struct file_operations kbasep_csf_tiler_heap_debugfs_fops = { |
---|
74 | 104 | .open = kbasep_csf_tiler_heap_debugfs_open, |
---|
| 105 | + .read = seq_read, |
---|
| 106 | + .llseek = seq_lseek, |
---|
| 107 | + .release = single_release, |
---|
| 108 | +}; |
---|
| 109 | + |
---|
| 110 | +static const struct file_operations kbasep_csf_tiler_heap_total_debugfs_fops = { |
---|
| 111 | + .open = kbasep_csf_tiler_heap_total_debugfs_open, |
---|
75 | 112 | .read = seq_read, |
---|
76 | 113 | .llseek = seq_lseek, |
---|
77 | 114 | .release = single_release, |
---|
.. | .. |
---|
93 | 130 | } |
---|
94 | 131 | } |
---|
95 | 132 | |
---|
| 133 | +void kbase_csf_tiler_heap_total_debugfs_init(struct kbase_context *kctx) |
---|
| 134 | +{ |
---|
| 135 | + struct dentry *file; |
---|
| 136 | + |
---|
| 137 | + if (WARN_ON(!kctx || IS_ERR_OR_NULL(kctx->kctx_dentry))) |
---|
| 138 | + return; |
---|
| 139 | + |
---|
| 140 | + file = debugfs_create_file("tiler_heaps_total", 0444, kctx->kctx_dentry, |
---|
| 141 | + kctx, &kbasep_csf_tiler_heap_total_debugfs_fops); |
---|
| 142 | + |
---|
| 143 | + if (IS_ERR_OR_NULL(file)) { |
---|
| 144 | + dev_warn(kctx->kbdev->dev, |
---|
| 145 | + "Unable to create total tiler heap allocated memory debugfs entry"); |
---|
| 146 | + } |
---|
| 147 | +} |
---|
96 | 148 | |
---|
97 | 149 | #else |
---|
98 | 150 | /* |
---|
.. | .. |
---|
102 | 154 | { |
---|
103 | 155 | } |
---|
104 | 156 | |
---|
| 157 | +void kbase_csf_tiler_heap_total_debugfs_init(struct kbase_context *kctx) |
---|
| 158 | +{ |
---|
| 159 | +} |
---|
| 160 | + |
---|
105 | 161 | #endif /* CONFIG_DEBUG_FS */ |
---|
106 | 162 | |
---|