From: Greg Kroah-Hartman Date: Sun, 9 Jun 2019 11:04:14 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.1.9~18 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fkernel%2Fstable-queue.git;a=commitdiff_plain;h=38fb516942eaf76f453b5e13bfaf2017ae896889 4.19-stable patches added patches: drm-add-non-desktop-quirk-for-valve-hmds.patch drm-add-non-desktop-quirks-to-sensics-and-osvr-headsets.patch drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch drm-amdgpu-remove-atpx_dgpu_req_power_for_displays-check-when-hotplug-in.patch drm-amdgpu-soc15-skip-reset-on-init.patch drm-don-t-block-fb-changes-for-async-plane-updates.patch drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch drm-i915-fix-i915_exec_ring_mask.patch drm-i915-gvt-initialize-intel_gvt_gtt_entry-in-stack.patch drm-i915-maintain-consistent-documentation-subsection-ordering.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.19/cls_matchall-avoid-panic-when-receiving-a-packet-before-filter-set.patch b/queue-4.19/cls_matchall-avoid-panic-when-receiving-a-packet-before-filter-set.patch deleted file mode 100644 index 9a0f9b547b..0000000000 --- a/queue-4.19/cls_matchall-avoid-panic-when-receiving-a-packet-before-filter-set.patch +++ /dev/null @@ -1,97 +0,0 @@ -From foo@baz Sun 09 Jun 2019 09:25:15 AM CEST -From: Matteo Croce -Date: Thu, 2 May 2019 10:51:05 +0200 -Subject: cls_matchall: avoid panic when receiving a packet before filter set - -From: Matteo Croce - -[ Upstream commit 25426043ec9e22b90c789407c28e40f32a9d1985 ] - -When a matchall classifier is added, there is a small time interval in -which tp->root is NULL. If we receive a packet in this small time slice -a NULL pointer dereference will happen, leading to a kernel panic: - - # tc qdisc replace dev eth0 ingress - # tc filter add dev eth0 parent ffff: matchall action gact drop - Unable to handle kernel NULL pointer dereference at virtual address 0000000000000034 - Mem abort info: - ESR = 0x96000005 - Exception class = DABT (current EL), IL = 32 bits - SET = 0, FnV = 0 - EA = 0, S1PTW = 0 - Data abort info: - ISV = 0, ISS = 0x00000005 - CM = 0, WnR = 0 - user pgtable: 4k pages, 39-bit VAs, pgdp = 00000000a623d530 - [0000000000000034] pgd=0000000000000000, pud=0000000000000000 - Internal error: Oops: 96000005 [#1] SMP - Modules linked in: cls_matchall sch_ingress nls_iso8859_1 nls_cp437 vfat fat m25p80 spi_nor mtd xhci_plat_hcd xhci_hcd phy_generic sfp mdio_i2c usbcore i2c_mv64xxx marvell10g mvpp2 usb_common spi_orion mvmdio i2c_core sbsa_gwdt phylink ip_tables x_tables autofs4 - Process ksoftirqd/0 (pid: 9, stack limit = 0x0000000009de7d62) - CPU: 0 PID: 9 Comm: ksoftirqd/0 Not tainted 5.1.0-rc6 #21 - Hardware name: Marvell 8040 MACCHIATOBin Double-shot (DT) - pstate: 40000005 (nZcv daif -PAN -UAO) - pc : mall_classify+0x28/0x78 [cls_matchall] - lr : tcf_classify+0x78/0x138 - sp : ffffff80109db9d0 - x29: ffffff80109db9d0 x28: ffffffc426058800 - x27: 0000000000000000 x26: ffffffc425b0dd00 - x25: 0000000020000000 x24: 0000000000000000 - x23: ffffff80109dbac0 x22: 0000000000000001 - x21: ffffffc428ab5100 x20: ffffffc425b0dd00 - x19: ffffff80109dbac0 x18: 0000000000000000 - x17: 0000000000000000 x16: 0000000000000000 - x15: 0000000000000000 x14: 0000000000000000 - x13: ffffffbf108ad288 x12: dead000000000200 - x11: 00000000f0000000 x10: 0000000000000001 - x9 : ffffffbf1089a220 x8 : 0000000000000001 - x7 : ffffffbebffaa950 x6 : 0000000000000000 - x5 : 000000442d6ba000 x4 : 0000000000000000 - x3 : ffffff8008735ad8 x2 : ffffff80109dbac0 - x1 : ffffffc425b0dd00 x0 : ffffff8010592078 - Call trace: - mall_classify+0x28/0x78 [cls_matchall] - tcf_classify+0x78/0x138 - __netif_receive_skb_core+0x29c/0xa20 - __netif_receive_skb_one_core+0x34/0x60 - __netif_receive_skb+0x28/0x78 - netif_receive_skb_internal+0x2c/0xc0 - napi_gro_receive+0x1a0/0x1d8 - mvpp2_poll+0x928/0xb18 [mvpp2] - net_rx_action+0x108/0x378 - __do_softirq+0x128/0x320 - run_ksoftirqd+0x44/0x60 - smpboot_thread_fn+0x168/0x1b0 - kthread+0x12c/0x130 - ret_from_fork+0x10/0x1c - Code: aa0203f3 aa1e03e0 d503201f f9400684 (b9403480) - ---[ end trace fc71e2ef7b8ab5a5 ]--- - Kernel panic - not syncing: Fatal exception in interrupt - SMP: stopping secondary CPUs - Kernel Offset: disabled - CPU features: 0x002,00002000 - Memory Limit: none - Rebooting in 1 seconds.. - -Fix this by adding a NULL check in mall_classify(). - -Fixes: ed76f5edccc9 ("net: sched: protect filter_chain list with filter_chain_lock mutex") -Signed-off-by: Matteo Croce -Acked-by: Cong Wang -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/sched/cls_matchall.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/net/sched/cls_matchall.c -+++ b/net/sched/cls_matchall.c -@@ -30,6 +30,9 @@ static int mall_classify(struct sk_buff - { - struct cls_mall_head *head = rcu_dereference_bh(tp->root); - -+ if (unlikely(!head)) -+ return -1; -+ - if (tc_skip_sw(head->flags)) - return -1; - diff --git a/queue-4.19/drm-add-non-desktop-quirk-for-valve-hmds.patch b/queue-4.19/drm-add-non-desktop-quirk-for-valve-hmds.patch new file mode 100644 index 0000000000..5566cd7668 --- /dev/null +++ b/queue-4.19/drm-add-non-desktop-quirk-for-valve-hmds.patch @@ -0,0 +1,50 @@ +From 30d62d4453e49f85dd17b2ba60bbb68b6593dba0 Mon Sep 17 00:00:00 2001 +From: Andres Rodriguez +Date: Thu, 2 May 2019 15:31:57 -0400 +Subject: drm: add non-desktop quirk for Valve HMDs + +From: Andres Rodriguez + +commit 30d62d4453e49f85dd17b2ba60bbb68b6593dba0 upstream. + +Add vendor/product pairs for the Valve Index HMDs. + +Signed-off-by: Andres Rodriguez +Cc: Dave Airlie +Cc: # v4.15 +Signed-off-by: Dave Airlie +Link: https://patchwork.freedesktop.org/patch/msgid/20190502193157.15692-1-andresx7@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/drm_edid.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -172,6 +172,25 @@ static const struct edid_quirk { + /* Rotel RSX-1058 forwards sink's EDID but only does HDMI 1.1*/ + { "ETR", 13896, EDID_QUIRK_FORCE_8BPC }, + ++ /* Valve Index Headset */ ++ { "VLV", 0x91a8, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b0, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b1, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b2, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b3, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b4, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b5, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b6, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b7, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b8, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91b9, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91ba, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91bb, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91bc, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91bd, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91be, EDID_QUIRK_NON_DESKTOP }, ++ { "VLV", 0x91bf, EDID_QUIRK_NON_DESKTOP }, ++ + /* HTC Vive and Vive Pro VR Headsets */ + { "HVR", 0xaa01, EDID_QUIRK_NON_DESKTOP }, + { "HVR", 0xaa02, EDID_QUIRK_NON_DESKTOP }, diff --git a/queue-4.19/drm-add-non-desktop-quirks-to-sensics-and-osvr-headsets.patch b/queue-4.19/drm-add-non-desktop-quirks-to-sensics-and-osvr-headsets.patch new file mode 100644 index 0000000000..ef92bd3bc6 --- /dev/null +++ b/queue-4.19/drm-add-non-desktop-quirks-to-sensics-and-osvr-headsets.patch @@ -0,0 +1,39 @@ +From 29054230f3e11ea818eccfa7bb4e4b3e89544164 Mon Sep 17 00:00:00 2001 +From: Ryan Pavlik +Date: Mon, 3 Dec 2018 10:46:44 -0600 +Subject: drm: add non-desktop quirks to Sensics and OSVR headsets. + +From: Ryan Pavlik + +commit 29054230f3e11ea818eccfa7bb4e4b3e89544164 upstream. + +Add two EDID vendor/product pairs used across a variety of +Sensics products, as well as the OSVR HDK and HDK 2. + +Signed-off-by: Ryan Pavlik +Signed-off-by: Daniel Stone +Reviewed-by: Daniel Stone +Reviewed-by: Philipp Zabel +Link: https://patchwork.freedesktop.org/patch/msgid/20181203164644.13974-1-ryan.pavlik@collabora.com +Cc: # v4.15+ +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/drm_edid.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -212,6 +212,12 @@ static const struct edid_quirk { + + /* Sony PlayStation VR Headset */ + { "SNY", 0x0704, EDID_QUIRK_NON_DESKTOP }, ++ ++ /* Sensics VR Headsets */ ++ { "SEN", 0x1019, EDID_QUIRK_NON_DESKTOP }, ++ ++ /* OSVR HDK and HDK2 VR Headsets */ ++ { "SVR", 0x1019, EDID_QUIRK_NON_DESKTOP }, + }; + + /* diff --git a/queue-4.19/drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch b/queue-4.19/drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch new file mode 100644 index 0000000000..acba4ecad8 --- /dev/null +++ b/queue-4.19/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: + case CHIP_VEGA12: +@@ -67,6 +59,15 @@ static int psp_sw_init(void *handle) + if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) + return 0; + ++ 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.19/drm-amdgpu-remove-atpx_dgpu_req_power_for_displays-check-when-hotplug-in.patch b/queue-4.19/drm-amdgpu-remove-atpx_dgpu_req_power_for_displays-check-when-hotplug-in.patch new file mode 100644 index 0000000000..43bbe68344 --- /dev/null +++ b/queue-4.19/drm-amdgpu-remove-atpx_dgpu_req_power_for_displays-check-when-hotplug-in.patch @@ -0,0 +1,35 @@ +From bdb1ccb080dafc1b4224873a5b759ff85a7d1c10 Mon Sep 17 00:00:00 2001 +From: Aaron Liu +Date: Tue, 30 Apr 2019 09:47:25 +0800 +Subject: drm/amdgpu: remove ATPX_DGPU_REQ_POWER_FOR_DISPLAYS check when hotplug-in + +From: Aaron Liu + +commit bdb1ccb080dafc1b4224873a5b759ff85a7d1c10 upstream. + +In amdgpu_atif_handler, when hotplug event received, remove +ATPX_DGPU_REQ_POWER_FOR_DISPLAYS check. This bit's check will cause missing +system resume. + +Signed-off-by: Aaron Liu +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +@@ -416,8 +416,7 @@ static int amdgpu_atif_handler(struct am + } + } + if (req.pending & ATIF_DGPU_DISPLAY_EVENT) { +- if ((adev->flags & AMD_IS_PX) && +- amdgpu_atpx_dgpu_req_power_for_displays()) { ++ if (adev->flags & AMD_IS_PX) { + pm_runtime_get_sync(adev->ddev->dev); + /* Just fire off a uevent and let userspace tell us what to do */ + drm_helper_hpd_irq_event(adev->ddev); diff --git a/queue-4.19/drm-amdgpu-soc15-skip-reset-on-init.patch b/queue-4.19/drm-amdgpu-soc15-skip-reset-on-init.patch new file mode 100644 index 0000000000..855f81e74a --- /dev/null +++ b/queue-4.19/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 +@@ -495,6 +495,11 @@ int soc15_set_ip_blocks(struct amdgpu_de + return -EINVAL; + } + ++ /* Just return false for soc15 GPUs. Reset does not seem to ++ * be necessary. ++ */ ++ return false; ++ + if (adev->flags & AMD_IS_APU) + adev->nbio_funcs = &nbio_v7_0_funcs; + else if (adev->asic_type == CHIP_VEGA20) diff --git a/queue-4.19/drm-don-t-block-fb-changes-for-async-plane-updates.patch b/queue-4.19/drm-don-t-block-fb-changes-for-async-plane-updates.patch new file mode 100644 index 0000000000..bd6dd442f6 --- /dev/null +++ b/queue-4.19/drm-don-t-block-fb-changes-for-async-plane-updates.patch @@ -0,0 +1,132 @@ +From 89a4aac0ab0e6f5eea10d7bf4869dd15c3de2cd4 Mon Sep 17 00:00:00 2001 +From: Helen Koike +Date: Mon, 3 Jun 2019 13:56:10 -0300 +Subject: drm: don't block fb changes for async plane updates + +From: Helen Koike + +commit 89a4aac0ab0e6f5eea10d7bf4869dd15c3de2cd4 upstream. + +In the case of a normal sync update, the preparation of framebuffers (be +it calling drm_atomic_helper_prepare_planes() or doing setups with +drm_framebuffer_get()) are performed in the new_state and the respective +cleanups are performed in the old_state. + +In the case of async updates, the preparation is also done in the +new_state but the cleanups are done in the new_state (because updates +are performed in place, i.e. in the current state). + +The current code blocks async udpates when the fb is changed, turning +async updates into sync updates, slowing down cursor updates and +introducing regressions in igt tests with errors of type: + +"CRITICAL: completed 97 cursor updated in a period of 30 flips, we +expect to complete approximately 15360 updates, with the threshold set +at 7680" + +Fb changes in async updates were prevented to avoid the following scenario: + +- Async update, oldfb = NULL, newfb = fb1, prepare fb1, cleanup fb1 +- Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb2 +- Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 (wrong) +Where we have a single call to prepare fb2 but double cleanup call to fb2. + +To solve the above problems, instead of blocking async fb changes, we +place the old framebuffer in the new_state object, so when the code +performs cleanups in the new_state it will cleanup the old_fb and we +will have the following scenario instead: + +- Async update, oldfb = NULL, newfb = fb1, prepare fb1, no cleanup +- Async update, oldfb = fb1, newfb = fb2, prepare fb2, cleanup fb1 +- Non-async commit, oldfb = fb2, newfb = fb1, prepare fb1, cleanup fb2 + +Where calls to prepare/cleanup are balanced. + +Cc: # v4.14+ +Fixes: 25dc194b34dd ("drm: Block fb changes for async plane updates") +Suggested-by: Boris Brezillon +Signed-off-by: Helen Koike +Reviewed-by: Boris Brezillon +Reviewed-by: Nicholas Kazlauskas +Signed-off-by: Boris Brezillon +Link: https://patchwork.freedesktop.org/patch/msgid/20190603165610.24614-6-helen.koike@collabora.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/drm_atomic_helper.c | 22 ++++++++++++---------- + include/drm/drm_modeset_helper_vtables.h | 8 ++++++++ + 2 files changed, 20 insertions(+), 10 deletions(-) + +--- a/drivers/gpu/drm/drm_atomic_helper.c ++++ b/drivers/gpu/drm/drm_atomic_helper.c +@@ -1573,15 +1573,6 @@ int drm_atomic_helper_async_check(struct + if (old_plane_state->fb != new_plane_state->fb) + return -EINVAL; + +- /* +- * FIXME: Since prepare_fb and cleanup_fb are always called on +- * the new_plane_state for async updates we need to block framebuffer +- * changes. This prevents use of a fb that's been cleaned up and +- * double cleanups from occuring. +- */ +- if (old_plane_state->fb != new_plane_state->fb) +- return -EINVAL; +- + funcs = plane->helper_private; + if (!funcs->atomic_async_update) + return -EINVAL; +@@ -1612,6 +1603,8 @@ EXPORT_SYMBOL(drm_atomic_helper_async_ch + * drm_atomic_async_check() succeeds. Async commits are not supposed to swap + * the states like normal sync commits, but just do in-place changes on the + * current state. ++ * ++ * TODO: Implement full swap instead of doing in-place changes. + */ + void drm_atomic_helper_async_commit(struct drm_device *dev, + struct drm_atomic_state *state) +@@ -1622,6 +1615,9 @@ void drm_atomic_helper_async_commit(stru + int i; + + for_each_new_plane_in_state(state, plane, plane_state, i) { ++ struct drm_framebuffer *new_fb = plane_state->fb; ++ struct drm_framebuffer *old_fb = plane->state->fb; ++ + funcs = plane->helper_private; + funcs->atomic_async_update(plane, plane_state); + +@@ -1630,11 +1626,17 @@ void drm_atomic_helper_async_commit(stru + * plane->state in-place, make sure at least common + * properties have been properly updated. + */ +- WARN_ON_ONCE(plane->state->fb != plane_state->fb); ++ WARN_ON_ONCE(plane->state->fb != new_fb); + WARN_ON_ONCE(plane->state->crtc_x != plane_state->crtc_x); + WARN_ON_ONCE(plane->state->crtc_y != plane_state->crtc_y); + WARN_ON_ONCE(plane->state->src_x != plane_state->src_x); + WARN_ON_ONCE(plane->state->src_y != plane_state->src_y); ++ ++ /* ++ * Make sure the FBs have been swapped so that cleanups in the ++ * new_state performs a cleanup in the old FB. ++ */ ++ WARN_ON_ONCE(plane_state->fb != old_fb); + } + } + EXPORT_SYMBOL(drm_atomic_helper_async_commit); +--- a/include/drm/drm_modeset_helper_vtables.h ++++ b/include/drm/drm_modeset_helper_vtables.h +@@ -1174,6 +1174,14 @@ struct drm_plane_helper_funcs { + * current one with the new plane configurations in the new + * plane_state. + * ++ * Drivers should also swap the framebuffers between current plane ++ * state (&drm_plane.state) and new_state. ++ * This is required since cleanup for async commits is performed on ++ * the new state, rather than old state like for traditional commits. ++ * Since we want to give up the reference on the current (old) fb ++ * instead of our brand new one, swap them in the driver during the ++ * async commit. ++ * + * FIXME: + * - It only works for single plane updates + * - Async Pageflips are not supported yet diff --git a/queue-4.19/drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch b/queue-4.19/drm-i915-fbc-disable-framebuffer-compression-on-geminilake.patch new file mode 100644 index 0000000000..7f05b8833f --- /dev/null +++ b/queue-4.19/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 +@@ -1267,6 +1267,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.19/drm-i915-fix-i915_exec_ring_mask.patch b/queue-4.19/drm-i915-fix-i915_exec_ring_mask.patch new file mode 100644 index 0000000000..96c8491129 --- /dev/null +++ b/queue-4.19/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 +@@ -942,7 +942,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.19/drm-i915-gvt-initialize-intel_gvt_gtt_entry-in-stack.patch b/queue-4.19/drm-i915-gvt-initialize-intel_gvt_gtt_entry-in-stack.patch new file mode 100644 index 0000000000..3cd76d3b30 --- /dev/null +++ b/queue-4.19/drm-i915-gvt-initialize-intel_gvt_gtt_entry-in-stack.patch @@ -0,0 +1,63 @@ +From 387a4c2b55291b37e245c840813bd8a8bd06ed49 Mon Sep 17 00:00:00 2001 +From: Tina Zhang +Date: Thu, 23 May 2019 06:18:36 +0800 +Subject: drm/i915/gvt: Initialize intel_gvt_gtt_entry in stack + +From: Tina Zhang + +commit 387a4c2b55291b37e245c840813bd8a8bd06ed49 upstream. + +Stack struct intel_gvt_gtt_entry value needs to be initialized before +being used, as the fields may contain garbage values. + +W/o this patch, set_ggtt_entry prints: +------------------------------------- +274.046840: set_ggtt_entry: vgpu1:set ggtt entry 0x9bed8000ffffe900 +274.046846: set_ggtt_entry: vgpu1:set ggtt entry 0xe55df001 +274.046852: set_ggtt_entry: vgpu1:set ggtt entry 0x9bed8000ffffe900 + +0x9bed8000 is the stack grabage. + +W/ this patch, set_ggtt_entry prints: +------------------------------------ +274.046840: set_ggtt_entry: vgpu1:set ggtt entry 0xffffe900 +274.046846: set_ggtt_entry: vgpu1:set ggtt entry 0xe55df001 +274.046852: set_ggtt_entry: vgpu1:set ggtt entry 0xffffe900 + +v2: +- Initialize during declaration. (Zhenyu) + +Fixes: 7598e8700e9a ("drm/i915/gvt: Missed to cancel dma map for ggtt entries") +Cc: stable@vger.kernel.org # v4.20+ +Cc: Zhenyu Wang +Reviewed-by: Zhenyu Wang +Signed-off-by: Tina Zhang +Signed-off-by: Zhenyu Wang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/gvt/gtt.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/i915/gvt/gtt.c ++++ b/drivers/gpu/drm/i915/gvt/gtt.c +@@ -2161,7 +2161,8 @@ static int emulate_ggtt_mmio_write(struc + struct intel_gvt_gtt_pte_ops *ops = gvt->gtt.pte_ops; + unsigned long g_gtt_index = off >> info->gtt_entry_size_shift; + unsigned long gma, gfn; +- struct intel_gvt_gtt_entry e, m; ++ struct intel_gvt_gtt_entry e = {.val64 = 0, .type = GTT_TYPE_GGTT_PTE}; ++ struct intel_gvt_gtt_entry m = {.val64 = 0, .type = GTT_TYPE_GGTT_PTE}; + dma_addr_t dma_addr; + int ret; + +@@ -2237,7 +2238,8 @@ static int emulate_ggtt_mmio_write(struc + + if (ops->test_present(&e)) { + gfn = ops->get_pfn(&e); +- m = e; ++ m.val64 = e.val64; ++ m.type = e.type; + + /* one PTE update may be issued in multiple writes and the + * first write may not construct a valid gfn diff --git a/queue-4.19/drm-i915-maintain-consistent-documentation-subsection-ordering.patch b/queue-4.19/drm-i915-maintain-consistent-documentation-subsection-ordering.patch new file mode 100644 index 0000000000..3382dff276 --- /dev/null +++ b/queue-4.19/drm-i915-maintain-consistent-documentation-subsection-ordering.patch @@ -0,0 +1,86 @@ +From 551bd3368a7b3cfef01edaade8970948d178d40a Mon Sep 17 00:00:00 2001 +From: Jonathan Corbet +Date: Thu, 23 May 2019 10:06:46 -0600 +Subject: drm/i915: Maintain consistent documentation subsection ordering + +From: Jonathan Corbet + +commit 551bd3368a7b3cfef01edaade8970948d178d40a upstream. + +With Sphinx 2.0 (or prior versions with the deprecation warnings fixed) the +docs build fails with: + + Documentation/gpu/i915.rst:403: WARNING: Title level inconsistent: + + Global GTT Fence Handling + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + reST markup error: + Documentation/gpu/i915.rst:403: (SEVERE/4) Title level inconsistent: + +I "fixed" it by changing the subsections in i915.rst, but that didn't seem +like the correct change. It turns out that a couple of i915 files create +their own subsections in kerneldoc comments using apostrophes as the +heading marker: + + Layout + '''''' + +That breaks the normal subsection marker ordering, and newer Sphinx is +rather more strict about enforcing that ordering. So fix the offending +comments to make Sphinx happy. + +(This is unfortunate, in that kerneldoc comments shouldn't need to be aware +of where they might be included in the heading hierarchy, but I don't see +a better way around it). + +Cc: stable@vger.kernel.org # v4.14+ +Acked-by: Jani Nikula +Signed-off-by: Jonathan Corbet +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/i915_reg.h | 6 +++--- + drivers/gpu/drm/i915/intel_workarounds.c | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/gpu/drm/i915/i915_reg.h ++++ b/drivers/gpu/drm/i915/i915_reg.h +@@ -32,7 +32,7 @@ + * macros. Do **not** mass change existing definitions just to update the style. + * + * Layout +- * '''''' ++ * ~~~~~~ + * + * Keep helper macros near the top. For example, _PIPE() and friends. + * +@@ -78,7 +78,7 @@ + * style. Use lower case in hexadecimal values. + * + * Naming +- * '''''' ++ * ~~~~~~ + * + * Try to name registers according to the specs. If the register name changes in + * the specs from platform to another, stick to the original name. +@@ -96,7 +96,7 @@ + * suffix to the name. For example, ``_SKL`` or ``_GEN8``. + * + * Examples +- * '''''''' ++ * ~~~~~~~~ + * + * (Note that the values in the example are indented using spaces instead of + * TABs to avoid misalignment in generated documentation. Use TABs in the +--- a/drivers/gpu/drm/i915/intel_workarounds.c ++++ b/drivers/gpu/drm/i915/intel_workarounds.c +@@ -37,7 +37,7 @@ + * costly and simplifies things. We can revisit this in the future. + * + * Layout +- * '''''' ++ * ~~~~~~ + * + * Keep things in this file ordered by WA type, as per the above (context, GT, + * display, register whitelist, batchbuffer). Then, inside each type, keep the diff --git a/queue-4.19/drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch b/queue-4.19/drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch new file mode 100644 index 0000000000..ee23520a5f --- /dev/null +++ b/queue-4.19/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 +@@ -1015,8 +1015,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.19/drm-radeon-prefer-lower-reference-dividers.patch b/queue-4.19/drm-radeon-prefer-lower-reference-dividers.patch new file mode 100644 index 0000000000..3680ef57b3 --- /dev/null +++ b/queue-4.19/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 +@@ -921,12 +921,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.19/series b/queue-4.19/series index 9d6955756c..abcfff0704 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -1,4 +1,3 @@ -cls_matchall-avoid-panic-when-receiving-a-packet-before-filter-set.patch ethtool-fix-potential-userspace-buffer-overflow.patch fix-memory-leak-in-sctp_process_init.patch ipv4-not-do-cache-for-local-delivery-if-bc_forwarding-is-enabled.patch @@ -37,3 +36,16 @@ 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-msm-fix-fb-references-in-async-update.patch +drm-add-non-desktop-quirk-for-valve-hmds.patch +drm-nouveau-add-kconfig-option-to-turn-off-nouveau-legacy-contexts.-v3.patch +drm-add-non-desktop-quirks-to-sensics-and-osvr-headsets.patch +drm-amdgpu-psp-move-psp-version-specific-function-pointers-to-early_init.patch +drm-radeon-prefer-lower-reference-dividers.patch +drm-amdgpu-remove-atpx_dgpu_req_power_for_displays-check-when-hotplug-in.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 +drm-i915-maintain-consistent-documentation-subsection-ordering.patch +drm-don-t-block-fb-changes-for-async-plane-updates.patch +drm-i915-gvt-initialize-intel_gvt_gtt_entry-in-stack.patch +tty-serial_core-add-install.patch diff --git a/queue-4.19/tty-serial_core-add-install.patch b/queue-4.19/tty-serial_core-add-install.patch new file mode 100644 index 0000000000..ce8011d09d --- /dev/null +++ b/queue-4.19/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 +@@ -130,9 +130,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); +@@ -730,9 +727,6 @@ static void uart_unthrottle(struct tty_s + upstat_t mask = UPSTAT_SYNC_FIFO; + struct uart_port *port; + +- if (!state) +- return; +- + port = uart_port_ref(state); + if (!port) + return; +@@ -1708,6 +1702,16 @@ static void uart_dtr_rts(struct tty_port + uart_port_deref(uport); + } + ++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); ++} ++ + /* + * Calls to uart_open are serialised by the tty_lock in + * drivers/tty/tty_io.c:tty_open() +@@ -1720,11 +1724,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,6 +2410,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,