Skip to content

Commit 8e65afb

Browse files
committed
Merge tag 'drm-fixes-2022-07-22' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Fixes for this week. The main one is the i915 firmware fix for the phoronix reported issue. I've written some firmware guidelines as a result, should land in -next soon. Otherwise a few amdgpu fixes, a scheduler fix, ttm fix and two other minor ones. scheduler: - scheduling while atomic fix ttm: - locking fix edp: - variable typo fix i915: - add back support for v69 firmware on ADL-P amdgpu: - Drop redundant buffer cleanup that can lead to a segfault - Add a bo_list mutex to avoid possible list corruption in CS - dmub notification fix imx: - fix error path" * tag 'drm-fixes-2022-07-22' of git://anongit.freedesktop.org/drm/drm: drm/amdgpu: Protect the amdgpu_bo_list list with a mutex v2 drm/imx/dcss: Add missing of_node_put() in fail path drm/i915/guc: support v69 in parallel to v70 drm/i915/guc: Support programming the EU priority in the GuC descriptor drm/panel-edp: Fix variable typo when saving hpd absent delay from DT drm/amdgpu: Remove one duplicated ef removal drm/ttm: fix locking in vmap/vunmap TTM GEM helpers drm/scheduler: Don't kill jobs in interrupt context drm/amd/display: Fix new dmub notification enabling in DM
2 parents 4ba1329 + 7f5ec14 commit 8e65afb

19 files changed

+505
-98
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,16 +1364,10 @@ void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev,
13641364
struct amdgpu_vm *vm)
13651365
{
13661366
struct amdkfd_process_info *process_info = vm->process_info;
1367-
struct amdgpu_bo *pd = vm->root.bo;
13681367

13691368
if (!process_info)
13701369
return;
13711370

1372-
/* Release eviction fence from PD */
1373-
amdgpu_bo_reserve(pd, false);
1374-
amdgpu_bo_fence(pd, NULL, false);
1375-
amdgpu_bo_unreserve(pd);
1376-
13771371
/* Update process info */
13781372
mutex_lock(&process_info->lock);
13791373
process_info->n_vms--;

drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static void amdgpu_bo_list_free_rcu(struct rcu_head *rcu)
4040
{
4141
struct amdgpu_bo_list *list = container_of(rcu, struct amdgpu_bo_list,
4242
rhead);
43-
43+
mutex_destroy(&list->bo_list_mutex);
4444
kvfree(list);
4545
}
4646

@@ -136,6 +136,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
136136

137137
trace_amdgpu_cs_bo_status(list->num_entries, total_size);
138138

139+
mutex_init(&list->bo_list_mutex);
139140
*result = list;
140141
return 0;
141142

drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ struct amdgpu_bo_list {
4747
struct amdgpu_bo *oa_obj;
4848
unsigned first_userptr;
4949
unsigned num_entries;
50+
51+
/* Protect access during command submission.
52+
*/
53+
struct mutex bo_list_mutex;
5054
};
5155

5256
int amdgpu_bo_list_get(struct amdgpu_fpriv *fpriv, int id,

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
519519
return r;
520520
}
521521

522+
mutex_lock(&p->bo_list->bo_list_mutex);
523+
522524
/* One for TTM and one for the CS job */
523525
amdgpu_bo_list_for_each_entry(e, p->bo_list)
524526
e->tv.num_shared = 2;
@@ -651,6 +653,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
651653
kvfree(e->user_pages);
652654
e->user_pages = NULL;
653655
}
656+
mutex_unlock(&p->bo_list->bo_list_mutex);
654657
}
655658
return r;
656659
}
@@ -690,9 +693,11 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser, int error,
690693
{
691694
unsigned i;
692695

693-
if (error && backoff)
696+
if (error && backoff) {
694697
ttm_eu_backoff_reservation(&parser->ticket,
695698
&parser->validated);
699+
mutex_unlock(&parser->bo_list->bo_list_mutex);
700+
}
696701

697702
for (i = 0; i < parser->num_post_deps; i++) {
698703
drm_syncobj_put(parser->post_deps[i].syncobj);
@@ -832,12 +837,16 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
832837
continue;
833838

834839
r = amdgpu_vm_bo_update(adev, bo_va, false);
835-
if (r)
840+
if (r) {
841+
mutex_unlock(&p->bo_list->bo_list_mutex);
836842
return r;
843+
}
837844

838845
r = amdgpu_sync_fence(&p->job->sync, bo_va->last_pt_update);
839-
if (r)
846+
if (r) {
847+
mutex_unlock(&p->bo_list->bo_list_mutex);
840848
return r;
849+
}
841850
}
842851

843852
r = amdgpu_vm_handle_moved(adev, vm);
@@ -1278,6 +1287,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
12781287

12791288
ttm_eu_fence_buffer_objects(&p->ticket, &p->validated, p->fence);
12801289
mutex_unlock(&p->adev->notifier_lock);
1290+
mutex_unlock(&p->bo_list->bo_list_mutex);
12811291

12821292
return 0;
12831293

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
16531653
#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY)
16541654
adev->dm.crc_rd_wrk = amdgpu_dm_crtc_secure_display_create_work();
16551655
#endif
1656-
if (dc_enable_dmub_notifications(adev->dm.dc)) {
1656+
if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
16571657
init_completion(&adev->dm.dmub_aux_transfer_done);
16581658
adev->dm.dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_KERNEL);
16591659
if (!adev->dm.dmub_notify) {
@@ -1689,6 +1689,13 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
16891689
goto error;
16901690
}
16911691

1692+
/* Enable outbox notification only after IRQ handlers are registered and DMUB is alive.
1693+
* It is expected that DMUB will resend any pending notifications at this point, for
1694+
* example HPD from DPIA.
1695+
*/
1696+
if (dc_is_dmub_outbox_supported(adev->dm.dc))
1697+
dc_enable_dmub_outbox(adev->dm.dc);
1698+
16921699
/* create fake encoders for MST */
16931700
dm_dp_create_fake_mst_encoders(adev);
16941701

@@ -2678,9 +2685,6 @@ static int dm_resume(void *handle)
26782685
*/
26792686
link_enc_cfg_copy(adev->dm.dc->current_state, dc_state);
26802687

2681-
if (dc_enable_dmub_notifications(adev->dm.dc))
2682-
amdgpu_dm_outbox_init(adev);
2683-
26842688
r = dm_dmub_hw_init(adev);
26852689
if (r)
26862690
DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r);
@@ -2698,6 +2702,11 @@ static int dm_resume(void *handle)
26982702
}
26992703
}
27002704

