--- /dev/null
+From 85f57752b33cf12f1d583f0c10b752292de00abe Mon Sep 17 00:00:00 2001
+From: Nandor Han <nandor.han@ge.com>
+Date: Tue, 11 Oct 2016 14:13:41 +0300
+Subject: dmaengine: imx-sdma - correct the dma transfer residue calculation
+
+From: Nandor Han <nandor.han@ge.com>
+
+commit 85f57752b33cf12f1d583f0c10b752292de00abe upstream.
+
+The residue calculation was taking in consideration that dma
+transaction status will be always retrieved in the dma callback
+used to inform that dma transfer is complete. However this is not
+the case for all subsystems that use dma. Some subsystems use a
+timer to check the dma status periodically.
+
+Therefore the calculation was updated and residue is calculated
+accordingly by a) update the residue calculation taking in
+consideration the last used buffer index by using *buf_ptail* variable
+and b) chn_real_count (number of bytes transferred) is initialized to
+zero, when dma channel is created, to avoid using an uninitialized
+value in residue calculation when dma status is checked without
+waiting dma complete event.
+
+Signed-off-by: Nandor Han <nandor.han@ge.com>
+Acked-by: Peter Senna Tschudin <peter.senna@collabora.com>
+Tested-by: Peter Senna Tschudin <peter.senna@collabora.com>
+Tested-by: Marek Vasut <marex@denx.de>
+Signed-off-by: Vinod Koul <vinod.koul@intel.com>
+Cc: Fabio Estevam <festevam@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/dma/imx-sdma.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+--- a/drivers/dma/imx-sdma.c
++++ b/drivers/dma/imx-sdma.c
+@@ -298,6 +298,7 @@ struct sdma_engine;
+ * @event_id1 for channels that use 2 events
+ * @word_size peripheral access size
+ * @buf_tail ID of the buffer that was processed
++ * @buf_ptail ID of the previous buffer that was processed
+ * @num_bd max NUM_BD. number of descriptors currently handling
+ */
+ struct sdma_channel {
+@@ -309,6 +310,7 @@ struct sdma_channel {
+ unsigned int event_id1;
+ enum dma_slave_buswidth word_size;
+ unsigned int buf_tail;
++ unsigned int buf_ptail;
+ unsigned int num_bd;
+ unsigned int period_len;
+ struct sdma_buffer_descriptor *bd;
+@@ -700,6 +702,8 @@ static void sdma_update_channel_loop(str
+ sdmac->chn_real_count = bd->mode.count;
+ bd->mode.status |= BD_DONE;
+ bd->mode.count = sdmac->period_len;
++ sdmac->buf_ptail = sdmac->buf_tail;
++ sdmac->buf_tail = (sdmac->buf_tail + 1) % sdmac->num_bd;
+
+ /*
+ * The callback is called from the interrupt context in order
+@@ -710,9 +714,6 @@ static void sdma_update_channel_loop(str
+
+ dmaengine_desc_get_callback_invoke(&sdmac->desc, NULL);
+
+- sdmac->buf_tail++;
+- sdmac->buf_tail %= sdmac->num_bd;
+-
+ if (error)
+ sdmac->status = old_status;
+ }
+@@ -1186,6 +1187,8 @@ static struct dma_async_tx_descriptor *s
+ sdmac->flags = 0;
+
+ sdmac->buf_tail = 0;
++ sdmac->buf_ptail = 0;
++ sdmac->chn_real_count = 0;
+
+ dev_dbg(sdma->dev, "setting up %d entries for channel %d.\n",
+ sg_len, channel);
+@@ -1288,6 +1291,8 @@ static struct dma_async_tx_descriptor *s
+ sdmac->status = DMA_IN_PROGRESS;
+
+ sdmac->buf_tail = 0;
++ sdmac->buf_ptail = 0;
++ sdmac->chn_real_count = 0;
+ sdmac->period_len = period_len;
+
+ sdmac->flags |= IMX_DMA_SG_LOOP;
+@@ -1385,7 +1390,7 @@ static enum dma_status sdma_tx_status(st
+ u32 residue;
+
+ if (sdmac->flags & IMX_DMA_SG_LOOP)
+- residue = (sdmac->num_bd - sdmac->buf_tail) *
++ residue = (sdmac->num_bd - sdmac->buf_ptail) *
+ sdmac->period_len - sdmac->chn_real_count;
+ else
+ residue = sdmac->chn_count - sdmac->chn_real_count;
--- /dev/null
+From 4ce3bd45b351633f2a0512c587f7fcba2ce044e8 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 10 Feb 2017 00:00:52 -0500
+Subject: drm/amdgpu: add more cases to DCE11 possible crtc mask setup
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+commit 4ce3bd45b351633f2a0512c587f7fcba2ce044e8 upstream.
+
+Add cases for asics with 3 and 5 crtcs. Fixes an artificial
+limitation on asics with 3 or 5 crtcs.
+
+Fixes:
+https://bugs.freedesktop.org/show_bug.cgi?id=99744
+
+Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+@@ -3814,9 +3814,15 @@ static void dce_v11_0_encoder_add(struct
+ default:
+ encoder->possible_crtcs = 0x3;
+ break;
++ case 3:
++ encoder->possible_crtcs = 0x7;
++ break;
+ case 4:
+ encoder->possible_crtcs = 0xf;
+ break;
++ case 5:
++ encoder->possible_crtcs = 0x1f;
++ break;
+ case 6:
+ encoder->possible_crtcs = 0x3f;
+ break;
--- /dev/null
+From 9bb92f51558f2ef5f56c257bdcea0588f31d857e Mon Sep 17 00:00:00 2001
+From: "Y.C. Chen" <yc_chen@aspeedtech.com>
+Date: Wed, 22 Feb 2017 15:14:19 +1100
+Subject: drm/ast: Call open_key before enable_mmio in POST code
+
+From: Y.C. Chen <yc_chen@aspeedtech.com>
+
+commit 9bb92f51558f2ef5f56c257bdcea0588f31d857e upstream.
+
+open_key enables access the registers used by enable_mmio
+
+Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Acked-by: Joel Stanley <joel@jms.id.au>
+Tested-by: Y.C. Chen <yc_chen@aspeedtech.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/ast/ast_post.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/ast/ast_post.c
++++ b/drivers/gpu/drm/ast/ast_post.c
+@@ -371,8 +371,8 @@ void ast_post_gpu(struct drm_device *dev
+ pci_write_config_dword(ast->dev->pdev, 0x04, reg);
+
+ ast_enable_vga(dev);
+- ast_enable_mmio(dev);
+ ast_open_key(ast);
++ ast_enable_mmio(dev);
+ ast_set_def_ext_reg(dev);
+
+ if (ast->chip == AST2300 || ast->chip == AST2400)
--- /dev/null
+From 3856081eede297b617560b85e948cfb00bb395ec Mon Sep 17 00:00:00 2001
+From: "Y.C. Chen" <yc_chen@aspeedtech.com>
+Date: Thu, 23 Feb 2017 15:52:33 +0800
+Subject: drm/ast: Fix AST2400 POST failure without BMC FW or VBIOS
+
+From: Y.C. Chen <yc_chen@aspeedtech.com>
+
+commit 3856081eede297b617560b85e948cfb00bb395ec upstream.
+
+The current POST code for the AST2300/2400 family doesn't work properly
+if the chip hasn't been initialized previously by either the BMC own FW
+or the VBIOS. This fixes it.
+
+Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Tested-by: Y.C. Chen <yc_chen@aspeedtech.com>
+Acked-by: Joel Stanley <joel@jms.id.au>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/ast/ast_post.c | 38 +++++++++++++++++++++++++++++++++++---
+ 1 file changed, 35 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/ast/ast_post.c
++++ b/drivers/gpu/drm/ast/ast_post.c
+@@ -1626,12 +1626,44 @@ static void ast_init_dram_2300(struct dr
+ temp |= 0x73;
+ ast_write32(ast, 0x12008, temp);
+
++ param.dram_freq = 396;
+ param.dram_type = AST_DDR3;
++ temp = ast_mindwm(ast, 0x1e6e2070);
+ if (temp & 0x01000000)
+ param.dram_type = AST_DDR2;
+- param.dram_chipid = ast->dram_type;
+- param.dram_freq = ast->mclk;
+- param.vram_size = ast->vram_size;
++ switch (temp & 0x18000000) {
++ case 0:
++ param.dram_chipid = AST_DRAM_512Mx16;
++ break;
++ default:
++ case 0x08000000:
++ param.dram_chipid = AST_DRAM_1Gx16;
++ break;
++ case 0x10000000:
++ param.dram_chipid = AST_DRAM_2Gx16;
++ break;
++ case 0x18000000:
++ param.dram_chipid = AST_DRAM_4Gx16;
++ break;
++ }
++ switch (temp & 0x0c) {
++ default:
++ case 0x00:
++ param.vram_size = AST_VIDMEM_SIZE_8M;
++ break;
++
++ case 0x04:
++ param.vram_size = AST_VIDMEM_SIZE_16M;
++ break;
++
++ case 0x08:
++ param.vram_size = AST_VIDMEM_SIZE_32M;
++ break;
++
++ case 0x0c:
++ param.vram_size = AST_VIDMEM_SIZE_64M;
++ break;
++ }
+
+ if (param.dram_type == AST_DDR3) {
+ get_ddr3_info(ast, ¶m);
--- /dev/null
+From 905f21a49d388de3e99438235f3301cabf0c0ef4 Mon Sep 17 00:00:00 2001
+From: "Y.C. Chen" <yc_chen@aspeedtech.com>
+Date: Wed, 22 Feb 2017 15:10:50 +1100
+Subject: drm/ast: Fix test for VGA enabled
+
+From: Y.C. Chen <yc_chen@aspeedtech.com>
+
+commit 905f21a49d388de3e99438235f3301cabf0c0ef4 upstream.
+
+The test to see if VGA was already enabled is doing an unnecessary
+second test from a register that may or may not have been initialized
+to a valid value. Remove it.
+
+Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Acked-by: Joel Stanley <joel@jms.id.au>
+Tested-by: Y.C. Chen <yc_chen@aspeedtech.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/ast/ast_post.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+--- a/drivers/gpu/drm/ast/ast_post.c
++++ b/drivers/gpu/drm/ast/ast_post.c
+@@ -58,13 +58,9 @@ bool ast_is_vga_enabled(struct drm_devic
+ /* TODO 1180 */
+ } else {
+ ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT);
+- if (ch) {
+- ast_open_key(ast);
+- ch = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff);
+- return ch & 0x04;
+- }
++ return !!(ch & 0x01);
+ }
+- return 0;
++ return false;
+ }
+
+ static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff };
--- /dev/null
+From f9ad86e42d0303eeb8e0d41bb208153022ebd9d2 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Wed, 8 Feb 2017 02:46:01 +0300
+Subject: drm/atomic: fix an error code in mode_fixup()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit f9ad86e42d0303eeb8e0d41bb208153022ebd9d2 upstream.
+
+Having "ret" be a bool type works for everything except
+ret = funcs->atomic_check(). The other functions all return zero on
+error but ->atomic_check() returns negative error codes. We want to
+propagate the error code but instead we return 1.
+
+I found this bug with static analysis and I don't know if it affects
+run time.
+
+Fixes: 4cd4df8080a3 ("drm/atomic: Add ->atomic_check() to encoder helpers")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: http://patchwork.freedesktop.org/patch/msgid/20170207234601.GA23981@mwanda
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/drm_atomic_helper.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/drm_atomic_helper.c
++++ b/drivers/gpu/drm/drm_atomic_helper.c
+@@ -362,7 +362,7 @@ mode_fixup(struct drm_atomic_state *stat
+ struct drm_connector *connector;
+ struct drm_connector_state *conn_state;
+ int i;
+- bool ret;
++ int ret;
+
+ for_each_crtc_in_state(state, crtc, crtc_state, i) {
+ if (!crtc_state->mode_changed &&
--- /dev/null
+From f21b9a92ca7c29382909eaab9facc2cf46f2cc0b Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Tue, 7 Feb 2017 12:49:55 +0000
+Subject: drm: Cancel drm_fb_helper_dirty_work on unload
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit f21b9a92ca7c29382909eaab9facc2cf46f2cc0b upstream.
+
+We can not allow the worker to run after its fbdev, or even the module,
+has been removed.
+
+Fixes: eaa434defaca ("drm/fb-helper: Add fb_deferred_io support")
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Noralf Trønnes <noralf@tronnes.org>
+Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
+Cc: Jani Nikula <jani.nikula@linux.intel.com>
+Cc: Sean Paul <seanpaul@chromium.org>
+Cc: dri-devel@lists.freedesktop.org
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: http://patchwork.freedesktop.org/patch/msgid/20170207124956.14954-1-chris@chris-wilson.co.uk
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/drm_fb_helper.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/gpu/drm/drm_fb_helper.c
++++ b/drivers/gpu/drm/drm_fb_helper.c
+@@ -848,6 +848,8 @@ void drm_fb_helper_fini(struct drm_fb_he
+ if (!drm_fbdev_emulation)
+ return;
+
++ cancel_work_sync(&fb_helper->dirty_work);
++
+ if (!list_empty(&fb_helper->kernel_fb_list)) {
+ list_del(&fb_helper->kernel_fb_list);
+ if (list_empty(&kernel_fb_helper_list)) {
--- /dev/null
+From 24f76b2c87ed68f79f9f0705b11ccbefaaa0d390 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Tue, 7 Feb 2017 12:49:56 +0000
+Subject: drm: Cancel drm_fb_helper_resume_work on unload
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 24f76b2c87ed68f79f9f0705b11ccbefaaa0d390 upstream.
+
+We can not allow the worker to run after its fbdev, or even the module,
+has been removed.
+
+Fixes: cfe63423d9be ("drm/fb-helper: Add drm_fb_helper_set_suspend_unlocked()")
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Noralf Trønnes <noralf@tronnes.org>
+Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
+Cc: Jani Nikula <jani.nikula@linux.intel.com>
+Cc: Sean Paul <seanpaul@chromium.org>
+Cc: dri-devel@lists.freedesktop.org
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: http://patchwork.freedesktop.org/patch/msgid/20170207124956.14954-2-chris@chris-wilson.co.uk
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/drm_fb_helper.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpu/drm/drm_fb_helper.c
++++ b/drivers/gpu/drm/drm_fb_helper.c
+@@ -848,6 +848,7 @@ void drm_fb_helper_fini(struct drm_fb_he
+ if (!drm_fbdev_emulation)
+ return;
+
++ cancel_work_sync(&fb_helper->resume_work);
+ cancel_work_sync(&fb_helper->dirty_work);
+
+ if (!list_empty(&fb_helper->kernel_fb_list)) {
--- /dev/null
+From 36fc579761b50784b63dafd0f2e796b659e0f5ee Mon Sep 17 00:00:00 2001
+From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
+Date: Mon, 20 Feb 2017 16:25:45 +0100
+Subject: drm/edid: Add EDID_QUIRK_FORCE_8BPC quirk for Rotel RSX-1058
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
+
+commit 36fc579761b50784b63dafd0f2e796b659e0f5ee upstream.
+
+Rotel RSX-1058 is a receiver with 4 HDMI inputs and a HDMI output, all
+1.1.
+
+When a sink that supports deep color is connected to the output, the
+receiver will send EDIDs that advertise this capability, even if it
+isn't possible with HDMI versions earlier than 1.3.
+
+Currently the kernel is assuming that deep color is possible and the
+sink displays an error.
+
+This quirk will make sure that deep color isn't used with this
+particular receiver.
+
+Fixes: 7a0baa623446 ("Revert "drm/i915: Disable 12bpc hdmi for now"")
+Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
+Link: http://patchwork.freedesktop.org/patch/msgid/20170220152545.13153-1-tomeu.vizoso@collabora.com
+Cc: Matt Horan <matt@matthoran.com>
+Tested-by: Matt Horan <matt@matthoran.com>
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99869
+Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/drm_edid.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/gpu/drm/drm_edid.c
++++ b/drivers/gpu/drm/drm_edid.c
+@@ -145,6 +145,9 @@ static struct edid_quirk {
+
+ /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
+ { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC },
++
++ /* Rotel RSX-1058 forwards sink's EDID but only does HDMI 1.1*/
++ { "ETR", 13896, EDID_QUIRK_FORCE_8BPC },
+ };
+
+ /*
--- /dev/null
+From ddd09373628adcbdc3f7b9098d22328834f8d772 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Wed, 9 Nov 2016 10:39:05 +0000
+Subject: drm/i915/gvt: Disable access to stolen memory as a guest
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit ddd09373628adcbdc3f7b9098d22328834f8d772 upstream.
+
+Explicitly disable stolen memory when running as a guest in a virtual
+machine, since the memory is not mediated between clients and reserved
+entirely for the host. The actual size should be reported as zero, but
+like every other quirk we want to tell the user what is happening.
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99028
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
+Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
+Link: http://patchwork.freedesktop.org/patch/msgid/20161109103905.17860-1-chris@chris-wilson.co.uk
+Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
+(cherry picked from commit 04a68a35ce6d7b54749989f943993020f48fed62)
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/i915_gem_stolen.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
++++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
+@@ -415,6 +415,11 @@ int i915_gem_init_stolen(struct drm_devi
+
+ mutex_init(&dev_priv->mm.stolen_lock);
+
++ if (intel_vgpu_active(dev_priv)) {
++ DRM_INFO("iGVT-g active, disabling use of stolen memory\n");
++ return 0;
++ }
++
+ #ifdef CONFIG_INTEL_IOMMU
+ if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) {
+ DRM_INFO("DMAR active, disabling use of stolen memory\n");
--- /dev/null
+From fc12bccda8b6f5c38139eceec9e369ed78091b2b Mon Sep 17 00:00:00 2001
+From: Fabio Estevam <fabio.estevam@nxp.com>
+Date: Wed, 8 Feb 2017 10:47:49 -0200
+Subject: drm/imx: imx-tve: Do not set the regulator voltage
+
+From: Fabio Estevam <fabio.estevam@nxp.com>
+
+commit fc12bccda8b6f5c38139eceec9e369ed78091b2b upstream.
+
+Commit deb65870b5d9d ("drm/imx: imx-tve: check the value returned by
+regulator_set_voltage()") exposes the following probe issue:
+
+63ff0000.tve supply dac not found, using dummy regulator
+imx-drm display-subsystem: failed to bind 63ff0000.tve (ops imx_tve_ops): -22
+
+When the 'dac-supply' is not passed in the device tree a dummy regulator is
+used and setting its voltage is not allowed.
+
+To fix this issue, do not set the dac-supply voltage inside the driver
+and let its voltage be specified in the device tree.
+
+Print a warning if the the 'dac-supply' voltage has a value different
+from 2.75V.
+
+Fixes: deb65870b5d9d ("drm/imx: imx-tve: check the value returned by regulator_set_voltage()")
+Suggested-by: Lucas Stach <l.stach@pengutronix.de>
+Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/imx/imx-tve.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/imx/imx-tve.c
++++ b/drivers/gpu/drm/imx/imx-tve.c
+@@ -98,6 +98,8 @@
+ /* TVE_TST_MODE_REG */
+ #define TVE_TVDAC_TEST_MODE_MASK (0x7 << 0)
+
++#define IMX_TVE_DAC_VOLTAGE 2750000
++
+ enum {
+ TVE_MODE_TVOUT,
+ TVE_MODE_VGA,
+@@ -628,9 +630,8 @@ static int imx_tve_bind(struct device *d
+
+ tve->dac_reg = devm_regulator_get(dev, "dac");
+ if (!IS_ERR(tve->dac_reg)) {
+- ret = regulator_set_voltage(tve->dac_reg, 2750000, 2750000);
+- if (ret)
+- return ret;
++ if (regulator_get_voltage(tve->dac_reg) != IMX_TVE_DAC_VOLTAGE)
++ dev_warn(dev, "dac voltage is not %d uV\n", IMX_TVE_DAC_VOLTAGE);
+ ret = regulator_enable(tve->dac_reg);
+ if (ret)
+ return ret;
--- /dev/null
+From 239ac65fa5ffab71adf66e642750f940e7241d99 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
+Date: Wed, 25 Jan 2017 17:21:31 +0900
+Subject: drm/ttm: Make sure BOs being swapped out are cacheable
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michel Dänzer <michel.daenzer@amd.com>
+
+commit 239ac65fa5ffab71adf66e642750f940e7241d99 upstream.
+
+The current caching state may not be tt_cached, even though the
+placement contains TTM_PL_FLAG_CACHED, because placement can contain
+multiple caching flags. Trying to swap out such a BO would trip up the
+
+ BUG_ON(ttm->caching_state != tt_cached);
+
+in ttm_tt_swapout.
+
+Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
+Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>.
+Reviewed-by: Sinclair Yeh <syeh@vmware.com>
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/ttm/ttm_bo.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/ttm/ttm_bo.c
++++ b/drivers/gpu/drm/ttm/ttm_bo.c
+@@ -1654,7 +1654,6 @@ static int ttm_bo_swapout(struct ttm_mem
+ struct ttm_buffer_object *bo;
+ int ret = -EBUSY;
+ int put_count;
+- uint32_t swap_placement = (TTM_PL_FLAG_CACHED | TTM_PL_FLAG_SYSTEM);
+
+ spin_lock(&glob->lru_lock);
+ list_for_each_entry(bo, &glob->swap_lru, swap) {
+@@ -1685,7 +1684,8 @@ static int ttm_bo_swapout(struct ttm_mem
+ * Move to system cached
+ */
+
+- if ((bo->mem.placement & swap_placement) != swap_placement) {
++ if (bo->mem.mem_type != TTM_PL_SYSTEM ||
++ bo->ttm->caching_state != tt_cached) {
+ struct ttm_mem_reg evict_mem;
+
+ evict_mem = bo->mem;
--- /dev/null
+From 31788ca803a0c89078f9e604e64286fbd9077926 Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom <thellstrom@vmware.com>
+Date: Tue, 21 Feb 2017 17:42:27 +0700
+Subject: drm/vmwgfx: Work around drm removal of control nodes
+
+From: Thomas Hellstrom <thellstrom@vmware.com>
+
+commit 31788ca803a0c89078f9e604e64286fbd9077926 upstream.
+
+vmware tools has a daemon that gets layout information from the GUI and
+forwards it to DRM so that the modesetting code can set preferred connector
+locations and modes. This daemon was using control nodes but since control
+nodes were just removed, make it possible for the daemon to use render- or
+primary nodes instead. This is a bit ugly but will allow drm to proceed with
+removal of the mostly unused control-node code and allow vmware to proceed
+with fixing up automatic layout settings for gnome-shell/wayland.
+
+We bump minor to inform user-space about the api change.
+
+Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
+Reviewed-by: Sinclair Yeh <syeh@vmware.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: http://patchwork.freedesktop.org/patch/msgid/20170221104227.2854-1-thellstrom@vmware.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 11 ++++++++++-
+ drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 4 ++--
+ 2 files changed, 12 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+@@ -199,9 +199,14 @@ static const struct drm_ioctl_desc vmw_i
+ VMW_IOCTL_DEF(VMW_PRESENT_READBACK,
+ vmw_present_readback_ioctl,
+ DRM_MASTER | DRM_AUTH),
++ /*
++ * The permissions of the below ioctl are overridden in
++ * vmw_generic_ioctl(). We require either
++ * DRM_MASTER or capable(CAP_SYS_ADMIN).
++ */
+ VMW_IOCTL_DEF(VMW_UPDATE_LAYOUT,
+ vmw_kms_update_layout_ioctl,
+- DRM_MASTER | DRM_CONTROL_ALLOW),
++ DRM_RENDER_ALLOW),
+ VMW_IOCTL_DEF(VMW_CREATE_SHADER,
+ vmw_shader_define_ioctl,
+ DRM_AUTH | DRM_RENDER_ALLOW),
+@@ -1125,6 +1130,10 @@ static long vmw_generic_ioctl(struct fil
+
+ return (long) vmw_execbuf_ioctl(dev, arg, file_priv,
+ _IOC_SIZE(cmd));
++ } else if (nr == DRM_COMMAND_BASE + DRM_VMW_UPDATE_LAYOUT) {
++ if (!drm_is_current_master(file_priv) &&
++ !capable(CAP_SYS_ADMIN))
++ return -EACCES;
+ }
+
+ if (unlikely(ioctl->cmd != cmd))
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+@@ -41,9 +41,9 @@
+ #include <drm/ttm/ttm_module.h>
+ #include "vmwgfx_fence.h"
+
+-#define VMWGFX_DRIVER_DATE "20160210"
++#define VMWGFX_DRIVER_DATE "20170221"
+ #define VMWGFX_DRIVER_MAJOR 2
+-#define VMWGFX_DRIVER_MINOR 11
++#define VMWGFX_DRIVER_MINOR 12
+ #define VMWGFX_DRIVER_PATCHLEVEL 0
+ #define VMWGFX_FILE_PAGE_OFFSET 0x00100000
+ #define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
mac80211-don-t-reorder-frames-with-sn-smaller-than-ssn.patch
mac80211-don-t-handle-filtered-frames-within-a-ba-session.patch
mac80211-use-driver-indicated-transmitter-sta-only-for-data-frames.patch
+drm-amdgpu-add-more-cases-to-dce11-possible-crtc-mask-setup.patch
+drm-ast-fix-test-for-vga-enabled.patch
+drm-ast-call-open_key-before-enable_mmio-in-post-code.patch
+drm-ast-fix-ast2400-post-failure-without-bmc-fw-or-vbios.patch
+drm-edid-add-edid_quirk_force_8bpc-quirk-for-rotel-rsx-1058.patch
+drm-ttm-make-sure-bos-being-swapped-out-are-cacheable.patch
+drm-vmwgfx-work-around-drm-removal-of-control-nodes.patch
+dmaengine-imx-sdma-correct-the-dma-transfer-residue-calculation.patch
+drm-imx-imx-tve-do-not-set-the-regulator-voltage.patch
+drm-atomic-fix-an-error-code-in-mode_fixup.patch
+drm-i915-gvt-disable-access-to-stolen-memory-as-a-guest.patch
+drm-cancel-drm_fb_helper_dirty_work-on-unload.patch
+drm-cancel-drm_fb_helper_resume_work-on-unload.patch