drm/i915/guc: Better name for context id limit
The LRC descriptor pool is going away. So, stop using it as the limit for how many context ids are available. Instead, size the pool according to the number of contexts allowed. Note that this is just a naming change, the actual limit is identical in value. While at it, also update a kzalloc(sizeof()*count) to be a kcalloc(count,size). Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220302003357.4188363-4-John.C.Harrison@Intel.com
This commit is contained in:
parent
09570c5010
commit
d124902242
|
@ -400,7 +400,7 @@ intel_context_init(struct intel_context *ce, struct intel_engine_cs *engine)
|
|||
INIT_LIST_HEAD(&ce->guc_state.fences);
|
||||
INIT_LIST_HEAD(&ce->guc_state.requests);
|
||||
|
||||
ce->guc_id.id = GUC_INVALID_LRC_ID;
|
||||
ce->guc_id.id = GUC_INVALID_CONTEXT_ID;
|
||||
INIT_LIST_HEAD(&ce->guc_id.link);
|
||||
|
||||
INIT_LIST_HEAD(&ce->destroyed_link);
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#define GUC_CLIENT_PRIORITY_NORMAL 3
|
||||
#define GUC_CLIENT_PRIORITY_NUM 4
|
||||
|
||||
#define GUC_MAX_LRC_DESCRIPTORS 65535
|
||||
#define GUC_INVALID_LRC_ID GUC_MAX_LRC_DESCRIPTORS
|
||||
#define GUC_MAX_CONTEXT_ID 65535
|
||||
#define GUC_INVALID_CONTEXT_ID GUC_MAX_CONTEXT_ID
|
||||
|
||||
#define GUC_RENDER_ENGINE 0
|
||||
#define GUC_VIDEO_ENGINE 1
|
||||
|
|
|
@ -351,12 +351,12 @@ request_to_scheduling_context(struct i915_request *rq)
|
|||
|
||||
static inline bool context_guc_id_invalid(struct intel_context *ce)
|
||||
{
|
||||
return ce->guc_id.id == GUC_INVALID_LRC_ID;
|
||||
return ce->guc_id.id == GUC_INVALID_CONTEXT_ID;
|
||||
}
|
||||
|
||||
static inline void set_context_guc_id_invalid(struct intel_context *ce)
|
||||
{
|
||||
ce->guc_id.id = GUC_INVALID_LRC_ID;
|
||||
ce->guc_id.id = GUC_INVALID_CONTEXT_ID;
|
||||
}
|
||||
|
||||
static inline struct intel_guc *ce_to_guc(struct intel_context *ce)
|
||||
|
@ -471,7 +471,7 @@ static struct guc_lrc_desc *__get_lrc_desc(struct intel_guc *guc, u32 index)
|
|||
{
|
||||
struct guc_lrc_desc *base = guc->lrc_desc_pool_vaddr;
|
||||
|
||||
GEM_BUG_ON(index >= GUC_MAX_LRC_DESCRIPTORS);
|
||||
GEM_BUG_ON(index >= GUC_MAX_CONTEXT_ID);
|
||||
|
||||
return &base[index];
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ static inline struct intel_context *__get_context(struct intel_guc *guc, u32 id)
|
|||
{
|
||||
struct intel_context *ce = xa_load(&guc->context_lookup, id);
|
||||
|
||||
GEM_BUG_ON(id >= GUC_MAX_LRC_DESCRIPTORS);
|
||||
GEM_BUG_ON(id >= GUC_MAX_CONTEXT_ID);
|
||||
|
||||
return ce;
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ static int guc_lrc_desc_pool_create(struct intel_guc *guc)
|
|||
int ret;
|
||||
|
||||
size = PAGE_ALIGN(sizeof(struct guc_lrc_desc) *
|
||||
GUC_MAX_LRC_DESCRIPTORS);
|
||||
GUC_MAX_CONTEXT_ID);
|
||||
ret = intel_guc_allocate_and_map_vma(guc, size, &guc->lrc_desc_pool,
|
||||
(void **)&guc->lrc_desc_pool_vaddr);
|
||||
if (ret)
|
||||
|
@ -2428,7 +2428,7 @@ static void __guc_context_sched_disable(struct intel_guc *guc,
|
|||
GUC_CONTEXT_DISABLE
|
||||
};
|
||||
|
||||
GEM_BUG_ON(guc_id == GUC_INVALID_LRC_ID);
|
||||
GEM_BUG_ON(guc_id == GUC_INVALID_CONTEXT_ID);
|
||||
|
||||
GEM_BUG_ON(intel_context_is_child(ce));
|
||||
trace_intel_context_sched_disable(ce);
|
||||
|
@ -3844,7 +3844,7 @@ void intel_guc_submission_init_early(struct intel_guc *guc)
|
|||
spin_lock_init(&guc->timestamp.lock);
|
||||
INIT_DELAYED_WORK(&guc->timestamp.work, guc_timestamp_ping);
|
||||
|
||||
guc->submission_state.num_guc_ids = GUC_MAX_LRC_DESCRIPTORS;
|
||||
guc->submission_state.num_guc_ids = GUC_MAX_CONTEXT_ID;
|
||||
guc->submission_supported = __guc_submission_supported(guc);
|
||||
guc->submission_selected = __guc_submission_selected(guc);
|
||||
}
|
||||
|
@ -3854,7 +3854,7 @@ g2h_context_lookup(struct intel_guc *guc, u32 desc_idx)
|
|||
{
|
||||
struct intel_context *ce;
|
||||
|
||||
if (unlikely(desc_idx >= GUC_MAX_LRC_DESCRIPTORS)) {
|
||||
if (unlikely(desc_idx >= GUC_MAX_CONTEXT_ID)) {
|
||||
drm_err(&guc_to_gt(guc)->i915->drm,
|
||||
"Invalid desc_idx %u", desc_idx);
|
||||
return NULL;
|
||||
|
|
|
@ -148,7 +148,7 @@ static int intel_guc_steal_guc_ids(void *arg)
|
|||
struct i915_request *spin_rq = NULL, *rq, *last = NULL;
|
||||
int number_guc_id_stolen = guc->number_guc_id_stolen;
|
||||
|
||||
ce = kzalloc(sizeof(*ce) * GUC_MAX_LRC_DESCRIPTORS, GFP_KERNEL);
|
||||
ce = kcalloc(GUC_MAX_CONTEXT_ID, sizeof(*ce), GFP_KERNEL);
|
||||
if (!ce) {
|
||||
pr_err("Context array allocation failed\n");
|
||||
return -ENOMEM;
|
||||
|
|
Loading…
Reference in New Issue