Skip to content

Commit fd1f297

Browse files
committed
Merge tag 'drm-fixes-2019-03-22' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "i915, amdgpu, vmwgfx, exynos, nouveau and udl fixes. Seems to be lots of little minor ones for regressions in rc1, and some cleanups. The exynos one is the largest one, and is for a hw difference between exynos versions" * tag 'drm-fixes-2019-03-22' of git://anongit.freedesktop.org/drm/drm: drm/nouveau/dmem: empty chunk do not have a buffer object associated with them. drm/nouveau/debugfs: Fix check of pm_runtime_get_sync failure drm/nouveau/dmem: Fix a NULL vs IS_ERR() check drm/nouveau/dmem: remove set but not used variable 'drm' drm/exynos/mixer: fix MIXER shadow registry synchronisation code drm/vmwgfx: Don't double-free the mode stored in par->set_mode drm/vmwgfx: Return 0 when gmrid::get_node runs out of ID's drm/amdgpu: fix invalid use of change_bit drm/amdgpu: revert "cleanup setting bulk_movable" drm/i915: Sanity check mmap length against object size drm/i915: Fix off-by-one in reporting hanging process drm/i915/bios: assume eDP is present on port A when there is no VBT drm/udl: use drm_gem_object_put_unlocked.
2 parents d92da1f + 8e07878 commit fd1f297

File tree

11 files changed

+87
-75
lines changed

11 files changed

+87
-75
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,8 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
700700
struct amdgpu_vm_bo_base *bo_base, *tmp;
701701
int r = 0;
702702

703+
vm->bulk_moveable &= list_empty(&vm->evicted);
704+
703705
list_for_each_entry_safe(bo_base, tmp, &vm->evicted, vm_status) {
704706
struct amdgpu_bo *bo = bo_base->bo;
705707

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ static int gmc_v9_0_allocate_vm_inv_eng(struct amdgpu_device *adev)
742742
}
743743

744744
ring->vm_inv_eng = inv_eng - 1;
745-
change_bit(inv_eng - 1, (unsigned long *)(&vm_inv_engs[vmhub]));
745+
vm_inv_engs[vmhub] &= ~(1 << ring->vm_inv_eng);
746746

747747
dev_info(adev->dev, "ring %s uses VM inv eng %u on hub %u\n",
748748
ring->name, ring->vm_inv_eng, ring->funcs->vmhub);

drivers/gpu/drm/exynos/exynos_mixer.c

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "regs-vp.h"
2121

2222
#include <linux/kernel.h>
23+
#include <linux/ktime.h>
2324
#include <linux/spinlock.h>
2425
#include <linux/wait.h>
2526
#include <linux/i2c.h>
@@ -352,15 +353,62 @@ static void mixer_cfg_vp_blend(struct mixer_context *ctx, unsigned int alpha)
352353
mixer_reg_write(ctx, MXR_VIDEO_CFG, val);
353354
}
354355

355-
static void mixer_vsync_set_update(struct mixer_context *ctx, bool enable)
356+
static bool mixer_is_synced(struct mixer_context *ctx)
356357
{
357-
/* block update on vsync */
358-
mixer_reg_writemask(ctx, MXR_STATUS, enable ?
359-
MXR_STATUS_SYNC_ENABLE : 0, MXR_STATUS_SYNC_ENABLE);
358+
u32 base, shadow;
360359

360+
if (ctx->mxr_ver == MXR_VER_16_0_33_0 ||
361+
ctx->mxr_ver == MXR_VER_128_0_0_184)
362+
return !(mixer_reg_read(ctx, MXR_CFG) &
363+
MXR_CFG_LAYER_UPDATE_COUNT_MASK);
364+
365+
if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags) &&
366+
vp_reg_read(ctx, VP_SHADOW_UPDATE))
367+
return false;
368+
369+
base = mixer_reg_read(ctx, MXR_CFG);
370+
shadow = mixer_reg_read(ctx, MXR_CFG_S);
371+
if (base != shadow)
372+
return false;
373+
374+
base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0));
375+
shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0));
376+
if (base != shadow)
377+
return false;
378+
379+
base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(1));
380+
shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(1));
381+
if (base != shadow)
382+
return false;
383+
384+
return true;
385+
}
386+
387+
static int mixer_wait_for_sync(struct mixer_context *ctx)
388+
{
389+
ktime_t timeout = ktime_add_us(ktime_get(), 100000);
390+
391+
while (!mixer_is_synced(ctx)) {
392+
usleep_range(1000, 2000);
393+
if (ktime_compare(ktime_get(), timeout) > 0)
394+
return -ETIMEDOUT;
395+
}
396+
return 0;
397+
}
398+
399+
static void mixer_disable_sync(struct mixer_context *ctx)
400+
{
401+
mixer_reg_writemask(ctx, MXR_STATUS, 0, MXR_STATUS_SYNC_ENABLE);
402+
}
403+
404+
static void mixer_enable_sync(struct mixer_context *ctx)
405+
{
406+
if (ctx->mxr_ver == MXR_VER_16_0_33_0 ||
407+
ctx->mxr_ver == MXR_VER_128_0_0_184)
408+
mixer_reg_writemask(ctx, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
409+
mixer_reg_writemask(ctx, MXR_STATUS, ~0, MXR_STATUS_SYNC_ENABLE);
361410
if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags))
362-
vp_reg_write(ctx, VP_SHADOW_UPDATE, enable ?
363-
VP_SHADOW_UPDATE_ENABLE : 0);
411+
vp_reg_write(ctx, VP_SHADOW_UPDATE, VP_SHADOW_UPDATE_ENABLE);
364412
}
365413

