Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/xe/xe3: Fix OAM stream broken on Xe3+
@ 2026-10-21  5:23 Shekhar Chauhan
  2026-10-21  5:29 ` ✗ CI.checkpatch: warning for drm/xe/xe3: Fix OAM stream broken on Xe3+ (rev3) Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Shekhar Chauhan @ 2026-10-21  5:23 UTC (permalink / raw)
  To: intel-xe; +Cc: shekhar.chauhan, umesh.nerlige.ramappa

OAM stream: Prevent partial reports at the end of the buffer
when overrun mode is enabled by making the buffer size
a multiple of the report size.

v2: Fix checkpatch issues by using a static func instead of #define.

Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
---
 drivers/gpu/drm/xe/xe_oa.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index a3484e943c55..f45d4970b29b 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -1743,6 +1743,15 @@ static const struct file_operations xe_oa_fops = {
 	.mmap		= xe_oa_mmap,
 };
 
+#define oag_has_tail_address_wrap(stream) \
+	(GRAPHICS_VER((stream)->oa->xe) >= 20 && \
+	 (stream)->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAG)
+
+#define oam_has_tail_address_wrap(stream) \
+	(MEDIA_VER((stream)->oa->xe) >= 30 && \
+	 ((stream)->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAM || \
+	  (stream)->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAM_SAG))
+
 static int xe_oa_stream_init(struct xe_oa_stream *stream,
 			     struct xe_oa_open_param *param)
 {
@@ -1767,12 +1776,13 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
 	stream->syncs = param->syncs;
 
 	/*
-	 * For Xe2+, when overrun mode is enabled, there are no partial reports at the end
-	 * of buffer, making the OA buffer effectively a non-power-of-2 size circular
-	 * buffer whose size, circ_size, is a multiple of the report size
+	 * For Xe2+ OAG and Xe3+ OAM, when overrun mode is enabled, there are no
+	 * partial reports at the end of buffer, making the OA buffer effectively a
+	 * non-power-of-2 size circular buffer whose size, circ_size, is
+	 * a multiple of the report size.
 	 */
-	if (GRAPHICS_VER(stream->oa->xe) >= 20 &&
-	    stream->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAG && stream->sample)
+	if (stream->sample &&
+	    (oag_has_tail_address_wrap(stream) || oam_has_tail_address_wrap(stream)))
 		stream->oa_buffer.circ_size =
 			param->oa_buffer_size -
 			param->oa_buffer_size % stream->oa_buffer.format->size;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH v2] drm/xe/xe3: Fix OAM stream broken on Xe3+
@ 2026-10-21  5:30 Shekhar Chauhan
  0 siblings, 0 replies; 7+ messages in thread
From: Shekhar Chauhan @ 2026-10-21  5:30 UTC (permalink / raw)
  To: intel-xe; +Cc: shekhar.chauhan, umesh.nerlige.ramappa

OAM stream: Prevent partial reports at the end of the buffer
when overrun mode is enabled by making the buffer size
a multiple of the report size.

v2: Fix checkpatch issues by using a static func instead of #define.

Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
---
 drivers/gpu/drm/xe/xe_oa.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index a3484e943c55..353880f2d5cb 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -1743,6 +1743,19 @@ static const struct file_operations xe_oa_fops = {
 	.mmap		= xe_oa_mmap,
 };
 
+static bool oag_has_tail_address_wrap(struct xe_oa_stream *stream)
+{
+	return GRAPHICS_VER(stream->oa->xe) >= 20 &&
+		stream->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAG;
+}
+
+static bool oam_has_tail_address_wrap(struct xe_oa_stream *stream)
+{
+	return MEDIA_VER(stream->oa->xe) >= 30 &&
+		(stream->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAM ||
+		 stream->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAM_SAG);
+}
+
 static int xe_oa_stream_init(struct xe_oa_stream *stream,
 			     struct xe_oa_open_param *param)
 {
@@ -1767,12 +1780,13 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
 	stream->syncs = param->syncs;
 
 	/*
-	 * For Xe2+, when overrun mode is enabled, there are no partial reports at the end
-	 * of buffer, making the OA buffer effectively a non-power-of-2 size circular
-	 * buffer whose size, circ_size, is a multiple of the report size
+	 * For Xe2+ OAG and Xe3+ OAM, when overrun mode is enabled, there are no
+	 * partial reports at the end of buffer, making the OA buffer effectively a
+	 * non-power-of-2 size circular buffer whose size, circ_size, is
+	 * a multiple of the report size.
 	 */
-	if (GRAPHICS_VER(stream->oa->xe) >= 20 &&
-	    stream->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAG && stream->sample)
+	if (stream->sample &&
+	    (oag_has_tail_address_wrap(stream) || oam_has_tail_address_wrap(stream)))
 		stream->oa_buffer.circ_size =
 			param->oa_buffer_size -
 			param->oa_buffer_size % stream->oa_buffer.format->size;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-21  6:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21  5:23 [PATCH v2] drm/xe/xe3: Fix OAM stream broken on Xe3+ Shekhar Chauhan
2026-10-21  5:29 ` ✗ CI.checkpatch: warning for drm/xe/xe3: Fix OAM stream broken on Xe3+ (rev3) Patchwork
2026-10-21  5:31 ` ✓ CI.KUnit: success " Patchwork
2026-10-21  5:33 ` [PATCH v2] drm/xe/xe3: Fix OAM stream broken on Xe3+ Shekhar Chauhan
2026-10-21  5:39 ` sashiko-bot
2026-10-21  6:14 ` ✓ Xe.CI.BAT: success for drm/xe/xe3: Fix OAM stream broken on Xe3+ (rev3) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2026-10-21  5:30 [PATCH v2] drm/xe/xe3: Fix OAM stream broken on Xe3+ Shekhar Chauhan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox