aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-29 10:11:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-29 10:11:03 -0400
commit48a3c64b4649b5b23a4ca756af93b4ee820ff883 (patch)
tree7725fdf30632fd5ed4ac539af382a9e2310ab0f7
parentff23908bb78bbc0999ff35e6f319f1648c4ded93 (diff)
parent2d8aa4ef6aac566617052640e9bb07ecb9c45183 (diff)
Merge tag 'drm-fixes-2018-06-29' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Nothing too major this round: - small set of mali-dp fixes - single meson fix - a bunch of amdgpu fixes (one makes non-4k page sizes not be a bad experience)" * tag 'drm-fixes-2018-06-29' of git://anongit.freedesktop.org/drm/drm: drm/amd/display: release spinlock before committing updates to stream drm/amdgpu:Support new VCN FW version naming convention drm/amdgpu: fix UBSAN: Undefined behaviour for amdgpu_fence.c drm/meson: Fix an un-handled error path in 'meson_drv_bind_master()' drm/amdgpu: GPU vs CPU page size fixes in amdgpu_vm_bo_split_mapping drm/amdgpu: Count disabled CRTCs in commit tail earlier drm/mali-dp: Rectify the width and height passed to rotmem_required() drm/arm/malidp: Preserve LAYER_FORMAT contents when setting format drm: mali-dp: Enable Global SE interrupts mask for DP500 drm/arm/malidp: Ensure that the crtcs are shutdown before removing any encoder/connector
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c33
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c8
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c16
-rw-r--r--drivers/gpu/drm/arm/malidp_drv.c3
-rw-r--r--drivers/gpu/drm/arm/malidp_hw.c3
-rw-r--r--drivers/gpu/drm/arm/malidp_planes.c9
-rw-r--r--drivers/gpu/drm/meson/meson_drv.c12
8 files changed, 59 insertions, 27 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 39ec6b8890a1..e74d620d9699 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -376,7 +376,7 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
376 struct amdgpu_device *adev = ring->adev; 376 struct amdgpu_device *adev = ring->adev;
377 uint64_t index; 377 uint64_t index;
378 378
379 if (ring != &adev->uvd.inst[ring->me].ring) { 379 if (ring->funcs->type != AMDGPU_RING_TYPE_UVD) {
380 ring->fence_drv.cpu_addr = &adev->wb.wb[ring->fence_offs]; 380 ring->fence_drv.cpu_addr = &adev->wb.wb[ring->fence_offs];
381 ring->fence_drv.gpu_addr = adev->wb.gpu_addr + (ring->fence_offs * 4); 381 ring->fence_drv.gpu_addr = adev->wb.gpu_addr + (ring->fence_offs * 4);
382 } else { 382 } else {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 127e87b470ff..1b4ad9b2a755 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -52,7 +52,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
52 unsigned long bo_size; 52 unsigned long bo_size;
53 const char *fw_name; 53 const char *fw_name;
54 const struct common_firmware_header *hdr; 54 const struct common_firmware_header *hdr;
55 unsigned version_major, version_minor, family_id; 55 unsigned char fw_check;
56 int r; 56 int r;
57 57
58 INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler); 58 INIT_DELAYED_WORK(&adev->vcn.idle_work, amdgpu_vcn_idle_work_handler);
@@ -83,12 +83,33 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
83 83
84 hdr = (const struct common_firmware_header *)adev->vcn.fw->data; 84 hdr = (const struct common_firmware_header *)adev->vcn.fw->data;
85 adev->vcn.fw_version = le32_to_cpu(hdr->ucode_version); 85 adev->vcn.fw_version = le32_to_cpu(hdr->ucode_version);
86 family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
87 version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
88 version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
89 DRM_INFO("Found VCN firmware Version: %hu.%hu Family ID: %hu\n",
90 version_major, version_minor, family_id);
91 86
87 /* Bit 20-23, it is encode major and non-zero for new naming convention.
88 * This field is part of version minor and DRM_DISABLED_FLAG in old naming
89 * convention. Since the l:wq!atest version minor is 0x5B and DRM_DISABLED_FLAG
90 * is zero in old naming convention, this field is always zero so far.
91 * These four bits are used to tell which naming convention is present.
92 */
93 fw_check = (le32_to_cpu(hdr->ucode_version) >> 20) & 0xf;
94 if (fw_check) {
95 unsigned int dec_ver, enc_major, enc_minor, vep, fw_rev;
96
97 fw_rev = le32_to_cpu(hdr->ucode_version) & 0xfff;
98 enc_minor = (le32_to_cpu(hdr->ucode_version) >> 12) & 0xff;
99 enc_major = fw_check;
100 dec_ver = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xf;
101 vep = (le32_to_cpu(hdr->ucode_version) >> 28) & 0xf;
102 DRM_INFO("Found VCN firmware Version ENC: %hu.%hu DEC: %hu VEP: %hu Revision: %hu\n",
103 enc_major, enc_minor, dec_ver, vep, fw_rev);
104 } else {
105 unsigned int version_major, version_minor, family_id;
106
107 family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
108 version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
109 version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
110 DRM_INFO("Found VCN firmware Version: %hu.%hu Family ID: %hu\n",
111 version_major, version_minor, family_id);
112 }
92 113
93 bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) 114 bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
94 + AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_HEAP_SIZE 115 + AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_HEAP_SIZE
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index b0eb2f537392..edf16b2b957a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1463,7 +1463,9 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
1463 uint64_t count; 1463 uint64_t count;
1464 1464
1465 max_entries = min(max_entries, 16ull * 1024ull); 1465 max_entries = min(max_entries, 16ull * 1024ull);
1466 for (count = 1; count < max_entries; ++count) { 1466 for (count = 1;
1467 count < max_entries / (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
1468 ++count) {
1467 uint64_t idx = pfn + count; 1469 uint64_t idx = pfn + count;
1468 1470
1469 if (pages_addr[idx] != 1471 if (pages_addr[idx] !=
@@ -1476,7 +1478,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
1476 dma_addr = pages_addr; 1478 dma_addr = pages_addr;
1477 } else { 1479 } else {
1478 addr = pages_addr[pfn]; 1480 addr = pages_addr[pfn];
1479 max_entries = count; 1481 max_entries = count * (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
1480 } 1482 }
1481 1483
1482 } else if (flags & AMDGPU_PTE_VALID) { 1484 } else if (flags & AMDGPU_PTE_VALID) {
@@ -1491,7 +1493,7 @@ static int amdgpu_vm_bo_split_mapping(struct amdgpu_device *adev,
1491 if (r) 1493 if (r)
1492 return r; 1494 return r;
1493 1495
1494 pfn += last - start + 1; 1496 pfn += (last - start + 1) / (PAGE_SIZE / AMDGPU_GPU_PAGE_SIZE);
1495 if (nodes && nodes->size == pfn) { 1497 if (nodes && nodes->size == pfn) {
1496 pfn = 0; 1498 pfn = 0;
1497 ++nodes; 1499 ++nodes;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index f9add85157e7..3a8d6356afc2 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3928,10 +3928,11 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc,
3928 if (acrtc->base.state->event) 3928 if (acrtc->base.state->event)
3929 prepare_flip_isr(acrtc); 3929 prepare_flip_isr(acrtc);
3930 3930
3931 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
3932
3931 surface_updates->surface = dc_stream_get_status(acrtc_state->stream)->plane_states[0]; 3933 surface_updates->surface = dc_stream_get_status(acrtc_state->stream)->plane_states[0];
3932 surface_updates->flip_addr = &addr; 3934 surface_updates->flip_addr = &addr;
3933 3935
3934
3935 dc_commit_updates_for_stream(adev->dm.dc, 3936 dc_commit_updates_for_stream(adev->dm.dc,
3936 surface_updates, 3937 surface_updates,
3937 1, 3938 1,
@@ -3944,9 +3945,6 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc,
3944 __func__, 3945 __func__,
3945 addr.address.grph.addr.high_part, 3946 addr.address.grph.addr.high_part,
3946 addr.address.grph.addr.low_part); 3947 addr.address.grph.addr.low_part);
3947
3948
3949 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
3950} 3948}
3951 3949
3952/* 3950/*
@@ -4206,6 +4204,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
4206 struct drm_connector *connector; 4204 struct drm_connector *connector;
4207 struct drm_connector_state *old_con_state, *new_con_state; 4205 struct drm_connector_state *old_con_state, *new_con_state;
4208 struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state; 4206 struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
4207 int crtc_disable_count = 0;
4209 4208
4210 drm_atomic_helper_update_legacy_modeset_state(dev, state); 4209 drm_atomic_helper_update_legacy_modeset_state(dev, state);
4211 4210
@@ -4410,6 +4409,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
4410 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); 4409 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
4411 bool modeset_needed; 4410 bool modeset_needed;
4412 4411
4412 if (old_crtc_state->active && !new_crtc_state->active)
4413 crtc_disable_count++;
4414
4413 dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); 4415 dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
4414 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); 4416 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
4415 modeset_needed = modeset_required( 4417 modeset_needed = modeset_required(
@@ -4463,11 +4465,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
4463 * so we can put the GPU into runtime suspend if we're not driving any 4465 * so we can put the GPU into runtime suspend if we're not driving any
4464 * displays anymore 4466 * displays anymore
4465 */ 4467 */
4468 for (i = 0; i < crtc_disable_count; i++)
4469 pm_runtime_put_autosuspend(dev->dev);
4466 pm_runtime_mark_last_busy(dev->dev); 4470 pm_runtime_mark_last_busy(dev->dev);
4467 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
4468 if (old_crtc_state->active && !new_crtc_state->active)
4469 pm_runtime_put_autosuspend(dev->dev);
4470 }
4471} 4471}
4472 4472
4473 4473
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 8d20faa198cf..0a788d76ed5f 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -278,7 +278,6 @@ static int malidp_init(struct drm_device *drm)
278 278
279static void malidp_fini(struct drm_device *drm) 279static void malidp_fini(struct drm_device *drm)
280{ 280{
281 drm_atomic_helper_shutdown(drm);
282 drm_mode_config_cleanup(drm); 281 drm_mode_config_cleanup(drm);
283} 282}
284 283
@@ -646,6 +645,7 @@ vblank_fail:
646 malidp_de_irq_fini(drm); 645 malidp_de_irq_fini(drm);
647 drm->irq_enabled = false; 646 drm->irq_enabled = false;
648irq_init_fail: 647irq_init_fail:
648 drm_atomic_helper_shutdown(drm);
649 component_unbind_all(dev, drm); 649 component_unbind_all(dev, drm);
650bind_fail: 650bind_fail:
651 of_node_put(malidp->crtc.port); 651 of_node_put(malidp->crtc.port);
@@ -681,6 +681,7 @@ static void malidp_unbind(struct device *dev)
681 malidp_se_irq_fini(drm); 681 malidp_se_irq_fini(drm);
682 malidp_de_irq_fini(drm); 682 malidp_de_irq_fini(drm);
683 drm->irq_enabled = false; 683 drm->irq_enabled = false;
684 drm_atomic_helper_shutdown(drm);
684 component_unbind_all(dev, drm); 685 component_unbind_all(dev, drm);
685 of_node_put(malidp->crtc.port); 686 of_node_put(malidp->crtc.port);
686 malidp->crtc.port = NULL; 687 malidp->crtc.port = NULL;
diff --git a/drivers/gpu/drm/arm/malidp_hw.c b/drivers/gpu/drm/arm/malidp_hw.c
index d789b46dc817..069783e715f1 100644
--- a/drivers/gpu/drm/arm/malidp_hw.c
+++ b/drivers/gpu/drm/arm/malidp_hw.c
@@ -634,7 +634,8 @@ const struct malidp_hw malidp_device[MALIDP_MAX_DEVICES] = {
634 .vsync_irq = MALIDP500_DE_IRQ_VSYNC, 634 .vsync_irq = MALIDP500_DE_IRQ_VSYNC,
635 }, 635 },
636 .se_irq_map = { 636 .se_irq_map = {
637 .irq_mask = MALIDP500_SE_IRQ_CONF_MODE, 637 .irq_mask = MALIDP500_SE_IRQ_CONF_MODE |
638 MALIDP500_SE_IRQ_GLOBAL,
638 .vsync_irq = 0, 639 .vsync_irq = 0,
639 }, 640 },
640 .dc_irq_map = { 641 .dc_irq_map = {
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 7a44897c50fe..29409a65d864 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -23,6 +23,7 @@
23 23
24/* Layer specific register offsets */ 24/* Layer specific register offsets */
25#define MALIDP_LAYER_FORMAT 0x000 25#define MALIDP_LAYER_FORMAT 0x000
26#define LAYER_FORMAT_MASK 0x3f
26#define MALIDP_LAYER_CONTROL 0x004 27#define MALIDP_LAYER_CONTROL 0x004
27#define LAYER_ENABLE (1 << 0) 28#define LAYER_ENABLE (1 << 0)
28#define LAYER_FLOWCFG_MASK 7 29#define LAYER_FLOWCFG_MASK 7
@@ -235,8 +236,8 @@ static int malidp_de_plane_check(struct drm_plane *plane,
235 if (state->rotation & MALIDP_ROTATED_MASK) { 236 if (state->rotation & MALIDP_ROTATED_MASK) {
236 int val; 237 int val;
237 238
238 val = mp->hwdev->hw->rotmem_required(mp->hwdev, state->crtc_h, 239 val = mp->hwdev->hw->rotmem_required(mp->hwdev, state->crtc_w,
239 state->crtc_w, 240 state->crtc_h,
240 fb->format->format); 241 fb->format->format);
241 if (val < 0) 242 if (val < 0)
242 return val; 243 return val;
@@ -337,7 +338,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
337 dest_w = plane->state->crtc_w; 338 dest_w = plane->state->crtc_w;
338 dest_h = plane->state->crtc_h; 339 dest_h = plane->state->crtc_h;
339 340
340 malidp_hw_write(mp->hwdev, ms->format, mp->layer->base); 341 val = malidp_hw_read(mp->hwdev, mp->layer->base);
342 val = (val & ~LAYER_FORMAT_MASK) | ms->format;
343 malidp_hw_write(mp->hwdev, val, mp->layer->base);
341 344
342 for (i = 0; i < ms->n_planes; i++) { 345 for (i = 0; i < ms->n_planes; i++) {
343 /* calculate the offset for the layer's plane registers */ 346 /* calculate the offset for the layer's plane registers */
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 32b1a6cdecfc..d3443125e661 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -197,8 +197,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
197 priv->io_base = regs; 197 priv->io_base = regs;
198 198
199 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi"); 199 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi");
200 if (!res) 200 if (!res) {
201 return -EINVAL; 201 ret = -EINVAL;
202 goto free_drm;
203 }
202 /* Simply ioremap since it may be a shared register zone */ 204 /* Simply ioremap since it may be a shared register zone */
203 regs = devm_ioremap(dev, res->start, resource_size(res)); 205 regs = devm_ioremap(dev, res->start, resource_size(res));
204 if (!regs) { 206 if (!regs) {
@@ -215,8 +217,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
215 } 217 }
216 218
217 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc"); 219 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc");
218 if (!res) 220 if (!res) {
219 return -EINVAL; 221 ret = -EINVAL;
222 goto free_drm;
223 }
220 /* Simply ioremap since it may be a shared register zone */ 224 /* Simply ioremap since it may be a shared register zone */
221 regs = devm_ioremap(dev, res->start, resource_size(res)); 225 regs = devm_ioremap(dev, res->start, resource_size(res));
222 if (!regs) { 226 if (!regs) {