Validate gt instead of checking gt_id is lesser
than max gts per tile
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20250630093741.2435281-1-riana.tauro@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
        return true;
 }
 
-static bool event_supported(struct xe_pmu *pmu, unsigned int gt,
+static bool event_supported(struct xe_pmu *pmu, unsigned int gt_id,
                            unsigned int id)
 {
-       if (gt >= XE_MAX_GT_PER_TILE)
+       struct xe_device *xe = container_of(pmu, typeof(*xe), pmu);
+       struct xe_gt *gt = xe_device_get_gt(xe, gt_id);
+
+       if (!gt)
                return false;
 
        return id < sizeof(pmu->supported_events) * BITS_PER_BYTE &&