From: sashiko-bot@kernel.org
To: "Mallesh Koujalagi" <mallesh.koujalagi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v6 6/9] drm/xe/sysctrl: Replace FIELD_GET() with REG_FIELD_GET()
Date: Mon, 31 Aug 2026 11:07:40 +0000 [thread overview]
Message-ID: <20260831110741.2C3781F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831104456.1770605-17-mallesh.koujalagi@intel.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Low] Incomplete migration to REG_FIELD_PREP() leaves packing logic inconsistent.
Pre-existing issues:
- [High] Hardware mailbox state machine lockup on oversized firmware response.
- [High] Endianness corruption on Big Endian architectures due to memcpy followed by writel.
--
commit 44f13e369dbf9b94796ecb4d99fe19420e2a9d18
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
drm/xe/sysctrl: Replace FIELD_GET() with REG_FIELD_GET()
Use REG_FIELD_GET() when extracting 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..3aa868f60b386 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> @@ -24,16 +24,16 @@ struct xe_sysctrl_mailbox_msg_hdr {
> } __packed;
>
> #define XE_SYSCTRL_HDR_GROUP_ID(hdr) \
> - FIELD_GET(SYSCTRL_HDR_GROUP_ID_MASK, le32_to_cpu((hdr)->data))
> + REG_FIELD_GET(SYSCTRL_HDR_GROUP_ID_MASK, le32_to_cpu((hdr)->data))
[Severity: Low]
Does this migration leave the packing logic inconsistent?
In sysctrl_prepare_command(), the code continues to use FIELD_PREP() despite
the getters being migrated to REG_FIELD_GET():
hdr->data = cpu_to_le32(FIELD_PREP(SYSCTRL_HDR_GROUP_ID_MASK, group_id) |
FIELD_PREP(SYSCTRL_HDR_COMMAND_MASK, command));
Should this be updated to REG_FIELD_PREP() for a complete migration?
[ ... ]
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h
> index f0d5e3d7f5e31..5a3dd14e3a110 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h
> @@ -15,13 +15,13 @@ struct xe_sysctrl;
> struct xe_sysctrl_mailbox_command;
>
> #define XE_SYSCTRL_APP_HDR_GROUP_ID(hdr) \
> - FIELD_GET(APP_HDR_GROUP_ID_MASK, (hdr)->data)
> + REG_FIELD_GET(APP_HDR_GROUP_ID_MASK, (hdr)->data)
[Severity: Low]
Does this incomplete migration leave xe_sysctrl_create_command() inconsistent?
While the getters in the header are updated to REG_FIELD_GET(), the packing
logic in xe_sysctrl_create_command() continues to use FIELD_PREP() for these
same masks:
header.data = FIELD_PREP(APP_HDR_GROUP_ID_MASK, group_id) |
FIELD_PREP(APP_HDR_COMMAND_MASK, cmd_id);
Should this be updated to REG_FIELD_PREP() as well?
[ ... ]
[Severity: High]
This is a pre-existing issue, but does sysctrl_receive_frames() leave the
hardware mailbox state machine wedged if the firmware response is oversized?
Looking at sysctrl_receive_frames() in drivers/gpu/drm/xe/xe_sysctrl_mailbox.c:
while (!done && remain) {
frame_size = min_t(size_t, remain, XE_SYSCTRL_MB_FRAME_SIZE);
ret = sysctrl_process_frame(sc, out, frame_size, timeout_ms,
&done);
if (ret)
return ret;
remain -= frame_size;
out += frame_size;
}
hdr = (struct xe_sysctrl_mailbox_msg_hdr *)buffer;
if (!XE_SYSCTRL_HDR_IS_RESPONSE(hdr) ||
XE_SYSCTRL_HDR_GROUP_ID(hdr) != XE_SYSCTRL_HDR_GROUP_ID(req) ||
XE_SYSCTRL_HDR_COMMAND(hdr) != XE_SYSCTRL_HDR_COMMAND(req)) {
If the firmware sends a response larger than expected, the loop exits when
remain reaches 0 even though the firmware indicates more frames are pending
(done == false).
The function then evaluates the header and returns without draining the
remaining frames from the hardware.
Does this leave the firmware stuck waiting for the host to clear
SYSCTRL_MB_CTRL_RUN_BUSY_OUT, preventing any subsequent mailbox communication?
[Severity: High]
This is a pre-existing issue, but can this cause endianness corruption on
Big Endian architectures?
In sysctrl_write_frame() in drivers/gpu/drm/xe/xe_sysctrl_mailbox.c:
memcpy(val, frame, len);
for (i = 0; i < dw; i++)
xe_mmio_write32(sc->mmio, regs[i], val[i]);
A little-endian byte array is copied into a u32 array with memcpy() and then
written with an endian-swapping MMIO accessor.
On Big Endian platforms, the u32 value constructed via memcpy evaluates with
its bytes logically reversed.
When this is passed to xe_mmio_write32() (which performs a cpu_to_le32()
conversion), the value is byte-swapped again, writing the bytes in reversed
order.
The same issue exists in reverse in sysctrl_read_frame():
for (i = 0; i < dw; i++)
val[i] = xe_mmio_read32(sc->mmio, regs[i]);
memcpy(frame, val, len);
Does this endian-swapped MMIO read being copied directly into a byte buffer
via memcpy corrupt the response byte order on Big Endian?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831104456.1770605-11-mallesh.koujalagi@intel.com?part=6
next prev parent reply other threads:[~2026-08-31 11:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 10:44 [PATCH v6 0/9] drm/xe/sysctrl: Clean up error handling in Mallesh Koujalagi
2026-08-31 10:44 ` [PATCH v6 1/9] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_clear() Mallesh Koujalagi
2026-08-31 10:55 ` sashiko-bot
2026-09-04 6:01 ` Tauro, Riana
2026-08-31 10:44 ` [PATCH v6 2/9] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set() Mallesh Koujalagi
2026-08-31 10:59 ` sashiko-bot
2026-08-31 10:45 ` [PATCH v6 3/9] drm/xe/sysctrl: Make sysctrl_write_frame() void Mallesh Koujalagi
2026-08-31 10:45 ` [PATCH v6 4/9] drm/xe/sysctrl: Make sysctrl_read_frame() void Mallesh Koujalagi
2026-09-02 16:16 ` Michal Wajdeczko
2026-09-03 4:45 ` Mallesh, Koujalagi
2026-08-31 10:45 ` [PATCH v6 5/9] drm/xe/sysctrl: Use xe_assert() for payload size validation Mallesh Koujalagi
2026-08-31 10:45 ` [PATCH v6 6/9] drm/xe/sysctrl: Replace FIELD_GET() with REG_FIELD_GET() Mallesh Koujalagi
2026-08-31 11:07 ` sashiko-bot [this message]
2026-08-31 10:45 ` [PATCH v6 7/9] drm/xe/sysctrl: Improve firmware response error logging Mallesh Koujalagi
2026-08-31 11:00 ` sashiko-bot
2026-09-02 16:22 ` Michal Wajdeczko
2026-09-03 4:59 ` Mallesh, Koujalagi
2026-08-31 10:45 ` [PATCH v6 8/9] drm/xe/sysctrl: Log group and command ID on mailbox failure Mallesh Koujalagi
2026-08-31 11:00 ` sashiko-bot
2026-08-31 10:45 ` [PATCH v6 9/9] drm/xe/sysctrl: Report 'System Controller event' error using SIGID Mallesh Koujalagi
2026-08-31 11:00 ` sashiko-bot
2026-08-31 14:37 ` ✓ CI.KUnit: success for drm/xe/sysctrl: Clean up error handling in (rev3) Patchwork
2026-08-31 15:26 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-31 17:52 ` ✗ Xe.CI.FULL: failure " 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=20260831110741.2C3781F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox