Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Add helper to return any available hw engine

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>

+18
+11
drivers/gpu/drm/xe/xe_gt.c
··· 833 833 834 834 return NULL; 835 835 } 836 + 837 + struct xe_hw_engine *xe_gt_any_hw_engine(struct xe_gt *gt) 838 + { 839 + struct xe_hw_engine *hwe; 840 + enum xe_hw_engine_id id; 841 + 842 + for_each_hw_engine(hwe, gt, id) 843 + return hwe; 844 + 845 + return NULL; 846 + }
+7
drivers/gpu/drm/xe/xe_gt.h
··· 67 67 struct xe_hw_engine * 68 68 xe_gt_any_hw_engine_by_reset_domain(struct xe_gt *gt, enum xe_engine_class class); 69 69 70 + /** 71 + * xe_gt_any_hw_engine - scan the list of engines and return the 72 + * first available 73 + * @gt: GT structure 74 + */ 75 + struct xe_hw_engine *xe_gt_any_hw_engine(struct xe_gt *gt); 76 + 70 77 struct xe_hw_engine *xe_gt_hw_engine(struct xe_gt *gt, 71 78 enum xe_engine_class class, 72 79 u16 instance,