From mboxrd@z Thu Jan 1 00:00:00 1970 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 DF376606A322 for ; Wed, 2 Dec 2026 13:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YcmdM76g Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A7A01121D2; Wed, 2 Dec 2026 13:19:30 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CCFE10E41D for ; Wed, 2 Dec 2026 13:19:24 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 88DC5601EE; Wed, 2 Dec 2026 13:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DD3A1F00893; Wed, 2 Dec 2026 13:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796217563; bh=0M9h6H+kX8q11AqL3tYGUNBb8Kd0dxsm0ltBnoDbwGU=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=YcmdM76gIbC5oabZrqpeWwe4rxyN/LbmwQSaecr9/NInZcpWhB24iq4ZOCKXI2Ls3 EMOj9WkOprTr/s2KPHbdnelvXsPbOZeArWfiy1Uah9gEcFPNIS1xjVEzimiXj60LaS mQVOtDyprG2Fo1F/2McQA5AiziwyxFpkumLzXToFKuzddkBRh6whkjqxnqCXC/cfYc AzEtD1mZ7Nw+aq0YDbhXMCaEUANPQoZgKuQCfa63BmgrzEH9TDcccahEn06srHYrxg SVbPcYSQbvzcnEg3WsIAxZ6EHFThl1qtNAx29aCVK82+wUVb3proCqnmPmV5BjnTwh iR/GGHO87ecGw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v7 08/10] drm/xe/hwmon: Restore fan user tables after resume To: "Karthik Poosa" , intel-xe@lists.freedesktop.org In-Reply-To: <20261202125637.1581881-9-karthik.poosa@intel.com> References: <20261202125637.1581881-1-karthik.poosa@intel.com> <20261202125637.1581881-9-karthik.poosa@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 13:19:22 +0000 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: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] drm/xe/hwmon: unsupported TjMax PCODE read in xe_hwmon_suspend() - [Low] drm/xe/hwmon: tjmax_fan_control_enable lost when !CONFIG_HWMON -- commit 240231fa4007880cdb7d39faae47263adccfe2fa Author: Karthik Poosa drm/xe/hwmon: Restore fan user tables after resume This commit saves and restores active manual and full-speed fan user tables and the TjMax fan control state across system suspend, runtime D3cold, and FLR. [ ... ] > diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c > index 7cb7fefae1b8f..2fd6c2c50f2c1 100644 > --- a/drivers/gpu/drm/xe/xe_hwmon.c > +++ b/drivers/gpu/drm/xe/xe_hwmon.c [ ... ] > @@ -2931,4 +2949,131 @@ void xe_hwmon_unregister(struct xe_device *xe) > hwmon_device_unregister(xe->hwmon->hwmon_dev); > xe->hwmon =3D NULL; > } > + > +/** > + * xe_hwmon_suspend - Save hwmon state before suspend > + * @xe: xe device instance > + * @runtime: true for runtime suspend, false for system suspend or FLR p= repare > + * > + * Save any hwmon runtime state that must survive PM suspend transitions. > + */ > +void xe_hwmon_suspend(struct xe_device *xe, bool runtime) > +{ > + struct xe_hwmon *hwmon =3D READ_ONCE(xe->hwmon); > + int fan; > + > + if (!hwmon || !xe->info.has_fan_control) > + return; > + > + /* Runtime suspend keeps the fan tables unless the device enters d3cold= . */ > + if (runtime && !xe->d3cold.allowed) { > + xe_dbg(xe, "d3cold not allowed, skipping fan state snapshot\n"); > + return; > + } > + > + guard(mutex)(&hwmon->hwmon_lock); > + > + if (!runtime || xe->d3cold.allowed) { > + u32 val =3D 0; > + int ret; > + > + hwmon->tjmax_fan_control_state =3D XE_TJMAX_FAN_CONTROL_UNKNOWN; > + > + ret =3D xe_pcode_read(xe_device_get_root_tile(xe), > + PCODE_MBOX(FAN_SPEED_CONTROL, > + FSC_READ_TJMAX_FAN_CONTROL_MODE, 0), > + &val, NULL); > + if (ret) { > + xe_warn(xe, "failed to save fan tjmax control, ret=3D%d\n", ret); [Severity: Medium] Does xe_hwmon_suspend() issue an unsupported FSC_READ_TJMAX_FAN_CONTROL_MODE PCODE read on XE_DG2 and on devices without late-bound TjMax fan-control firmware? dg2_desc sets has_fan_control =3D true for MMIO fan speed reads, while the other FAN_SPEED_CONTROL PCODE helpers in xe_hwmon.c (xe_hwmon_get_fan_enable_mask() and xe_hwmon_read_fan_control_info()) explicitly skip XE_DG2. In addition, fan_control_attr_group in drivers/gpu/drm/xe/xe_device_sysfs.c notes that FSC_READ_TJMAX_FAN_CONTROL_MODE may only be supported after fan-control late binding. Issuing this command unconditionally on every system suspend, runtime D3cold suspend, and FLR logs a PCODE mailbox error and an xe_warn() whenever the platform or firmware does not support it. [ ... ] > diff --git a/drivers/gpu/drm/xe/xe_hwmon.h b/drivers/gpu/drm/xe/xe_hwmon.h > index e67e0134f02a5..50874b6b6527a 100644 > --- a/drivers/gpu/drm/xe/xe_hwmon.h > +++ b/drivers/gpu/drm/xe/xe_hwmon.h > @@ -13,9 +13,13 @@ struct xe_device; > #if IS_REACHABLE(CONFIG_HWMON) > int xe_hwmon_register(struct xe_device *xe); > void xe_hwmon_unregister(struct xe_device *xe); > +void xe_hwmon_suspend(struct xe_device *xe, bool runtime); > +void xe_hwmon_resume(struct xe_device *xe, bool runtime); > #else > static inline int xe_hwmon_register(struct xe_device *xe) { return 0; }; > static inline void xe_hwmon_unregister(struct xe_device *xe) { } > +static inline void xe_hwmon_suspend(struct xe_device *xe, bool runtime) = {} > +static inline void xe_hwmon_resume(struct xe_device *xe, bool runtime) {} > #endif [Severity: Low] Will tjmax_fan_control_enable lose its state across suspend, runtime D3cold, and FLR when !IS_REACHABLE(CONFIG_HWMON)? xe_device_sysfs_init() registers fan_control_attr_group on the PCI device regardless of CONFIG_HWMON, but the save and restore logic for tjmax_fan_control_enable lives in xe_hwmon_suspend() and xe_hwmon_resume(), which compile to no-ops when CONFIG_HWMON is not reachable. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202125637.1581= 881-1-karthik.poosa@intel.com?part=3D8