Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC647C98317 for ; Thu, 24 Sep 2026 11:13:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AA9110F472; Thu, 24 Sep 2026 11:13:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="WDp20BWe"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id E042910F472 for ; Thu, 24 Sep 2026 11:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1790248386; x=1821784386; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qLEOnxWbmZBz2/fvrum4hlLjvVdEW/q/5Cs9ikplZIQ=; b=WDp20BWe/Aejq+q9PUXSF7d3k8Gu2J6z7PiDoMqM2fpx9Z8ZBrEzgFkV TePVLYqw5SQySVjotl2/uPXANMKYius9vd322NnFamQzZHKTzWlp71LSf nGX/464/iqmADTgFTd3oeiO5L93BJztkR1305ZKQQE4BOdEwnfPllxH4c a2dPC7RkdXUNXHG7XAyB8CEUjsDsz4I1S2JJ5CUKPzAtiUCLdtgxgaX/Z BbzBDq+17JC366AQQI8o4DxcfNHQJsSHiU2riShw0mAiudgclTUlv21ca xpTSVIzngYJwccbbSidb1wRWdqjOH+qZQ9eABHu2O0+QK5nO1uZpmCYtV w==; X-CSE-ConnectionGUID: nkRNqZShQ96qdvp1PqzMpg== X-CSE-MsgGUID: OFG8RmhYSKyb92jmVo00tg== X-IronPort-AV: E=McAfee;i="6800,10657,11914"; a="101187723" X-IronPort-AV: E=Sophos;i="6.27,120,1787036400"; d="scan'208";a="101187723" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2026 04:13:06 -0700 X-CSE-ConnectionGUID: iFfPnaUJQgGKPi5lhNHKRA== X-CSE-MsgGUID: F8QWfhUSQUmmp7KfHNLtFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,120,1787036400"; d="scan'208";a="277394745" Received: from sinjan-super-server.iind.intel.com ([10.190.239.39]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2026 04:13:03 -0700 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, riana.tauro@intel.com, sk.anirban@intel.com, mallesh.koujalagi@intel.com, soham.purkait@intel.com, Karthik Poosa Subject: [PATCH v5 06/13] drm/xe/hwmon: Detect unavailable PCIe thermal sensors Date: Thu, 24 Sep 2026 16:41:49 +0530 Message-Id: <20260924111156.2628915-7-karthik.poosa@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260924111156.2628915-1-karthik.poosa@intel.com> References: <20260924111156.2628915-1-karthik.poosa@intel.com> 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Return -ENXIO from get_pcie_temp() when the mailbox reports an invalid reading, so the PCIe sensor can be treated as unavailable. Guard the val store so the function can be used purely as an availability probe. No sysfs visibility changes. Signed-off-by: Karthik Poosa --- drivers/gpu/drm/xe/xe_hwmon.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c index 905c3d6b3d3f..7bb7a5f402d1 100644 --- a/drivers/gpu/drm/xe/xe_hwmon.c +++ b/drivers/gpu/drm/xe/xe_hwmon.c @@ -897,7 +897,13 @@ static int get_pcie_temp(struct xe_hwmon *hwmon, long *val) data = REG_FIELD_GET(PCIE_SENSOR_MASK, data); data = REG_FIELD_GET(TEMP_MASK, data); - *val = mbx_temp_decode(data) * MILLIDEGREE_PER_DEGREE; + if (!mbx_temp_valid(hwmon, data)) { + drm_dbg(&hwmon->xe->drm, "PCIe temperature not available\n"); + return -ENXIO; + } + + if (val) + *val = mbx_temp_decode(data) * MILLIDEGREE_PER_DEGREE; return 0; } -- 2.25.1