366414
static void mixer_cfg_scan(struct mixer_context *ctx, int width, int height)
@@ -498,7 +546,6 @@ static void vp_video_buffer(struct mixer_context *ctx,
498546

499547
spin_lock_irqsave(&ctx->reg_slock, flags);
500548

501-
vp_reg_write(ctx, VP_SHADOW_UPDATE, 1);
502549
/* interlace or progressive scan mode */
503550
val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0);
504551
vp_reg_writemask(ctx, VP_MODE, val, VP_MODE_LINE_SKIP);
@@ -553,11 +600,6 @@ static void vp_video_buffer(struct mixer_context *ctx,
553600
vp_regs_dump(ctx);
554601
}
555602

556-
static void mixer_layer_update(struct mixer_context *ctx)
557-
{
558-
mixer_reg_writemask(ctx, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
559-
}
560-
561603
static void mixer_graph_buffer(struct mixer_context *ctx,
562604
struct exynos_drm_plane *plane)
563605
{
@@ -640,11 +682,6 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
640682
mixer_cfg_layer(ctx, win, priority, true);
641683
mixer_cfg_gfx_blend(ctx, win, pixel_alpha, state->base.alpha);
642684

643-
/* layer update mandatory for mixer 16.0.33.0 */
644-
if (ctx->mxr_ver == MXR_VER_16_0_33_0 ||
645-
ctx->mxr_ver == MXR_VER_128_0_0_184)
646-
mixer_layer_update(ctx);
647-
648685
spin_unlock_irqrestore(&ctx->reg_slock, flags);
649686

650687
mixer_regs_dump(ctx);
@@ -709,7 +746,7 @@ static void mixer_win_reset(struct mixer_context *ctx)
709746
static irqreturn_t mixer_irq_handler(int irq, void *arg)
710747
{
711748
struct mixer_context *ctx = arg;
712-
u32 val, base, shadow;
749+
u32 val;
713750

714751
spin_lock(&ctx->reg_slock);
715752

@@ -723,26 +760,9 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)
723760
val &= ~MXR_INT_STATUS_VSYNC;
724761

725762
/* interlace scan need to check shadow register */
726-
if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) {
727-
if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags) &&
728-
vp_reg_read(ctx, VP_SHADOW_UPDATE))
729-
goto out;
730-
731-
base = mixer_reg_read(ctx, MXR_CFG);
732-
shadow = mixer_reg_read(ctx, MXR_CFG_S);
733-
if (base != shadow)
734-
goto out;
735-
736-
base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0));
737-
shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0));
738-
if (base != shadow)
739-
goto out;
740-
741-
base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(1));
742-
shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(1));
743-
if (base != shadow)
744-
goto out;
745-
}
763+
if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)
764+
&& !mixer_is_synced(ctx))
765+
goto out;
746766

747767
drm_crtc_handle_vblank(&ctx->crtc->base);
748768
}
@@ -917,12 +937,14 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc)
917937

