ivpu_debugfs.c (cf79f291f985662150363b4a93d16f88f12643bc) ivpu_debugfs.c (27d19268cf394f2c78db732be0cb31852eeadb0a)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2020-2023 Intel Corporation
4 */
5
6#include <drm/drm_debugfs.h>
7#include <drm/drm_file.h>
8#include <drm/drm_print.h>

--- 88 unchanged lines hidden (view full) ---

97 seq_printf(s, "%d\n", atomic_read(&vdev->pm->reset_counter));
98 return 0;
99}
100
101static int reset_pending_show(struct seq_file *s, void *v)
102{
103 struct ivpu_device *vdev = seq_to_ivpu(s);
104
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2020-2023 Intel Corporation
4 */
5
6#include <drm/drm_debugfs.h>
7#include <drm/drm_file.h>
8#include <drm/drm_print.h>

--- 88 unchanged lines hidden (view full) ---

97 seq_printf(s, "%d\n", atomic_read(&vdev->pm->reset_counter));
98 return 0;
99}
100
101static int reset_pending_show(struct seq_file *s, void *v)
102{
103 struct ivpu_device *vdev = seq_to_ivpu(s);
104
105 seq_printf(s, "%d\n", atomic_read(&vdev->pm->in_reset));
105 seq_printf(s, "%d\n", atomic_read(&vdev->pm->reset_pending));
106 return 0;
107}
108
109static const struct drm_debugfs_info vdev_debugfs_list[] = {
110 {"bo_list", bo_list_show, 0},
111 {"fw_name", fw_name_show, 0},
112 {"fw_trace_capability", fw_trace_capability_show, 0},
113 {"fw_trace_config", fw_trace_config_show, 0},

--- 11 unchanged lines hidden (view full) ---

125 int ret;
126
127 ret = kstrtou32_from_user(user_buf, size, 0, &dvfs_mode);
128 if (ret < 0)
129 return ret;
130
131 fw->dvfs_mode = dvfs_mode;
132
106 return 0;
107}
108
109static const struct drm_debugfs_info vdev_debugfs_list[] = {
110 {"bo_list", bo_list_show, 0},
111 {"fw_name", fw_name_show, 0},
112 {"fw_trace_capability", fw_trace_capability_show, 0},
113 {"fw_trace_config", fw_trace_config_show, 0},

--- 11 unchanged lines hidden (view full) ---

125 int ret;
126
127 ret = kstrtou32_from_user(user_buf, size, 0, &dvfs_mode);
128 if (ret < 0)
129 return ret;
130
131 fw->dvfs_mode = dvfs_mode;
132
133 ivpu_pm_schedule_recovery(vdev);
133 ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
134 if (ret)
135 return ret;
134
135 return size;
136}
137
138static const struct file_operations dvfs_mode_fops = {
139 .owner = THIS_MODULE,
140 .open = simple_open,
141 .write = dvfs_mode_fops_write,

--- 43 unchanged lines hidden (view full) ---

185 bool enable;
186 int ret;
187
188 ret = kstrtobool_from_user(user_buf, size, &enable);
189 if (ret < 0)
190 return ret;
191
192 ivpu_hw_profiling_freq_drive(vdev, enable);
136
137 return size;
138}
139
140static const struct file_operations dvfs_mode_fops = {
141 .owner = THIS_MODULE,
142 .open = simple_open,
143 .write = dvfs_mode_fops_write,

--- 43 unchanged lines hidden (view full) ---

187 bool enable;
188 int ret;
189
190 ret = kstrtobool_from_user(user_buf, size, &enable);
191 if (ret < 0)
192 return ret;
193
194 ivpu_hw_profiling_freq_drive(vdev, enable);
193 ivpu_pm_schedule_recovery(vdev);
194
195
196 ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
197 if (ret)
198 return ret;
199
195 return size;
196}
197
198static const struct file_operations fw_profiling_freq_fops = {
199 .owner = THIS_MODULE,
200 .open = simple_open,
201 .write = fw_profiling_freq_fops_write,
202};

--- 93 unchanged lines hidden (view full) ---

296
297 return size;
298}
299
300static ssize_t
301ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
302{
303 struct ivpu_device *vdev = file->private_data;
200 return size;
201}
202
203static const struct file_operations fw_profiling_freq_fops = {
204 .owner = THIS_MODULE,
205 .open = simple_open,
206 .write = fw_profiling_freq_fops_write,
207};

--- 93 unchanged lines hidden (view full) ---

301
302 return size;
303}
304
305static ssize_t
306ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
307{
308 struct ivpu_device *vdev = file->private_data;
309 int ret;
304
305 if (!size)
306 return -EINVAL;
307
310
311 if (!size)
312 return -EINVAL;
313
308 ivpu_pm_schedule_recovery(vdev);
314 ret = ivpu_rpm_get(vdev);
315 if (ret)
316 return ret;
317
318 ivpu_pm_trigger_recovery(vdev, "debugfs");
319 flush_work(&vdev->pm->recovery_work);
320 ivpu_rpm_put(vdev);
309 return size;
310}
311
312static const struct file_operations ivpu_force_recovery_fops = {
313 .owner = THIS_MODULE,
314 .open = simple_open,
315 .write = ivpu_force_recovery_fn,
316};

--- 35 unchanged lines hidden ---
321 return size;
322}
323
324static const struct file_operations ivpu_force_recovery_fops = {
325 .owner = THIS_MODULE,
326 .open = simple_open,
327 .write = ivpu_force_recovery_fn,
328};

--- 35 unchanged lines hidden ---