2705+
if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
2706+
amdgpu_dm_outbox_init(adev);
2707+
dc_enable_dmub_outbox(adev->dm.dc);
2708+
}
2709+
27012710
WARN_ON(!dc_commit_state(dm->dc, dc_state));
27022711

27032712
dm_gpureset_commit_state(dm->cached_dc_state, dm);
@@ -2719,13 +2728,15 @@ static int dm_resume(void *handle)
27192728
/* TODO: Remove dc_state->dccg, use dc->dccg directly. */
27202729
dc_resource_state_construct(dm->dc, dm_state->context);
27212730

2722-
/* Re-enable outbox interrupts for DPIA. */
2723-
if (dc_enable_dmub_notifications(adev->dm.dc))
2724-
amdgpu_dm_outbox_init(adev);
2725-
27262731
/* Before powering on DC we need to re-initialize DMUB. */
27272732
dm_dmub_hw_resume(adev);
27282733

2734+
/* Re-enable outbox interrupts for DPIA. */
2735+
if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
2736+
amdgpu_dm_outbox_init(adev);
2737+
dc_enable_dmub_outbox(adev->dm.dc);
2738+
}
2739+
27292740
/* power on hardware */
27302741
dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
27312742

drivers/gpu/drm/drm_gem_ttm_helper.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ int drm_gem_ttm_vmap(struct drm_gem_object *gem,
6464
struct iosys_map *map)
6565
{
6666
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
67+
int ret;
68+
69+
dma_resv_lock(gem->resv, NULL);
70+
ret = ttm_bo_vmap(bo, map);
71+
dma_resv_unlock(gem->resv);
6772

68-
return ttm_bo_vmap(bo, map);
73+
return ret;
6974
}
7075
EXPORT_SYMBOL(drm_gem_ttm_vmap);
7176

