From: sashiko-bot@kernel.org
To: "Mallesh Koujalagi" <mallesh.koujalagi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v5 5/7] drm/xe/sysctrl: Improve firmware response error logging
Date: Tue, 25 Aug 2026 11:22:45 +0000 [thread overview]
Message-ID: <20260825112245.B11A81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260825110542.1359776-14-mallesh.koujalagi@intel.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Low] Build failure due to missing `xe_log.h` and undeclared `xe_log_err` function.
Pre-existing issues:
- [High] Endianness bug in MMIO data transfer causes hardware state machine corruption on big-endian hosts.
- [High] Mailbox response reader truncates oversized responses without draining the mailbox, leading to hardware state machine corruption.
--
--- Patch [5]: [PATCH v5 5/7] drm/xe/sysctrl: Improve firmware response error logging ---
commit aca0eba486b26ff6a9ae8a95c07e0dfce167281d
Author: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
drm/xe/sysctrl: Improve firmware response error logging
Use xe_log_err() helper and include additional details when a
response header mismatch occurs.
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> index f8b518dcafa24..5032d766b3142 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
[ ... ]
> @@ -237,13 +237,17 @@ static int sysctrl_receive_frames(struct xe_sysctrl *sc,
> 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)) {
> - xe_err(xe, "sysctrl: Response header mismatch\n");
> + xe_log_err(xe, SYSCTRL, -EPROTO,
> + "Response header mismatch: got group=%#x cmd=%#x is_resp=%u, expected group=%#x cmd=%#x\n",
> + XE_SYSCTRL_HDR_GROUP_ID(hdr), XE_SYSCTRL_HDR_COMMAND(hdr),
> + XE_SYSCTRL_HDR_IS_RESPONSE(hdr),
> + XE_SYSCTRL_HDR_GROUP_ID(req), XE_SYSCTRL_HDR_COMMAND(req));
[Severity: Low]
Does this code fail to compile? It looks like xe_log.h is missing from the
source tree, meaning xe_log_err and SYSCTRL might be undeclared identifiers.
> return -EPROTO;
> }
>
> if (XE_SYSCTRL_HDR_RESULT(hdr) != 0) {
> - xe_err(xe, "sysctrl: Firmware error: 0x%02lx\n",
> - XE_SYSCTRL_HDR_RESULT(hdr));
> + xe_log_err(xe, SYSCTRL, -EIO, "Firmware error: %#04x\n",
> + XE_SYSCTRL_HDR_RESULT(hdr));
> return -EIO;
> }
[Severity: High]
This is a pre-existing issue, but does this loop truncate oversized responses
without draining the mailbox?
drivers/gpu/drm/xe/xe_sysctrl_mailbox.c:sysctrl_receive_frames() {
...
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;
}
...
}
If the firmware sends more frames than expected by data_out_len, remain
becomes 0 before done is set to true. The loop exits silently and returns
success, leaving the unread frames in the mailbox.
Will subsequent mailbox commands write to the control register while it is
still busy, potentially corrupting the hardware state machine?
[Severity: High]
This is a pre-existing issue, but is there an endianness mismatch in the MMIO
data transfers here?
drivers/gpu/drm/xe/xe_sysctrl_mailbox.c:sysctrl_write_frame() {
...
memcpy(val, frame, len);
for (i = 0; i < dw; i++)
xe_mmio_write32(sc->mmio, regs[i], val[i]);
...
}
And similarly:
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);
...
}
When little-endian bytes are copied into native CPU-endian u32 arrays, won't
this result in an incorrect byte order on big-endian hosts?
The bytes could be placed in the wrong order inside the CPU-endian u32
values, and when the MMIO accessors byte-swap these values again, the
resulting byte stream on the wire might be reversed compared to the
intended payload.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260825110542.1359776-9-mallesh.koujalagi@intel.com?part=5
next prev parent reply other threads:[~2026-08-25 11:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 11:05 [PATCH v5 0/7] drm/xe/sysctrl: Clean up error handling in Mallesh Koujalagi
2026-08-25 11:05 ` [PATCH v5 1/7] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_clear() Mallesh Koujalagi
2026-08-25 11:24 ` sashiko-bot
2026-08-25 11:05 ` [PATCH v5 2/7] drm/xe/sysctrl: Return error codes from sysctrl_wait_bit_set() Mallesh Koujalagi
2026-08-25 11:24 ` sashiko-bot
2026-08-25 11:05 ` [PATCH v5 3/7] drm/xe/sysctrl: Make sysctrl_write_frame() void Mallesh Koujalagi
2026-08-25 11:05 ` [PATCH v5 4/7] drm/xe/sysctrl: Use xe_assert() for payload size validation Mallesh Koujalagi
2026-08-25 11:05 ` [PATCH v5 5/7] drm/xe/sysctrl: Improve firmware response error logging Mallesh Koujalagi
2026-08-25 11:22 ` sashiko-bot [this message]
2026-08-27 10:57 ` Michal Wajdeczko
2026-08-27 12:50 ` Mallesh, Koujalagi
2026-08-27 14:40 ` Michal Wajdeczko
2026-08-25 11:05 ` [PATCH v5 6/7] drm/xe/sysctrl: Log group and command ID on mailbox failure Mallesh Koujalagi
2026-08-25 11:21 ` sashiko-bot
2026-08-27 11:01 ` Michal Wajdeczko
2026-08-25 11:05 ` [PATCH v5 7/7] drm/xe/sysctrl: Report 'System Controller event' error using SIGID Mallesh Koujalagi
2026-08-25 11:18 ` sashiko-bot
2026-08-27 11:06 ` Michal Wajdeczko
2026-08-25 11:13 ` ✓ CI.KUnit: success for drm/xe/sysctrl: Clean up error handling in (rev2) Patchwork
2026-08-25 11:50 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-25 16:29 ` ✗ 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=20260825112245.B11A81F000E9@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