Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: ashutosh.dixit@intel.com, sai.teja.pottumuttu@intel.com
Subject: [PATCH v2 1/3] drm/xe/oa: Increase default OA buffer size to 128 M
Date: Tue, 26 Nov 2024 22:05:51 +0530	[thread overview]
Message-ID: <20241126163553.449850-2-sai.teja.pottumuttu@intel.com> (raw)
In-Reply-To: <20241126163553.449850-1-sai.teja.pottumuttu@intel.com>

From: Ashutosh Dixit <ashutosh.dixit@intel.com>

Increase default OA buffer size to 128 MB from the current 16 MB. A larger
OA buffer allows more flexibility to userland to read data before overrun's
occur.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/xe/regs/xe_oa_regs.h |  1 +
 drivers/gpu/drm/xe/xe_oa.c           | 10 +++++++++-
 drivers/gpu/drm/xe/xe_oa_types.h     |  2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/regs/xe_oa_regs.h b/drivers/gpu/drm/xe/regs/xe_oa_regs.h
index a9b0091cb7ee..1188eca79a57 100644
--- a/drivers/gpu/drm/xe/regs/xe_oa_regs.h
+++ b/drivers/gpu/drm/xe/regs/xe_oa_regs.h
@@ -63,6 +63,7 @@
 #define OAG_OA_DEBUG XE_REG(0xdaf8, XE_REG_OPTION_MASKED)
 #define  OAG_OA_DEBUG_DISABLE_MMIO_TRG			REG_BIT(14)
 #define  OAG_OA_DEBUG_START_TRIGGER_SCOPE_CONTROL	REG_BIT(13)
+#define  OAG_OA_DEBUG_BUF_SIZE_SELECT			REG_BIT(12)
 #define  OAG_OA_DEBUG_DISABLE_START_TRG_2_COUNT_QUAL	REG_BIT(8)
 #define  OAG_OA_DEBUG_DISABLE_START_TRG_1_COUNT_QUAL	REG_BIT(7)
 #define  OAG_OA_DEBUG_INCLUDE_CLK_RATIO			REG_BIT(6)
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 8dd55798ab31..0e1049079905 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -405,6 +405,7 @@ static void xe_oa_init_oa_buffer(struct xe_oa_stream *stream)
 {
 	struct xe_mmio *mmio = &stream->gt->mmio;
 	u32 gtt_offset = xe_bo_ggtt_addr(stream->oa_buffer.bo);
+	/* For 128M OA buffer size, x8 is done in xe_oa_enable_metric_set() */
 	u32 oa_buf = gtt_offset | OABUFFER_SIZE_16M | OAG_OABUFFER_MEMORY_SELECT;
 	unsigned long flags;
 
@@ -906,7 +907,6 @@ static int xe_oa_alloc_oa_buffer(struct xe_oa_stream *stream)
 	struct xe_bo *bo;
 
 	BUILD_BUG_ON_NOT_POWER_OF_2(XE_OA_BUFFER_SIZE);
-	BUILD_BUG_ON(XE_OA_BUFFER_SIZE < SZ_128K || XE_OA_BUFFER_SIZE > SZ_16M);
 
 	bo = xe_bo_create_pin_map(stream->oa->xe, stream->gt->tile, NULL,
 				  XE_OA_BUFFER_SIZE, ttm_bo_type_kernel,
@@ -1087,6 +1087,13 @@ static u32 oag_report_ctx_switches(const struct xe_oa_stream *stream)
 			     0 : OAG_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS);
 }
 
+static u32 oag_buf_size_select(void)
+{
+	BUILD_BUG_ON(XE_OA_BUFFER_SIZE != SZ_16M && XE_OA_BUFFER_SIZE != SZ_128M);
+	return _MASKED_FIELD(OAG_OA_DEBUG_BUF_SIZE_SELECT,
+			     (XE_OA_BUFFER_SIZE == SZ_128M) ? OAG_OA_DEBUG_BUF_SIZE_SELECT : 0);
+}
+
 static int xe_oa_enable_metric_set(struct xe_oa_stream *stream)
 {
 	struct xe_mmio *mmio = &stream->gt->mmio;
@@ -1119,6 +1126,7 @@ static int xe_oa_enable_metric_set(struct xe_oa_stream *stream)
 	xe_mmio_write32(mmio, __oa_regs(stream)->oa_debug,
 			_MASKED_BIT_ENABLE(oa_debug) |
 			oag_report_ctx_switches(stream) |
+			oag_buf_size_select() |
 			oag_configure_mmio_trigger(stream, true));
 
 	xe_mmio_write32(mmio, __oa_regs(stream)->oa_ctx_ctrl, stream->periodic ?
diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h
index fea9d981e414..539c75f57c09 100644
--- a/drivers/gpu/drm/xe/xe_oa_types.h
+++ b/drivers/gpu/drm/xe/xe_oa_types.h
@@ -15,7 +15,7 @@
 #include "regs/xe_reg_defs.h"
 #include "xe_hw_engine_types.h"
 
-#define XE_OA_BUFFER_SIZE SZ_16M
+#define XE_OA_BUFFER_SIZE SZ_128M
 
 enum xe_oa_report_header {
 	HDR_32_BIT = 0,
-- 
2.34.1


  reply	other threads:[~2024-11-26 16:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 16:35 [PATCH v2 0/3] Make OA buffer size configurable Sai Teja Pottumuttu
2024-11-26 16:35 ` Sai Teja Pottumuttu [this message]
2024-11-26 16:35 ` [PATCH v2 2/3] drm/xe/oa: " Sai Teja Pottumuttu
2024-12-03 21:24   ` Dixit, Ashutosh
2024-11-26 16:35 ` [PATCH v2 3/3] drm/xe/oa: Remove all the instances of hardcoded OA buffer size Sai Teja Pottumuttu
2024-11-26 17:30 ` ✓ CI.Patch_applied: success for Make OA buffer size configurable (rev2) Patchwork
2024-11-26 17:30 ` ✓ CI.checkpatch: " Patchwork
2024-11-26 17:32 ` ✓ CI.KUnit: " Patchwork
2024-11-26 17:50 ` ✓ CI.Build: " Patchwork
2024-11-26 17:52 ` ✓ CI.Hooks: " Patchwork
2024-11-26 17:53 ` ✓ CI.checksparse: " Patchwork
2024-11-26 18:14 ` ✗ Xe.CI.BAT: failure " Patchwork
2024-11-26 19:45 ` ✗ Xe.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241126163553.449850-2-sai.teja.pottumuttu@intel.com \
    --to=sai.teja.pottumuttu@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox