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 3/3] drm/xe/oa: Remove all the instances of hardcoded OA buffer size
Date: Tue, 26 Nov 2024 22:05:53 +0530	[thread overview]
Message-ID: <20241126163553.449850-4-sai.teja.pottumuttu@intel.com> (raw)
In-Reply-To: <20241126163553.449850-1-sai.teja.pottumuttu@intel.com>

Remove all the instances of hardcoded OA buffer size and use the
size coming from the new parameter and stream's oa buffer size at
the required places.

Signed-off-by: Sai Teja Pottumuttu <sai.teja.pottumuttu@intel.com>
---
 drivers/gpu/drm/xe/xe_oa.c       | 9 +++------
 drivers/gpu/drm/xe/xe_oa_types.h | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 7e5da7fef6ad..6db09a20f2e1 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -915,8 +915,6 @@ static int xe_oa_alloc_oa_buffer(struct xe_oa_stream *stream, size_t size)
 {
 	struct xe_bo *bo;
 
-	BUILD_BUG_ON_NOT_POWER_OF_2(XE_OA_BUFFER_SIZE);
-
 	bo = xe_bo_create_pin_map(stream->oa->xe, stream->gt->tile, NULL,
 				  size, ttm_bo_type_kernel,
 				  XE_BO_FLAG_SYSTEM | XE_BO_FLAG_GGTT);
@@ -1098,7 +1096,6 @@ static u32 oag_report_ctx_switches(const struct xe_oa_stream *stream)
 
 static u32 oag_buf_size_select(const struct xe_oa_stream *stream)
 {
-	BUILD_BUG_ON(XE_OA_BUFFER_SIZE != SZ_16M && XE_OA_BUFFER_SIZE != SZ_128M);
 	return _MASKED_FIELD(OAG_OA_DEBUG_BUF_SIZE_SELECT,
 			     (stream->oa_buffer.bo->size > SZ_16M) ?
 			     OAG_OA_DEBUG_BUF_SIZE_SELECT : 0);
@@ -1584,7 +1581,7 @@ static long xe_oa_status_locked(struct xe_oa_stream *stream, unsigned long arg)
 
 static long xe_oa_info_locked(struct xe_oa_stream *stream, unsigned long arg)
 {
-	struct drm_xe_oa_stream_info info = { .oa_buf_size = XE_OA_BUFFER_SIZE, };
+	struct drm_xe_oa_stream_info info = { .oa_buf_size = stream->oa_buffer.bo->size, };
 	void __user *uaddr = (void __user *)arg;
 
 	if (copy_to_user(uaddr, &info, sizeof(info)))
@@ -1670,7 +1667,7 @@ static int xe_oa_mmap(struct file *file, struct vm_area_struct *vma)
 	}
 
 	/* Can mmap the entire OA buffer or nothing (no partial OA buffer mmaps) */
-	if (vma->vm_end - vma->vm_start != XE_OA_BUFFER_SIZE) {
+	if (vma->vm_end - vma->vm_start != stream->oa_buffer.bo->size) {
 		drm_dbg(&stream->oa->xe->drm, "Wrong mmap size, must be OA buffer size\n");
 		return -EINVAL;
 	}
@@ -2159,7 +2156,7 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f
 
 	if (!param.oa_buffer_size) {
 		/* If the oa buffer size is not provided, default to 16MB*/
-		param.oa_buffer_size = XE_OA_BUFFER_SIZE;
+		param.oa_buffer_size = DEFAULT_XE_OA_BUFFER_SIZE;
 	}
 
 	ret = xe_oa_parse_syncs(oa, &param);
diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h
index fea9d981e414..df7793915628 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 DEFAULT_XE_OA_BUFFER_SIZE SZ_16M
 
 enum xe_oa_report_header {
 	HDR_32_BIT = 0,
-- 
2.34.1


  parent reply	other threads:[~2024-11-26 16:44 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 ` [PATCH v2 1/3] drm/xe/oa: Increase default OA buffer size to 128 M Sai Teja Pottumuttu
2024-11-26 16:35 ` [PATCH v2 2/3] drm/xe/oa: Make OA buffer size configurable Sai Teja Pottumuttu
2024-12-03 21:24   ` Dixit, Ashutosh
2024-11-26 16:35 ` Sai Teja Pottumuttu [this message]
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-4-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