[Intel-gfx] [PATCH v3 2/2] drm/i915/gt: Move power management debug files into a gt aware debugfs

Chris Wilson chris at chris-wilson.co.uk
Fri Dec 13 12:52:37 UTC 2019


Quoting Andi Shyti (2019-12-13 12:45:49)
> +int debugfs_gt_init(struct intel_gt *gt)
> +{
> +       struct drm_minor *minor = gt->i915->drm.primary;
> +
> +       if (!minor->debugfs_root)
> +               return -ENODEV;
> +
> +       gt->debugfs_entry = debugfs_create_dir("gt", minor->debugfs_root);
> +
> +       return intel_gt_pm_debugfs_register(gt);
> +}

> +static const struct gt_pm_debugfs_files {
> +       const char *name;
> +       const struct file_operations *fops;
> +       bool (*eval)(struct intel_gt *gt);
> +} gt_pm_debugfs_files[] = {
> +       { "frequency_info", &frequency_info_fops, NULL },
> +       { "ring_freq_table", &ring_freq_table_fops, ring_freq_table_eval },
> +       { "rps_boost_info", &rps_boost_info_fops, NULL },
> +       { "forcewake_domains", &forcewake_domains_fops, NULL },
> +       { "drpc_info", &drpc_info_fops, NULL },
> +       { "llc", &llc_fops, NULL },

Resort into alphabetical. We should probably cull a few.
(Thinking rps_info, rc6_info, llc_info, with a few other debug knobs
for specific use cases.)

> +};
> +
> +int intel_gt_pm_debugfs_register(struct intel_gt *gt)
> +{
> +       struct dentry *root = gt->debugfs_entry;
> +       int i;
> +
> +       pr_info("ANDIII function start\n");
> +       if (unlikely(!root))
> +               return -ENODEV;
> +
> +       for (i = 0; i < ARRAY_SIZE(gt_pm_debugfs_files); i++) {
> +               const struct gt_pm_debugfs_files *f = &gt_pm_debugfs_files[i];
> +
> +               if (f->eval && !f->eval(gt))
> +                       continue;
> +
> +               debugfs_create_file(f->name, 0444, root, gt, f->fops);
> +       }
> +       pr_info("ANDIII function end\n");
> +
> +       return 0;

Looking better!

Do we even need to keep the gt->debugfs_entry around? We are not going to
ever do hotplug are we and so only need to populate once?
-Chris


More information about the Intel-gfx mailing list