[PATCH v2 1/2] drm/xe/guc: Allow to initialize submission with limited set of IDs
Michal Wajdeczko
michal.wajdeczko at intel.com
Tue May 21 09:25:17 UTC 2024
While PF and native drivers may initialize submission code to use
all available GuC contexts IDs, the VF driver may only use limited
number of IDs. Update init function to accept number of context
IDs available for use.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Matthew Brost <matthew.brost at intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
---
v2: add kernel-doc for xe_guc_submit_init (Himal)
---
drivers/gpu/drm/xe/xe_guc.c | 2 +-
drivers/gpu/drm/xe/xe_guc_submit.c | 17 +++++++++++++++--
drivers/gpu/drm/xe/xe_guc_submit.h | 2 +-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
index e52b544ac690..807ad53449e4 100644
--- a/drivers/gpu/drm/xe/xe_guc.c
+++ b/drivers/gpu/drm/xe/xe_guc.c
@@ -358,7 +358,7 @@ int xe_guc_init_post_hwconfig(struct xe_guc *guc)
guc_init_params_post_hwconfig(guc);
- ret = xe_guc_submit_init(guc);
+ ret = xe_guc_submit_init(guc, ~0);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 4efb88e3e056..13ec171ada1b 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -278,7 +278,20 @@ static void primelockdep(struct xe_guc *guc)
fs_reclaim_release(GFP_KERNEL);
}
-int xe_guc_submit_init(struct xe_guc *guc)
+/**
+ * xe_guc_submit_init() - Initialize GuC submission.
+ * @guc: the &xe_guc to initialize
+ * @num_ids: number of GuC context IDs to use
+ *
+ * The bare-metal or PF driver can pass ~0 as &num_ids to indicate that all
+ * GuC context IDs supported by the GuC firmware should be used for submission.
+ *
+ * Only VF drivers will have to provide explicit number of GuC context IDs
+ * that they can use for submission.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int xe_guc_submit_init(struct xe_guc *guc, unsigned int num_ids)
{
struct xe_device *xe = guc_to_xe(guc);
struct xe_gt *gt = guc_to_gt(guc);
@@ -288,7 +301,7 @@ int xe_guc_submit_init(struct xe_guc *guc)
if (err)
return err;
- err = xe_guc_id_mgr_init(&guc->submission_state.idm, ~0);
+ err = xe_guc_id_mgr_init(&guc->submission_state.idm, num_ids);
if (err)
return err;
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.h b/drivers/gpu/drm/xe/xe_guc_submit.h
index 4275b7da9df5..4ad5f4c1b084 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.h
+++ b/drivers/gpu/drm/xe/xe_guc_submit.h
@@ -12,7 +12,7 @@ struct drm_printer;
struct xe_exec_queue;
struct xe_guc;
-int xe_guc_submit_init(struct xe_guc *guc);
+int xe_guc_submit_init(struct xe_guc *guc, unsigned int num_ids);
int xe_guc_submit_reset_prepare(struct xe_guc *guc);
void xe_guc_submit_reset_wait(struct xe_guc *guc);
--
2.43.0
More information about the Intel-xe
mailing list