918938
static void mixer_atomic_begin(struct exynos_drm_crtc *crtc)
919939
{
920-
struct mixer_context *mixer_ctx = crtc->ctx;
940+
struct mixer_context *ctx = crtc->ctx;
921941

922-
if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags))
942+
if (!test_bit(MXR_BIT_POWERED, &ctx->flags))
923943
return;
924944

925-
mixer_vsync_set_update(mixer_ctx, false);
945+
if (mixer_wait_for_sync(ctx))
946+
dev_err(ctx->dev, "timeout waiting for VSYNC\n");
947+
mixer_disable_sync(ctx);
926948
}
927949

928950
static void mixer_update_plane(struct exynos_drm_crtc *crtc,
@@ -964,7 +986,7 @@ static void mixer_atomic_flush(struct exynos_drm_crtc *crtc)
964986
if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags))
965987
return;
966988

967-
mixer_vsync_set_update(mixer_ctx, true);
989+
mixer_enable_sync(mixer_ctx);
968990
exynos_crtc_handle_event(crtc);
969991
}
970992

@@ -979,7 +1001,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
9791001

9801002
exynos_drm_pipe_clk_enable(crtc, true);
9811003

982-
mixer_vsync_set_update(ctx, false);
1004+
mixer_disable_sync(ctx);
9831005

9841006
mixer_reg_writemask(ctx, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET);
9851007

@@ -992,7 +1014,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
9921014

9931015
mixer_commit(ctx);
9941016

995-
mixer_vsync_set_update(ctx, true);
1017+
mixer_enable_sync(ctx);
9961018

9971019
set_bit(MXR_BIT_POWERED, &ctx->flags);
9981020
}

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,8 +1734,13 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
17341734
* pages from.
17351735
*/
17361736
if (!obj->base.filp) {
1737-
i915_gem_object_put(obj);
1738-
return -ENXIO;
1737+
addr = -ENXIO;
1738+
goto err;
1739+
}
1740+
1741+
if (range_overflows(args->offset, args->size, (u64)obj->base.size)) {
1742+
addr = -EINVAL;
1743+
goto err;
17391744
}
17401745

17411746
addr = vm_mmap(obj->base.filp, 0, args->size,
@@ -1749,8 +1754,8 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
17491754
struct vm_area_struct *vma;
17501755

17511756
if (down_write_killable(&mm->mmap_sem)) {
1752-
i915_gem_object_put(obj);
1753-
return -EINTR;
1757+
addr = -EINTR;
1758+
goto err;
17541759
}
17551760
vma = find_vma(mm, addr);
17561761
if (vma && __vma_matches(vma, obj->base.filp, addr, args->size))
@@ -1768,12 +1773,10 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
17681773
i915_gem_object_put(obj);
17691774

17701775
args->addr_ptr = (u64)addr;
1771-
17721776
return 0;
17731777

17741778
err:
17751779
i915_gem_object_put(obj);
1776-
17771780
return addr;
17781781
}
17791782

drivers/gpu/drm/i915/i915_gpu_error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ error_msg(struct i915_gpu_state *error, unsigned long engines, const char *msg)
17211721
i915_error_generate_code(error, engines));
17221722
if (engines) {
17231723
/* Just show the first executing process, more is confusing */
1724-
i = ffs(engines);
1724+
i = __ffs(engines);
17251725
len += scnprintf(error->error_msg + len,
17261726
sizeof(error->error_msg) - len,
17271727
", in %s [%d]",

drivers/gpu/drm/i915/intel_bios.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,7 @@ init_vbt_missing_defaults(struct drm_i915_private *dev_priv)
16731673
info->supports_dvi = (port != PORT_A && port != PORT_E);
16741674
info->supports_hdmi = info->supports_dvi;
16751675
info->supports_dp = (port != PORT_E);
1676+
info->supports_edp = (port == PORT_A);
16761677
}
16771678
}
16781679

drivers/gpu/drm/nouveau/nouveau_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf,
181181
}
182182

183183
ret = pm_runtime_get_sync(drm->dev);
184-
if (IS_ERR_VALUE(ret) && ret != -EACCES)
184+
if (ret < 0 && ret != -EACCES)
185185
return ret;
186186
ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_USER, &args, sizeof(args));
187187
pm_runtime_put_autosuspend(drm->dev);

