[RFC 0/3] FW guard class

Michal Wajdeczko michal.wajdeczko at intel.com
Mon Jun 17 14:34:27 UTC 2024


There is support for 'classes' with constructor and destructor
semantics that can be used for any scope-based resource management,
like device force-wake management.

Add necessary definitions explicitly, since existing macros from
linux/cleanup.h can't deal with our specific requirements yet.

This should allow us to use:

	scoped_guard(xe_fw, fw, XE_FW_GT)
		foo();
or
	CLASS(xe_fw, var)(fw, XE_FW_GT);

without any concern of leaking the force-wake references.

Note: this is preliminary code as right now it's unclear how to
correctly handle errors from the force-wake functions.

Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>

Michal Wajdeczko (3):
  drm/xe: Introduce force-wake guard class
  drm/xe: Use new FW guard in xe_mocs.c
  drm/xe: Use new FW guard in xe_pat.c

 drivers/gpu/drm/xe/xe_force_wake.h       | 48 +++++++++++++++++++
 drivers/gpu/drm/xe/xe_force_wake_types.h | 12 +++++
 drivers/gpu/drm/xe/xe_mocs.c             | 12 +----
 drivers/gpu/drm/xe/xe_pat.c              | 60 ++++++++----------------
 4 files changed, 82 insertions(+), 50 deletions(-)

-- 
2.43.0



More information about the Intel-xe mailing list