Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation
@ 2026-01-19 14:31 Karthik Poosa
  2026-01-20 13:38 ` Raag Jadav
  0 siblings, 1 reply; 6+ messages in thread
From: Karthik Poosa @ 2026-01-19 14:31 UTC (permalink / raw)
  To: intel-xe
  Cc: anshuman.gupta, badal.nilawar, rodrigo.vivi, raag.jadav,
	Karthik Poosa

Remove the unnecessary VRAM channel entry introduced in
xe_hwmon_channel. Without this, adding any new hwmon channel
causes an extra VRAM channel to appear. This remained unnoticed
earlier because VRAM was the final xe hwmon channel.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Fixes: 49a498338417 ("drm/xe/hwmon: Expose individual VRAM channel temperature")
---
 drivers/gpu/drm/xe/xe_hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index baf277955b33..f614f1308dec 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -48,7 +48,7 @@ enum xe_hwmon_channel {
 	CHANNEL_MCTRL,
 	CHANNEL_PCIE,
 	CHANNEL_VRAM_N,
-	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS,
+	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1,
 	CHANNEL_MAX,
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation
  2026-01-19 14:31 [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation Karthik Poosa
@ 2026-01-20 13:38 ` Raag Jadav
  2026-02-06  7:29   ` Poosa, Karthik
  0 siblings, 1 reply; 6+ messages in thread
From: Raag Jadav @ 2026-01-20 13:38 UTC (permalink / raw)
  To: Karthik Poosa; +Cc: intel-xe, anshuman.gupta, badal.nilawar, rodrigo.vivi

On Mon, Jan 19, 2026 at 08:01:38PM +0530, Karthik Poosa wrote:
> Remove the unnecessary VRAM channel entry introduced in
> xe_hwmon_channel. Without this, adding any new hwmon channel
> causes an extra VRAM channel to appear. This remained unnoticed
> earlier because VRAM was the final xe hwmon channel.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> Fixes: 49a498338417 ("drm/xe/hwmon: Expose individual VRAM channel temperature")
> ---
>  drivers/gpu/drm/xe/xe_hwmon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index baf277955b33..f614f1308dec 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -48,7 +48,7 @@ enum xe_hwmon_channel {
>  	CHANNEL_MCTRL,
>  	CHANNEL_PCIE,
>  	CHANNEL_VRAM_N,
> -	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS,
> +	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1,

Can you also check in_range() logic and investigate how channel id greater
than CHANNEL_VRAM_N_MAX (for example 23) is delt with?

Raag

>  	CHANNEL_MAX,
>  };
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation
  2026-01-20 13:38 ` Raag Jadav
@ 2026-02-06  7:29   ` Poosa, Karthik
  0 siblings, 0 replies; 6+ messages in thread
From: Poosa, Karthik @ 2026-02-06  7:29 UTC (permalink / raw)
  To: Raag Jadav; +Cc: intel-xe, anshuman.gupta, badal.nilawar, rodrigo.vivi

[-- Attachment #1: Type: text/plain, Size: 1783 bytes --]

2

On 20-01-2026 19:08, Raag Jadav wrote:
> On Mon, Jan 19, 2026 at 08:01:38PM +0530, Karthik Poosa wrote:
>> Remove the unnecessary VRAM channel entry introduced in
>> xe_hwmon_channel. Without this, adding any new hwmon channel
>> causes an extra VRAM channel to appear. This remained unnoticed
>> earlier because VRAM was the final xe hwmon channel.
>>
>> Signed-off-by: Karthik Poosa<karthik.poosa@intel.com>
>> Fixes: 49a498338417 ("drm/xe/hwmon: Expose individual VRAM channel temperature")
>> ---
>>   drivers/gpu/drm/xe/xe_hwmon.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
>> index baf277955b33..f614f1308dec 100644
>> --- a/drivers/gpu/drm/xe/xe_hwmon.c
>> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
>> @@ -48,7 +48,7 @@ enum xe_hwmon_channel {
>>   	CHANNEL_MCTRL,
>>   	CHANNEL_PCIE,
>>   	CHANNEL_VRAM_N,
>> -	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS,
>> +	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1,
> Can you also check in_range() logic and investigate how channel id greater
> than CHANNEL_VRAM_N_MAX (for example 23) is delt with?
>
> Raag
Hi Raag,

We are not seeing new channels with in_range() + CHANNEL_VRAM_N_MAX as
1. hwmon_info[] has defined only CHANNEL_VRAM_N_MAX channels,
2. CHANNEL_VRAM_N_MAX is the max channel supported in xe_hwmon.c
Checked in_range implementation also, you are right, using 
|MAX_VRAM_CHANNELS| with |in_range|() is correct, |as it |requires a 
start value and length.
Using |CHANNEL_VRAM_N_MAX| instead would pass offset which also includes 
extra offsets from CHANNEL_CARD to CHANNEL_PCIe.

I will use MAX_VRAM_CHANNELS with in_range in the next revision.
>
>>   	CHANNEL_MAX,
>>   };
>>   
>> -- 
>> 2.25.1
>>

[-- Attachment #2: Type: text/html, Size: 4331 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation
@ 2026-02-06  8:16 Karthik Poosa
  2026-02-11 11:17 ` Raag Jadav
  0 siblings, 1 reply; 6+ messages in thread
