From: Greg Kroah-Hartman Date: Mon, 19 Jan 2015 11:09:18 +0000 (+0800) Subject: 3.14-stable patches X-Git-Tag: v3.10.66~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d32ff71fbd83ba37c31beab285c80b42c0a4d8e;p=thirdparty%2Fkernel%2Fstable-queue.git 3.14-stable patches added patches: drm-radeon-check-the-right-ring-in-radeon_evict_flags.patch drm-radeon-fix-typo-in-ci-dpm-disable.patch drm-radeon-properly-filter-dp1.2-4k-modes-on-non-dp1.2-hw.patch drm-radeon-work-around-a-hw-bug-in-mgcg-on-cik.patch drm-ttm-avoid-memory-allocation-from-shrinker-functions.patch drm-vmwgfx-fix-fence-event-code.patch --- diff --git a/queue-3.14/drm-radeon-check-the-right-ring-in-radeon_evict_flags.patch b/queue-3.14/drm-radeon-check-the-right-ring-in-radeon_evict_flags.patch new file mode 100644 index 00000000000..b23daee21e1 --- /dev/null +++ b/queue-3.14/drm-radeon-check-the-right-ring-in-radeon_evict_flags.patch @@ -0,0 +1,35 @@ +From 5e5c21cac1001089007260c48b0c89ebaace0e71 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Wed, 3 Dec 2014 00:03:49 -0500 +Subject: drm/radeon: check the right ring in radeon_evict_flags() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 5e5c21cac1001089007260c48b0c89ebaace0e71 upstream. + +Check the that ring we are using for copies is functional +rather than the GFX ring. On newer asics we use the DMA +ring for bo moves. + +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/radeon/radeon_ttm.c ++++ b/drivers/gpu/drm/radeon/radeon_ttm.c +@@ -191,7 +191,7 @@ static void radeon_evict_flags(struct tt + rbo = container_of(bo, struct radeon_bo, tbo); + switch (bo->mem.mem_type) { + case TTM_PL_VRAM: +- if (rbo->rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready == false) ++ if (rbo->rdev->ring[radeon_copy_ring_index(rbo->rdev)].ready == false) + radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_CPU); + else + radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT); diff --git a/queue-3.14/drm-radeon-fix-typo-in-ci-dpm-disable.patch b/queue-3.14/drm-radeon-fix-typo-in-ci-dpm-disable.patch new file mode 100644 index 00000000000..4605101466c --- /dev/null +++ b/queue-3.14/drm-radeon-fix-typo-in-ci-dpm-disable.patch @@ -0,0 +1,29 @@ +From 129acb7c0b682512e89c4f65c33593d50f2f49a9 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 7 Nov 2014 11:05:04 -0500 +Subject: drm/radeon: fix typo in CI dpm disable + +From: Alex Deucher + +commit 129acb7c0b682512e89c4f65c33593d50f2f49a9 upstream. + +Need to disable DS, not enable it when disabling dpm. + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/ci_dpm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/radeon/ci_dpm.c ++++ b/drivers/gpu/drm/radeon/ci_dpm.c +@@ -4733,7 +4733,7 @@ void ci_dpm_disable(struct radeon_device + ci_enable_spread_spectrum(rdev, false); + ci_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, false); + ci_stop_dpm(rdev); +- ci_enable_ds_master_switch(rdev, true); ++ ci_enable_ds_master_switch(rdev, false); + ci_enable_ulv(rdev, false); + ci_clear_vc(rdev); + ci_reset_to_default(rdev); diff --git a/queue-3.14/drm-radeon-properly-filter-dp1.2-4k-modes-on-non-dp1.2-hw.patch b/queue-3.14/drm-radeon-properly-filter-dp1.2-4k-modes-on-non-dp1.2-hw.patch new file mode 100644 index 00000000000..29605d03247 --- /dev/null +++ b/queue-3.14/drm-radeon-properly-filter-dp1.2-4k-modes-on-non-dp1.2-hw.patch @@ -0,0 +1,38 @@ +From 410cce2a6b82299b46ff316c6384e789ce275ecb Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Wed, 10 Dec 2014 09:42:10 -0500 +Subject: drm/radeon: properly filter DP1.2 4k modes on non-DP1.2 hw + +From: Alex Deucher + +commit 410cce2a6b82299b46ff316c6384e789ce275ecb upstream. + +The check was already in place in the dp mode_valid check, but +radeon_dp_get_dp_link_clock() never returned the high clock +mode_valid was checking for because that function clipped the +clock based on the hw capabilities. Add an explicit check +in the mode_valid function. + +bug: +https://bugs.freedesktop.org/show_bug.cgi?id=87172 + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/atombios_dp.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/gpu/drm/radeon/atombios_dp.c ++++ b/drivers/gpu/drm/radeon/atombios_dp.c +@@ -576,6 +576,10 @@ int radeon_dp_mode_valid_helper(struct d + struct radeon_connector_atom_dig *dig_connector; + int dp_clock; + ++ if ((mode->clock > 340000) && ++ (!radeon_connector_is_dp12_capable(connector))) ++ return MODE_CLOCK_HIGH; ++ + if (!radeon_connector->con_priv) + return MODE_CLOCK_HIGH; + dig_connector = radeon_connector->con_priv; diff --git a/queue-3.14/drm-radeon-work-around-a-hw-bug-in-mgcg-on-cik.patch b/queue-3.14/drm-radeon-work-around-a-hw-bug-in-mgcg-on-cik.patch new file mode 100644 index 00000000000..1aab23ed5a9 --- /dev/null +++ b/queue-3.14/drm-radeon-work-around-a-hw-bug-in-mgcg-on-cik.patch @@ -0,0 +1,38 @@ +From 4bb62c95a7e781a238b2ab374f34b1bf91e01ddc Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Mon, 17 Nov 2014 15:08:17 -0500 +Subject: drm/radeon: work around a hw bug in MGCG on CIK + +From: Alex Deucher + +commit 4bb62c95a7e781a238b2ab374f34b1bf91e01ddc upstream. + +Always need to set bit 0 of RLC_CGTT_MGCG_OVERRIDE +to avoid unreliable doorbell updates in some cases. + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/cik.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/radeon/cik.c ++++ b/drivers/gpu/drm/radeon/cik.c +@@ -5879,6 +5879,7 @@ static void cik_enable_mgcg(struct radeo + } + + orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); ++ data |= 0x00000001; + data &= 0xfffffffd; + if (orig != data) + WREG32(RLC_CGTT_MGCG_OVERRIDE, data); +@@ -5910,7 +5911,7 @@ static void cik_enable_mgcg(struct radeo + } + } else { + orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); +- data |= 0x00000002; ++ data |= 0x00000003; + if (orig != data) + WREG32(RLC_CGTT_MGCG_OVERRIDE, data); + diff --git a/queue-3.14/drm-ttm-avoid-memory-allocation-from-shrinker-functions.patch b/queue-3.14/drm-ttm-avoid-memory-allocation-from-shrinker-functions.patch new file mode 100644 index 00000000000..d8dc164669e --- /dev/null +++ b/queue-3.14/drm-ttm-avoid-memory-allocation-from-shrinker-functions.patch @@ -0,0 +1,232 @@ +From 881fdaa5e4cb0d68e52acab0ad4e1820e2bfffa4 Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Thu, 13 Nov 2014 22:43:23 +0900 +Subject: drm/ttm: Avoid memory allocation from shrinker functions. + +From: Tetsuo Handa + +commit 881fdaa5e4cb0d68e52acab0ad4e1820e2bfffa4 upstream. + +Andrew Morton wrote: +> On Wed, 12 Nov 2014 13:08:55 +0900 Tetsuo Handa wrote: +> +> > Andrew Morton wrote: +> > > Poor ttm guys - this is a bit of a trap we set for them. +> > +> > Commit a91576d7916f6cce ("drm/ttm: Pass GFP flags in order to avoid deadlock.") +> > changed to use sc->gfp_mask rather than GFP_KERNEL. +> > +> > - pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), +> > - GFP_KERNEL); +> > + pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); +> > +> > But this bug is caused by sc->gfp_mask containing some flags which are not +> > in GFP_KERNEL, right? Then, I think +> > +> > - pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); +> > + pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp & GFP_KERNEL); +> > +> > would hide this bug. +> > +> > But I think we should use GFP_ATOMIC (or drop __GFP_WAIT flag) +> +> Well no - ttm_page_pool_free() should stop calling kmalloc altogether. +> Just do +> +> struct page *pages_to_free[16]; +> +> and rework the code to free 16 pages at a time. Easy. + +Well, ttm code wants to process 512 pages at a time for performance. +Memory footprint increased by 512 * sizeof(struct page *) buffer is +only 4096 bytes. What about using static buffer like below? +---------- +>From d3cb5393c9c8099d6b37e769f78c31af1541fe8c Mon Sep 17 00:00:00 2001 +From: Tetsuo Handa +Date: Thu, 13 Nov 2014 22:21:54 +0900 +Subject: drm/ttm: Avoid memory allocation from shrinker functions. + +Commit a91576d7916f6cce ("drm/ttm: Pass GFP flags in order to avoid +deadlock.") caused BUG_ON() due to sc->gfp_mask containing flags +which are not in GFP_KERNEL. + + https://bugzilla.kernel.org/show_bug.cgi?id=87891 + +Changing from sc->gfp_mask to (sc->gfp_mask & GFP_KERNEL) would +avoid the BUG_ON(), but avoiding memory allocation from shrinker +function is better and reliable fix. + +Shrinker function is already serialized by global lock, and +clean up function is called after shrinker function is unregistered. +Thus, we can use static buffer when called from shrinker function +and clean up function. + +Signed-off-by: Tetsuo Handa +Signed-off-by: Dave Airlie +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/ttm/ttm_page_alloc.c | 26 +++++++++++++++----------- + drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 25 +++++++++++++++---------- + 2 files changed, 30 insertions(+), 21 deletions(-) + +--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c ++++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c +@@ -297,11 +297,12 @@ static void ttm_pool_update_free_locked( + * + * @pool: to free the pages from + * @free_all: If set to true will free all pages in pool +- * @gfp: GFP flags. ++ * @use_static: Safe to use static buffer + **/ + static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, +- gfp_t gfp) ++ bool use_static) + { ++ static struct page *static_buf[NUM_PAGES_TO_ALLOC]; + unsigned long irq_flags; + struct page *p; + struct page **pages_to_free; +@@ -311,7 +312,11 @@ static int ttm_page_pool_free(struct ttm + if (NUM_PAGES_TO_ALLOC < nr_free) + npages_to_free = NUM_PAGES_TO_ALLOC; + +- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); ++ if (use_static) ++ pages_to_free = static_buf; ++ else ++ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), ++ GFP_KERNEL); + if (!pages_to_free) { + pr_err("Failed to allocate memory for pool free operation\n"); + return 0; +@@ -374,7 +379,8 @@ restart: + if (freed_pages) + ttm_pages_put(pages_to_free, freed_pages); + out: +- kfree(pages_to_free); ++ if (pages_to_free != static_buf) ++ kfree(pages_to_free); + return nr_free; + } + +@@ -383,8 +389,6 @@ out: + * + * XXX: (dchinner) Deadlock warning! + * +- * We need to pass sc->gfp_mask to ttm_page_pool_free(). +- * + * This code is crying out for a shrinker per pool.... + */ + static unsigned long +@@ -407,8 +411,8 @@ ttm_pool_shrink_scan(struct shrinker *sh + if (shrink_pages == 0) + break; + pool = &_manager->pools[(i + pool_offset)%NUM_POOLS]; +- shrink_pages = ttm_page_pool_free(pool, nr_free, +- sc->gfp_mask); ++ /* OK to use static buffer since global mutex is held. */ ++ shrink_pages = ttm_page_pool_free(pool, nr_free, true); + freed += nr_free - shrink_pages; + } + mutex_unlock(&lock); +@@ -710,7 +714,7 @@ static void ttm_put_pages(struct page ** + } + spin_unlock_irqrestore(&pool->lock, irq_flags); + if (npages) +- ttm_page_pool_free(pool, npages, GFP_KERNEL); ++ ttm_page_pool_free(pool, npages, false); + } + + /* +@@ -849,9 +853,9 @@ void ttm_page_alloc_fini(void) + pr_info("Finalizing pool allocator\n"); + ttm_pool_mm_shrink_fini(_manager); + ++ /* OK to use static buffer since global mutex is no longer used. */ + for (i = 0; i < NUM_POOLS; ++i) +- ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES, +- GFP_KERNEL); ++ ttm_page_pool_free(&_manager->pools[i], FREE_ALL_PAGES, true); + + kobject_put(&_manager->kobj); + _manager = NULL; +--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c ++++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +@@ -411,11 +411,12 @@ static void ttm_dma_page_put(struct dma_ + * + * @pool: to free the pages from + * @nr_free: If set to true will free all pages in pool +- * @gfp: GFP flags. ++ * @use_static: Safe to use static buffer + **/ + static unsigned ttm_dma_page_pool_free(struct dma_pool *pool, unsigned nr_free, +- gfp_t gfp) ++ bool use_static) + { ++ static struct page *static_buf[NUM_PAGES_TO_ALLOC]; + unsigned long irq_flags; + struct dma_page *dma_p, *tmp; + struct page **pages_to_free; +@@ -432,7 +433,11 @@ static unsigned ttm_dma_page_pool_free(s + npages_to_free, nr_free); + } + #endif +- pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), gfp); ++ if (use_static) ++ pages_to_free = static_buf; ++ else ++ pages_to_free = kmalloc(npages_to_free * sizeof(struct page *), ++ GFP_KERNEL); + + if (!pages_to_free) { + pr_err("%s: Failed to allocate memory for pool free operation\n", +@@ -502,7 +507,8 @@ restart: + if (freed_pages) + ttm_dma_pages_put(pool, &d_pages, pages_to_free, freed_pages); + out: +- kfree(pages_to_free); ++ if (pages_to_free != static_buf) ++ kfree(pages_to_free); + return nr_free; + } + +@@ -531,7 +537,8 @@ static void ttm_dma_free_pool(struct dev + if (pool->type != type) + continue; + /* Takes a spinlock.. */ +- ttm_dma_page_pool_free(pool, FREE_ALL_PAGES, GFP_KERNEL); ++ /* OK to use static buffer since global mutex is held. */ ++ ttm_dma_page_pool_free(pool, FREE_ALL_PAGES, true); + WARN_ON(((pool->npages_in_use + pool->npages_free) != 0)); + /* This code path is called after _all_ references to the + * struct device has been dropped - so nobody should be +@@ -984,7 +991,7 @@ void ttm_dma_unpopulate(struct ttm_dma_t + + /* shrink pool if necessary (only on !is_cached pools)*/ + if (npages) +- ttm_dma_page_pool_free(pool, npages, GFP_KERNEL); ++ ttm_dma_page_pool_free(pool, npages, false); + ttm->state = tt_unpopulated; + } + EXPORT_SYMBOL_GPL(ttm_dma_unpopulate); +@@ -994,8 +1001,6 @@ EXPORT_SYMBOL_GPL(ttm_dma_unpopulate); + * + * XXX: (dchinner) Deadlock warning! + * +- * We need to pass sc->gfp_mask to ttm_dma_page_pool_free(). +- * + * I'm getting sadder as I hear more pathetical whimpers about needing per-pool + * shrinkers + */ +@@ -1028,8 +1033,8 @@ ttm_dma_pool_shrink_scan(struct shrinker + if (++idx < pool_offset) + continue; + nr_free = shrink_pages; +- shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free, +- sc->gfp_mask); ++ /* OK to use static buffer since global mutex is held. */ ++ shrink_pages = ttm_dma_page_pool_free(p->pool, nr_free, true); + freed += nr_free - shrink_pages; + + pr_debug("%s: (%s:%d) Asked to shrink %d, have %d more to go\n", diff --git a/queue-3.14/drm-vmwgfx-fix-fence-event-code.patch b/queue-3.14/drm-vmwgfx-fix-fence-event-code.patch new file mode 100644 index 00000000000..a5f77dac37d --- /dev/null +++ b/queue-3.14/drm-vmwgfx-fix-fence-event-code.patch @@ -0,0 +1,58 @@ +From 89669e7a7f96be3ee8d9a22a071d7c0d3b4428fc Mon Sep 17 00:00:00 2001 +From: Thomas Hellstrom +Date: Tue, 2 Dec 2014 03:36:57 -0800 +Subject: drm/vmwgfx: Fix fence event code + +From: Thomas Hellstrom + +commit 89669e7a7f96be3ee8d9a22a071d7c0d3b4428fc upstream. + +The commit "vmwgfx: Rework fence event action" introduced a number of bugs +that are fixed with this commit: + +a) A forgotten return stateemnt. +b) An if statement with identical branches. + +Reported-by: Rob Clark +Signed-off-by: Thomas Hellstrom +Reviewed-by: Jakob Bornecrantz +Reviewed-by: Sinclair Yeh +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 17 ++++++----------- + 1 file changed, 6 insertions(+), 11 deletions(-) + +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +@@ -1049,6 +1049,8 @@ static int vmw_event_fence_action_create + if (ret != 0) + goto out_no_queue; + ++ return 0; ++ + out_no_queue: + event->base.destroy(&event->base); + out_no_event: +@@ -1124,17 +1126,10 @@ int vmw_fence_event_ioctl(struct drm_dev + + BUG_ON(fence == NULL); + +- if (arg->flags & DRM_VMW_FE_FLAG_REQ_TIME) +- ret = vmw_event_fence_action_create(file_priv, fence, +- arg->flags, +- arg->user_data, +- true); +- else +- ret = vmw_event_fence_action_create(file_priv, fence, +- arg->flags, +- arg->user_data, +- true); +- ++ ret = vmw_event_fence_action_create(file_priv, fence, ++ arg->flags, ++ arg->user_data, ++ true); + if (unlikely(ret != 0)) { + if (ret != -ERESTARTSYS) + DRM_ERROR("Failed to attach event to fence.\n"); diff --git a/queue-3.14/series b/queue-3.14/series index 83a18f85f65..f8f70c77b59 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -13,3 +13,9 @@ alx-fix-alx_poll.patch team-avoid-possible-underflow-of-count_pending-value-for-notify_peers-and-mcast_rejoin.patch enic-fix-rx-skb-checksum.patch net-core-handle-csum-for-checksum_complete-vxlan-forwarding.patch +drm-vmwgfx-fix-fence-event-code.patch +drm-ttm-avoid-memory-allocation-from-shrinker-functions.patch +drm-radeon-fix-typo-in-ci-dpm-disable.patch +drm-radeon-work-around-a-hw-bug-in-mgcg-on-cik.patch +drm-radeon-check-the-right-ring-in-radeon_evict_flags.patch +drm-radeon-properly-filter-dp1.2-4k-modes-on-non-dp1.2-hw.patch