Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe/hwmon: Prevent unintended VRAM channel creation

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)

Fixes: 49a498338417 ("drm/xe/hwmon: Expose individual VRAM channel temperature")
Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Link: https://patch.msgid.link/20260206081655.2115439-1-karthik.poosa@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 48eb073c7d95883eca2789447f94e1e8cafbabe5)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Karthik Poosa and committed by
Rodrigo Vivi
93d08a1c b61d5651

+3 -3
+3 -3
drivers/gpu/drm/xe/xe_hwmon.c
··· 48 48 CHANNEL_MCTRL, 49 49 CHANNEL_PCIE, 50 50 CHANNEL_VRAM_N, 51 - CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS, 51 + CHANNEL_VRAM_N_MAX = CHANNEL_VRAM_N + MAX_VRAM_CHANNELS - 1, 52 52 CHANNEL_MAX, 53 53 }; 54 54 ··· 264 264 return BMG_PACKAGE_TEMPERATURE; 265 265 else if (channel == CHANNEL_VRAM) 266 266 return BMG_VRAM_TEMPERATURE; 267 - else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX)) 267 + else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS)) 268 268 return BMG_VRAM_TEMPERATURE_N(channel - CHANNEL_VRAM_N); 269 269 } else if (xe->info.platform == XE_DG2) { 270 270 if (channel == CHANNEL_PKG) ··· 1427 1427 *str = "mctrl"; 1428 1428 else if (channel == CHANNEL_PCIE) 1429 1429 *str = "pcie"; 1430 - else if (in_range(channel, CHANNEL_VRAM_N, CHANNEL_VRAM_N_MAX)) 1430 + else if (in_range(channel, CHANNEL_VRAM_N, MAX_VRAM_CHANNELS)) 1431 1431 *str = hwmon->temp.vram_label[channel - CHANNEL_VRAM_N]; 1432 1432 return 0; 1433 1433 case hwmon_power: