[PATCH 3/4] drm/xe: Add build on bug to assert access counter queue works

Matthew Brost matthew.brost at intel.com
Tue Jan 9 17:28:37 UTC 2024


If NUM_ACC_QUEUE % ACC_MSG_LEN_DW != 0 then the access counter queue
logic does not work when wrapping occurs. Add a build bug on to assert
NUM_ACC_QUEUE % ACC_MSG_LEN_DW == 0 to enforce this restriction and
document the code.

Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index fdd5c47dbe37..83a0e9a5f3a8 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -629,6 +629,11 @@ int xe_guc_access_counter_notify_handler(struct xe_guc *guc, u32 *msg, u32 len)
 	u32 asid;
 	bool full;
 
+	/*
+	 * The below logic doesn't work unless NUM_ACC_QUEUE % ACC_MSG_LEN_DW == 0
+	 */
+	BUILD_BUG_ON(NUM_ACC_QUEUE % ACC_MSG_LEN_DW);
+
 	if (unlikely(len != ACC_MSG_LEN_DW))
 		return -EPROTO;
 
-- 
2.34.1



More information about the Intel-xe mailing list