From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Mallesh, Koujalagi" <mallesh.koujalagi@intel.com>,
<intel-xe@lists.freedesktop.org>, <rodrigo.vivi@intel.com>,
<matthew.brost@intel.com>
Cc: <anshuman.gupta@intel.com>, <badal.nilawar@intel.com>,
<vinay.belgaumkar@intel.com>, <riana.tauro@intel.com>,
<karthik.poosa@intel.com>, <sk.anirban@intel.com>,
<raag.jadav@intel.com>, <aravind.iddamsetty@linux.intel.com>,
<umesh.nerlige.ramappa@intel.com>,
<dnyaneshwar.bhadane@intel.com>, <anoop.c.vijay@intel.com>
Subject: Re: [PATCH v7 6/9] drm/xe/sysctrl: Replace FIELD_GET() with REG_FIELD_GET()
Date: Mon, 7 Sep 2026 16:07:27 +0200 [thread overview]
Message-ID: <f5cf7284-f9b8-4e80-af35-aa02a99bdac1@intel.com> (raw)
In-Reply-To: <6ea0523c-0a37-4fdb-be63-ff0f2b8d0774@intel.com>
On 9/7/2026 2:07 PM, Mallesh, Koujalagi wrote:
>
> On 07-09-2026 05:17 pm, Michal Wajdeczko wrote:
>>
>> On 9/7/2026 12:53 PM, Mallesh Koujalagi wrote:
>>> Use REG_FIELD_GET() when extracting fields from SysCtrl and
>> nit:
>>
>> Use REG_FIELD_GET()and REG_FIELD_PREP() when working with fields
> Sure!
>>
>>> application headers. This better reflects that the masks
>>> represent register-style bitfields and improves consistency.
>>>
>>> Signed-off-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
>>> ---
>>> v7:
>>> - Update FIELD_PREP to REG_FIELD_PREP. (Sashiko)
>>> - Update FIELD_GET to REG_FIELD_GET.
>>> ---
>>> drivers/gpu/drm/xe/xe_sysctrl_mailbox.c | 20 ++++++++++----------
>>> drivers/gpu/drm/xe/xe_sysctrl_mailbox.h | 6 +++---
>>> 2 files changed, 13 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
>>> index 50bbdab072de..cdd929ebed4a 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))
>>> #define XE_SYSCTRL_HDR_COMMAND(hdr) \
>>> - FIELD_GET(SYSCTRL_HDR_COMMAND_MASK, le32_to_cpu((hdr)->data))
>>> + REG_FIELD_GET(SYSCTRL_HDR_COMMAND_MASK, le32_to_cpu((hdr)->data))
>>> #define XE_SYSCTRL_HDR_IS_RESPONSE(hdr) \
>>> - FIELD_GET(SYSCTRL_HDR_IS_RESPONSE, le32_to_cpu((hdr)->data))
>>> + REG_FIELD_GET(SYSCTRL_HDR_IS_RESPONSE, le32_to_cpu((hdr)->data))
>>> #define XE_SYSCTRL_HDR_RESULT(hdr) \
>>> - FIELD_GET(SYSCTRL_HDR_RESULT_MASK, le32_to_cpu((hdr)->data))
>>> + REG_FIELD_GET(SYSCTRL_HDR_RESULT_MASK, le32_to_cpu((hdr)->data))
>>> static int sysctrl_wait_bit_clear(struct xe_sysctrl *sc, u32 bit_mask,
>>> unsigned int timeout_ms)
>>> @@ -112,8 +112,8 @@ static int sysctrl_prepare_command(struct xe_device *xe,
>>> return -ENOMEM;
>>> hdr = (struct xe_sysctrl_mailbox_msg_hdr *)buffer;
>>> - hdr->data = cpu_to_le32(FIELD_PREP(SYSCTRL_HDR_GROUP_ID_MASK, group_id) |
>>> - FIELD_PREP(SYSCTRL_HDR_COMMAND_MASK, command));
>>> + hdr->data = cpu_to_le32(REG_FIELD_PREP(SYSCTRL_HDR_GROUP_ID_MASK, group_id) |
>>> + REG_FIELD_PREP(SYSCTRL_HDR_COMMAND_MASK, command));
>>> if (data_in && data_in_len)
>>> memcpy(buffer + sizeof(*hdr), data_in, data_in_len);
>>> @@ -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);
>>> sysctrl_clear_response(sc);
>>> @@ -295,8 +295,8 @@ void xe_sysctrl_create_command(struct xe_sysctrl_mailbox_command *command, u8 gr
>>> {
>>> struct xe_sysctrl_app_msg_hdr header = {0};
>>> - header.data = FIELD_PREP(APP_HDR_GROUP_ID_MASK, group_id) |
>>> - FIELD_PREP(APP_HDR_COMMAND_MASK, cmd_id);
>>> + header.data = REG_FIELD_PREP(APP_HDR_GROUP_ID_MASK, group_id) |
>>> + REG_FIELD_PREP(APP_HDR_COMMAND_MASK, cmd_id);
>> hmm, shouldn't we use le32 conversion here?
>> other sysctrl cmd/hdr parsing/prep seems to use it
>
> le32 conversion is not required.
>
> le32 already removed in the code, find the change: https://patchwork.freedesktop.org/patch/717045/?series=164526&rev=1
hmm, but was this fix correct? maybe the problem is elsewhere?
today we have:
struct xe_sysctrl_mailbox_msg_hdr {
__le32 data;
} __packed;
and:
struct xe_sysctrl_app_msg_hdr {
u32 data;
} __packed;
both used during sysctrl communication but only one is using __le32
IMO either both or none should use __le32,
or I'm missing something?
>
>>
>>> command->header = header;
>>> command->data_in = request;
>>> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox.h
>>> index f0d5e3d7f5e3..5a3dd14e3a11 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)
>>> #define XE_SYSCTRL_APP_HDR_COMMAND(hdr) \
>>> - FIELD_GET(APP_HDR_COMMAND_MASK, (hdr)->data)
>>> + REG_FIELD_GET(APP_HDR_COMMAND_MASK, (hdr)->data)
>>> #define XE_SYSCTRL_APP_HDR_VERSION(hdr) \
>>> - FIELD_GET(APP_HDR_VERSION_MASK, (hdr)->data)
>>> + REG_FIELD_GET(APP_HDR_VERSION_MASK, (hdr)->data)
>> ditto
> ditto
>>> void xe_sysctrl_create_command(struct xe_sysctrl_mailbox_command *command, u8 group_id, u8 cmd_id,
>>> void *request, size_t request_len, void *response,
next prev parent reply other threads:[~2026-09-07 14:07 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
2026-09-07 11:47 ` Michal Wajdeczko
2026-09-07 12:07 ` Mallesh, Koujalagi
2026-09-07 14:07 ` Michal Wajdeczko [this message]
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=f5cf7284-f9b8-4e80-af35-aa02a99bdac1@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=anoop.c.vijay@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=aravind.iddamsetty@linux.intel.com \
--cc=badal.nilawar@intel.com \
--cc=dnyaneshwar.bhadane@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=karthik.poosa@intel.com \
--cc=mallesh.koujalagi@intel.com \
--cc=matthew.brost@intel.com \
--cc=raag.jadav@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=sk.anirban@intel.com \
--cc=umesh.nerlige.ramappa@intel.com \
--cc=vinay.belgaumkar@intel.com \
/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.