Some debugfs enhancements
Subsystems (2)
v5 cover Some debugfs enhancements
From: Andi Shyti <[email protected]>
Hi,
this two patches are few debugfs improvements. The first adds some helpers for reading the GT frequency, while the second patch moves all the power management debufs functions into gt/
Thanks Chris and Michal for the reviews.
Thanks,
Andi
Changelog:
==========
v4-v5: (v4: https://lists.freedesktop.org/archives/intel-gfx/2019-December/223431.html)
- renamed files:
renamed: drivers/gpu/drm/i915/gt/debugfs_gt.c -> drivers/gpu/drm/i915/gt/intel_debugfs_gt.c
renamed: drivers/gpu/drm/i915/gt/debugfs_gt.h -> drivers/gpu/drm/i915/gt/intel_debugfs_gt.h
renamed: drivers/gpu/drm/i915/gt/debugfs_pm.c -> drivers/gpu/drm/i915/gt/intel_debugfs_pm.c
renamed: drivers/gpu/drm/i915/gt/debugfs_pm.h -> drivers/gpu/drm/i915/gt/intel_debugfs_pm.h- change the spdx identifier's comment from the /* */ to the // style.
v3-v4: (v3: https://lists.freedesktop.org/archives/intel-gfx/2019-December/223368.html)
- added wakeref in frequency reading (patch 1)
- added Chris reviewed-by in patch 1
- sorted in alphabetical order the debugfs functions
- removed dentry reference in the gt structure, because it's useless.
v2-v3: (v2: https://lists.freedesktop.org/archives/intel-gfx/2019-December/223277.html)
Fixed the three reviews from Chris
- removed the 'i915' prefix from the gt pm debugfs files
- fixed my laziness and made the debugfs pm files more gt
oriented. Now the only dependency remaining from the 'drm_i915_private' structure is for platform generation check.
- restored the 'node_to_i915' to its original position, as it's
not needed anymore.
v1-v2: (v1: https://lists.freedesktop.org/archives/intel-gfx/2019-December/222758.html)
- renamed functions from
intel_cagf_freq_read to intel_rps_read_actual_frequency intel_cagf_read to intel_rps_read_cagf
- created an independent gt/ directory in debugfs
Andi Shyti (2):
drm/i915/rps: Add frequency translation helpers drm/i915/gt: Move power management debug files into a gt aware debugfs
drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.c | 23 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.h | 27 + drivers/gpu/drm/i915/gt/intel_debugfs_pm.c | 623 +++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_debugfs_pm.h | 16 + drivers/gpu/drm/i915/gt/intel_rps.c | 30 + drivers/gpu/drm/i915/gt/intel_rps.h | 2 + drivers/gpu/drm/i915/i915_debugfs.c | 590 +------------------ drivers/gpu/drm/i915/i915_sysfs.c | 14 +- 9 files changed, 734 insertions(+), 593 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_gt.c create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_gt.h create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_pm.c create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_pm.h
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 1/2 drm/i915/rps: Add frequency translation helpers
From: Andi Shyti <[email protected]>
Add two helpers that for reading the actual GT's frequency. The two helpers are:
- intel_rps_read_cagf: reads the frequency and returns it not normalized
- intel_rps_read_actual_frequency: provides the frequency in Hz.
Use the above helpers in sysfs and debugfs.
--- drivers/gpu/drm/i915/gt/intel_rps.c | 30 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_rps.h | 2 ++ drivers/gpu/drm/i915/i915_debugfs.c | 21 +++++--------------- drivers/gpu/drm/i915/i915_sysfs.c | 14 ++------------ 4 files changed, 39 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/gt/intel_rps.c +30 -0
@@ -1682,6 +1682,36 @@ u32 intel_get_cagf(struct intel_rps *rps, u32 rpstat)return cagf; } +u32 intel_rps_read_cagf (struct intel_rps *rps) +{ +struct drm_i915_private *i915 =rps_to_i915 (rps); +u32 freq; + +if (IS_VALLEYVIEW (i915) ||IS_CHERRYVIEW (i915)) { +vlv_punit_get (i915); + freq =vlv_punit_read (i915,PUNIT_REG_GPU_FREQ_STS ); +vlv_punit_put (i915); + +return (freq >>8 ) &0xff ; + } + +return intel_get_cagf (rps,intel_uncore_read (rps_to_gt (rps)->uncore, +GEN6_RPSTAT1 )); +} + +u32 intel_rps_read_actual_frequency (struct intel_rps *rps) +{ +struct intel_runtime_pm *rpm =rps_to_gt (rps)->uncore->rpm; +intel_wakeref_t wakeref; +int freq; + + wakeref =intel_runtime_pm_get (rpm); + freq =intel_gpu_freq (rps,intel_rps_read_cagf (rps)); +intel_runtime_pm_put (rpm, wakeref); + +return freq; +} +/* External interface for intel_ips.ko */ static struct drm_i915_private __rcu *ips_mchdev;
drivers/gpu/drm/i915/gt/intel_rps.h +2 -0
@@ -30,6 +30,8 @@ void intel_rps_mark_interactive(struct intel_rps *rps, bool interactive);int intel_gpu_freq (struct intel_rps *rps,int val);int intel_freq_opcode (struct intel_rps *rps,int val);u32 intel_get_cagf (struct intel_rps *rps,u32 rpstat1); +u32 intel_rps_read_cagf (struct intel_rps *rps); +u32 intel_rps_read_actual_frequency (struct intel_rps *rps);void gen5_rps_irq_handler (struct intel_rps *rps);void gen6_rps_irq_handler (struct intel_rps *rps,u32 pm_iir);
drivers/gpu/drm/i915/i915_debugfs.c +5 -16
@@ -881,7 +881,7 @@ static int i915_frequency_info(struct seq_file *m, void *unused) rpdownei =I915_READ (GEN6_RP_CUR_DOWN_EI ) &GEN6_CURIAVG_MASK ; rpcurdown =I915_READ (GEN6_RP_CUR_DOWN ) &GEN6_CURBSYTAVG_MASK ; rpprevdown =I915_READ (GEN6_RP_PREV_DOWN ) &GEN6_CURBSYTAVG_MASK ; - cagf =intel_gpu_freq (rps,intel_get_cagf (rps, rpstat)); + cagf =intel_rps_read_actual_frequency (rps);intel_uncore_forcewake_put (&dev_priv->uncore,FORCEWAKE_ALL );
@@ -1623,21 +1623,11 @@ static int i915_rps_boost_info(struct seq_file *m, void *data) {struct drm_i915_private *dev_priv =node_to_i915 (m->private);struct intel_rps *rps = &dev_priv->gt.rps; -u32 act_freq = rps->cur_freq; +u32 act_freq;intel_wakeref_t wakeref; - with_intel_runtime_pm_if_in_use(&dev_priv->runtime_pm, wakeref) { -if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { -vlv_punit_get (dev_priv); - act_freq =vlv_punit_read (dev_priv, -PUNIT_REG_GPU_FREQ_STS ); -vlv_punit_put (dev_priv); - act_freq = (act_freq >>8 ) &0xff ; - }else { - act_freq =intel_get_cagf (rps, -I915_READ (GEN6_RPSTAT1 )); - } - } +with_intel_runtime_pm_if_in_use (&dev_priv->runtime_pm, wakeref) + act_freq = intel_rps_read_actual_frequency(rps);seq_printf (m,"RPS enabled? %d\n" , rps->enabled);seq_printf (m,"GPU busy? %s\n" ,yesno (dev_priv->gt.awake));
@@ -1645,8 +1635,7 @@ static int i915_rps_boost_info(struct seq_file *m, void *data) atomic_read(&rps->num_waiters));seq_printf (m,"Interactive? %d\n" ,READ_ONCE (rps->power.interactive));seq_printf (m,"Frequency requested %d, actual %d\n" , -intel_gpu_freq (rps, rps->cur_freq), -intel_gpu_freq (rps, act_freq)); +intel_gpu_freq (rps, rps->cur_freq), act_freq); seq_printf(m, " min hard:%d, soft:%d; max soft:%d, hard:%d\n", intel_gpu_freq(rps, rps->min_freq), intel_gpu_freq(rps, rps->min_freq_softlimit),
drivers/gpu/drm/i915/i915_sysfs.c +2 -12
@@ -265,20 +265,10 @@ static ssize_t gt_act_freq_mhz_show(struct device *kdev,u32 freq; wakeref =intel_runtime_pm_get (&dev_priv->runtime_pm); - -if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { -vlv_punit_get (dev_priv); - freq =vlv_punit_read (dev_priv,PUNIT_REG_GPU_FREQ_STS ); -vlv_punit_put (dev_priv); - - freq = (freq >>8 ) &0xff ; - }else { - freq =intel_get_cagf (rps,I915_READ (GEN6_RPSTAT1 )); - } - + freq =intel_rps_read_actual_frequency (rps);intel_runtime_pm_put (&dev_priv->runtime_pm, wakeref); -return snprintf (buf,PAGE_SIZE ,"%d\n" ,intel_gpu_freq (rps, freq)); +return snprintf (buf,PAGE_SIZE ,"%d\n" , freq); } static ssize_t gt_cur_freq_mhz_show(struct device *kdev,
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 2/2 drm/i915/gt: Move power management debug files into a gt aware debugfs
In reply to Andi ShytiFrom: Andi Shyti <[email protected]>
The GT system is becoming more and more a stand-alone system in i915 and it's fair to assign it its own debugfs directory.
rc6, rps and llc debugfs files are gt related, move them into the gt debugfs directory.
--- drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.c | 23 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.h | 27 + drivers/gpu/drm/i915/gt/intel_debugfs_pm.c | 623 +++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_debugfs_pm.h | 16 + drivers/gpu/drm/i915/i915_debugfs.c | 579 +------------------ 6 files changed, 700 insertions(+), 570 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_gt.c create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_gt.h create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_pm.c create mode 100644 drivers/gpu/drm/i915/gt/intel_debugfs_pm.h
drivers/gpu/drm/i915/Makefile +2 -0
@@ -77,6 +77,8 @@ obj-y += gt/ gt-y += \ gt/intel_breadcrumbs.o \ gt/intel_context.o \ + gt/intel_debugfs_gt.o \ + gt/intel_debugfs_pm.o \ gt/intel_engine_cs.o \ gt/intel_engine_heartbeat.o \ gt/intel_engine_pm.o \
drivers/gpu/drm/i915/gt/intel_debugfs_gt.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT + +/* +* Copyright © 2019 Intel Corporation +*/ + +#include "i915_trace.h" +#include "intel_debugfs_pm.h" + +int debugfs_gt_init (struct intel_gt *gt) +{ +struct dentry *debugfs_root = gt->i915->drm.primary->debugfs_root; +struct dentry *gt_root; + +if (!debugfs_root) +return -ENODEV ; + + gt_root =debugfs_create_dir ("gt" , debugfs_root); +if (IS_ERR (gt_root)) +return PTR_ERR (gt_root); + +return intel_gt_pm_debugfs_register (gt, gt_root); +}
drivers/gpu/drm/i915/gt/intel_debugfs_gt.h new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + +/* +* Copyright © 2019 Intel Corporation +*/ + +#ifndef DEBUGFS_GT +#define DEBUGFS_GT + +#include "intel_gt_types.h" + +#define DEFINE_GT_DEBUGFS_ATTRIBUTE (__name) \ +static int __name ## _open(struct inode *inode, struct file *file) \ +{ \ + return single_open(file, __name ## _show, inode->i_private); \ +} \ +static const struct file_operations __name ## _fops = { \ + .owner = THIS_MODULE, \ + .open = __name ## _open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ +} + +int debugfs_gt_init (struct intel_gt *gt); + +#endif /* DEBUGFS_GT */
drivers/gpu/drm/i915/gt/intel_debugfs_pm.c new file +623 -0
623 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_debugfs_pm.h new file +16 -0
@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + +/* +* Copyright © 2019 Intel Corporation +*/ + +#ifndef DEBUGFS_PM +#define DEBUGFS_PM + +#include <linux/seq_file.h> + +#include "intel_gt_types.h" + +int intel_gt_pm_debugfs_register (struct intel_gt *gt,struct dentry *root); + +#endif /* DEBUGFS_PM */
drivers/gpu/drm/i915/i915_debugfs.c +9 -570
637 lines not on this page · raw message
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v5 2/2] drm/i915/gt: Move power management debug files into a gt aware debugfs
Quoting Andi Shyti (2019-12-13 21:00:50)
Quoted 8 lines
From: Andi Shyti <[email protected]>
The GT system is becoming more and more a stand-alone system in i915 and it's fair to assign it its own debugfs directory.
rc6, rps and llc debugfs files are gt related, move them into the gt debugfs directory.
Quoted 7 lines
Signed-off-by Andi Shyti <[email protected]>--- drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.c | 23 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.h | 27 + drivers/gpu/drm/i915/gt/intel_debugfs_pm.c | 623 +++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_debugfs_pm.h | 16 +
That's the worst of all worlds. debugfs is not a piece of intel hw. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v5 2/2] drm/i915/gt: Move power management debug files into a gt aware debugfs
Quoted 14 lines
Quoted 6 lines
The GT system is becoming more and more a stand-alone system in i915 and it's fair to assign it its own debugfs directory.
rc6, rps and llc debugfs files are gt related, move them into the gt debugfs directory.
Quoted 7 lines
Signed-off-by Andi Shyti <[email protected]>--- drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.c | 23 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.h | 27 + drivers/gpu/drm/i915/gt/intel_debugfs_pm.c | 623 +++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_debugfs_pm.h | 16 +
Quoted 1 line
That's the worst of all worlds. debugfs is not a piece of intel hw.
I don't see other way for having everything grouped by name. We can keep the previous patch (v4) with "debugfs_*", then.
Is that fine? If so we can just ignore this version.
Andi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v5 2/2] drm/i915/gt: Move power management debug files into a gt aware debugfs
Quoting Andi Shyti (2019-12-13 21:17:36)
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
The GT system is becoming more and more a stand-alone system in i915 and it's fair to assign it its own debugfs directory.
rc6, rps and llc debugfs files are gt related, move them into the gt debugfs directory.
Signed-off-by Andi Shyti <[email protected]>--- drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.c | 23 + drivers/gpu/drm/i915/gt/intel_debugfs_gt.h | 27 + drivers/gpu/drm/i915/gt/intel_debugfs_pm.c | 623 +++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_debugfs_pm.h | 16 +
Quoted 6 lines
Quoted 1 line
That's the worst of all worlds. debugfs is not a piece of intel hw.
I don't see other way for having everything grouped by name. We can keep the previous patch (v4) with "debugfs_*", then.
Is that fine? If so we can just ignore this version.
I had no objections, just a suggestion for gt-${CONFIG_DEBUGFS} :) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for Some debugfs enhancements (rev5)
In reply to Andi Shyti== Series Details ==
== Series Details ==
Series: Some debugfs enhancements (rev5)
URL : https://patchwork.freedesktop.org/series/70658/
State : failure
== Summary ==
Applying: drm/i915/rps: Add frequency translation helpers Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gt/intel_rps.c
M drivers/gpu/drm/i915/gt/intel_rps.h
M drivers/gpu/drm/i915/i915_debugfs.c
M drivers/gpu/drm/i915/i915_sysfs.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_sysfs.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_sysfs.c Auto-merging drivers/gpu/drm/i915/i915_debugfs.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_debugfs.c Auto-merging drivers/gpu/drm/i915/gt/intel_rps.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/intel_rps.h Auto-merging drivers/gpu/drm/i915/gt/intel_rps.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch Patch failed at 0001 drm/i915/rps: Add frequency translation helpers When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx