Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm gixes from Dave Airlie:
- exynos: infinite loop regressions fixed
- i915: one regression
- radeon: one race condition on monitor probing
- noveau: two regressions
- tegra: one vblank regression fix

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
drm/tegra: dc: Add missing call to drm_vblank_on()
drm/nouveau/nv50/disp: Fix modeset on G94
drm/gk20a/fb: fix setting of large page size bit
drm/radeon: add locking around atombios scratch space usage
drm/i915: Fix obj->map_and_fenceable across tiling changes
drm/exynos: fix possible infinite loop issue
drm/exynos: g2d: fix null pointer dereference
drm/exynos: resolve infinite loop issue on non multi-platform
drm/exynos: resolve infinite loop issue on multi-platform

+103 -46
+33 -16
drivers/gpu/drm/exynos/exynos_drm_drv.c
··· 495 495 496 496 mutex_lock(&drm_component_lock); 497 497 498 + /* Do not retry to probe if there is no any kms driver regitered. */ 499 + if (list_empty(&drm_component_list)) { 500 + mutex_unlock(&drm_component_lock); 501 + return ERR_PTR(-ENODEV); 502 + } 503 + 498 504 list_for_each_entry(cdev, &drm_component_list, list) { 499 505 /* 500 506 * Add components to master only in case that crtc and ··· 591 585 goto err_unregister_mixer_drv; 592 586 #endif 593 587 588 + match = exynos_drm_match_add(&pdev->dev); 589 + if (IS_ERR(match)) { 590 + ret = PTR_ERR(match); 591 + goto err_unregister_hdmi_drv; 592 + } 593 + 594 + ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, 595 + match); 596 + if (ret < 0) 597 + goto err_unregister_hdmi_drv; 598 + 594 599 #ifdef CONFIG_DRM_EXYNOS_G2D 595 600 ret = platform_driver_register(&g2d_driver); 596 601 if (ret < 0) 597 - goto err_unregister_hdmi_drv; 602 + goto err_del_component_master; 598 603 #endif 599 604 600 605 #ifdef CONFIG_DRM_EXYNOS_FIMC ··· 636 619 goto err_unregister_ipp_drv; 637 620 #endif 638 621 639 - match = exynos_drm_match_add(&pdev->dev); 640 - if (IS_ERR(match)) { 641 - ret = PTR_ERR(match); 642 - goto err_unregister_resources; 643 - } 644 - 645 - ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, 646 - match); 647 - if (ret < 0) 648 - goto err_unregister_resources; 649 - 650 622 return ret; 651 623 652 - err_unregister_resources: 653 - 654 624 #ifdef CONFIG_DRM_EXYNOS_IPP 655 - exynos_platform_device_ipp_unregister(); 656 625 err_unregister_ipp_drv: 657 626 platform_driver_unregister(&ipp_driver); 658 627 err_unregister_gsc_drv: ··· 661 658 662 659 #ifdef CONFIG_DRM_EXYNOS_G2D 663 660 platform_driver_unregister(&g2d_driver); 664 - err_unregister_hdmi_drv: 661 + err_del_component_master: 665 662 #endif 663 + component_master_del(&pdev->dev, &exynos_drm_ops); 666 664 665 + err_unregister_hdmi_drv: 667 666 #ifdef CONFIG_DRM_EXYNOS_HDMI 668 667 platform_driver_unregister(&hdmi_driver); 669 668 err_unregister_mixer_drv: ··· 745 740 static int exynos_drm_init(void) 746 741 { 747 742 int ret; 743 + 744 + /* 745 + * Register device object only in case of Exynos SoC. 746 + * 747 + * Below codes resolves temporarily infinite loop issue incurred 748 + * by Exynos drm driver when using multi-platform kernel. 749 + * So these codes will be replaced with more generic way later. 750 + */ 751 + if (!of_machine_is_compatible("samsung,exynos3") && 752 + !of_machine_is_compatible("samsung,exynos4") && 753 + !of_machine_is_compatible("samsung,exynos5")) 754 + return -ENODEV; 748 755 749 756 exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, 750 757 NULL, 0);
+6 -3
drivers/gpu/drm/exynos/exynos_drm_g2d.c
··· 302 302 struct exynos_drm_subdrv *subdrv = &g2d->subdrv; 303 303 304 304 kfree(g2d->cmdlist_node); 305 - dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE, 306 - g2d->cmdlist_pool_virt, 307 - g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); 305 + 306 + if (g2d->cmdlist_pool_virt && g2d->cmdlist_pool) { 307 + dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE, 308 + g2d->cmdlist_pool_virt, 309 + g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); 310 + } 308 311 } 309 312 310 313 static struct g2d_cmdlist_node *g2d_get_cmdlist(struct g2d_data *g2d)
+3 -16
drivers/gpu/drm/i915/i915_gem_tiling.c
··· 364 364 * has to also include the unfenced register the GPU uses 365 365 * whilst executing a fenced command for an untiled object. 366 366 */ 367 - 368 - obj->map_and_fenceable = 369 - !i915_gem_obj_ggtt_bound(obj) || 370 - (i915_gem_obj_ggtt_offset(obj) + 371 - obj->base.size <= dev_priv->gtt.mappable_end && 372 - i915_gem_object_fence_ok(obj, args->tiling_mode)); 373 - 374 - /* Rebind if we need a change of alignment */ 375 - if (!obj->map_and_fenceable) { 376 - u32 unfenced_align = 377 - i915_gem_get_gtt_alignment(dev, obj->base.size, 378 - args->tiling_mode, 379 - false); 380 - if (i915_gem_obj_ggtt_offset(obj) & (unfenced_align - 1)) 381 - ret = i915_gem_object_ggtt_unbind(obj); 382 - } 367 + if (obj->map_and_fenceable && 368 + !i915_gem_object_fence_ok(obj, args->tiling_mode)) 369 + ret = i915_gem_object_ggtt_unbind(obj); 383 370 384 371 if (ret == 0) { 385 372 obj->fence_dirty =
+15 -1
drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c
··· 27 27 }; 28 28 29 29 static int 30 + gk20a_fb_init(struct nouveau_object *object) 31 + { 32 + struct gk20a_fb_priv *priv = (void *)object; 33 + int ret; 34 + 35 + ret = nouveau_fb_init(&priv->base); 36 + if (ret) 37 + return ret; 38 + 39 + nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ 40 + return 0; 41 + } 42 + 43 + static int 30 44 gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 31 45 struct nouveau_oclass *oclass, void *data, u32 size, 32 46 struct nouveau_object **pobject) ··· 62 48 .base.ofuncs = &(struct nouveau_ofuncs) { 63 49 .ctor = gk20a_fb_ctor, 64 50 .dtor = _nouveau_fb_dtor, 65 - .init = _nouveau_fb_init, 51 + .init = gk20a_fb_init, 66 52 .fini = _nouveau_fb_fini, 67 53 }, 68 54 .memtype = nvc0_fb_memtype_valid,
+23 -2
drivers/gpu/drm/nouveau/nv50_display.c
··· 791 791 } 792 792 793 793 static int 794 + nv50_crtc_set_raster_vblank_dmi(struct nouveau_crtc *nv_crtc, u32 usec) 795 + { 796 + struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); 797 + u32 *push; 798 + 799 + push = evo_wait(mast, 8); 800 + if (!push) 801 + return -ENOMEM; 802 + 803 + evo_mthd(push, 0x0828 + (nv_crtc->index * 0x400), 1); 804 + evo_data(push, usec); 805 + evo_kick(push, mast); 806 + return 0; 807 + } 808 + 809 + static int 794 810 nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) 795 811 { 796 812 struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); ··· 1120 1104 evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); 1121 1105 evo_data(push, 0x00800000 | mode->clock); 1122 1106 evo_data(push, (ilace == 2) ? 2 : 0); 1123 - evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 8); 1107 + evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 6); 1124 1108 evo_data(push, 0x00000000); 1125 1109 evo_data(push, (vactive << 16) | hactive); 1126 1110 evo_data(push, ( vsynce << 16) | hsynce); 1127 1111 evo_data(push, (vblanke << 16) | hblanke); 1128 1112 evo_data(push, (vblanks << 16) | hblanks); 1129 1113 evo_data(push, (vblan2e << 16) | vblan2s); 1130 - evo_data(push, vblankus); 1114 + evo_mthd(push, 0x082c + (nv_crtc->index * 0x400), 1); 1131 1115 evo_data(push, 0x00000000); 1132 1116 evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); 1133 1117 evo_data(push, 0x00000311); ··· 1157 1141 nv_connector = nouveau_crtc_connector_get(nv_crtc); 1158 1142 nv50_crtc_set_dither(nv_crtc, false); 1159 1143 nv50_crtc_set_scale(nv_crtc, false); 1144 + 1145 + /* G94 only accepts this after setting scale */ 1146 + if (nv50_vers(mast) < GF110_DISP_CORE_CHANNEL_DMA) 1147 + nv50_crtc_set_raster_vblank_dmi(nv_crtc, vblankus); 1148 + 1160 1149 nv50_crtc_set_color_vibrance(nv_crtc, false); 1161 1150 nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); 1162 1151 return 0;
+10 -1
drivers/gpu/drm/radeon/atom.c
··· 1217 1217 return ret; 1218 1218 } 1219 1219 1220 - int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1220 + int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uint32_t * params) 1221 1221 { 1222 1222 int r; 1223 1223 ··· 1235 1235 ctx->divmul[1] = 0; 1236 1236 r = atom_execute_table_locked(ctx, index, params); 1237 1237 mutex_unlock(&ctx->mutex); 1238 + return r; 1239 + } 1240 + 1241 + int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) 1242 + { 1243 + int r; 1244 + mutex_lock(&ctx->scratch_mutex); 1245 + r = atom_execute_table_scratch_unlocked(ctx, index, params); 1246 + mutex_unlock(&ctx->scratch_mutex); 1238 1247 return r; 1239 1248 } 1240 1249
+2
drivers/gpu/drm/radeon/atom.h
··· 125 125 struct atom_context { 126 126 struct card_info *card; 127 127 struct mutex mutex; 128 + struct mutex scratch_mutex; 128 129 void *bios; 129 130 uint32_t cmd_table, data_table; 130 131 uint16_t *iio; ··· 146 145 147 146 struct atom_context *atom_parse(struct card_info *, void *); 148 147 int atom_execute_table(struct atom_context *, int, uint32_t *); 148 + int atom_execute_table_scratch_unlocked(struct atom_context *, int, uint32_t *); 149 149 int atom_asic_init(struct atom_context *); 150 150 void atom_destroy(struct atom_context *); 151 151 bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size,
+3 -1
drivers/gpu/drm/radeon/atombios_dp.c
··· 100 100 memset(&args, 0, sizeof(args)); 101 101 102 102 mutex_lock(&chan->mutex); 103 + mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); 103 104 104 105 base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); 105 106 ··· 114 113 if (ASIC_IS_DCE4(rdev)) 115 114 args.v2.ucHPD_ID = chan->rec.hpd; 116 115 117 - atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 116 + atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); 118 117 119 118 *ack = args.v1.ucReplyStatus; 120 119 ··· 148 147 149 148 r = recv_bytes; 150 149 done: 150 + mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); 151 151 mutex_unlock(&chan->mutex); 152 152 153 153 return r;
+3 -1
drivers/gpu/drm/radeon/atombios_i2c.c
··· 48 48 memset(&args, 0, sizeof(args)); 49 49 50 50 mutex_lock(&chan->mutex); 51 + mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); 51 52 52 53 base = (unsigned char *)rdev->mode_info.atom_context->scratch; 53 54 ··· 83 82 args.ucSlaveAddr = slave_addr << 1; 84 83 args.ucLineNumber = chan->rec.i2c_id; 85 84 86 - atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 85 + atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); 87 86 88 87 /* error */ 89 88 if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { ··· 96 95 radeon_atom_copy_swap(buf, base, num, false); 97 96 98 97 done: 98 + mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); 99 99 mutex_unlock(&chan->mutex); 100 100 101 101 return r;
+1
drivers/gpu/drm/radeon/radeon_device.c
··· 952 952 } 953 953 954 954 mutex_init(&rdev->mode_info.atom_context->mutex); 955 + mutex_init(&rdev->mode_info.atom_context->scratch_mutex); 955 956 radeon_atom_initialize_bios_scratch_regs(rdev->ddev); 956 957 atom_allocate_fb_scratch(rdev->mode_info.atom_context); 957 958 return 0;
+4 -5
drivers/gpu/drm/tegra/dc.c
··· 736 736 737 737 static void tegra_crtc_disable(struct drm_crtc *crtc) 738 738 { 739 - struct tegra_dc *dc = to_tegra_dc(crtc); 740 739 struct drm_device *drm = crtc->dev; 741 740 struct drm_plane *plane; 742 741 ··· 751 752 } 752 753 } 753 754 754 - drm_vblank_off(drm, dc->pipe); 755 + drm_crtc_vblank_off(crtc); 755 756 } 756 757 757 758 static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, ··· 840 841 u32 value; 841 842 int err; 842 843 843 - drm_vblank_pre_modeset(crtc->dev, dc->pipe); 844 - 845 844 err = tegra_crtc_setup_clk(crtc, mode); 846 845 if (err) { 847 846 dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); ··· 893 896 unsigned int syncpt; 894 897 unsigned long value; 895 898 899 + drm_crtc_vblank_off(crtc); 900 + 896 901 /* hardware initialization */ 897 902 reset_control_deassert(dc->rst); 898 903 usleep_range(10000, 20000); ··· 942 943 value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; 943 944 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); 944 945 945 - drm_vblank_post_modeset(crtc->dev, dc->pipe); 946 + drm_crtc_vblank_on(crtc); 946 947 } 947 948 948 949 static void tegra_crtc_load_lut(struct drm_crtc *crtc)