Re: [PATCH V5 19/20] platform/x86/intel/pmc: Add debug attribute for Die C6 counter

From: Ilpo Järvinen
Date: Thu Nov 23 2023 - 06:39:07 EST


On Wed, 22 Nov 2023, David E. Box wrote:

> Add a "die_c6_us_show" debugfs attribute. Reads the counter value using
> Intel Platform Monitoring Technology (PMT) driver API. This counter is
> useful for determining the idle residency of CPUs in the compute tile.
> Also adds a missing forward declaration for punit_ep which was declared in
> an earlier upstream commit but only used for the first time in this one.
>
> Signed-off-by: David E. Box <david.e.box@xxxxxxxxxxxxxxx>
> ---
> V5 - Change comment for crystal error and return value
>
> V4 - no change
>
> V3 - Split previous PATCH V2 13. Separates implementation (this patch) from
> platform specific use (next patch)
>
> V2 - Remove use of __func__
> - Use HZ_PER_MHZ
> - Fix missing newlines in printks
>
> drivers/platform/x86/intel/pmc/core.c | 55 +++++++++++++++++++++++++++
> drivers/platform/x86/intel/pmc/core.h | 4 ++
> 2 files changed, 59 insertions(+)
>
> diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
> index 4a38d52558fd..fb2c84fba0ae 100644
> --- a/drivers/platform/x86/intel/pmc/core.c
> +++ b/drivers/platform/x86/intel/pmc/core.c

> +static int pmc_core_die_c6_us_show(struct seq_file *s, void *unused)
> +{
> + struct pmc_dev *pmcdev = s->private;
> + u64 die_c6_res, count;
> + int ret;
> +
> + if (!pmcdev->crystal_freq) {
> + dev_warn_once(&pmcdev->pdev->dev, "Crystal frequency unavailable\n");
> + return -ENXIO;
> + }

I actually started to wonder whether it would be better to just not show
the file in this case (using .is_visible())? (I'm sorry I forgot to send
the note about that earlier.)

--
i.