From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Poosa, Karthik" <karthik.poosa@intel.com>
Cc: <sashiko-reviews@lists.linux.dev>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v13 04/16] drm/xe/hwmon: Add helpers to validate thermal sensor readings
Date: Wed, 14 Oct 2026 13:51:07 -0400 [thread overview]
Message-ID: <as_BC39_06w-A0-0@intel.com> (raw)
In-Reply-To: <2348ff5c-6d98-4f9f-b4f5-1ca164920ddf@intel.com>
On Wed, Oct 14, 2026 at 06:47:01PM +0530, Poosa, Karthik wrote:
>
> On 14-10-2026 17:41, sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > - [Low] drm/xe/hwmon: mbx_temp_valid() fails to reject 0x80 (-0°C) as invalid
> > --
> >
> > commit cc835292455ece8a38adb02fe6e4c345fc3aa89a
> > Author: Karthik Poosa <karthik.poosa@intel.com>
> >
> > drm/xe/hwmon: Add helpers to validate thermal sensor readings
> >
> > This commit adds mmio_temp_valid() and mbx_temp_valid() to validate
> > temperature sensor readings. It uses the has_temp_sentinel flag to gate
> > these checks and rejects 0xFF for mailbox and 0xFFFFFFFF for MMIO.
> >
> > > diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
> > > index 1b4efbf4ac999..883a0ae1d90e3 100644
> > > --- a/drivers/gpu/drm/xe/xe_hwmon.c
> > > +++ b/drivers/gpu/drm/xe/xe_hwmon.c
> > [ ... ]
> > > @@ -834,6 +837,30 @@ static int xe_hwmon_pcode_read_thermal_info(struct xe_hwmon *hwmon)
> > > return ret;
> > > }
> > [ ... ]
> > > +/* Mailbox temperature is sign-magnitude (bit 7 sign, bits 6:0 magnitude). */
> > > +static inline bool mbx_temp_valid(const struct xe_hwmon *hwmon, u8 value)
> > > +{
> > > + if (value == TEMP_MBX_INVALID)
> > > + return false;
> > > +
> > > + return hwmon->xe->info.has_temp_sentinel || value != 0;
> > [Severity: Low]
> > Does this raw byte check fail to reject 0x80?
> >
> > Since 0x80 represents -0 degrees Celsius in the sign-magnitude format (sign
> > bit 7 is set, magnitude bits 6:0 are zero), it evaluates to true here
> > because 0x80 is not equal to 0.
> hardware will not send 0x80, so this case is not expected in practice.
> >
> > > +}
> > > +
> > > +/* Decode an 8-bit sign-magnitude mailbox temperature to degrees Celsius. */
> > > +static int mbx_temp_decode(u8 value)
> > > +{
> > > + int temp = value & TEMP_MBX_MAG;
> > > +
> > > + return (value & TEMP_MBX_SIGN) ? -temp : temp;
> > If 0x80 is passed here, it decodes to 0 degrees Celsius.
> >
> > This means the fallback safety logic in mbx_temp_valid() intended to reject
> > uninitialized 0 degrees Celsius readings can be bypassed if the hardware
> > returns 0x80 instead of 0x00. This could fold invalid readings into the
> > temperature average.
> >
> > > +}
> same as above
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
next prev parent reply other threads:[~2026-10-14 17:51 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 11:57 [PATCH v13 00/16] drm/xe/hwmon: Update hwmon thermal mailbox Karthik Poosa
2026-10-14 11:57 ` [PATCH v13 01/16] drm/xe/hwmon: Fix pcode power limit handling Karthik Poosa
2026-10-14 17:46 ` Rodrigo Vivi
2026-10-14 11:57 ` [PATCH v13 02/16] drm/xe/hwmon: Decode mailbox temperature as sign-magnitude Karthik Poosa
2026-10-14 11:57 ` [PATCH v13 03/16] drm/xe/hwmon: Fix thermal sensor data handling Karthik Poosa
2026-10-14 12:16 ` sashiko-bot
2026-10-14 13:42 ` Poosa, Karthik
2026-10-14 17:49 ` Rodrigo Vivi
2026-10-14 11:57 ` [PATCH v13 04/16] drm/xe/hwmon: Add helpers to validate thermal sensor readings Karthik Poosa
2026-10-14 12:11 ` sashiko-bot
2026-10-14 13:17 ` Poosa, Karthik
2026-10-14 17:51 ` Rodrigo Vivi [this message]
2026-10-14 11:57 ` [PATCH v13 05/16] drm/xe/hwmon: Handle unavailable memory controller sensors Karthik Poosa
2026-10-14 11:57 ` [PATCH v13 06/16] drm/xe/hwmon: Detect unavailable PCIe thermal sensors Karthik Poosa
2026-10-14 11:57 ` [PATCH v13 07/16] drm/xe/hwmon: Consolidate temperature sensor availability checks Karthik Poosa
2026-10-14 11:57 ` [PATCH v13 08/16] drm/xe/hwmon: Cache temperature availability to reduce probe time Karthik Poosa
2026-10-14 11:57 ` [PATCH v13 09/16] drm/xe/hwmon: use CRI-specific package and VRAM temperature registers Karthik Poosa
2026-10-14 11:58 ` [PATCH v13 10/16] drm/xe/hwmon: Add platform-aware VRAM thermal channel support Karthik Poosa
2026-10-14 11:58 ` [PATCH v13 11/16] drm/xe/hwmon: Decode CRI temperature registers as IEEE-754 Karthik Poosa
2026-10-14 17:53 ` Rodrigo Vivi
2026-10-14 11:58 ` [PATCH v13 12/16] drm/xe/hwmon: Update memory controller temperature offset for CRI Karthik Poosa
2026-10-14 17:52 ` Rodrigo Vivi
2026-10-14 19:33 ` Poosa, Karthik
2026-10-14 20:01 ` Rodrigo Vivi
2026-10-14 11:58 ` [PATCH v13 13/16] drm/xe/hwmon: add PCIe temperature support " Karthik Poosa
2026-10-14 11:58 ` [PATCH v13 14/16] drm/xe/hwmon: Simplify temperature channels config Karthik Poosa
2026-10-14 11:58 ` [PATCH v13 15/16] drm/xe: Validate thermal sensor count before reads Karthik Poosa
2026-10-14 17:53 ` Rodrigo Vivi
2026-10-14 11:58 ` [PATCH v13 16/16] drm/xe/hwmon: Propagate all hardware read errors Karthik Poosa
2026-10-14 12:12 ` ✓ CI.KUnit: success for drm/xe/hwmon: Update hwmon thermal mailbox Patchwork
2026-10-14 18:40 ` ✓ Xe.CI.BAT: " 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=as_BC39_06w-A0-0@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=karthik.poosa@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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