X86 platform drivers
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org, Patil.Reddy@amd.com,
	lizhi.hou@amd.com, VinitKumar Shukla <VinitKumar.Shukla@amd.com>
Subject: Re: [PATCH v2 5/5] accel/amdxdna: Provide real-time NPU power estimate via AMD PMF
Date: Wed, 12 Nov 2025 12:03:25 -0600	[thread overview]
Message-ID: <7034fae1-4096-4cdb-a46f-5e23e7accfa0@amd.com> (raw)
In-Reply-To: <20251111063737.4156385-6-Shyam-sundar.S-k@amd.com>

On 11/11/25 12:37 AM, Shyam Sundar S K wrote:
> From: VinitKumar Shukla <VinitKumar.Shukla@amd.com>
> 
> Add aie2_smu_get_power_estimate() to obtain NPU power readings from the
> AMD PMF driver. This xdna interface enables user space to reflect current
> workload power consumption in real time.

But.. it doesn't.  It just adds a new function that could potentially do 
this job.  The actual gluing it to userspace in some way to use this 
function will be another patch.

> 
> Signed-off-by: VinitKumar Shukla <VinitKumar.Shukla@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
>   drivers/accel/amdxdna/aie2_pci.h |  2 ++
>   drivers/accel/amdxdna/aie2_smu.c | 12 ++++++++++++
>   2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/accel/amdxdna/aie2_pci.h b/drivers/accel/amdxdna/aie2_pci.h
> index 91a8e948f82a..5601de841b5b 100644
> --- a/drivers/accel/amdxdna/aie2_pci.h
> +++ b/drivers/accel/amdxdna/aie2_pci.h
> @@ -8,6 +8,7 @@
>   
>   #include <drm/amdxdna_accel.h>
>   #include <linux/semaphore.h>
> +#include <linux/amd-pmf-io.h>
>   
>   #include "amdxdna_mailbox.h"
>   
> @@ -240,6 +241,7 @@ int aie2_smu_init(struct amdxdna_dev_hdl *ndev);
>   void aie2_smu_fini(struct amdxdna_dev_hdl *ndev);
>   int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level);
>   int npu4_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level);
> +int aie2_smu_get_power_estimate(void);
>   
>   /* aie2_pm.c */
>   int aie2_pm_init(struct amdxdna_dev_hdl *ndev);
> diff --git a/drivers/accel/amdxdna/aie2_smu.c b/drivers/accel/amdxdna/aie2_smu.c
> index d303701b0ded..7b5e2c383dd3 100644
> --- a/drivers/accel/amdxdna/aie2_smu.c
> +++ b/drivers/accel/amdxdna/aie2_smu.c
> @@ -54,6 +54,18 @@ static int aie2_smu_exec(struct amdxdna_dev_hdl *ndev, u32 reg_cmd,
>   	return 0;
>   }
>   
> +int aie2_smu_get_power_estimate(void)
> +{
> +	struct amd_pmf_npu_metrics npu_metrics;
> +	int ret;
> +
> +	ret = amd_pmf_get_npu_data(&npu_metrics);
> +	if (ret)
> +		return ret;
> +
> +	return npu_metrics.npu_power;
> +}
> +
>   int npu1_set_dpm(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
>   {
>   	u32 freq;


  reply	other threads:[~2025-11-12 18:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11  6:37 [PATCH v2 0/5] PMF NPU metrics cleanup, command flag cleanup, and amdxdna integration Shyam Sundar S K
2025-11-11  6:37 ` [PATCH v2 1/5] platform/x86/amd/pmf: Rename IPU metrics fields to NPU for consistency Shyam Sundar S K
2025-11-18 15:36   ` Ilpo Järvinen
2025-11-11  6:37 ` [PATCH v2 2/5] platform/x86/amd/pmf: Use explicit SET_CMD/GET_CMD flags in amd_pmf_send_cmd() Shyam Sundar S K
2025-11-18 15:41   ` Ilpo Järvinen
2025-11-18 17:03     ` Shyam Sundar S K
2025-11-18 17:08       ` Ilpo Järvinen
2025-11-11  6:37 ` [PATCH v2 3/5] platform/x86/amd/pmf: replace magic table id with METRICS_TABLE_ID Shyam Sundar S K
2025-11-18 15:44   ` Ilpo Järvinen
2025-11-11  6:37 ` [PATCH v2 4/5] platform/x86/amd/pmf: Introduce new interface to export NPU metrics Shyam Sundar S K
2025-11-18 15:54   ` Ilpo Järvinen
2025-11-11  6:37 ` [PATCH v2 5/5] accel/amdxdna: Provide real-time NPU power estimate via AMD PMF Shyam Sundar S K
2025-11-12 18:03   ` Mario Limonciello [this message]
2025-11-13  7:33     ` Shyam Sundar S K
2025-11-14 16:56       ` Mario Limonciello
2025-11-18 15:59         ` Ilpo Järvinen
2025-11-18 16:01           ` Ilpo Järvinen
2025-11-18 16:46             ` Shyam Sundar S K
2025-11-19 12:44               ` Ilpo Järvinen
2025-11-20 10:55                 ` Shyam Sundar S K
2025-11-12 17:21 ` [PATCH v2 0/5] PMF NPU metrics cleanup, command flag cleanup, and amdxdna integration Mario Limonciello
2025-11-13  7:37   ` Shyam Sundar S K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7034fae1-4096-4cdb-a46f-5e23e7accfa0@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Patil.Reddy@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=VinitKumar.Shukla@amd.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lizhi.hou@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox