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

Himal Prasad Ghimiray himal.prasad.ghimiray at intel.com
Thu Jun 6 12:41:31 UTC 2024


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)));
+
 	xe_gt_assert(fw->gt, fw->awake_domains & domain);
 }
 
-- 
2.25.1



More information about the Intel-xe mailing list