Skip to content

Commit dde4c3d

Browse files
unerligetursulin
authored andcommitted
drm/i915/perf: Consider OA buffer boundary when zeroing out reports
For reports that are not powers of 2, reports at the end of the OA buffer may get split across the buffer boundary. When zeroing out such reports, take the split into consideration. v2: Use OA_BUFFER_SIZE (Ashutosh) Fixes: 09a3601 ("drm/i915/perf: Clear out entire reports after reading if not power of 2 size") Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: Ashutosh Dixit <[email protected]> Signed-off-by: Ashutosh Dixit <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 40b1588) Signed-off-by: Tvrtko Ursulin <[email protected]>
1 parent 5c41318 commit dde4c3d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,17 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,
868868
oa_report_id_clear(stream, report32);
869869
oa_timestamp_clear(stream, report32);
870870
} else {
871+
u8 *oa_buf_end = stream->oa_buffer.vaddr +
872+
OA_BUFFER_SIZE;
873+
u32 part = oa_buf_end - (u8 *)report32;
874+
871875
/* Zero out the entire report */
872-
memset(report32, 0, report_size);
876+
if (report_size <= part) {
877+
memset(report32, 0, report_size);
878+
} else {
879+
memset(report32, 0, part);
880+
memset(oa_buf_base, 0, report_size - part);
881+
}
873882
}
874883
}
875884

0 commit comments

Comments
 (0)