drivers/gpu/drm/nouveau/nouveau_dmem.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,10 @@ static void
100100
nouveau_dmem_free(struct hmm_devmem *devmem, struct page *page)
101101
{
102102
struct nouveau_dmem_chunk *chunk;
103-
struct nouveau_drm *drm;
104103
unsigned long idx;
105104

106105
chunk = (void *)hmm_devmem_page_get_drvdata(page);
107106
idx = page_to_pfn(page) - chunk->pfn_first;
108-
drm = chunk->drm;
109107

110108
/*
111109
* FIXME:
@@ -456,11 +454,6 @@ nouveau_dmem_resume(struct nouveau_drm *drm)
456454
/* FIXME handle pin failure */
457455
WARN_ON(ret);
458456
}
459-
list_for_each_entry (chunk, &drm->dmem->chunk_empty, list) {
460-
ret = nouveau_bo_pin(chunk->bo, TTM_PL_FLAG_VRAM, false);
461-
/* FIXME handle pin failure */
462-
WARN_ON(ret);
463-
}
464457
mutex_unlock(&drm->dmem->mutex);
465458
}
466459

@@ -479,9 +472,6 @@ nouveau_dmem_suspend(struct nouveau_drm *drm)
479472
list_for_each_entry (chunk, &drm->dmem->chunk_full, list) {
480473
nouveau_bo_unpin(chunk->bo);
481474
}
482-
list_for_each_entry (chunk, &drm->dmem->chunk_empty, list) {
483-
nouveau_bo_unpin(chunk->bo);
484-
}
485475
mutex_unlock(&drm->dmem->mutex);
486476
}
487477

@@ -623,7 +613,7 @@ nouveau_dmem_init(struct nouveau_drm *drm)
623613
*/
624614
drm->dmem->devmem = hmm_devmem_add(&nouveau_dmem_devmem_ops,
625615
device, size);
626-
if (drm->dmem->devmem == NULL) {
616+
if (IS_ERR(drm->dmem->devmem)) {
627617
kfree(drm->dmem);
628618
drm->dmem = NULL;
629619
return;

drivers/gpu/drm/udl/udl_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device *dev,
224224
*offset = drm_vma_node_offset_addr(&gobj->base.vma_node);
225225

226226
out:
227-
drm_gem_object_put(&gobj->base);
227+
drm_gem_object_put_unlocked(&gobj->base);
228228
unlock:
229229
mutex_unlock(&udl->gem_lock);
230230
return ret;

drivers/gpu/drm/vmwgfx/vmwgfx_fb.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,9 @@ static int vmw_fb_set_par(struct fb_info *info)
564564
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
565565
DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC)
566566
};
567-
struct drm_display_mode *old_mode;
568567
struct drm_display_mode *mode;
569568
int ret;
570569

571-
old_mode = par->set_mode;
572570
mode = drm_mode_duplicate(vmw_priv->dev, &new_mode);
573571
if (!mode) {
574572
DRM_ERROR("Could not create new fb mode.\n");
@@ -579,11 +577,7 @@ static int vmw_fb_set_par(struct fb_info *info)
579577
mode->vdisplay = var->yres;
580578
vmw_guess_mode_timing(mode);
581579

582-
if (old_mode && drm_mode_equal(old_mode, mode)) {
583-
drm_mode_destroy(vmw_priv->dev, mode);
584-
mode = old_mode;
585-
old_mode = NULL;
586-
} else if (!vmw_kms_validate_mode_vram(vmw_priv,
580+
if (!vmw_kms_validate_mode_vram(vmw_priv,
587581
mode->hdisplay *
588582
DIV_ROUND_UP(var->bits_per_pixel, 8),
589583
mode->vdisplay)) {
@@ -620,8 +614,8 @@ static int vmw_fb_set_par(struct fb_info *info)
620614
schedule_delayed_work(&par->local_work, 0);
621615

622616
out_unlock:
623-
if (old_mode)
624-
drm_mode_destroy(vmw_priv->dev, old_mode);
617+
if (par->set_mode)
618+
drm_mode_destroy(vmw_priv->dev, par->set_mode);
625619
par->set_mode = mode;
626620

627621
mutex_unlock(&par->bo_mutex);

drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static int vmw_gmrid_man_get_node(struct ttm_mem_type_manager *man,
5757

5858
id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
5959
if (id < 0)
60-
return id;
60+
return (id != -ENOMEM ? 0 : id);
6161

6262
spin_lock(&gman->lock);
6363

0 commit comments

Comments
 (0)