[PATCH v2 3/3] drm/xe/oa: Remove all the instances of hardcoded OA buffer size
Sai Teja Pottumuttu
sai.teja.pottumuttu at intel.com
Tue Nov 26 16:35:53 UTC 2024
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 at 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, ¶m);
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
More information about the Intel-xe
mailing list