Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Sundaresan, Sujaritha" <sujaritha.sundaresan@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v2 1/2] drm/xe: Add a couple of pcode helpers
Date: Wed, 27 Sep 2023 15:32:10 +0530	[thread overview]
Message-ID: <76cdbdd9-507b-c4c3-2f49-f157f12a4bc5@intel.com> (raw)
In-Reply-To: <ZRMUqwN70Bl+foMo@intel.com>


On 9/26/2023 10:58 PM, Rodrigo Vivi wrote:
> On Tue, Sep 26, 2023 at 08:11:19PM +0530, Sujaritha Sundaresan wrote:
>> Some pcode commands take additional sub-commands and parameters. Add a
>> couple of helpers to help formatting these commands to improve code
>> readability.
>>
>> v2: change function name (Rodrigo)
>>
>> Signed-off-by: Sujaritha Sundaresan <sujaritha.sundaresan@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_pcode.c | 28 ++++++++++++++++++++++++++++
>>   drivers/gpu/drm/xe/xe_pcode.h |  3 +++
>>   2 files changed, 31 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
>> index 7f1bf2297f51..eed096ffc23c 100644
>> --- a/drivers/gpu/drm/xe/xe_pcode.c
>> +++ b/drivers/gpu/drm/xe/xe_pcode.c
>> @@ -104,6 +104,34 @@ int xe_pcode_read(struct xe_gt *gt, u32 mbox, u32 *val, u32 *val1)
>>   	return err;
>>   }
>>   
>> +int xe_gt_pcode_read(struct xe_gt *gt, u32 mbcmd, u32 p1, u32 p2, u32 *val)
>> +{
>> +	u32 mbox;
>> +	int err;
>> +
>> +	mbox = REG_FIELD_PREP(PCODE_MB_COMMAND, mbcmd)
>> +		| REG_FIELD_PREP(PCODE_MB_PARAM1, p1)
>> +		| REG_FIELD_PREP(PCODE_MB_PARAM2, p2);
>> +
>> +	err = xe_pcode_read(gt, mbox, val, NULL);
>> +
>> +	return err;
>> +}
>> +
>> +int xe_gt_pcode_write(struct xe_gt *gt, u32 mbcmd, u32 p1, u32 p2, u32 val)
>> +{
>> +	u32 mbox;
>> +	int err;
>> +
>> +	mbox = REG_FIELD_PREP(PCODE_MB_COMMAND, mbcmd)
>> +		| REG_FIELD_PREP(PCODE_MB_PARAM1, p1)
>> +		| REG_FIELD_PREP(PCODE_MB_PARAM2, p2);
>> +
>> +	err = xe_pcode_write(gt, mbox, val);
>> +
>> +	return err;
>> +}
>> +
>>   static int xe_pcode_try_request(struct xe_gt *gt, u32 mbox,
>>   				u32 request, u32 reply_mask, u32 reply,
>>   				u32 *status, bool atomic, int timeout_us)
>> diff --git a/drivers/gpu/drm/xe/xe_pcode.h b/drivers/gpu/drm/xe/xe_pcode.h
>> index 3b4aa8c1a3ba..79ae45e71228 100644
>> --- a/drivers/gpu/drm/xe/xe_pcode.h
>> +++ b/drivers/gpu/drm/xe/xe_pcode.h
>> @@ -19,6 +19,9 @@ int xe_pcode_write_timeout(struct xe_gt *gt, u32 mbox, u32 val,
>>   #define xe_pcode_write(gt, mbox, val) \
>>   	xe_pcode_write_timeout(gt, mbox, val, 1)
>>   
>> +int xe_gt_pcode_read(struct xe_gt *gt, u32 mbcmd, u32 p1, u32 p2, u32 *val);
>> +int xe_gt_pcode_write(struct xe_gt *gt, u32 mbcmd, u32 p1, u32 p2, u32 val);
> A few things that are wrong here:
>
> 1. namespace: xe_pcode is the name of the component. That should be in the prefix.
> Please notice the xe_mmio for instance on the tile option vs gt... 'tile' comes
> after the xe_mmio, not before.
>
> 2. 'gt' is already the main argument in the other xe_pcode functions, why are
> you adding that as prefix?
>
> 3. Please unify the read and write functions, without creating new ones.
> Please take a look to hwmon series there... There's a need for something
> different there, and that solution from Badal is better than adding new
> signatures. But please, let's combine them all.

I think I'll just skip the functions and have the mbox be defined in the 
call itself.

Thanks,

Suja

>
>> +
>>   int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request,
>>   		     u32 reply_mask, u32 reply, int timeout_ms);
>>   
>> -- 
>> 2.25.1
>>

  reply	other threads:[~2023-09-27 10:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 14:41 [Intel-xe] [PATCH v2 0/2] Add some performance and frequency sysfs nodes Sujaritha Sundaresan
2023-09-26 14:41 ` [Intel-xe] [PATCH v2 1/2] drm/xe: Add a couple of pcode helpers Sujaritha Sundaresan
2023-09-26 17:28   ` Rodrigo Vivi
2023-09-27 10:02     ` Sundaresan, Sujaritha [this message]
2023-09-26 14:41 ` [Intel-xe] [PATCH v2 2/2] drm/xe: Add base performance and vram frequency sysfs attributes Sujaritha Sundaresan
2023-09-26 17:31   ` Rodrigo Vivi
2023-09-27 10:03     ` Sundaresan, Sujaritha
2023-09-29  5:39     ` Riana Tauro
2023-09-29  6:03       ` Sundaresan, Sujaritha
2023-09-29  6:08         ` Sundaresan, Sujaritha
2023-09-26 15:18 ` [Intel-xe] ✓ CI.Patch_applied: success for Add some performance and frequency sysfs nodes (rev2) Patchwork
2023-09-26 15:18 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-09-26 15:19 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-09-26 15:27 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-09-26 15:27 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-09-26 15:28 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-09-26 15:54 ` [Intel-xe] ✗ CI.BAT: 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=76cdbdd9-507b-c4c3-2f49-f157f12a4bc5@intel.com \
    --to=sujaritha.sundaresan@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@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