Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DAB3606A32D for ; Thu, 3 Dec 2026 09:05:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AMH4Y8b9 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED16A1120C6; Thu, 3 Dec 2026 09:05:36 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97FD611201C for ; Thu, 3 Dec 2026 09:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796288731; x=1827824731; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PHD7ICkt4fcJ5TsT6ndqa83IYlo0xOi1rHvnKrJeuTw=; b=AMH4Y8b9vD88bnFWFyRYIJOWV4rgZQicAsyFlUPVymmC442wmH8iuY2r YnBRbeLT3e8pSnjtGfH212D50DBAR5k1t3jOXruwut9heA9gXDr3GCErv xKJZX3W6FzedyEJC3I8azS1BdE43x5WDUeIOzbuqtM1sNBWqBOCjbKVSB ZlLjXGH4x3qKiPhTCPRMNS48GNeqgFBvz75cJdns5abWitY2Ba2jV5IIG wxttm/GKUe9P5zeFgzbOZCud8wR+gWJSoW42m1mEVwV6oq8qs/39YZYrg 5DMD2ZWQTBcyjorp/oVw2i3yGPZF0krwxuzCYmoQ1FW/zl6dusKtE6eyf w==; X-CSE-ConnectionGUID: WsxBy/qjTWuuGJanWdoqLQ== X-CSE-MsgGUID: p4CFdUALSl6FX7lwbds+qQ== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5254244" X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="5254244" Received: from fmviesa013.fm.intel.com ([10.60.135.153]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 01:05:31 -0800 X-CSE-ConnectionGUID: fQ/lrVY8S4ixCxyX8c3/9Q== X-CSE-MsgGUID: jxtFlUJqTxS7XkCtUHQuOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="15730365" Received: from sinjan-super-server.iind.intel.com ([10.190.239.39]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 01:05:28 -0800 From: Karthik Poosa To: intel-xe@lists.freedesktop.org Cc: rodrigo.vivi@intel.com, anshuman.gupta@intel.com, badal.nilawar@intel.com, raag.jadav@intel.com, soham.purkait@intel.com, riana.tauro@intel.com, Karthik Poosa Subject: [PATCH v11 03/11] drm/xe/hwmon: Expose fanN_max Date: Thu, 3 Dec 2026 14:36:57 +0530 Message-Id: <20261203090705.2500610-4-karthik.poosa@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261203090705.2500610-1-karthik.poosa@intel.com> References: <20261203090705.2500610-1-karthik.poosa@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Expose fan maximum RPM via fanN_max. The value is derived from the firmware-reported maximum fan RPS and converted to RPM in the fan hwmon read path. Update Xe hwmon ABI documentation for fanN_max. Reviewed-by: Rodrigo Vivi Reviewed-by: Soham Purkait Signed-off-by: Karthik Poosa --- .../ABI/testing/sysfs-driver-intel-xe-hwmon | 8 +++++++ drivers/gpu/drm/xe/xe_hwmon.c | 21 ++++++++++++++++++- drivers/gpu/drm/xe/xe_pcode_api.h | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon index 2bb78a503f46..ac9ccfd47eab 100644 --- a/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon +++ b/Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon @@ -266,6 +266,14 @@ Description: RO. Fan 3 speed in RPM. Only supported for particular Intel Xe graphics platforms. +What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon/fan[1-3]_max +Date: December 2026 +KernelVersion: 7.5 +Contact: intel-xe@lists.freedesktop.org +Description: RO. Maximum fan speed in RPM for each fan channel. + + Only supported for particular Intel Xe graphics platforms. + What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon/power1_cap Date: May 2025 KernelVersion: 6.15 diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c index 6558ed8281a3..3d040daee2c0 100644 --- a/drivers/gpu/drm/xe/xe_hwmon.c +++ b/drivers/gpu/drm/xe/xe_hwmon.c @@ -192,6 +192,8 @@ struct xe_hwmon_fan_info { u8 speed; } fcp[MAX_FAN_CONTROL_POINTS]; } fan_table[FAN_TABLE_MAX]; + /** @max_rps: maximum fan RPS */ + u32 max_rps; }; /** @@ -926,7 +928,8 @@ static const struct hwmon_channel_info * const hwmon_info[] = { HWMON_CHANNEL_INFO(curr, HWMON_C_LABEL, HWMON_C_CRIT | HWMON_C_LABEL), HWMON_CHANNEL_INFO(in, HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL), HWMON_CHANNEL_INFO(energy, HWMON_E_INPUT | HWMON_E_LABEL, HWMON_E_INPUT | HWMON_E_LABEL), - HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT, HWMON_F_INPUT, HWMON_F_INPUT), + HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_MAX, HWMON_F_INPUT | HWMON_F_MAX, + HWMON_F_INPUT | HWMON_F_MAX), NULL }; @@ -1180,14 +1183,25 @@ static int xe_hwmon_read_fan_control_info(struct xe_hwmon *hwmon) if (hwmon->xe->info.platform == XE_DG2) return -ENODATA; + /* Stock table failures leave fan_input and fan_max visible; they don't need it. */ for (fan = 0; fan < FAN_MAX; fan++) { struct fan_control_point stock_fcp[MAX_FAN_CONTROL_POINTS]; struct xe_hwmon_fan_info *fi = &hwmon->fi[fan]; u32 stock_fcp_count = 0; + u32 max_rps = 0; if (!IS_FAN_ENABLED(hwmon, fan)) continue; + ret = xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_MAX_FAN_RPS, fan, + &max_rps); + if (ret) { + xe_warn(hwmon->xe, "failed to read fan %d max RPS, ret=%d\n", fan, ret); + } else { + fi->max_rps = max_rps; + xe_dbg(hwmon->xe, "fan %d max RPS %u\n", fan, fi->max_rps); + } + ret = xe_hwmon_pcode_read_fan_control(hwmon, FSC_READ_STOCK_FAN_CONTROL_POINTS, fan, &stock_fcp_count); @@ -1781,6 +1795,8 @@ xe_hwmon_fan_is_visible(struct xe_hwmon *hwmon, u32 attr, int channel) switch (attr) { case hwmon_fan_input: return IS_FAN_ENABLED(hwmon, channel) ? 0444 : 0; + case hwmon_fan_max: + return IS_FAN_ENABLED(hwmon, channel) && hwmon->fi[channel].max_rps ? 0444 : 0; default: return 0; } @@ -1831,6 +1847,9 @@ xe_hwmon_fan_read(struct xe_hwmon *hwmon, u32 attr, int channel, long *val) switch (attr) { case hwmon_fan_input: return xe_hwmon_fan_input_read(hwmon, channel, val); + case hwmon_fan_max: + *val = mul_u32_u32(hwmon->fi[channel].max_rps, 60); + return 0; default: return -EOPNOTSUPP; } diff --git a/drivers/gpu/drm/xe/xe_pcode_api.h b/drivers/gpu/drm/xe/xe_pcode_api.h index 387885760205..2308e5464082 100644 --- a/drivers/gpu/drm/xe/xe_pcode_api.h +++ b/drivers/gpu/drm/xe/xe_pcode_api.h @@ -86,6 +86,7 @@ #define MEMORY_CONFIG_SUBCOMMAND_READ_MAX_FREQUENCY 0x1 #define FAN_SPEED_CONTROL 0x7D +#define FSC_READ_MAX_FAN_RPS 0x3 #define FSC_READ_NUM_FANS 0x4 #define FSC_READ_STOCK_FAN_CONTROL_POINTS 0x5 #define FSC_READ_FAN_TABLE 0x7 -- 2.34.1