--- /dev/null
+From 3ac65259328324de323dc006b52ff7c1a5b18d19 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Wed, 7 Aug 2013 10:01:56 +1000
+Subject: drm/ast: invalidate page tables when pinning a BO
+
+From: Dave Airlie <airlied@redhat.com>
+
+commit 3ac65259328324de323dc006b52ff7c1a5b18d19 upstream.
+
+same fix as cirrus and mgag200.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/ast/ast_ttm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpu/drm/ast/ast_ttm.c
++++ b/drivers/gpu/drm/ast/ast_ttm.c
+@@ -348,6 +348,7 @@ int ast_bo_create(struct drm_device *dev
+
+ astbo->gem.driver_private = NULL;
+ astbo->bo.bdev = &ast->ttm.bdev;
++ astbo->bo.bdev->dev_mapping = dev->dev_mapping;
+
+ ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
+
--- /dev/null
+From 109a51598869a39fdcec2d49672a9a39b6d89481 Mon Sep 17 00:00:00 2001
+From: Michal Srb <msrb@suse.com>
+Date: Tue, 6 Aug 2013 15:26:50 +0200
+Subject: drm/cirrus: Invalidate page tables when pinning a BO
+
+From: Michal Srb <msrb@suse.com>
+
+commit 109a51598869a39fdcec2d49672a9a39b6d89481 upstream.
+
+This is a cirrus version of Egbert Eich's patch for mgag200.
+
+Without bo.bdev->dev_mapping set, the ttm_bo_unmap_virtual_locked
+called from ttm_bo_handle_move_mem returns with no effect. If any
+application accessed the memory before it was moved, it will
+access wrong memory next time. This causes crashes when changing
+resolution down.
+
+Signed-off-by: Michal Srb <msrb@suse.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/cirrus/cirrus_ttm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
++++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
+@@ -353,6 +353,7 @@ int cirrus_bo_create(struct drm_device *
+
+ cirrusbo->gem.driver_private = NULL;
+ cirrusbo->bo.bdev = &cirrus->ttm.bdev;
++ cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping;
+
+ cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
+
--- /dev/null
+From e91abf80a0998f326107874c88d549f94839f13c Mon Sep 17 00:00:00 2001
+From: Michel Dänzer <michel.daenzer@amd.com>
+Date: Wed, 12 Jun 2013 11:58:44 +0200
+Subject: drm: Don't pass negative delta to ktime_sub_ns()
+
+From: Michel Dänzer <michel.daenzer@amd.com>
+
+commit e91abf80a0998f326107874c88d549f94839f13c upstream.
+
+It takes an unsigned value. This happens not to blow up on 64-bit
+architectures, but it does on 32-bit, causing
+drm_calc_vbltimestamp_from_scanoutpos() to calculate totally bogus
+timestamps for vblank events. Which in turn causes e.g. gnome-shell to
+hang after a DPMS off cycle with current xf86-video-ati Git.
+
+[airlied: regression introduced in drm: use monotonic time in drm_calc_vbltimestamp_from_scanoutpos]
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59339
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59836
+Tested-by: shui yangwei <yangweix.shui@intel.com>
+Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
+Reviewed-by: Imre Deak <imre.deak@intel.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/drm_irq.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/drm_irq.c
++++ b/drivers/gpu/drm/drm_irq.c
+@@ -708,7 +708,10 @@ int drm_calc_vbltimestamp_from_scanoutpo
+ /* Subtract time delta from raw timestamp to get final
+ * vblank_time timestamp for end of vblank.
+ */
+- etime = ktime_sub_ns(etime, delta_ns);
++ if (delta_ns < 0)
++ etime = ktime_add_ns(etime, -delta_ns);
++ else
++ etime = ktime_sub_ns(etime, delta_ns);
+ *vblank_time = ktime_to_timeval(etime);
+
+ DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",
--- /dev/null
+From ecaac1c866bcda4780a963b3d18cd310d971aea3 Mon Sep 17 00:00:00 2001
+From: Egbert Eich <eich@suse.com>
+Date: Wed, 17 Jul 2013 17:40:56 +0200
+Subject: drm/mgag200: Invalidate page tables when pinning a BO
+
+From: Egbert Eich <eich@suse.com>
+
+commit ecaac1c866bcda4780a963b3d18cd310d971aea3 upstream.
+
+When a BO gets pinned the placement may get changed. If the memory is
+mapped into user space and user space has already accessed the mapped
+range the page tables are set up but now point to the wrong memory.
+Set bo.mdev->dev_mapping in mgag200_bo_create() to make sure that
+ttm_bo_unmap_virtual() called from ttm_bo_handle_move_mem() will take
+care of this.
+
+v2: Don't call ttm_bo_unmap_virtual() in mgag200_bo_pin(), fix comment.
+
+Signed-off-by: Egbert Eich <eich@suse.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/mgag200/mgag200_ttm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
++++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
+@@ -347,6 +347,7 @@ int mgag200_bo_create(struct drm_device
+
+ mgabo->gem.driver_private = NULL;
+ mgabo->bo.bdev = &mdev->ttm.bdev;
++ mgabo->bo.bdev->dev_mapping = dev->dev_mapping;
+
+ mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
+
--- /dev/null
+From e1accbf0543eecfdb161131208c3dfefee22d61f Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Mon, 29 Jul 2013 18:56:13 -0400
+Subject: drm/radeon: select audio dto based on encoder id for DCE3
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+commit e1accbf0543eecfdb161131208c3dfefee22d61f upstream.
+
+There are two audio dtos on radeon asics that you can
+select between. Normally, dto0 is used for hdmi and
+dto1 for DP, but it seems that the dto is somehow
+tied to the encoders on DCE3 asics.
+
+fixes:
+https://bugs.freedesktop.org/show_bug.cgi?id=67435
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/r600_hdmi.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/r600_hdmi.c
++++ b/drivers/gpu/drm/radeon/r600_hdmi.c
+@@ -242,9 +242,15 @@ void r600_audio_set_dto(struct drm_encod
+ /* according to the reg specs, this should DCE3.2 only, but in
+ * practice it seems to cover DCE3.0 as well.
+ */
+- WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100);
+- WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100);
+- WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */
++ if (dig->dig_encoder == 0) {
++ WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100);
++ WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100);
++ WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */
++ } else {
++ WREG32(DCCG_AUDIO_DTO1_PHASE, base_rate * 100);
++ WREG32(DCCG_AUDIO_DTO1_MODULE, clock * 100);
++ WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */
++ }
+ } else {
+ /* according to the reg specs, this should be DCE2.0 and DCE3.0 */
+ WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) |
--- /dev/null
+From 641a00593f7d07eab778fbabf546fb68fff3d5ce Mon Sep 17 00:00:00 2001
+From: Christian König <christian.koenig@amd.com>
+Date: Mon, 5 Aug 2013 14:10:56 +0200
+Subject: drm/radeon: stop sending invalid UVD destroy msg
+
+From: Christian König <christian.koenig@amd.com>
+
+commit 641a00593f7d07eab778fbabf546fb68fff3d5ce upstream.
+
+We also need to check the handle.
+
+Signed-off-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/radeon/radeon_uvd.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/radeon_uvd.c
++++ b/drivers/gpu/drm/radeon/radeon_uvd.c
+@@ -218,8 +218,8 @@ void radeon_uvd_free_handles(struct rade
+ {
+ int i, r;
+ for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) {
+- if (rdev->uvd.filp[i] == filp) {
+- uint32_t handle = atomic_read(&rdev->uvd.handles[i]);
++ uint32_t handle = atomic_read(&rdev->uvd.handles[i]);
++ if (handle != 0 && rdev->uvd.filp[i] == filp) {
+ struct radeon_fence *fence;
+
+ r = radeon_uvd_get_destroy_msg(rdev,
virtio-console-clean-up-port-data-immediately-at-time-of-unplug.patch
virtio-console-fix-raising-sigio-after-port-unplug.patch
virtio-console-return-enodev-on-all-read-operations-after-unplug.patch
+drm-cirrus-invalidate-page-tables-when-pinning-a-bo.patch
+drm-mgag200-invalidate-page-tables-when-pinning-a-bo.patch
+drm-ast-invalidate-page-tables-when-pinning-a-bo.patch
+drm-don-t-pass-negative-delta-to-ktime_sub_ns.patch
+drm-radeon-select-audio-dto-based-on-encoder-id-for-dce3.patch
+drm-radeon-stop-sending-invalid-uvd-destroy-msg.patch