@@ -82,7 +87,9 @@ void drm_gem_ttm_vunmap(struct drm_gem_object *gem,
8287
{
8388
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
8489

90+
dma_resv_lock(gem->resv, NULL);
8591
ttm_bo_vunmap(bo, map);
92+
dma_resv_unlock(gem->resv);
8693
}
8794
EXPORT_SYMBOL(drm_gem_ttm_vunmap);
8895

drivers/gpu/drm/i915/gt/intel_context_types.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,17 @@ struct intel_context {
273273
u8 child_index;
274274
/** @guc: GuC specific members for parallel submission */
275275
struct {
276-
/** @wqi_head: head pointer in work queue */
276+
/** @wqi_head: cached head pointer in work queue */
277277
u16 wqi_head;
278-
/** @wqi_tail: tail pointer in work queue */
278+
/** @wqi_tail: cached tail pointer in work queue */
279279
u16 wqi_tail;
280+
/** @wq_head: pointer to the actual head in work queue */
281+
u32 *wq_head;
282+
/** @wq_tail: pointer to the actual head in work queue */
283+
u32 *wq_tail;
284+
/** @wq_status: pointer to the status in work queue */
285+
u32 *wq_status;
286+
280287
/**
281288
* @parent_page: page in context state (ce->state) used
282289
* by parent for work queue, process descriptor

drivers/gpu/drm/i915/gt/intel_execlists_submission.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,16 @@ static inline void execlists_schedule_out(struct i915_request *rq)
661661
i915_request_put(rq);
662662
}
663663

664+
static u32 map_i915_prio_to_lrc_desc_prio(int prio)
665+
{
666+
if (prio > I915_PRIORITY_NORMAL)
667+
return GEN12_CTX_PRIORITY_HIGH;
668+
else if (prio < I915_PRIORITY_NORMAL)
669+
return GEN12_CTX_PRIORITY_LOW;
670+
else
671+
return GEN12_CTX_PRIORITY_NORMAL;
672+
}
673+
664674
static u64 execlists_update_context(struct i915_request *rq)
665675
{
666676
struct intel_context *ce = rq->context;
@@ -669,7 +679,7 @@ static u64 execlists_update_context(struct i915_request *rq)
669679

670680
desc = ce->lrc.desc;
671681
if (rq->engine->flags & I915_ENGINE_HAS_EU_PRIORITY)
672-
desc |= lrc_desc_priority(rq_prio(rq));
682+
desc |= map_i915_prio_to_lrc_desc_prio(rq_prio(rq));
673683

674684
/*
675685
* WaIdleLiteRestore:bdw,skl

drivers/gpu/drm/i915/gt/intel_lrc.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,6 @@ enum {
111111
#define XEHP_SW_COUNTER_SHIFT 58
112112
#define XEHP_SW_COUNTER_WIDTH 6
113113

114-
static inline u32 lrc_desc_priority(int prio)
115-
{
116-
if (prio > I915_PRIORITY_NORMAL)
117-
return GEN12_CTX_PRIORITY_HIGH;
118-
else if (prio < I915_PRIORITY_NORMAL)
119-
return GEN12_CTX_PRIORITY_LOW;
120-
else
121-
return GEN12_CTX_PRIORITY_NORMAL;
122-
}
123-
124114
static inline void lrc_runtime_start(struct intel_context *ce)
125115
{
126116
struct intel_context_stats *stats = &ce->stats;

drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ enum intel_guc_action {
122122
INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE = 0x1002,
123123
INTEL_GUC_ACTION_SCHED_ENGINE_MODE_SET = 0x1003,
124124
INTEL_GUC_ACTION_SCHED_ENGINE_MODE_DONE = 0x1004,
125+
INTEL_GUC_ACTION_V69_SET_CONTEXT_PRIORITY = 0x1005,
126+
INTEL_GUC_ACTION_V69_SET_CONTEXT_EXECUTION_QUANTUM = 0x1006,
127+
INTEL_GUC_ACTION_V69_SET_CONTEXT_PREEMPTION_TIMEOUT = 0x1007,
125128
INTEL_GUC_ACTION_CONTEXT_RESET_NOTIFICATION = 0x1008,
126129
INTEL_GUC_ACTION_ENGINE_FAILURE_NOTIFICATION = 0x1009,
127130
INTEL_GUC_ACTION_HOST2GUC_UPDATE_CONTEXT_POLICIES = 0x100B,

0 commit comments

Comments
 (0)