Skip to content

Commit

Permalink
platform/x86: intel_telemetry: Add debugfs entry for S0ix residency
Browse files Browse the repository at this point in the history
This adds a debugfs consumer for the exported kernel API
intel_pmc_read_s0ix_residency. This debugfs entry reads S0ix residency
directly from the PMC hardware counters.

TEST:
- echo freeze > /sys/power/state
- Wake the system, read the S0ix residency i.e.
  cat /sys/kernel/debug/telemetry/s0ix_residency_usec

Signed-off-by: Shanth Murthy <shanth.murthy@intel.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Rajneesh Bhardwaj authored and Darren Hart (VMware) committed Jul 5, 2017
1 parent 7a3a51a commit bc8c47a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions drivers/platform/x86/intel_telemetry_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,24 @@ static const struct file_operations telem_socstate_ops = {
.release = single_release,
};

static int telem_s0ix_res_get(void *data, u64 *val)
{
u64 s0ix_total_res;
int ret;

ret = intel_pmc_s0ix_counter_read(&s0ix_total_res);
if (ret) {
pr_err("Failed to read S0ix residency");
return ret;
}

*val = s0ix_total_res;

return 0;
}

DEFINE_DEBUGFS_ATTRIBUTE(telem_s0ix_fops, telem_s0ix_res_get, NULL, "%llu\n");

static int telem_pss_trc_verb_show(struct seq_file *s, void *unused)
{
u32 verbosity;
Expand Down Expand Up @@ -987,6 +1005,14 @@ static int __init telemetry_debugfs_init(void)
goto out;
}

f = debugfs_create_file("s0ix_residency_usec", S_IFREG | S_IRUGO,
debugfs_conf->telemetry_dbg_dir,
NULL, &telem_s0ix_fops);
if (!f) {
pr_err("s0ix_residency_usec debugfs register failed\n");
goto out;
}

f = debugfs_create_file("pss_trace_verbosity", S_IFREG | S_IRUGO,
debugfs_conf->telemetry_dbg_dir, NULL,
&telem_pss_trc_verb_ops);
Expand Down

0 comments on commit bc8c47a

Please sign in to comment.