Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/hwmon: Fix xe_hwmon_pcode_write_i1 param from u32 to u16
@ 2024-08-08 17:27 Karthik Poosa
  2024-08-08 18:08 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Karthik Poosa @ 2024-08-08 17:27 UTC (permalink / raw)
  To: intel-xe
  Cc: anshuman.gupta, badal.nilawar, ashutosh.dixit, rodrigo.vivi,
	Karthik Poosa

WRITE_I1 sub command of pcode takes param of u16 compared to u32 for
READ_I1, so corrected it. Without this pcode shall return illegal
sub command errors.

Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>
Fixes: 92d44a422d0d ("drm/xe/hwmon: Expose card reactive critical power")
---
 drivers/gpu/drm/xe/xe_hwmon.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 832ea81faeee..617c8bdb8f28 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -446,11 +446,11 @@ static int xe_hwmon_pcode_read_i1(struct xe_gt *gt, u32 *uval)
 			     uval, NULL);
 }
 
-static int xe_hwmon_pcode_write_i1(struct xe_gt *gt, u32 uval)
+static int xe_hwmon_pcode_write_i1(struct xe_gt *gt, u16 uval)
 {
 	return xe_pcode_write(gt, PCODE_MBOX(PCODE_POWER_SETUP,
 			      POWER_SETUP_SUBCOMMAND_WRITE_I1, 0),
-			      uval);
+			      (u32)(uval & POWER_SETUP_I1_DATA_MASK));
 }
 
 static int xe_hwmon_power_curr_crit_read(struct xe_hwmon *hwmon, int channel,
@@ -476,11 +476,11 @@ static int xe_hwmon_power_curr_crit_write(struct xe_hwmon *hwmon, int channel,
 					  long value, u32 scale_factor)
 {
 	int ret;
-	u32 uval;
+	u16 uval;
 
 	mutex_lock(&hwmon->hwmon_lock);
 
-	uval = DIV_ROUND_CLOSEST_ULL(value << POWER_SETUP_I1_SHIFT, scale_factor);
+	uval = DIV_ROUND_CLOSEST((u16)value << POWER_SETUP_I1_SHIFT, scale_factor);
 	ret = xe_hwmon_pcode_write_i1(hwmon->gt, uval);
 
 	mutex_unlock(&hwmon->hwmon_lock);
-- 
2.25.1


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

end of thread, other threads:[~2024-08-26  8:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 17:27 [PATCH] drm/xe/hwmon: Fix xe_hwmon_pcode_write_i1 param from u32 to u16 Karthik Poosa
2024-08-08 18:08 ` ✓ CI.Patch_applied: success for " Patchwork
2024-08-08 18:09 ` ✓ CI.checkpatch: " Patchwork
2024-08-08 18:10 ` ✓ CI.KUnit: " Patchwork
2024-08-08 18:22 ` ✓ CI.Build: " Patchwork
2024-08-08 18:24 ` ✓ CI.Hooks: " Patchwork
2024-08-08 18:26 ` ✓ CI.checksparse: " Patchwork
2024-08-08 18:59 ` ✓ CI.BAT: " Patchwork
2024-08-08 20:45 ` ✗ CI.FULL: failure " Patchwork
2024-08-09  4:07 ` [PATCH] " Poosa, Karthik
2024-08-26  7:08   ` Poosa, Karthik
2024-08-26  8:11     ` Nilawar, Badal

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