[PATCH 1/3] drm/xe/xe_oa: Clear status only if relevant bits are set
Umesh Nerlige Ramappa <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
OA monitors only a few bits in the status field. The current read-modify-write will write to the MMIO even if none of the relevant bits are set. Clear the status only if relevant bits are set. Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: Ashutosh Dixit <[email protected]> --- v2: Move comment (Ashutosh) --- drivers/gpu/drm/xe/xe_oa.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c index b460fcdfca15..024940478c06 100644 --- a/drivers/gpu/drm/xe/xe_oa.c +++ b/drivers/gpu/drm/xe/xe_oa.c @@ -542,15 +542,17 @@ static int xe_oa_wait_unlocked(struct xe_oa_stream *stream) static int __xe_oa_read(struct xe_oa_stream *stream, char __user *buf, size_t count, size_t *offset) { - /* Only clear our bits to avoid side-effects */ - stream->oa_status = xe_mmio_rmw32(&stream->gt->mmio, __oa_regs(stream)->oa_status, - OASTATUS_RELEVANT_BITS, 0); + stream->oa_status = xe_mmio_read32(&stream->gt->mmio, __oa_regs(stream)->oa_status); /* * Signal to userspace that there is non-zero OA status to read via * @DRM_XE_OBSERVATION_IOCTL_STATUS observation stream fd ioctl */ - if (stream->oa_status & OASTATUS_RELEVANT_BITS) + if (stream->oa_status & OASTATUS_RELEVANT_BITS) { + /* Only clear our bits to avoid side-effects */ + xe_mmio_write32(&stream->gt->mmio, __oa_regs(stream)->oa_status, + stream->oa_status & ~OASTATUS_RELEVANT_BITS); return -EIO; + } return xe_oa_append_reports(stream, buf, count, offset); } -- 2.51.0