Skip to content

Commit e7cea79

Browse files
committed
Merge tag 'drm-fixes-2020-05-15' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "As mentioned last week an i915 PR came in late, but I left it, so the i915 bits of this cover 2 weeks, which is why it's likely a bit larger than usual. Otherwise it's mostly amdgpu fixes, one tegra fix, one meson fix. i915: - Handle idling during i915_gem_evict_something busy loops (Chris) - Mark current submissions with a weak-dependency (Chris) - Propagate error from completed fences (Chris) - Fixes on execlist to avoid GPU hang situation (Chris) - Fixes couple deadlocks (Chris) - Timeslice preemption fixes (Chris) - Fix Display Port interrupt handling on Tiger Lake (Imre) - Reduce debug noise around Frame Buffer Compression (Peter) - Fix logic around IPC W/a for Coffee Lake and Kaby Lake (Sultan) - Avoid dereferencing a dead context (Chris) tegra: - tegra120/4 smmu fixes amdgpu: - Clockgating fixes - Fix fbdev with scatter/gather display - S4 fix for navi - Soft recovery for gfx10 - Freesync fixes - Atomic check cursor fix - Add a gfxoff quirk - MST fix amdkfd: - Fix GEM reference counting meson: - error code propogation fix" * tag 'drm-fixes-2020-05-15' of git://anongit.freedesktop.org/drm/drm: (29 commits) drm/i915: Handle idling during i915_gem_evict_something busy loops drm/meson: pm resume add return errno branch drm/amd/amdgpu: Update update_config() logic drm/amd/amdgpu: add raven1 part to the gfxoff quirk list drm/i915: Mark concurrent submissions with a weak-dependency drm/i915: Propagate error from completed fences drm/i915/gvt: Fix kernel oops for 3-level ppgtt guest drm/i915/gvt: Init DPLL/DDI vreg for virtual display instead of inheritance. drm/amd/display: add basic atomic check for cursor plane drm/amd/display: Fix vblank and pageflip event handling for FreeSync drm/amdgpu: implement soft_recovery for gfx10 drm/amdgpu: enable hibernate support on Navi1X drm/amdgpu: Use GEM obj reference for KFD BOs drm/amdgpu: force fbdev into vram drm/amd/powerplay: perform PG ungate prior to CG ungate drm/amdgpu: drop unnecessary cancel_delayed_work_sync on PG ungate drm/amdgpu: disable MGCG/MGLS also on gfx CG ungate drm/i915/execlists: Track inflight CCID drm/i915/execlists: Avoid reusing the same logical CCID drm/i915/gem: Remove object_is_locked assertion from unpin_from_display_plane ...
2 parents 1ae7efb + 1d2a1eb commit e7cea79

38 files changed

+439
-274
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@ struct amdgpu_device {
945945

946946
/* s3/s4 mask */
947947
bool in_suspend;
948+
bool in_hibernate;
948949

949950
/* record last mm index being written through WREG32*/
950951
unsigned long last_mm_index;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
13431343
}
13441344

13451345
/* Free the BO*/
1346-
amdgpu_bo_unref(&mem->bo);
1346+
drm_gem_object_put_unlocked(&mem->bo->tbo.base);
13471347
mutex_destroy(&mem->lock);
13481348
kfree(mem);
13491349

@@ -1688,7 +1688,8 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd,
16881688
| KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE
16891689
| KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE;
16901690

