Skip to content

Commit 0305613

Browse files
llandwerlin-intelrodrigovivi
authored andcommitted
drm/i915/perf: workaround register corruption in OATAILPTR
After having written the entire OA buffer with reports, the HW will write again at the beginning of the OA buffer. It'll indicate it by setting the WRAP bits in the OASTATUS register. When a wrap happens and that at the end of the read vfunc we write the OASTATUS register back to clear the REPORT_LOST bit, we sometimes see that the OATAILPTR register is reset to a previous position on Gen8/9 (apparently not the case on Gen11+). This leads the next call to the read vfunc to process reports we've already read. Because we've marked those as read by clearing the reason & timestamp dwords, they're discarded and a "Skipping spurious, invalid OA report" message is emitted. The workaround to avoid this OATAILPTR value reset seems to be to set the wrap bits when writing back OASTATUS. This change has no impact on userspace, it only avoids a bunch of DRM_NOTE("Skipping spurious, invalid OA report\n") messages. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes: 19f81df ("drm/i915/perf: Add OA unit support for Gen 8+") Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201117130124.829979-1-lionel.g.landwerlin@intel.com (cherry picked from commit 059a0be) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 418baf2 commit 0305613

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,13 @@ static int gen8_oa_read(struct i915_perf_stream *stream,
909909
DRM_I915_PERF_RECORD_OA_REPORT_LOST);
910910
if (ret)
911911
return ret;
912-
intel_uncore_write(uncore, oastatus_reg,
913-
oastatus & ~GEN8_OASTATUS_REPORT_LOST);
912+
913+
intel_uncore_rmw(uncore, oastatus_reg,
914+
GEN8_OASTATUS_COUNTER_OVERFLOW |
915+
GEN8_OASTATUS_REPORT_LOST,
916+
IS_GEN_RANGE(uncore->i915, 8, 10) ?
917+
(GEN8_OASTATUS_HEAD_POINTER_WRAP |
918+
GEN8_OASTATUS_TAIL_POINTER_WRAP) : 0);
914919
}
915920

916921
return gen8_append_oa_reports(stream, buf, count, offset);

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
676676
#define GEN7_OASTATUS2_MEM_SELECT_GGTT (1 << 0) /* 0: PPGTT, 1: GGTT */
677677

678678
#define GEN8_OASTATUS _MMIO(0x2b08)
679+
#define GEN8_OASTATUS_TAIL_POINTER_WRAP (1 << 17)
680+
#define GEN8_OASTATUS_HEAD_POINTER_WRAP (1 << 16)
679681
#define GEN8_OASTATUS_OVERRUN_STATUS (1 << 3)
680682
#define GEN8_OASTATUS_COUNTER_OVERFLOW (1 << 2)
681683
#define GEN8_OASTATUS_OABUFFER_OVERFLOW (1 << 1)

0 commit comments

Comments
 (0)