[PATCH 1/3] drm/xe: Ensure caller uses sole domain for xe_force_wake_assert_held

Michal Wajdeczko michal.wajdeczko at intel.com
Thu Jun 6 12:49:43 UTC 2024



On 06.06.2024 14:41, Himal Prasad Ghimiray wrote:
> xe_force_wake_assert_held() is designed to confirm a particular
> forcewake domain's wakefulness; it doesn't verify the wakefulness of
> multiple domains. Make sure the caller doesn't input multiple domains as
> a parameter, this will ensure caller doesn't use xe_force_wake_assert_held
> with XE_FORCEWAKE_ALL parameter.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> Cc: Badal Nilawar <badal.nilawar at intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_force_wake.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_force_wake.h b/drivers/gpu/drm/xe/xe_force_wake.h
> index 83cb157da7cc..cee8ff039f83 100644
> --- a/drivers/gpu/drm/xe/xe_force_wake.h
> +++ b/drivers/gpu/drm/xe/xe_force_wake.h
> @@ -32,6 +32,9 @@ static inline void
>  xe_force_wake_assert_held(struct xe_force_wake *fw,
>  			  enum xe_force_wake_domains domain)
>  {
> +	/* Ensure caller is not passing multiple domains */
> +	xe_gt_assert(fw->gt, !(domain & (domain - 1)));

as all enumerators but XE_FORCEWAKE_ALL are defined as BIT then maybe it
is sufficient to just use clear to understand:

	xe_gt_assert(fw->gt, domain != XE_FORCEWAKE_ALL);

> +
>  	xe_gt_assert(fw->gt, fw->awake_domains & domain);
>  }
>  


More information about the Intel-xe mailing list