Skip to content

Commit b9329f5

Browse files
rtauro1895mattrope
authored andcommitted
drm/xe/xe_pmu: Validate gt in event supported
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>
1 parent d4eb4a0 commit b9329f5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/gpu/drm/xe/xe_pmu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,13 @@ static bool event_gt_forcewake(struct perf_event *event)
157157
return true;
158158
}
159159

160-
static bool event_supported(struct xe_pmu *pmu, unsigned int gt,
160+
static bool event_supported(struct xe_pmu *pmu, unsigned int gt_id,
161161
unsigned int id)
162162
{
163-
if (gt >= XE_MAX_GT_PER_TILE)
163+
struct xe_device *xe = container_of(pmu, typeof(*xe), pmu);
164+
struct xe_gt *gt = xe_device_get_gt(xe, gt_id);
165+
166+
if (!gt)
164167
return false;
165168

166169
return id < sizeof(pmu->supported_events) * BITS_PER_BYTE &&

0 commit comments

Comments
 (0)