1691-
(*mem)->bo = amdgpu_bo_ref(bo);
1691+
drm_gem_object_get(&bo->tbo.base);
1692+
(*mem)->bo = bo;
16921693
(*mem)->va = va;
16931694
(*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ?
16941695
AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,9 @@ static int amdgpu_pmops_freeze(struct device *dev)
11811181
struct amdgpu_device *adev = drm_dev->dev_private;
11821182
int r;
11831183

1184+
adev->in_hibernate = true;
11841185
r = amdgpu_device_suspend(drm_dev, true);
1186+
adev->in_hibernate = false;
11851187
if (r)
11861188
return r;
11871189
return amdgpu_asic_reset(adev);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
133133
u32 cpp;
134134
u64 flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
135135
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
136-
AMDGPU_GEM_CREATE_VRAM_CLEARED |
137-
AMDGPU_GEM_CREATE_CPU_GTT_USWC;
136+
AMDGPU_GEM_CREATE_VRAM_CLEARED;
138137

139138
info = drm_get_format_info(adev->ddev, mode_cmd);
140139
cpp = info->cpp[0];

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,7 +4273,7 @@ static int gfx_v10_0_update_gfx_clock_gating(struct amdgpu_device *adev,
42734273
/* === CGCG /CGLS for GFX 3D Only === */
42744274
gfx_v10_0_update_3d_clock_gating(adev, enable);
42754275
/* === MGCG + MGLS === */
4276-
/* gfx_v10_0_update_medium_grain_clock_gating(adev, enable); */
4276+
gfx_v10_0_update_medium_grain_clock_gating(adev, enable);
42774277
}
42784278

42794279
if (adev->cg_flags &
@@ -4353,11 +4353,7 @@ static int gfx_v10_0_set_powergating_state(void *handle,
43534353
switch (adev->asic_type) {
43544354
case CHIP_NAVI10:
43554355
case CHIP_NAVI14:
4356-
if (!enable) {
4357-
amdgpu_gfx_off_ctrl(adev, false);
4358-
cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
4359-
} else
4360-
amdgpu_gfx_off_ctrl(adev, true);
4356+
amdgpu_gfx_off_ctrl(adev, enable);
43614357
break;
43624358
default:
43634359
break;
@@ -4918,6 +4914,19 @@ static void gfx_v10_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
49184914
ref, mask);
49194915
}
49204916

4917+
static void gfx_v10_0_ring_soft_recovery(struct amdgpu_ring *ring,
4918+
unsigned vmid)
4919+
{
4920+
struct amdgpu_device *adev = ring->adev;
4921+
uint32_t value = 0;
4922+
4923+
value = REG_SET_FIELD(value, SQ_CMD, CMD, 0x03);
4924+
value = REG_SET_FIELD(value, SQ_CMD, MODE, 0x01);
4925+
value = REG_SET_FIELD(value, SQ_CMD, CHECK_VMID, 1);
4926+
value = REG_SET_FIELD(value, SQ_CMD, VM_ID, vmid);
4927+
WREG32_SOC15(GC, 0, mmSQ_CMD, value);
4928+
}
4929+
49214930
static void
49224931
gfx_v10_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
49234932
uint32_t me, uint32_t pipe,
@@ -5309,6 +5318,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
53095318
.emit_wreg = gfx_v10_0_ring_emit_wreg,
53105319
.emit_reg_wait = gfx_v10_0_ring_emit_reg_wait,
53115320
.emit_reg_write_reg_wait = gfx_v10_0_ring_emit_reg_write_reg_wait,
5321+
.soft_recovery = gfx_v10_0_ring_soft_recovery,
53125322
};
53135323

53145324
static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,8 @@ static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
12361236
{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
12371237
/* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */
12381238
{ 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 },
1239+
/* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */
1240+
{ 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 },
12391241
{ 0, 0, 0, 0, 0 },
12401242
};
12411243

@@ -5025,10 +5027,9 @@ static int gfx_v9_0_set_powergating_state(void *handle,
50255027
switch (adev->asic_type) {
50265028
case CHIP_RAVEN:
50275029
case CHIP_RENOIR:
5028-
if (!enable) {
5030+
if (!enable)
50295031
amdgpu_gfx_off_ctrl(adev, false);
5030-
cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
5031-
}
5032+
50325033
if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
50335034
gfx_v9_0_enable_sck_slow_down_on_power_up(adev, true);
50345035
gfx_v9_0_enable_sck_slow_down_on_power_down(adev, true);
@@ -5052,12 +5053,7 @@ static int gfx_v9_0_set_powergating_state(void *handle,
50525053
amdgpu_gfx_off_ctrl(adev, true);
50535054
break;
50545055
case CHIP_VEGA12:
5055-
if (!enable) {
5056-
amdgpu_gfx_off_ctrl(adev, false);
5057-
cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
5058-
} else {
5059-
amdgpu_gfx_off_ctrl(adev, true);
5060-
}
5056+
amdgpu_gfx_off_ctrl(adev, enable);
50615057
break;
50625058
default:
50635059
break;

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

Lines changed: 79 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ static void dm_vupdate_high_irq(void *interrupt_params)
441441

442442
/**
443443
* dm_crtc_high_irq() - Handles CRTC interrupt
444-
* @interrupt_params: ignored
444+
* @interrupt_params: used for determining the CRTC instance
445445
*
446446
* Handles the CRTC/VSYNC interrupt by notfying DRM's VBLANK
447447
* event handler.
@@ -455,70 +455,6 @@ static void dm_crtc_high_irq(void *interrupt_params)
455455
unsigned long flags;
456456

457457
acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VBLANK);
458-
459-
if (acrtc) {
460-
acrtc_state = to_dm_crtc_state(acrtc->base.state);
461-
462-
DRM_DEBUG_VBL("crtc:%d, vupdate-vrr:%d\n",
463-
acrtc->crtc_id,
464-
amdgpu_dm_vrr_active(acrtc_state));
465-
466-
/* Core vblank handling at start of front-porch is only possible
467-
* in non-vrr mode, as only there vblank timestamping will give
468-
* valid results while done in front-porch. Otherwise defer it
469-
* to dm_vupdate_high_irq after end of front-porch.
470-
*/
471-
if (!amdgpu_dm_vrr_active(acrtc_state))
472-
drm_crtc_handle_vblank(&acrtc->base);
473-
474-
/* Following stuff must happen at start of vblank, for crc
475-
* computation and below-the-range btr support in vrr mode.
476-
*/
477-
amdgpu_dm_crtc_handle_crc_irq(&acrtc->base);
478-
479-
if (acrtc_state->stream && adev->family >= AMDGPU_FAMILY_AI &&
480-
acrtc_state->vrr_params.supported &&
481-
acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE) {
482-
spin_lock_irqsave(&adev->ddev->event_lock, flags);
483-
mod_freesync_handle_v_update(
484-
adev->dm.freesync_module,
485-
acrtc_state->stream,
486-
&acrtc_state->vrr_params);
487-
488-
dc_stream_adjust_vmin_vmax(
489-
adev->dm.dc,
490-
acrtc_state->stream,
491-
&acrtc_state->vrr_params.adjust);
492-
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
493-
}
494-
}
495-
}
496-
497-
#if defined(CONFIG_DRM_AMD_DC_DCN)
498-
/**
499-
* dm_dcn_crtc_high_irq() - Handles VStartup interrupt for DCN generation ASICs
500-
* @interrupt params - interrupt parameters
501-
*
502-
* Notify DRM's vblank event handler at VSTARTUP
503-
*
504-
* Unlike DCE hardware, we trigger the handler at VSTARTUP. at which:
505-
* * We are close enough to VUPDATE - the point of no return for hw
506-
* * We are in the fixed portion of variable front porch when vrr is enabled
507-
* * We are before VUPDATE, where double-buffered vrr registers are swapped
508-
*
509-
* It is therefore the correct place to signal vblank, send user flip events,
510-
* and update VRR.
511-
*/
512-
static void dm_dcn_crtc_high_irq(void *interrupt_params)
513-
{
514-
struct common_irq_params *irq_params = interrupt_params;
515-
struct amdgpu_device *adev = irq_params->adev;
516-
struct amdgpu_crtc *acrtc;
517-
struct dm_crtc_state *acrtc_state;
518-
unsigned long flags;
519-
520-
acrtc = get_crtc_by_otg_inst(adev, irq_params->irq_src - IRQ_TYPE_VBLANK);
521-
522458
if (!acrtc)
523459
return;
524460

@@ -528,22 +464,35 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params)
528464
amdgpu_dm_vrr_active(acrtc_state),
529465
acrtc_state->active_planes);
530466

467+
/**
468+
* Core vblank handling at start of front-porch is only possible
469+
* in non-vrr mode, as only there vblank timestamping will give
470+
* valid results while done in front-porch. Otherwise defer it
471+
* to dm_vupdate_high_irq after end of front-porch.
472+
*/
473+
if (!amdgpu_dm_vrr_active(acrtc_state))
474+
drm_crtc_handle_vblank(&acrtc->base);
475+
476+
/**
477+
* Following stuff must happen at start of vblank, for crc
478+
* computation and below-the-range btr support in vrr mode.
479+
*/
531480
amdgpu_dm_crtc_handle_crc_irq(&acrtc->base);
532-
drm_crtc_handle_vblank(&acrtc->base);
481+
482+
/* BTR updates need to happen before VUPDATE on Vega and above. */
483+
if (adev->family < AMDGPU_FAMILY_AI)
484+
return;
533485

534486
spin_lock_irqsave(&adev->ddev->event_lock, flags);
535487

536-
if (acrtc_state->vrr_params.supported &&
488+
if (acrtc_state->stream && acrtc_state->vrr_params.supported &&
537489
acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE) {
538-
mod_freesync_handle_v_update(
539-
adev->dm.freesync_module,
540-
acrtc_state->stream,
541-
&acrtc_state->vrr_params);
490+
mod_freesync_handle_v_update(adev->dm.freesync_module,
491+
acrtc_state->stream,
492+
&acrtc_state->vrr_params);
542493

543-
dc_stream_adjust_vmin_vmax(
544-
adev->dm.dc,
545-
acrtc_state->stream,
546-
&acrtc_state->vrr_params.adjust);
494+
dc_stream_adjust_vmin_vmax(adev->dm.dc, acrtc_state->stream,
495+
&acrtc_state->vrr_params.adjust);
547496
}
548497

549498
/*
@@ -556,7 +505,8 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params)
556505
* avoid race conditions between flip programming and completion,
557506
* which could cause too early flip completion events.
558507
*/
559-
if (acrtc->pflip_status == AMDGPU_FLIP_SUBMITTED &&
508+
if (adev->family >= AMDGPU_FAMILY_RV &&
509+
acrtc->pflip_status == AMDGPU_FLIP_SUBMITTED &&
560510
acrtc_state->active_planes == 0) {
561511
if (acrtc->event) {
562512
drm_crtc_send_vblank_event(&acrtc->base, acrtc->event);
@@ -568,7 +518,6 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params)
568518

569519
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
570520
}
571-
#endif
572521

573522
static int dm_set_clockgating_state(void *handle,
574523
enum amd_clockgating_state state)
@@ -2445,8 +2394,36 @@ static int dcn10_register_irq_handlers(struct amdgpu_device *adev)
24452394
c_irq_params->adev = adev;
24462395
c_irq_params->irq_src = int_params.irq_source;
24472396

2397+
amdgpu_dm_irq_register_interrupt(
2398+
adev, &int_params, dm_crtc_high_irq, c_irq_params);
2399+
}
2400+
2401+
/* Use VUPDATE_NO_LOCK interrupt on DCN, which seems to correspond to
2402+
* the regular VUPDATE interrupt on DCE. We want DC_IRQ_SOURCE_VUPDATEx
2403+
* to trigger at end of each vblank, regardless of state of the lock,
2404+
* matching DCE behaviour.
2405+
*/
2406+
for (i = DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT;
2407+
i <= DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT + adev->mode_info.num_crtc - 1;
2408+
i++) {
2409+
r = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_DCE, i, &adev->vupdate_irq);
2410+
2411+
if (r) {
2412+
DRM_ERROR("Failed to add vupdate irq id!\n");
2413+
return r;
2414+
}
2415+
2416+
int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT;
2417+
int_params.irq_source =
2418+
dc_interrupt_to_irq_source(dc, i, 0);
2419+
2420+
c_irq_params = &adev->dm.vupdate_params[int_params.irq_source - DC_IRQ_SOURCE_VUPDATE1];
2421+
2422+
c_irq_params->adev = adev;
2423+
c_irq_params->irq_src = int_params.irq_source;
2424+
24482425
amdgpu_dm_irq_register_interrupt(adev, &int_params,
2449-
dm_dcn_crtc_high_irq, c_irq_params);
2426+
dm_vupdate_high_irq, c_irq_params);
24502427
}
24512428

