From: sashiko-bot@kernel.org
To: "Mallesh Koujalagi" <mallesh.koujalagi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v7 6/9] drm/xe/sysctrl: Replace FIELD_GET() with REG_FIELD_GET()
Date: Mon, 07 Sep 2026 11:04:31 +0000 [thread overview]
Message-ID: <20260907110431.8980F1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260907105313.2208003-17-mallesh.koujalagi@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Type-punning byte streams to a u32 array using memcpy() causes byte order reversal on big-endian systems during MMIO access.
--
commit 62065782d283be78ecb64ef05ff6080ad6f9d489
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
drm/xe/sysctrl: Replace FIELD_GET() with REG_FIELD_GET()
This commit replaces the FIELD_GET() and FIELD_PREP() macros with
REG_FIELD_GET() and REG_FIELD_PREP() when extracting or preparing fields
from SysCtrl and application headers. This better reflects that the masks
represent register-style bitfields and improves consistency.
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> index 50bbdab072de6..cdd929ebed4a6 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
[ ... ]
> @@ -186,8 +186,8 @@ static int sysctrl_process_frame(struct xe_sysctrl *sc, void *out,
> }
>
> ctrl_reg = xe_mmio_read32(sc->mmio, SYSCTRL_MB_CTRL);
> - total_frames = FIELD_GET(SYSCTRL_FRAME_TOTAL_MASK, ctrl_reg);
> - curr_frame = FIELD_GET(SYSCTRL_FRAME_CURRENT_MASK, ctrl_reg);
> + total_frames = REG_FIELD_GET(SYSCTRL_FRAME_TOTAL_MASK, ctrl_reg);
> + curr_frame = REG_FIELD_GET(SYSCTRL_FRAME_CURRENT_MASK, ctrl_reg);
>
> sysctrl_read_frame(sc, out, frame_size);
[Severity: High]
This isn't a bug introduced by this patch, but this is a pre-existing issue:
Does this code cause byte order reversal on big-endian systems during MMIO
access?
Looking at the implementation of sysctrl_read_frame() called here, the u32
value read via readl() (which already byte-swapped the little-endian PCI
register to CPU endianness) is incorrectly type-punned back into a byte
stream:
drivers/gpu/drm/xe/xe_sysctrl_mailbox.c:sysctrl_read_frame() {
...
for (i = 0; i < dw; i++)
val[i] = xe_mmio_read32(sc->mmio, regs[i]);
memcpy(frame, val, len);
}
This reverses the bytes on big-endian systems. A similar issue occurs in
sysctrl_write_frame() where the little-endian byte stream is type-punned
into a u32 array and undergoes an incorrect double byte-swap via writel().
Sending or receiving mailbox frames on a big-endian host through these
functions could lead to complete failure of the sysctrl mailbox
communication, resulting in driver initialization errors or missing
hardware control features.
> sysctrl_clear_response(sc);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907105313.2208003-11-mallesh.koujalagi@intel.com?part=6
next prev parent reply other threads:[~2026-09-07 11:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 10:53 [PATCH v7 0/9] drm/xe/sysctrl: Clean up error handling in Mallesh Koujalagi
2026-09-07 10:53 ` [PATCH v7 1/9] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_clear() Mallesh Koujalagi
2026-09-07 10:53 ` [PATCH v7 2/9] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set() Mallesh Koujalagi
2026-09-07 10:53 ` [PATCH v7 3/9] drm/xe/sysctrl: Make sysctrl_write_frame() void Mallesh Koujalagi
2026-09-07 10:53 ` [PATCH v7 4/9] drm/xe/sysctrl: Make sysctrl_read_frame() void Mallesh Koujalagi
2026-09-07 10:53 ` [PATCH v7 5/9] drm/xe/sysctrl: Use xe_assert() for payload size validation Mallesh Koujalagi
2026-09-07 10:53 ` [PATCH v7 6/9] drm/xe/sysctrl: Replace FIELD_GET() with REG_FIELD_GET() Mallesh Koujalagi
2026-09-07 11:04 ` sashiko-bot [this message]
2026-09-07 11:47 ` Michal Wajdeczko
2026-09-07 12:07 ` Mallesh, Koujalagi
2026-09-07 14:07 ` Michal Wajdeczko
2026-09-08 7:36 ` Mallesh, Koujalagi
2026-09-07 10:53 ` [PATCH v7 7/9] drm/xe/sysctrl: Improve firmware response error logging Mallesh Koujalagi
2026-09-07 11:03 ` sashiko-bot
2026-09-07 10:53 ` [PATCH v7 8/9] drm/xe/sysctrl: Log group and command ID on mailbox failure Mallesh Koujalagi
2026-09-07 10:53 ` [PATCH v7 9/9] drm/xe/sysctrl: Report 'System Controller event' error using SIGID Mallesh Koujalagi
2026-09-07 12:19 ` ✓ CI.KUnit: success for drm/xe/sysctrl: Clean up error handling in (rev4) Patchwork
2026-09-08 8:05 ` Patchwork
2026-09-08 10:30 ` ✓ CI.KUnit: success for drm/xe/sysctrl: Clean up error handling in (rev5) Patchwork
2026-09-08 11:28 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-08 14:15 ` ✓ 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=20260907110431.8980F1F00A3E@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=mallesh.koujalagi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.