Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nilawar, Badal" <badal.nilawar@intel.com>
To: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Karthik Poosa <karthik.poosa@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH 2/2] drm/xe/hwmon: Expose card power and energy attributes of BMG
Date: Tue, 28 May 2024 10:39:40 +0530	[thread overview]
Message-ID: <a29034db-6b73-4cd5-9a1c-60cb43ed15d9@intel.com> (raw)
In-Reply-To: <20240523144351.4040131-3-balasubramani.vivekanandan@intel.com>



On 23-05-2024 20:13, Balasubramani Vivekanandan wrote:
> From: Karthik Poosa <karthik.poosa@intel.com>
> 
> In BMG there are separate registers for card/platform power and
> energy.
> These are exposed through channel 0 i.e power_1/energy1_xxx.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
> ---

LGTM
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>

Regards,
Badal
>   drivers/gpu/drm/xe/regs/xe_pcode_regs.h |  2 ++
>   drivers/gpu/drm/xe/xe_hwmon.c           | 26 +++++++++++++++++--------
>   2 files changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/regs/xe_pcode_regs.h b/drivers/gpu/drm/xe/regs/xe_pcode_regs.h
> index beba16d592fc..0b0b49d850ae 100644
> --- a/drivers/gpu/drm/xe/regs/xe_pcode_regs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_pcode_regs.h
> @@ -22,5 +22,7 @@
>   #define BMG_PACKAGE_POWER_SKU_UNIT		XE_REG(0x1380dc)
>   #define BMG_PACKAGE_ENERGY_STATUS		XE_REG(0x138120)
>   #define BMG_PACKAGE_RAPL_LIMIT			XE_REG(0x138440)
> +#define BMG_PLATFORM_ENERGY_STATUS		XE_REG(0x138458)
> +#define BMG_PLATFORM_POWER_LIMIT		XE_REG(0x138460)
>   
>   #endif /* _XE_PCODE_REGS_H_ */
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index 8daa070d7b1a..aae9670428a3 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -86,12 +86,17 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
>   
>   	switch (hwmon_reg) {
>   	case REG_PKG_RAPL_LIMIT:
> -		if (xe->info.platform == XE_BATTLEMAGE && channel == CHANNEL_PKG)
> -			return BMG_PACKAGE_RAPL_LIMIT;
> -		else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
> +		if (xe->info.platform == XE_BATTLEMAGE) {
> +			if (channel == CHANNEL_PKG) {
> +				return BMG_PACKAGE_RAPL_LIMIT;
> +			} else {
> +				return BMG_PLATFORM_POWER_LIMIT;
> +			}
> +		} else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
>   			return PVC_GT0_PACKAGE_RAPL_LIMIT;
> -		else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG))
> +		} else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG)) {
>   			return PCU_CR_PACKAGE_RAPL_LIMIT;
> +		}
>   		break;
>   	case REG_PKG_POWER_SKU:
>   		if (xe->info.platform == XE_BATTLEMAGE)
> @@ -114,12 +119,17 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
>   			return GT_PERF_STATUS;
>   		break;
>   	case REG_PKG_ENERGY_STATUS:
> -		if (xe->info.platform == XE_BATTLEMAGE && channel == CHANNEL_PKG)
> -			return BMG_PACKAGE_ENERGY_STATUS;
> -		else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG)
> +		if (xe->info.platform == XE_BATTLEMAGE) {
> +			if (channel == CHANNEL_PKG) {
> +				return BMG_PACKAGE_ENERGY_STATUS;
> +			} else {
> +				return BMG_PLATFORM_ENERGY_STATUS;
> +			}
> +		} else if (xe->info.platform == XE_PVC && channel == CHANNEL_PKG) {
>   			return PVC_GT0_PLATFORM_ENERGY_STATUS;
> -		else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG))
> +		} else if ((xe->info.platform == XE_DG2) && (channel == CHANNEL_PKG)) {
>   			return PCU_CR_PACKAGE_ENERGY_STATUS;
> +		}
>   		break;
>   	default:
>   		drm_warn(&xe->drm, "Unknown xe hwmon reg id: %d\n", hwmon_reg);

  reply	other threads:[~2024-05-28  5:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 14:43 [PATCH 0/2] Add HWMON support for BMG Balasubramani Vivekanandan
2024-05-23 14:43 ` [PATCH 1/2] drm/xe/hwmon: " Balasubramani Vivekanandan
2024-05-23 17:29   ` Rodrigo Vivi
2024-05-28  5:08   ` Nilawar, Badal
2024-05-23 14:43 ` [PATCH 2/2] drm/xe/hwmon: Expose card power and energy attributes of BMG Balasubramani Vivekanandan
2024-05-28  5:09   ` Nilawar, Badal [this message]
2024-05-23 14:47 ` ✓ CI.Patch_applied: success for Add HWMON support for BMG Patchwork
2024-05-23 14:48 ` ✗ CI.checkpatch: warning " Patchwork
2024-05-23 14:49 ` ✓ CI.KUnit: success " Patchwork
2024-05-23 15:01 ` ✓ CI.Build: " Patchwork
2024-05-23 15:03 ` ✓ CI.Hooks: " Patchwork
2024-05-23 15:05 ` ✓ CI.checksparse: " Patchwork
2024-05-23 15:34 ` ✗ CI.BAT: failure " Patchwork
2024-05-23 17:04 ` ✗ CI.FULL: " Patchwork

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=a29034db-6b73-4cd5-9a1c-60cb43ed15d9@intel.com \
    --to=badal.nilawar@intel.com \
    --cc=balasubramani.vivekanandan@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /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