24522429
/* Use GRPH_PFLIP interrupt */
@@ -4453,10 +4430,6 @@ static inline int dm_set_vupdate_irq(struct drm_crtc *crtc, bool enable)
44534430
struct amdgpu_device *adev = crtc->dev->dev_private;
44544431
int rc;
44554432

4456-
/* Do not set vupdate for DCN hardware */
4457-
if (adev->family > AMDGPU_FAMILY_AI)
4458-
return 0;
4459-
44604433
irq_source = IRQ_TYPE_VUPDATE + acrtc->otg_inst;
44614434

44624435
rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY;
@@ -7882,6 +7855,7 @@ static int dm_update_plane_state(struct dc *dc,
78827855
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
78837856
struct dm_crtc_state *dm_new_crtc_state, *dm_old_crtc_state;
78847857
struct dm_plane_state *dm_new_plane_state, *dm_old_plane_state;
7858+
struct amdgpu_crtc *new_acrtc;
78857859
bool needs_reset;
78867860
int ret = 0;
78877861

@@ -7891,9 +7865,30 @@ static int dm_update_plane_state(struct dc *dc,
78917865
dm_new_plane_state = to_dm_plane_state(new_plane_state);
78927866
dm_old_plane_state = to_dm_plane_state(old_plane_state);
78937867

7894-
/*TODO Implement atomic check for cursor plane */
7895-
if (plane->type == DRM_PLANE_TYPE_CURSOR)
7868+
/*TODO Implement better atomic check for cursor plane */
7869+
if (plane->type == DRM_PLANE_TYPE_CURSOR) {
7870+
if (!enable || !new_plane_crtc ||
7871+
drm_atomic_plane_disabling(plane->state, new_plane_state))
7872+
return 0;
7873+
7874+
new_acrtc = to_amdgpu_crtc(new_plane_crtc);
7875+
7876+
if ((new_plane_state->crtc_w > new_acrtc->max_cursor_width) ||
7877+
(new_plane_state->crtc_h > new_acrtc->max_cursor_height)) {
7878+
DRM_DEBUG_ATOMIC("Bad cursor size %d x %d\n",
7879+
new_plane_state->crtc_w, new_plane_state->crtc_h);
7880+
return -EINVAL;
7881+
}
7882+
7883+
if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width ||
7884+
new_plane_state->crtc_y <= -new_acrtc->max_cursor_height) {
7885+
DRM_DEBUG_ATOMIC("Bad cursor position %d, %d\n",
7886+
new_plane_state->crtc_x, new_plane_state->crtc_y);
7887+
return -EINVAL;
7888+
}
7889+
78967890
return 0;
7891+
}
78977892

78987893
needs_reset = should_reset_plane(state, plane, old_plane_state,
78997894
new_plane_state);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,15 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
398398
struct mod_hdcp_display *display = &hdcp_work[link_index].display;
399399
struct mod_hdcp_link *link = &hdcp_work[link_index].link;
400400

401-
memset(display, 0, sizeof(*display));
402-
memset(link, 0, sizeof(*link));
403-
404-
display->index = aconnector->base.index;
405-
406401
if (config->dpms_off) {
407402
hdcp_remove_display(hdcp_work, link_index, aconnector);
408403
return;
409404
}
405+
406+
memset(display, 0, sizeof(*display));
407+
memset(link, 0, sizeof(*link));
408+
409+
display->index = aconnector->base.index;
410410
display->state = MOD_HDCP_DISPLAY_ACTIVE;
411411

412412
if (aconnector->dc_sink != NULL)

0 commit comments

Comments
 (0)