Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/xe/guc: Use proper definitions while processing G2H events
Date: Wed, 10 Jan 2024 18:58:03 +0100	[thread overview]
Message-ID: <fc88c15b-73c1-4fdc-97f9-ef1be85fe378@intel.com> (raw)
In-Reply-To: <ZZ3oVfxAx6EKHuZR@DUT025-TGLU.fm.intel.com>



On 10.01.2024 01:44, Matthew Brost wrote:
> On Wed, Jan 10, 2024 at 12:00:14AM +0100, Michal Wajdeczko wrote:
>> While dispatching G2H events we should use HXG EVENT definitions,
>> no need to rely on outer CTB layer definitions that forced us to
>> use shifted offsets:
>>
>> 	FIELD_GET(GUC_HXG_MSG_0_xxx, msg[1])
>> vs
>> 	FIELD_GET(GUC_HXG_MSG_0_xxx, hxg[0])
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> ---
>>  drivers/gpu/drm/xe/xe_guc_ct.c | 15 +++++++++------
>>  1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
>> index c29f095aa1b9..9d1d855da229 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
>> @@ -923,18 +923,21 @@ static int parse_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
>>  	return ret;
>>  }
>>  
>> -static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
>> +static int process_g2h_msg(struct xe_guc_ct *ct, u32 *hxg, u32 len)
> 
> I can't say I love this change as we pass around ct->msg as an argument

IMO passing ct->msg together with the ct pointer is also questionable

> to bunch of other function and changing this to hxg makes this
> incongruent. Maybe change this patch to assign hxg from the msg first
> and then parse the fields from the hxg variable? Also maybe add a
> msg_to_hxg helper and cleanup all the msg[1] usage in this file too.
> This would make everything consistent.

since I also like consistency, lets start with local variable:

	u32 *hxg = msg_to_hxg(msg);

> 
> Matt
> 
>>  {
>>  	struct xe_device *xe = ct_to_xe(ct);
>>  	struct xe_guc *guc = ct_to_guc(ct);
>> -	u32 action = FIELD_GET(GUC_HXG_EVENT_MSG_0_ACTION, msg[1]);
>> -	u32 *payload = msg + GUC_CTB_HXG_MSG_MIN_LEN;
>> -	u32 adj_len = len - GUC_CTB_HXG_MSG_MIN_LEN;
>> +	u32 action, adj_len;
>> +	u32 *payload;
>>  	int ret = 0;
>>  
>> -	if (FIELD_GET(GUC_HXG_MSG_0_TYPE, msg[1]) != GUC_HXG_TYPE_EVENT)
>> +	if (FIELD_GET(GUC_HXG_MSG_0_TYPE, hxg[0]) != GUC_HXG_TYPE_EVENT)
>>  		return 0;
>>  
>> +	action = FIELD_GET(GUC_HXG_EVENT_MSG_0_ACTION, hxg[0]);
>> +	payload = hxg + GUC_HXG_EVENT_MSG_MIN_LEN;
>> +	adj_len = len - GUC_HXG_EVENT_MSG_MIN_LEN;
>> +
>>  	switch (action) {
>>  	case XE_GUC_ACTION_SCHED_CONTEXT_MODE_DONE:
>>  		ret = xe_guc_sched_done_handler(guc, payload, adj_len);
>> @@ -1145,7 +1148,7 @@ static int dequeue_one_g2h(struct xe_guc_ct *ct)
>>  	if (unlikely(ret < 0))
>>  		return ret;
>>  
>> -	ret = process_g2h_msg(ct, ct->msg, len);
>> +	ret = process_g2h_msg(ct, ct->msg + GUC_CTB_MSG_MIN_LEN, len - GUC_CTB_MSG_MIN_LEN);
>>  	if (unlikely(ret < 0))
>>  		return ret;
>>  
>>
>> base-commit: 39df1f6b1259816cc42b5f2451ca5092fad340ce
>> -- 
>> 2.25.1
>>

      reply	other threads:[~2024-01-10 17:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 23:00 [PATCH 1/2] drm/xe/guc: Use proper definitions while processing G2H events Michal Wajdeczko
2024-01-09 23:00 ` [PATCH 2/2] drm/xe/guc: Fix arguments passed to relay G2H handlers Michal Wajdeczko
2024-01-10  0:47   ` Matthew Brost
2024-01-10 17:55     ` Michal Wajdeczko
2024-01-09 23:23 ` ✓ CI.Patch_applied: success for series starting with [1/2] drm/xe/guc: Use proper definitions while processing G2H events Patchwork
2024-01-09 23:23 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-09 23:24 ` ✓ CI.KUnit: success " Patchwork
2024-01-09 23:32 ` ✓ CI.Build: " Patchwork
2024-01-09 23:32 ` ✓ CI.Hooks: " Patchwork
2024-01-09 23:33 ` ✓ CI.checksparse: " Patchwork
2024-01-10  0:08 ` ✓ CI.BAT: " Patchwork
2024-01-10  0:44 ` [PATCH 1/2] " Matthew Brost
2024-01-10 17:58   ` Michal Wajdeczko [this message]

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=fc88c15b-73c1-4fdc-97f9-ef1be85fe378@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox