[PATCH 08/12] drm/xe/guc: Define stub for xe_guc_ct_send_recv()

Michal Wajdeczko michal.wajdeczko at intel.com
Fri Aug 9 16:51:55 UTC 2024


For some advanced KUnit test cases we may want to use replacement
function instead of the real xe_guc_ct_send_recv().

Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
---
 drivers/gpu/drm/xe/xe_guc_ct.c       | 2 ++
 drivers/gpu/drm/xe/xe_guc_ct_types.h | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index beeeb120d1fc..30536f7021fc 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -938,6 +938,8 @@ int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
 			u32 *response_buffer)
 {
 	KUNIT_STATIC_STUB_REDIRECT(xe_guc_ct_send_recv, ct, action, len, response_buffer);
+	XE_TEST_REDIRECT(ct->send_recv, ct, action, len, response_buffer);
+
 	return guc_ct_send_recv(ct, action, len, response_buffer, false);
 }
 
diff --git a/drivers/gpu/drm/xe/xe_guc_ct_types.h b/drivers/gpu/drm/xe/xe_guc_ct_types.h
index 761cb9031298..50c024b0227d 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct_types.h
+++ b/drivers/gpu/drm/xe/xe_guc_ct_types.h
@@ -13,6 +13,7 @@
 #include <linux/xarray.h>
 
 #include "abi/guc_communication_ctb_abi.h"
+#include "tests/xe_test.h"
 
 struct xe_bo;
 
@@ -128,6 +129,10 @@ struct xe_guc_ct {
 	u32 msg[GUC_CTB_MSG_MAX_LEN];
 	/** @fast_msg: Message buffer */
 	u32 fast_msg[GUC_CTB_MSG_MAX_LEN];
+
+	XE_TEST_DECLARE(int (*send_recv)(struct xe_guc_ct *ct,
+					 const u32 *action, u32 len,
+					 u32 *response_buffer));
 };
 
 #endif
-- 
2.43.0



More information about the Intel-xe mailing list