From: Raag Jadav <raag.jadav@intel.com>
To: rodrigo.vivi@intel.com, jani.nikula@intel.com
Cc: intel-xe@lists.freedesktop.org, riana.tauro@intel.com,
matthew.brost@intel.com, michal.wajdeczko@intel.com,
badal.nilawar@intel.com, ville.syrjala@linux.intel.com,
karthik.poosa@intel.com, anshuman.gupta@intel.com,
matthew.d.roper@intel.com, Raag Jadav <raag.jadav@intel.com>
Subject: [PATCH v2 3/4] drm/xe/hwmon: Use PCODE_FALLBACK_MAGIC
Date: Mon, 1 Dec 2025 15:57:57 +0530 [thread overview]
Message-ID: <20251201102902.362650-4-raag.jadav@intel.com> (raw)
In-Reply-To: <20251201102902.362650-1-raag.jadav@intel.com>
Use PCODE_FALLBACK_MAGIC to check for mailbox command support on the
device while exposing respective hwmon attributes.
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
drivers/gpu/drm/xe/xe_hwmon.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index ff2aea52ef75..905887a57571 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -693,14 +693,9 @@ static const struct hwmon_channel_info * const hwmon_info[] = {
static int xe_hwmon_pcode_read_i1(const struct xe_hwmon *hwmon, u32 *uval)
{
struct xe_tile *root_tile = xe_device_get_root_tile(hwmon->xe);
+ u32 mbox = PCODE_MBOX(PCODE_POWER_SETUP, POWER_SETUP_SUBCOMMAND_READ_I1, 0);
- /* Avoid Illegal Subcommand error */
- if (hwmon->xe->info.platform == XE_DG2)
- return -ENXIO;
-
- return xe_pcode_read(root_tile, PCODE_MBOX(PCODE_POWER_SETUP,
- POWER_SETUP_SUBCOMMAND_READ_I1, 0),
- uval, NULL);
+ return xe_pcode_read(root_tile, mbox | PCODE_FALLBACK_MAGIC, uval, NULL);
}
static int xe_hwmon_pcode_write_i1(const struct xe_hwmon *hwmon, u32 uval)
@@ -715,6 +710,7 @@ static int xe_hwmon_pcode_write_i1(const struct xe_hwmon *hwmon, u32 uval)
static int xe_hwmon_pcode_read_fan_control(const struct xe_hwmon *hwmon, u32 subcmd, u32 *uval)
{
struct xe_tile *root_tile = xe_device_get_root_tile(hwmon->xe);
+ u32 mbox = PCODE_MBOX(FAN_SPEED_CONTROL, subcmd, 0);
/* Platforms that don't return correct value */
if (hwmon->xe->info.platform == XE_DG2 && subcmd == FSC_READ_NUM_FANS) {
@@ -722,7 +718,7 @@ static int xe_hwmon_pcode_read_fan_control(const struct xe_hwmon *hwmon, u32 sub
return 0;
}
- return xe_pcode_read(root_tile, PCODE_MBOX(FAN_SPEED_CONTROL, subcmd, 0), uval, NULL);
+ return xe_pcode_read(root_tile, mbox | PCODE_FALLBACK_MAGIC, uval, NULL);
}
static int xe_hwmon_power_curr_crit_read(struct xe_hwmon *hwmon, int channel,
--
2.43.0
next prev parent reply other threads:[~2025-12-01 10:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 10:27 [PATCH v2 0/4] Introduce PCODE_FALLBACK_MAGIC Raag Jadav
2025-12-01 10:27 ` [PATCH v2 1/4] drm/xe/pcode: " Raag Jadav
2025-12-01 20:13 ` Rodrigo Vivi
2025-12-01 10:27 ` [PATCH v2 2/4] drm/xe/sysfs: Use PCODE_FALLBACK_MAGIC Raag Jadav
2025-12-01 10:27 ` Raag Jadav [this message]
2025-12-01 10:27 ` [PATCH v2 4/4] drm/xe/late_bind: " Raag Jadav
2025-12-01 10:40 ` ✓ CI.KUnit: success for Introduce PCODE_FALLBACK_MAGIC Patchwork
2025-12-01 11:47 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-01 12:49 ` ✓ Xe.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=20251201102902.362650-4-raag.jadav@intel.com \
--to=raag.jadav@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=badal.nilawar@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=karthik.poosa@intel.com \
--cc=matthew.brost@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=ville.syrjala@linux.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