--- /dev/null
+From d90c06d57027203f73021bb7ddb30b800d65c636 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Fri, 1 Mar 2019 14:03:47 +0000
+Subject: drm/i915: Fix I915_EXEC_RING_MASK
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit d90c06d57027203f73021bb7ddb30b800d65c636 upstream.
+
+This was supposed to be a mask of all known rings, but it is being used
+by execbuffer to filter out invalid rings, and so is instead mapping high
+unused values onto valid rings. Instead of a mask of all known rings,
+we need it to be the mask of all possible rings.
+
+Fixes: 549f7365820a ("drm/i915: Enable SandyBridge blitter ring")
+Fixes: de1add360522 ("drm/i915: Decouple execbuf uAPI from internal implementation")
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
+Cc: <stable@vger.kernel.org> # v4.6+
+Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20190301140404.26690-21-chris@chris-wilson.co.uk
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/uapi/drm/i915_drm.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/uapi/drm/i915_drm.h
++++ b/include/uapi/drm/i915_drm.h
+@@ -756,7 +756,7 @@ struct drm_i915_gem_execbuffer2 {
+ __u32 num_cliprects;
+ /** This is a struct drm_clip_rect *cliprects */
+ __u64 cliprects_ptr;
+-#define I915_EXEC_RING_MASK (7<<0)
++#define I915_EXEC_RING_MASK (0x3f)
+ #define I915_EXEC_DEFAULT (0<<0)
+ #define I915_EXEC_RENDER (1<<0)
+ #define I915_EXEC_BSD (2<<0)
--- /dev/null
+From 2e26ccb119bde03584be53406bbd22e711b0d6e6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Mon, 6 May 2019 19:57:52 +0200
+Subject: drm/radeon: prefer lower reference dividers
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Christian König <christian.koenig@amd.com>
+
+commit 2e26ccb119bde03584be53406bbd22e711b0d6e6 upstream.
+
+Instead of the closest reference divider prefer the lowest,
+this fixes flickering issues on HP Compaq nx9420.
+
+Bugs: https://bugs.freedesktop.org/show_bug.cgi?id=108514
+Suggested-by: Paul Dufresne <dufresnep@gmail.com>
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/radeon_display.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/radeon_display.c
++++ b/drivers/gpu/drm/radeon/radeon_display.c
+@@ -935,12 +935,12 @@ static void avivo_get_fb_ref_div(unsigne
+ ref_div_max = max(min(100 / post_div, ref_div_max), 1u);
+
+ /* get matching reference and feedback divider */
+- *ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max);
++ *ref_div = min(max(den/post_div, 1u), ref_div_max);
+ *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den);
+
+ /* limit fb divider to its maximum */
+ if (*fb_div > fb_div_max) {
+- *ref_div = DIV_ROUND_CLOSEST(*ref_div * fb_div_max, *fb_div);
++ *ref_div = (*ref_div * fb_div_max)/(*fb_div);
+ *fb_div = fb_div_max;
+ }
+ }
--- /dev/null
+From 4cdd17ba1dff20ffc99fdbd2e6f0201fc7fe67df Mon Sep 17 00:00:00 2001
+From: Jiri Slaby <jslaby@suse.cz>
+Date: Wed, 17 Apr 2019 10:58:53 +0200
+Subject: TTY: serial_core, add ->install
+
+From: Jiri Slaby <jslaby@suse.cz>
+
+commit 4cdd17ba1dff20ffc99fdbd2e6f0201fc7fe67df upstream.
+
+We need to compute the uart state only on the first open. This is
+usually what is done in the ->install hook. serial_core used to do this
+in ->open on every open. So move it to ->install.
+
+As a side effect, it ensures the state is set properly in the window
+after tty_init_dev is called, but before uart_open. This fixes a bunch
+of races between tty_open and flush_to_ldisc we were dealing with
+recently.
+
+One of such bugs was attempted to fix in commit fedb5760648a (serial:
+fix race between flush_to_ldisc and tty_open), but it only took care of
+a couple of functions (uart_start and uart_unthrottle). I was able to
+reproduce the crash on a SLE system, but in uart_write_room which is
+also called from flush_to_ldisc via process_echoes. I was *unable* to
+reproduce the bug locally. It is due to having this patch in my queue
+since 2012!
+
+ general protection fault: 0000 [#1] SMP KASAN PTI
+ CPU: 1 PID: 5 Comm: kworker/u4:0 Tainted: G L 4.12.14-396-default #1 SLE15-SP1 (unreleased)
+ Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c89-prebuilt.qemu.org 04/01/2014
+ Workqueue: events_unbound flush_to_ldisc
+ task: ffff8800427d8040 task.stack: ffff8800427f0000
+ RIP: 0010:uart_write_room+0xc4/0x590
+ RSP: 0018:ffff8800427f7088 EFLAGS: 00010202
+ RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
+ RDX: 000000000000002f RSI: 00000000000000ee RDI: ffff88003888bd90
+ RBP: ffffffffb9545850 R08: 0000000000000001 R09: 0000000000000400
+ R10: ffff8800427d825c R11: 000000000000006e R12: 1ffff100084fee12
+ R13: ffffc900004c5000 R14: ffff88003888bb28 R15: 0000000000000178
+ FS: 0000000000000000(0000) GS:ffff880043300000(0000) knlGS:0000000000000000
+ CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+ CR2: 0000561da0794148 CR3: 000000000ebf4000 CR4: 00000000000006e0
+ Call Trace:
+ tty_write_room+0x6d/0xc0
+ __process_echoes+0x55/0x870
+ n_tty_receive_buf_common+0x105e/0x26d0
+ tty_ldisc_receive_buf+0xb7/0x1c0
+ tty_port_default_receive_buf+0x107/0x180
+ flush_to_ldisc+0x35d/0x5c0
+...
+
+0 in rbx means tty->driver_data is NULL in uart_write_room. 0x178 is
+tried to be dereferenced (0x178 >> 3 is 0x2f in rdx) at
+uart_write_room+0xc4. 0x178 is exactly (struct uart_state *)NULL->refcount
+used in uart_port_lock from uart_write_room.
+
+So revert the upstream commit here as my local patch should fix the
+whole family.
+
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+Cc: Li RongQing <lirongqing@baidu.com>
+Cc: Wang Li <wangli39@baidu.com>
+Cc: Zhang Yu <zhangyu31@baidu.com>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/serial_core.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
+--- a/drivers/tty/serial/serial_core.c
++++ b/drivers/tty/serial/serial_core.c
+@@ -141,9 +141,6 @@ static void uart_start(struct tty_struct
+ struct uart_port *port;
+ unsigned long flags;
+
+- if (!state)
+- return;
+-
+ port = uart_port_lock(state, flags);
+ __uart_start(tty);
+ uart_port_unlock(port, flags);
+@@ -1714,11 +1711,8 @@ static void uart_dtr_rts(struct tty_port
+ */
+ static int uart_open(struct tty_struct *tty, struct file *filp)
+ {
+- struct uart_driver *drv = tty->driver->driver_state;
+- int retval, line = tty->index;
+- struct uart_state *state = drv->state + line;
+-
+- tty->driver_data = state;
++ struct uart_state *state = tty->driver_data;
++ int retval;
+
+ retval = tty_port_open(&state->port, tty, filp);
+ if (retval > 0)
+@@ -2409,9 +2403,6 @@ static void uart_poll_put_char(struct tt
+ struct uart_state *state = drv->state + line;
+ struct uart_port *port;
+
+- if (!state)
+- return;
+-
+ port = uart_port_ref(state);
+ if (!port)
+ return;
+@@ -2424,6 +2415,7 @@ static void uart_poll_put_char(struct tt
+ #endif
+
+ static const struct tty_operations uart_ops = {
++ .install = uart_install,
+ .open = uart_open,
+ .close = uart_close,
+ .write = uart_write,
+@@ -2910,6 +2902,16 @@ out:
+ return ret;
+ }
+
++static int uart_install(struct tty_driver *driver, struct tty_struct *tty)
++{
++ struct uart_driver *drv = driver->driver_state;
++ struct uart_state *state = drv->state + tty->index;
++
++ tty->driver_data = state;
++
++ return tty_standard_install(driver, tty);
++}
++
+ /*
+ * Are the two ports equivalent?
+ */