Skip to content

Commit

Permalink
drm/xe/guc: Allow to initialize submission with limited set of IDs
Browse files Browse the repository at this point in the history
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@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240521092518.624-2-michal.wajdeczko@intel.com
  • Loading branch information
Michal Wajdeczko committed May 22, 2024
1 parent f7e20cf commit 7065b19
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/xe/xe_guc.c
Original file line number Diff line number Diff line change
@@ -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;

17 changes: 15 additions & 2 deletions drivers/gpu/drm/xe/xe_guc_submit.c
Original file line number Diff line number Diff line change
@@ -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;

2 changes: 1 addition & 1 deletion drivers/gpu/drm/xe/xe_guc_submit.h
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 7065b19

Please sign in to comment.