summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
diff options
context:
space:
mode:
authorTejas Upadhyay <tejas.upadhyay@intel.com>2023-08-03 15:48:03 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 19:39:26 +0300
commit69838d6330a7cc11de4f06f55122bfdb60693e70 (patch)
treed0fe8433b8802349998d6301d8da214a22aa7d55 /drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
parentbc3a06ead1cd49d3a5e0f707cbd6c8e173307388 (diff)
downloadlinux-69838d6330a7cc11de4f06f55122bfdb60693e70.tar.xz
drm/xe: Add sysfs for preempt reset timeout
The preemption request and timeout is used for higher priority context or kill hung context and reset hardware engine. The preempt timeout can be adjusted per-engine class using, /sys/class/drm/cardX/device/tileN/gtN/engines/ccs/preempt_timeout_us and can be disabled by setting it to 0. V7: - Rebase V6: - Rebase to use s/xe_engine/xe_hw_engine/ - Matt V5: - Remove timeout validation, not relevant - Niranjana V4: - Rebase to replace hw engine with eclass interface V3: - Rebase to per class engine props interface V2: - Rebase - Update commit message to add tile Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c')
-rw-r--r--drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c b/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
index 01d5282d2b24..adbaaee1deca 100644
--- a/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
+++ b/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
@@ -103,6 +103,34 @@ static ssize_t timeslice_default(struct kobject *kobj,
static struct kobj_attribute timeslice_duration_def =
__ATTR(timeslice_duration_us, 0444, timeslice_default, NULL);
+static ssize_t preempt_timeout_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct xe_hw_engine_class_intf *eclass = kobj_to_eclass(kobj);
+ u32 timeout;
+ int err;
+
+ err = kstrtou32(buf, 0, &timeout);
+ if (err)
+ return err;
+
+ WRITE_ONCE(eclass->sched_props.preempt_timeout_us, timeout);
+
+ return count;
+}
+
+static ssize_t preempt_timeout_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ struct xe_hw_engine_class_intf *eclass = kobj_to_eclass(kobj);
+
+ return sprintf(buf, "%u\n", eclass->sched_props.preempt_timeout_us);
+}
+
+static struct kobj_attribute preempt_timeout_attr =
+__ATTR(preempt_timeout_us, 0644, preempt_timeout_show, preempt_timeout_store);
+
static ssize_t preempt_timeout_default(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
@@ -125,6 +153,7 @@ static const struct attribute *defaults[] = {
static const struct attribute *files[] = {
&job_timeout_attr.attr,
&timeslice_duration_attr.attr,
+ &preempt_timeout_attr.attr,
NULL
};