Skip to content

Commit

Permalink
Merge tag 'drm-intel-gt-next-2024-07-04' of https://gitlab.freedeskto…
Browse files Browse the repository at this point in the history
…p.org/drm/i915/kernel into drm-next

Driver Changes:

Fixes/improvements/new stuff:

- Downgrade stolen lmem setup warning [gem] (Jonathan Cavitt)
- Evaluate GuC priority within locks [gt/uc] (Andi Shyti)
- Fix potential UAF by revoke of fence registers [gt] (Janusz Krzysztofik)
- Return NULL instead of '0' [gem] (Andi Shyti)
- Use the correct format specifier for resource_size_t [gem] (Andi Shyti)
- Suppress oom warning in favour of ENOMEM to userspace [gem] (Nirmoy Das)

Miscellaneous:

- Evaluate forcewake usage within locks [gt] (Andi Shyti)
- Fix typo in comment [gt/uc] (Andi Shyti)

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Tvrtko Ursulin <tursulin@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZoZP6mUSergfzFMh@linux
  • Loading branch information
danvet committed Jul 5, 2024
2 parents 6be146c + 3b85152 commit bfc1093
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 18 deletions.
8 changes: 6 additions & 2 deletions drivers/gpu/drm/i915/gem/i915_gem_stolen.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,12 @@ i915_gem_stolen_lmem_setup(struct drm_i915_private *i915, u16 type,
} else {
/* Use DSM base address instead for stolen memory */
dsm_base = intel_uncore_read64(uncore, GEN6_DSMBASE) & GEN11_BDSM_MASK;
if (WARN_ON(lmem_size < dsm_base))
return ERR_PTR(-ENODEV);
if (lmem_size < dsm_base) {
drm_dbg(&i915->drm,
"Disabling stolen memory support due to OOB placement: lmem_size = %pa vs dsm_base = %pa\n",
&lmem_size, &dsm_base);
return NULL;
}
dsm_size = ALIGN_DOWN(lmem_size - dsm_base, SZ_1M);
}

Expand Down
4 changes: 4 additions & 0 deletions drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ static int fw_domains_show(struct seq_file *m, void *data)
struct intel_uncore_forcewake_domain *fw_domain;
unsigned int tmp;

spin_lock_irq(&uncore->lock);

seq_printf(m, "user.bypass_count = %u\n",
uncore->user_forcewake_count);

Expand All @@ -79,6 +81,8 @@ static int fw_domains_show(struct seq_file *m, void *data)
intel_uncore_forcewake_domain_to_str(fw_domain->id),
READ_ONCE(fw_domain->wake_count));

spin_unlock_irq(&uncore->lock);

return 0;
}
DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(fw_domains);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ struct guc_update_scheduling_policy_header {
} __packed;

/*
* Can't dynmically allocate memory for the scheduling policy KLV because
* Can't dynamically allocate memory for the scheduling policy KLV because
* it will be sent from within the reset path. Need a fixed size lump on
* the stack instead :(.
*
Expand Down
27 changes: 16 additions & 11 deletions drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
Original file line number Diff line number Diff line change
Expand Up @@ -4267,20 +4267,25 @@ static void guc_bump_inflight_request_prio(struct i915_request *rq,
u8 new_guc_prio = map_i915_prio_to_guc_prio(prio);

/* Short circuit function */
if (prio < I915_PRIORITY_NORMAL ||
rq->guc_prio == GUC_PRIO_FINI ||
(rq->guc_prio != GUC_PRIO_INIT &&
!new_guc_prio_higher(rq->guc_prio, new_guc_prio)))
if (prio < I915_PRIORITY_NORMAL)
return;

spin_lock(&ce->guc_state.lock);
if (rq->guc_prio != GUC_PRIO_FINI) {
if (rq->guc_prio != GUC_PRIO_INIT)
sub_context_inflight_prio(ce, rq->guc_prio);
rq->guc_prio = new_guc_prio;
add_context_inflight_prio(ce, rq->guc_prio);
update_context_prio(ce);
}

if (rq->guc_prio == GUC_PRIO_FINI)
goto exit;

if (!new_guc_prio_higher(rq->guc_prio, new_guc_prio))
goto exit;

if (rq->guc_prio != GUC_PRIO_INIT)
sub_context_inflight_prio(ce, rq->guc_prio);

rq->guc_prio = new_guc_prio;
add_context_inflight_prio(ce, rq->guc_prio);
update_context_prio(ce);

exit:
spin_unlock(&ce->guc_state.lock);
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/i915/i915_scatterlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,

GEM_BUG_ON(!max_segment);

rsgt = kmalloc(sizeof(*rsgt), GFP_KERNEL);
rsgt = kmalloc(sizeof(*rsgt), GFP_KERNEL | __GFP_NOWARN);
if (!rsgt)
return ERR_PTR(-ENOMEM);

Expand All @@ -104,7 +104,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
}

if (sg_alloc_table(st, DIV_ROUND_UP_ULL(node->size, segment_pages),
GFP_KERNEL)) {
GFP_KERNEL | __GFP_NOWARN)) {
i915_refct_sgt_put(rsgt);
return ERR_PTR(-ENOMEM);
}
Expand Down Expand Up @@ -178,7 +178,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
GEM_BUG_ON(list_empty(blocks));
GEM_BUG_ON(!max_segment);

rsgt = kmalloc(sizeof(*rsgt), GFP_KERNEL);
rsgt = kmalloc(sizeof(*rsgt), GFP_KERNEL | __GFP_NOWARN);
if (!rsgt)
return ERR_PTR(-ENOMEM);

Expand All @@ -190,7 +190,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
return ERR_PTR(-E2BIG);
}

if (sg_alloc_table(st, PFN_UP(res->size), GFP_KERNEL)) {
if (sg_alloc_table(st, PFN_UP(res->size), GFP_KERNEL | __GFP_NOWARN)) {
i915_refct_sgt_put(rsgt);
return ERR_PTR(-ENOMEM);
}
Expand Down

0 comments on commit bfc1093

Please sign in to comment.