aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyanka Dandamudi <[email protected]>2023-10-27 10:55:07 +0530
committerRodrigo Vivi <[email protected]>2023-12-21 11:43:31 -0500
commitb8d70702def26d7597eded092fe43cc584c0d064 (patch)
treee3379c1476308aeca0844eb4e04b62e8b0021273
parent65e95735882329632559cf71c9efbb4981473b07 (diff)
drm/xe/xe_exec_queue: Add check for access counter granularity
Add conditional check for access counter granularity. This check will return -EINVAL if granularity is beyond 64M which is a hardware limitation. v2: Defined XE_ACC_GRANULARITY_128K 0 XE_ACC_GRANULARITY_2M 1 XE_ACC_GRANULARITY_16M 2 XE_ACC_GRANULARITY_64M 3 as part of uAPI. So, that user can also use it.(Oak) v3: Move uAPI to proper location and give proper documentation.(Brian, Oak) Cc: Oak Zeng <[email protected]> Cc: Janga Rahul Kumar <[email protected]> Cc: Brian Welty <[email protected]> Signed-off-by: Priyanka Dandamudi <[email protected]> Reviewed-by: Oak Zeng <[email protected]> Reviewed-by: Oak Zeng <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]>
-rw-r--r--drivers/gpu/drm/xe/xe_exec_queue.c3
-rw-r--r--include/uapi/drm/xe_drm.h14
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
index 8e0620cb89e5..f67a6dee4a6f 100644
--- a/drivers/gpu/drm/xe/xe_exec_queue.c
+++ b/drivers/gpu/drm/xe/xe_exec_queue.c
@@ -393,6 +393,9 @@ static int exec_queue_set_acc_granularity(struct xe_device *xe, struct xe_exec_q
if (XE_IOCTL_DBG(xe, !xe->info.supports_usm))
return -EINVAL;
+ if (value > XE_ACC_GRANULARITY_64M)
+ return -EINVAL;
+
q->usm.acc_granularity = value;
return 0;
diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
index 24bf8f0f52e8..9bd7092a7ea4 100644
--- a/include/uapi/drm/xe_drm.h
+++ b/include/uapi/drm/xe_drm.h
@@ -731,6 +731,20 @@ struct drm_xe_vm_bind {
__u64 reserved[2];
};
+/* For use with XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY */
+
+/* Monitor 128KB contiguous region with 4K sub-granularity */
+#define XE_ACC_GRANULARITY_128K 0
+
+/* Monitor 2MB contiguous region with 64KB sub-granularity */
+#define XE_ACC_GRANULARITY_2M 1
+
+/* Monitor 16MB contiguous region with 512KB sub-granularity */
+#define XE_ACC_GRANULARITY_16M 2
+
+/* Monitor 64MB contiguous region with 2M sub-granularity */
+#define XE_ACC_GRANULARITY_64M 3
+
/**
* struct drm_xe_exec_queue_set_property - exec queue set property
*