From: Karthik Poosa @ 2026-02-06  8:16 UTC (permalink / raw)
  To: intel-xe
  Cc: anshuman.gupta, badal.nilawar, rodrigo.vivi, raag.jadav,
	Karthik Poosa

Remove the unnecessary VRAM channel entry introduced in xe_hwmon_channel.
Without this, adding any new hwmon channel causes extra VRAM channel
to appear. This remained unnoticed earlier because VRAM was the
final xe hwmon channel.

v2: Use MAX_VRAM_CHANNELS with in_range() instead of
    CHANNEL_VRAM_N_MAX. (Raag)

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Fixes: 49a498338417 ("drm/xe/hwmon: Expose individual VRAM channel temperature")
---
 drivers/gpu/drm/xe/xe_hwmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index baf277955b33..0fd4d4f1014a 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -48,7 +48,7 @@ enum xe_hwmon_channel {
 	CHANNEL_MCTRL,
 	CHANNEL_PCIE,
 	CHANNEL_VRAM_N,
-	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS,
+	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1,
 	CHANNEL_MAX,
 };
 
@@ -264,7 +264,7 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
 				return BMG_PACKAGE_TEMPERATURE;
 			else if (channel == CHANNEL_VRAM)
 				return BMG_VRAM_TEMPERATURE;
