From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>,
Badal Nilawar <badal.nilawar@intel.com>
Subject: Re: [PATCH v2 2/2] drm/xe: Check valid domain is passed in xe_force_wake_ref
Date: Fri, 7 Jun 2024 17:39:40 +0530 [thread overview]
Message-ID: <9a6c33ca-b0b2-44d8-a9c4-e1b23966b2b0@intel.com> (raw)
In-Reply-To: <cbb037d2-43fd-491d-b8d1-d023b32c9758@intel.com>
On 07-06-2024 17:20, Michal Wajdeczko wrote:
>
>
> On 07.06.2024 07:22, Himal Prasad Ghimiray wrote:
>> Assert in case of XE_FORCEWAKE_ALL is passed.
>
> We assert that XE_FORCEWAKE_ALL is *not* passed ;)
Oops, Will modify it.
>
>>
>> v2
>> - use domain != XE_FORCEWAKE_ALL (Michal)
>>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>> Cc: Badal Nilawar <badal.nilawar@intel.com>
>> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_force_wake.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/xe/xe_force_wake.h
>> index 651ea1e62c63..346785df3b49 100644
>> --- a/drivers/gpu/drm/xe/xe_force_wake.h
>> +++ b/drivers/gpu/drm/xe/xe_force_wake.h
>> @@ -24,7 +24,7 @@ static inline int
>> xe_force_wake_ref(struct xe_force_wake *fw,
>> enum xe_force_wake_domains domain)
>> {
>> - xe_gt_assert(fw->gt, domain);
>> + xe_gt_assert(fw->gt, domain != XE_FORCEWAKE_ALL);
>
> IMO we still need to document our assumptions about enum values (as
> kernel-doc for enum xe_force_wake_domains) that all of them but ALL are
> single BIT values, so below trick to convert it back to index must work
> by design
Sure.
>
> then we can also add code more consistent with such description:
>
> xe_gt_assert(fw->gt, is_power_of_2(domain));
> return fw->domains[ilog2(domain)].ref;
>
> but this patch is still a good move, so
>
> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Thanks for the review.
>
>> return fw->domains[ffs(domain) - 1].ref;
>> }
>>
next prev parent reply other threads:[~2024-06-07 12:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 5:22 [PATCH v2 0/2] Assert for multiple or undefined forcewake domains Himal Prasad Ghimiray
2024-06-07 5:11 ` ✓ CI.Patch_applied: success for " Patchwork
2024-06-07 5:11 ` ✓ CI.checkpatch: " Patchwork
2024-06-07 5:12 ` ✓ CI.KUnit: " Patchwork
2024-06-07 5:22 ` [PATCH v2 1/2] drm/xe: Ensure caller uses sole domain for xe_force_wake_assert_held Himal Prasad Ghimiray
2024-06-07 11:23 ` Michal Wajdeczko
2024-06-07 12:11 ` Ghimiray, Himal Prasad
2024-06-07 5:22 ` [PATCH v2 2/2] drm/xe: Check valid domain is passed in xe_force_wake_ref Himal Prasad Ghimiray
2024-06-07 11:50 ` Michal Wajdeczko
2024-06-07 12:09 ` Ghimiray, Himal Prasad [this message]
2024-06-07 5:24 ` ✓ CI.Build: success for Assert for multiple or undefined forcewake domains Patchwork
2024-06-07 5:26 ` ✓ CI.Hooks: " Patchwork
2024-06-07 5:27 ` ✓ CI.checksparse: " Patchwork
2024-06-07 6:09 ` ✓ CI.BAT: " Patchwork
2024-06-07 14:01 ` ✓ 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=9a6c33ca-b0b2-44d8-a9c4-e1b23966b2b0@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=badal.nilawar@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=michal.wajdeczko@intel.com \
--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