]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Add helper to return any available hw engine
authorLucas De Marchi <lucas.demarchi@intel.com>
Fri, 17 May 2024 20:43:09 +0000 (13:43 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 21 May 2024 13:33:40 +0000 (06:33 -0700)
Get the first available engine from a gt, which helps in the case any
engine serves as a context, like when reading RING_TIMESTAMP.

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240517204310.88854-8-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_gt.c
drivers/gpu/drm/xe/xe_gt.h

index 5194a3d38e767de7c23a00a534cb7a6949996a4b..3432fef564869de7ac046be3fa009b88d1aabdab 100644 (file)
@@ -833,3 +833,14 @@ struct xe_hw_engine *xe_gt_any_hw_engine_by_reset_domain(struct xe_gt *gt,
 
        return NULL;
 }
+
+struct xe_hw_engine *xe_gt_any_hw_engine(struct xe_gt *gt)
+{
+       struct xe_hw_engine *hwe;
+       enum xe_hw_engine_id id;
+
+       for_each_hw_engine(hwe, gt, id)
+               return hwe;
+
+       return NULL;
+}
index 1d010bf4a756f56e6e3c8f290ad8c2f114a4fec3..9073ac68a7771a1203271526d8c22a8d4f445133 100644 (file)
@@ -67,6 +67,13 @@ void xe_gt_remove(struct xe_gt *gt);
 struct xe_hw_engine *
 xe_gt_any_hw_engine_by_reset_domain(struct xe_gt *gt, enum xe_engine_class class);
 
+/**
+ * xe_gt_any_hw_engine - scan the list of engines and return the
+ * first available
+ * @gt: GT structure
+ */
+struct xe_hw_engine *xe_gt_any_hw_engine(struct xe_gt *gt);
+
 struct xe_hw_engine *xe_gt_hw_engine(struct xe_gt *gt,
                                     enum xe_engine_class class,
                                     u16 instance,