[PATCH 09/12] drm/xe/pf: Define stub for pf_sanitize_vf_resources()

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


For some advanced KUnit test cases we may want to use replacement
function instead of the pf_sanitize_vf_resources() which actually
implements the exported xe_gt_sriov_pf_config_sanitize() function.

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

diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
index eba6793294f3..c77730d6e254 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -1938,6 +1938,8 @@ static int pf_sanitize_vf_resources(struct xe_gt *gt, u32 vfid, long timeout)
 	struct xe_device *xe = gt_to_xe(gt);
 	int err = 0;
 
+	XE_TEST_REDIRECT(config->sanitize, gt, vfid, timeout);
+
 	/*
 	 * Only GGTT and LMEM requires to be cleared by the PF.
 	 * GuC doorbell IDs and context IDs do not need any clearing.
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h
index 7bc66656fcc7..99b4bc2b81bb 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h
@@ -8,9 +8,11 @@
 
 #include <drm/drm_mm.h>
 
+#include "tests/xe_test.h"
 #include "xe_guc_klv_thresholds_set_types.h"
 
 struct xe_bo;
+struct xe_gt;
 
 /**
  * struct xe_gt_sriov_config - GT level per-VF configuration data.
@@ -36,6 +38,9 @@ struct xe_gt_sriov_config {
 	u32 preempt_timeout;
 	/** @thresholds: GuC thresholds for adverse events notifications. */
 	u32 thresholds[XE_GUC_KLV_NUM_THRESHOLDS];
+
+	/* private: */
+	XE_TEST_DECLARE(int (*sanitize)(struct xe_gt *gt, unsigned int vfid, long timeout));
 };
 
 /**
-- 
2.43.0



More information about the Intel-xe mailing list