drm/xe/guc_pc: Add ignore efficient frequency support
Subsystems (2)
PATCH 1/1 drm/xe/guc_pc: Add ignore efficient frequency support
When setting minimum frequency, GuC automatically elevates it to efficient levels, potentially overriding user requests. This patch adds slpc_ignore_eff_freq sysfs interface to disable this behavior, allowing users to enforce their exact minimum frequency settings.
Signed-off-by Sk Anirban <[email protected]>
--- drivers/gpu/drm/xe/xe_gt_freq.c | 36 ++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_pc.c | 49 ++++++++++++++++++++++++++-- drivers/gpu/drm/xe/xe_guc_pc.h | 1 + drivers/gpu/drm/xe/xe_guc_pc_types.h | 2 ++ 4 files changed, 86 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_gt_freq.c +36 -0
@@ -227,6 +227,41 @@ static ssize_t max_freq_store(struct kobject *kobj, }static struct kobj_attribute attr_max_freq =__ATTR_RW (max_freq); +static ssize_t slpc_ignore_eff_freq_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) +{ +struct device *dev =kobj_to_dev (kobj); +struct xe_guc_pc *pc =dev_to_pc (dev); + +return sysfs_emit (buf,"%u\n" , pc->ignore_eff_freq); +} + +static ssize_t slpc_ignore_eff_freq_store (struct kobject *kobj, +struct kobj_attribute *attr, +const char *buff,size_t count) +{ +struct device *dev =kobj_to_dev (kobj); +struct xe_guc_pc *pc =dev_to_pc (dev); +u32 val; +ssize_t ret; + + ret =kstrtou32 (buff,0 , &val); +if (ret) +return ret; + +if (val >1 ) +return -EINVAL ; + +xe_pm_runtime_get (dev_to_xe (dev)); + ret =xe_guc_pc_set_ignore_eff_freq (pc, val); +xe_pm_runtime_put (dev_to_xe (dev)); +if (ret) +return ret; + +return count; +} +static struct kobj_attribute attr_slpc_ignore_eff_freq =__ATTR_RW (slpc_ignore_eff_freq); +static const struct attribute *freq_attrs[] = { &attr_act_freq.attr, &attr_cur_freq.attr,
@@ -236,6 +271,7 @@ static const struct attribute *freq_attrs[] = { &attr_rpn_freq.attr, &attr_min_freq.attr, &attr_max_freq.attr, + &attr_slpc_ignore_eff_freq.attr, NULL };
drivers/gpu/drm/xe/xe_guc_pc.c +47 -2
73 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_pc.h +1 -0
@@ -31,6 +31,7 @@ int xe_guc_pc_get_min_freq(struct xe_guc_pc *pc, u32 *freq);int xe_guc_pc_set_min_freq (struct xe_guc_pc *pc,u32 freq);int xe_guc_pc_get_max_freq (struct xe_guc_pc *pc,u32 *freq);int xe_guc_pc_set_max_freq (struct xe_guc_pc *pc,u32 freq); +int xe_guc_pc_set_ignore_eff_freq (struct xe_guc_pc *pc,bool val);enum xe_gt_idle_state xe_guc_pc_c_status (struct xe_guc_pc *pc);u64 xe_guc_pc_rc6_residency (struct xe_guc_pc *pc);
drivers/gpu/drm/xe/xe_guc_pc_types.h +2 -0
@@ -37,6 +37,8 @@ struct xe_guc_pc {struct mutex freq_lock;/** @freq_ready: Only handle freq changes, if they are really ready */ bool freq_ready; +/** @ignore_eff_freq: Ignore efficient frequency */ + bool ignore_eff_freq; };#endif /* _XE_GUC_PC_TYPES_H_ */
Signature · 1 line
2.43.0