[Intel-xe] [PATCH] drm/xe: Add a sysfs node for requested frequency
Riana Tauro
riana.tauro at intel.com
Mon May 29 11:30:01 UTC 2023
Hi Suja
On 5/29/2023 2:57 PM, Sujaritha Sundaresan wrote:
> Adding freq_pureq as a sysfs node to expose the frequency requested
> by the PUnit.
>
> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan at intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_pc.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index e799faa1c6b8..8a1b3bc5d397 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -62,6 +62,7 @@
> * device/gt#/freq_* *read-only* files:
> * - freq_act: The actual resolved frequency decided by PCODE.
> * - freq_cur: The current one requested by GuC PC to the Hardware.
> + * - freq_pureq: The frequency requested by PUnit.
> * - freq_rpn: The Render Performance (RP) N level, which is the minimal one.
> * - freq_rpe: The Render Performance (RP) E level, which is the efficient one.
> * - freq_rp0: The Render Performance (RP) 0 level, which is the maximum one.
> @@ -425,6 +426,19 @@ static ssize_t freq_cur_show(struct device *dev,
> }
> static DEVICE_ATTR_RO(freq_cur);
>
> +static ssize_t freq_pureq_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct kobject *kobj = &dev->kobj;
> + struct xe_gt *gt = kobj_to_gt(kobj);
> + u32 freq;
> +
> + freq = xe_mmio_read32(gt, RPNSWREQ);
freq_cur also reads the same mmio. REQ_RATIO_MASK is used in freq_cur.
Is there a mask missing here?
> +
> + return sysfs_emit(buf, "%d\n", decode_freq(freq));
> +}
> +static DEVICE_ATTR_RO(freq_pureq);
Maybe freq_punit_req?
Thanks
Riana
> +
> static ssize_t freq_rp0_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> @@ -628,6 +642,7 @@ static DEVICE_ATTR_RO(rc6_residency);
> static const struct attribute *pc_attrs[] = {
> &dev_attr_freq_act.attr,
> &dev_attr_freq_cur.attr,
> + &dev_attr_freq_pureq.attr,
> &dev_attr_freq_rp0.attr,
> &dev_attr_freq_rpe.attr,
> &dev_attr_freq_rpn.attr,
More information about the Intel-xe
mailing list