From: Greg Kroah-Hartman Date: Sun, 9 Jun 2019 11:04:37 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.1.9~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=728409df6dc7fdbadb2d8035bbd602146ca4884f;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch drm-amdgpu-soc15-skip-reset-on-init.patch drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch drm-i915-fix-i915_exec_ring_mask.patch drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch drm-radeon-prefer-lower-reference-dividers.patch tty-serial_core-add-install.patch --- diff --git a/queue-4.14/drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch b/queue-4.14/drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch new file mode 100644 index 00000000000..3aba78da5f9 --- /dev/null +++ b/queue-4.14/drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch @@ -0,0 +1,63 @@ +From 9d6fea5744d6798353f37ac42a8a653a2607ca69 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Wed, 8 May 2019 21:45:06 -0500 +Subject: drm/amdgpu/psp: move psp version specific function pointers to early_init +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Deucher + +commit 9d6fea5744d6798353f37ac42a8a653a2607ca69 upstream. + +In case we need to use them for GPU reset prior initializing the +asic. Fixes a crash if the driver attempts to reset the GPU at driver +load time. + +Acked-by: Christian König +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +@@ -37,18 +37,10 @@ static void psp_set_funcs(struct amdgpu_ + static int psp_early_init(void *handle) + { + struct amdgpu_device *adev = (struct amdgpu_device *)handle; ++ struct psp_context *psp = &adev->psp; + + psp_set_funcs(adev); + +- return 0; +-} +- +-static int psp_sw_init(void *handle) +-{ +- struct amdgpu_device *adev = (struct amdgpu_device *)handle; +- struct psp_context *psp = &adev->psp; +- int ret; +- + switch (adev->asic_type) { + case CHIP_VEGA10: + psp->init_microcode = psp_v3_1_init_microcode; +@@ -79,6 +71,15 @@ static int psp_sw_init(void *handle) + + psp->adev = adev; + ++ return 0; ++} ++ ++static int psp_sw_init(void *handle) ++{ ++ struct amdgpu_device *adev = (struct amdgpu_device *)handle; ++ struct psp_context *psp = &adev->psp; ++ int ret; ++ + ret = psp_init_microcode(psp); + if (ret) { + DRM_ERROR("Failed to load psp firmware!\n"); diff --git a/queue-4.14/drm-amdgpu-soc15-skip-reset-on-init.patch b/queue-4.14/drm-amdgpu-soc15-skip-reset-on-init.patch new file mode 100644 index 00000000000..cc0c70efe0b --- /dev/null +++ b/queue-4.14/drm-amdgpu-soc15-skip-reset-on-init.patch @@ -0,0 +1,34 @@ +From 5887a59961e2295c5b02f39dbc0ecf9212709b7b Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Fri, 17 May 2019 09:21:13 -0500 +Subject: drm/amdgpu/soc15: skip reset on init + +From: Alex Deucher + +commit 5887a59961e2295c5b02f39dbc0ecf9212709b7b upstream. + +Not necessary on soc15 and breaks driver reload on server cards. + +Acked-by: Amber Lin +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/amd/amdgpu/soc15.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/gpu/drm/amd/amdgpu/soc15.c ++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c +@@ -474,6 +474,11 @@ static void soc15_pcie_gen3_enable(struc + if (amdgpu_pcie_gen2 == 0) + return; + ++ /* Just return false for soc15 GPUs. Reset does not seem to ++ * be necessary. ++ */ ++ return false; ++ + if (adev->flags & AMD_IS_APU) + return; + diff --git a/queue-4.14/drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch b/queue-4.14/drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch new file mode 100644 index 00000000000..490b82b0c15 --- /dev/null +++ b/queue-4.14/drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch @@ -0,0 +1,49 @@ +From 396dd8143bdd94bd1c358a228a631c8c895a1126 Mon Sep 17 00:00:00 2001 +From: Daniel Drake +Date: Tue, 23 Apr 2019 17:28:10 +0800 +Subject: drm/i915/fbc: disable framebuffer compression on GeminiLake + +From: Daniel Drake + +commit 396dd8143bdd94bd1c358a228a631c8c895a1126 upstream. + +On many (all?) the Gemini Lake systems we work with, there is frequent +momentary graphical corruption at the top of the screen, and it seems +that disabling framebuffer compression can avoid this. + +The ticket was reported 6 months ago and has already affected a +multitude of users, without any real progress being made. So, lets +disable framebuffer compression on GeminiLake until a solution is found. + +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108085 +Fixes: fd7d6c5c8f3e ("drm/i915: enable FBC on gen9+ too") +Cc: Paulo Zanoni +Cc: Daniel Vetter +Cc: Jani Nikula +Cc: # v4.11+ +Reviewed-by: Paulo Zanoni +Signed-off-by: Daniel Drake +Signed-off-by: Jian-Hong Pan +Signed-off-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20190423092810.28359-1-jian-hong@endlessm.com +(cherry picked from commit 1d25724b41fad7eeb2c3058a5c8190d6ece73e08) +Signed-off-by: Joonas Lahtinen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_fbc.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/gpu/drm/i915/intel_fbc.c ++++ b/drivers/gpu/drm/i915/intel_fbc.c +@@ -1299,6 +1299,10 @@ static int intel_sanitize_fbc_option(str + if (!HAS_FBC(dev_priv)) + return 0; + ++ /* https://bugs.freedesktop.org/show_bug.cgi?id=108085 */ ++ if (IS_GEMINILAKE(dev_priv)) ++ return 0; ++ + if (IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9) + return 1; + diff --git a/queue-4.14/drm-i915-fix-i915_exec_ring_mask.patch b/queue-4.14/drm-i915-fix-i915_exec_ring_mask.patch new file mode 100644 index 00000000000..8604f66693e --- /dev/null +++ b/queue-4.14/drm-i915-fix-i915_exec_ring_mask.patch @@ -0,0 +1,38 @@ +From d90c06d57027203f73021bb7ddb30b800d65c636 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Fri, 1 Mar 2019 14:03:47 +0000 +Subject: drm/i915: Fix I915_EXEC_RING_MASK + +From: Chris Wilson + +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 +Cc: Tvrtko Ursulin +Cc: # v4.6+ +Reviewed-by: Tvrtko Ursulin +Link: https://patchwork.freedesktop.org/patch/msgid/20190301140404.26690-21-chris@chris-wilson.co.uk +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -853,7 +853,7 @@ struct drm_i915_gem_execbuffer2 { + * struct drm_i915_gem_exec_fence *fences. + */ + __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) diff --git a/queue-4.14/drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch b/queue-4.14/drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch new file mode 100644 index 00000000000..e44f419cd80 --- /dev/null +++ b/queue-4.14/drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch @@ -0,0 +1,112 @@ +From b30a43ac7132cdda833ac4b13dd1ebd35ace14b7 Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Thu, 18 Apr 2019 16:45:15 +1000 +Subject: drm/nouveau: add kconfig option to turn off nouveau legacy contexts. (v3) + +From: Dave Airlie + +commit b30a43ac7132cdda833ac4b13dd1ebd35ace14b7 upstream. + +There was a nouveau DDX that relied on legacy context ioctls to work, +but we fixed it years ago, give distros that have a modern DDX the +option to break the uAPI and close the mess of holes that legacy +context support is. + +Full context of the story: + +commit 0e975980d435d58df2d430d688b8c18778b42218 +Author: Peter Antoine +Date: Tue Jun 23 08:18:49 2015 +0100 + + drm: Turn off Legacy Context Functions + + The context functions are not used by the i915 driver and should not + be used by modeset drivers. These driver functions contain several bugs + and security holes. This change makes these functions optional can be + turned on by a setting, they are turned off by default for modeset + driver with the exception of the nouvea driver that may require them with + an old version of libdrm. + + The previous attempt was + + commit 7c510133d93dd6f15ca040733ba7b2891ed61fd1 + Author: Daniel Vetter + Date: Thu Aug 8 15:41:21 2013 +0200 + + drm: mark context support as a legacy subsystem + + but this had to be reverted + + commit c21eb21cb50d58e7cbdcb8b9e7ff68b85cfa5095 + Author: Dave Airlie + Date: Fri Sep 20 08:32:59 2013 +1000 + + Revert "drm: mark context support as a legacy subsystem" + + v2: remove returns from void function, and formatting (Daniel Vetter) + + v3: + - s/Nova/nouveau/ in the commit message, and add references to the + previous attempts + - drop the part touching the drm hw lock, that should be a separate + patch. + + Signed-off-by: Peter Antoine (v2) + Cc: Peter Antoine (v2) + Reviewed-by: Peter Antoine + Signed-off-by: Daniel Vetter + +v2: move DRM_VM dependency into legacy config. +v3: fix missing dep (kbuild robot) + +Cc: stable@vger.kernel.org +Reviewed-by: Daniel Vetter +Signed-off-by: Dave Airlie +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/nouveau/Kconfig | 13 ++++++++++++- + drivers/gpu/drm/nouveau/nouveau_drm.c | 7 +++++-- + 2 files changed, 17 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/nouveau/Kconfig ++++ b/drivers/gpu/drm/nouveau/Kconfig +@@ -16,10 +16,21 @@ config DRM_NOUVEAU + select INPUT if ACPI && X86 + select THERMAL if ACPI && X86 + select ACPI_VIDEO if ACPI && X86 +- select DRM_VM + help + Choose this option for open-source NVIDIA support. + ++config NOUVEAU_LEGACY_CTX_SUPPORT ++ bool "Nouveau legacy context support" ++ depends on DRM_NOUVEAU ++ select DRM_VM ++ default y ++ help ++ There was a version of the nouveau DDX that relied on legacy ++ ctx ioctls not erroring out. But that was back in time a long ++ ways, so offer a way to disable it now. For uapi compat with ++ old nouveau ddx this should be on by default, but modern distros ++ should consider turning it off. ++ + config NOUVEAU_PLATFORM_DRIVER + bool "Nouveau (NVIDIA) SoC GPUs" + depends on DRM_NOUVEAU && ARCH_TEGRA +--- a/drivers/gpu/drm/nouveau/nouveau_drm.c ++++ b/drivers/gpu/drm/nouveau/nouveau_drm.c +@@ -967,8 +967,11 @@ nouveau_driver_fops = { + static struct drm_driver + driver_stub = { + .driver_features = +- DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_RENDER | +- DRIVER_KMS_LEGACY_CONTEXT, ++ DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_RENDER ++#if defined(CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT) ++ | DRIVER_KMS_LEGACY_CONTEXT ++#endif ++ , + + .load = nouveau_drm_load, + .unload = nouveau_drm_unload, diff --git a/queue-4.14/drm-radeon-prefer-lower-reference-dividers.patch b/queue-4.14/drm-radeon-prefer-lower-reference-dividers.patch new file mode 100644 index 00000000000..fb3d97858ea --- /dev/null +++ b/queue-4.14/drm-radeon-prefer-lower-reference-dividers.patch @@ -0,0 +1,44 @@ +From 2e26ccb119bde03584be53406bbd22e711b0d6e6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= +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 + +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 +Signed-off-by: Christian König +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -923,12 +923,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; + } + } diff --git a/queue-4.14/series b/queue-4.14/series index f082d3c412a..f62ecb6f28c 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -24,3 +24,10 @@ revert-mips-perf-ath79-fix-perfcount-irq-assignment.patch genwqe-prevent-an-integer-overflow-in-the-ioctl.patch test_firmware-use-correct-snprintf-limit.patch drm-gma500-cdv-check-vbt-config-bits-when-detecting-lvds-panels.patch +drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch +drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch +drm-radeon-prefer-lower-reference-dividers.patch +drm-i915-fix-i915_exec_ring_mask.patch +drm-amdgpu-soc15-skip-reset-on-init.patch +drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch +tty-serial_core-add-install.patch diff --git a/queue-4.14/tty-serial_core-add-install.patch b/queue-4.14/tty-serial_core-add-install.patch new file mode 100644 index 00000000000..5365c6342f2 --- /dev/null +++ b/queue-4.14/tty-serial_core-add-install.patch @@ -0,0 +1,131 @@ +From 4cdd17ba1dff20ffc99fdbd2e6f0201fc7fe67df Mon Sep 17 00:00:00 2001 +From: Jiri Slaby +Date: Wed, 17 Apr 2019 10:58:53 +0200 +Subject: TTY: serial_core, add ->install + +From: Jiri Slaby + +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 +Cc: Li RongQing +Cc: Wang Li +Cc: Zhang Yu +Cc: Greg Kroah-Hartman +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -143,9 +143,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); +@@ -1731,11 +1728,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) +@@ -2418,9 +2412,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; +@@ -2433,6 +2424,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, +@@ -2926,6 +2918,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? + */