-			else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
+			else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
 				return BMG_VRAM_TEMPERATURE_N(channel - CHANNEL_VRAM_N);
 		} else if (xe->info.platform == XE_DG2) {
 			if (channel == CHANNEL_PKG)
@@ -1427,7 +1427,7 @@ static int xe_hwmon_read_label(struct device *dev,
 			*str = "mctrl";
 		else if (channel == CHANNEL_PCIE)
 			*str = "pcie";
-		else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
+		else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
 			*str = hwmon->temp.vram_label[channel - CHANNEL_VRAM_N];
 		return 0;
 	case hwmon_power:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation
  2026-02-06  8:16 Karthik Poosa
@ 2026-02-11 11:17 ` Raag Jadav
  2026-02-18  0:22   ` Rodrigo Vivi
  0 siblings, 1 reply; 6+ messages in thread
From: Raag Jadav @ 2026-02-11 11:17 UTC (permalink / raw)
  To: Karthik Poosa; +Cc: intel-xe, anshuman.gupta, badal.nilawar, rodrigo.vivi

On Fri, Feb 06, 2026 at 01:46:55PM +0530, Karthik Poosa wrote:
> Remove the unnecessary VRAM channel entry introduced in xe_hwmon_channel.
> Without this, adding any new hwmon channel causes extra VRAM channel
> to appear. This remained unnoticed earlier because VRAM was the
> final xe hwmon channel.
> 
> v2: Use MAX_VRAM_CHANNELS with in_range() instead of
>     CHANNEL_VRAM_N_MAX. (Raag)
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> Fixes: 49a498338417 ("drm/xe/hwmon: Expose individual VRAM channel temperature")

Fixes tag usually goes first, but perhaps it can be re-ordered while
applying. In any case,

Reviewed-by: Raag Jadav <raag.jadav@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_hwmon.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> index baf277955b33..0fd4d4f1014a 100644
> --- a/drivers/gpu/drm/xe/xe_hwmon.c
> +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> @@ -48,7 +48,7 @@ enum xe_hwmon_channel {
>  	CHANNEL_MCTRL,
>  	CHANNEL_PCIE,
>  	CHANNEL_VRAM_N,
> -	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS,
> +	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1,
>  	CHANNEL_MAX,
>  };
>  
> @@ -264,7 +264,7 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
>  				return BMG_PACKAGE_TEMPERATURE;
>  			else if (channel == CHANNEL_VRAM)
>  				return BMG_VRAM_TEMPERATURE;
> -			else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
> +			else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
>  				return BMG_VRAM_TEMPERATURE_N(channel - CHANNEL_VRAM_N);
>  		} else if (xe->info.platform == XE_DG2) {
>  			if (channel == CHANNEL_PKG)
> @@ -1427,7 +1427,7 @@ static int xe_hwmon_read_label(struct device *dev,
>  			*str = "mctrl";
>  		else if (channel == CHANNEL_PCIE)
>  			*str = "pcie";
> -		else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
> +		else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
>  			*str = hwmon->temp.vram_label[channel - CHANNEL_VRAM_N];
>  		return 0;
>  	case hwmon_power:
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation
  2026-02-11 11:17 ` Raag Jadav
@ 2026-02-18  0:22   ` Rodrigo Vivi
  0 siblings, 0 replies; 6+ messages in thread
From: Rodrigo Vivi @ 2026-02-18  0:22 UTC (permalink / raw)
  To: Raag Jadav; +Cc: Karthik Poosa, intel-xe, anshuman.gupta, badal.nilawar

On Wed, Feb 11, 2026 at 12:17:04PM +0100, Raag Jadav wrote:
> On Fri, Feb 06, 2026 at 01:46:55PM +0530, Karthik Poosa wrote:
> > Remove the unnecessary VRAM channel entry introduced in xe_hwmon_channel.
> > Without this, adding any new hwmon channel causes extra VRAM channel
> > to appear. This remained unnoticed earlier because VRAM was the
> > final xe hwmon channel.
> > 
> > v2: Use MAX_VRAM_CHANNELS with in_range() instead of
> >     CHANNEL_VRAM_N_MAX. (Raag)
> > 
> > Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
> > Fixes: 49a498338417 ("drm/xe/hwmon: Expose individual VRAM channel temperature")
> 
> Fixes tag usually goes first, but perhaps it can be re-ordered while
> applying. In any case,

done and pushed, thank you both

> 
> Reviewed-by: Raag Jadav <raag.jadav@intel.com>
> 
> > ---
> >  drivers/gpu/drm/xe/xe_hwmon.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> > index baf277955b33..0fd4d4f1014a 100644
> > --- a/drivers/gpu/drm/xe/xe_hwmon.c
> > +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> > @@ -48,7 +48,7 @@ enum xe_hwmon_channel {
> >  	CHANNEL_MCTRL,
> >  	CHANNEL_PCIE,
> >  	CHANNEL_VRAM_N,
> > -	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS,
> > +	CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1,
> >  	CHANNEL_MAX,
> >  };
> >  
> > @@ -264,7 +264,7 @@ static struct xe_reg xe_hwmon_get_reg(struct xe_hwmon *hwmon, enum xe_hwmon_reg
> >  				return BMG_PACKAGE_TEMPERATURE;
> >  			else if (channel == CHANNEL_VRAM)
> >  				return BMG_VRAM_TEMPERATURE;
> > -			else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
> > +			else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
> >  				return BMG_VRAM_TEMPERATURE_N(channel - CHANNEL_VRAM_N);
> >  		} else if (xe->info.platform == XE_DG2) {
> >  			if (channel == CHANNEL_PKG)
> > @@ -1427,7 +1427,7 @@ static int xe_hwmon_read_label(struct device *dev,
> >  			*str = "mctrl";
> >  		else if (channel == CHANNEL_PCIE)
> >  			*str = "pcie";
> > -		else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX))
> > +		else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS))
> >  			*str = hwmon->temp.vram_label[channel - CHANNEL_VRAM_N];
> >  		return 0;
> >  	case hwmon_power:
> > -- 
> > 2.25.1
> > 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-18  0:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 14:31 [PATCH] drm/xe/hwmon: Prevent unintended VRAM channel creation Karthik Poosa
2026-01-20 13:38 ` Raag Jadav
2026-02-06  7:29   ` Poosa, Karthik
  -- strict thread matches above, loose matches on Subject: below --
2026-02-06  8:16 Karthik Poosa
2026-02-11 11:17 ` Raag Jadav
2026-02-18  0:22   ` Rodrigo Vivi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox