From: Greg Kroah-Hartman Date: Tue, 4 Jun 2019 12:43:30 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.1.8~30 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fkernel%2Fstable-queue.git;a=commitdiff_plain;h=091fe26a7cf70840511b98da688f278398ddbe1b 4.19-stable patches added patches: drm-lease-make-sure-implicit-planes-are-leased.patch drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch drm-sun4i-fix-sun8i-hdmi-phy-clock-initialization.patch drm-sun4i-fix-sun8i-hdmi-phy-configuration-for-148.5-mhz.patch drm-tegra-gem-fix-cpu-cache-maintenance-for-bo-s-allocated-using-get_pages.patch drm-vmwgfx-don-t-send-drm-sysfs-hotplug-events-on-initial-master-set.patch efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch --- diff --git a/queue-4.19/drm-lease-make-sure-implicit-planes-are-leased.patch b/queue-4.19/drm-lease-make-sure-implicit-planes-are-leased.patch new file mode 100644 index 0000000000..a5466af3e6 --- /dev/null +++ b/queue-4.19/drm-lease-make-sure-implicit-planes-are-leased.patch @@ -0,0 +1,68 @@ +From 204f640da6914844b3270b41b29c84f6e3b74083 Mon Sep 17 00:00:00 2001 +From: Daniel Vetter +Date: Thu, 28 Feb 2019 15:49:08 +0100 +Subject: drm/lease: Make sure implicit planes are leased + +From: Daniel Vetter + +commit 204f640da6914844b3270b41b29c84f6e3b74083 upstream. + +If userspace doesn't enable universal planes, then we automatically +add the primary and cursor planes. But for universal userspace there's +no such check (and maybe we only want to give the lessee one plane, +maybe not even the primary one), hence we need to check for the +implied plane. + +v2: don't forget setcrtc ioctl. + +v3: Still allow disabling of the crtc in SETCRTC. + +Cc: stable@vger.kernel.org +Cc: Keith Packard +Reviewed-by: Boris Brezillon +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-6-daniel.vetter@ffwll.ch +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/drm_crtc.c | 4 ++++ + drivers/gpu/drm/drm_plane.c | 8 ++++++++ + 2 files changed, 12 insertions(+) + +--- a/drivers/gpu/drm/drm_crtc.c ++++ b/drivers/gpu/drm/drm_crtc.c +@@ -595,6 +595,10 @@ int drm_mode_setcrtc(struct drm_device * + + plane = crtc->primary; + ++ /* allow disabling with the primary plane leased */ ++ if (crtc_req->mode_valid && !drm_lease_held(file_priv, plane->base.id)) ++ return -EACCES; ++ + mutex_lock(&crtc->dev->mode_config.mutex); + drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE); + retry: +--- a/drivers/gpu/drm/drm_plane.c ++++ b/drivers/gpu/drm/drm_plane.c +@@ -940,6 +940,11 @@ retry: + if (ret) + goto out; + ++ if (!drm_lease_held(file_priv, crtc->cursor->base.id)) { ++ ret = -EACCES; ++ goto out; ++ } ++ + ret = drm_mode_cursor_universal(crtc, req, file_priv, &ctx); + goto out; + } +@@ -1042,6 +1047,9 @@ int drm_mode_page_flip_ioctl(struct drm_ + + plane = crtc->primary; + ++ if (!drm_lease_held(file_priv, plane->base.id)) ++ return -EACCES; ++ + if (crtc->funcs->page_flip_target) { + u32 current_vblank; + int r; diff --git a/queue-4.19/drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch b/queue-4.19/drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch new file mode 100644 index 0000000000..a4980c5eba --- /dev/null +++ b/queue-4.19/drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch @@ -0,0 +1,69 @@ +From b8f9d7f37b6af829c34c49d1a4f73ce6ed58e403 Mon Sep 17 00:00:00 2001 +From: Vicente Bergas +Date: Tue, 2 Apr 2019 13:37:53 +0200 +Subject: drm/rockchip: shutdown drm subsystem on shutdown + +From: Vicente Bergas + +commit b8f9d7f37b6af829c34c49d1a4f73ce6ed58e403 upstream. + +As explained by Robin Murphy: +> the IOMMU shutdown disables paging, so if the VOP is still +> scanning out then that will result in whatever IOVAs it was using now going +> straight out onto the bus as physical addresses. + +We had a more radical approach before in commit +7f3ef5dedb14 ("drm/rockchip: Allow driver to be shutdown on reboot/kexec") +but that resulted in new warnings and oopses on shutdown on rk3399 +chromeos devices. + +So second try is resurrecting Vicentes shutdown change which should +achieve the same result but in a less drastic way. + +Fixes: 63238173b2fa ("Revert "drm/rockchip: Allow driver to be shutdown on reboot/kexec"") +Cc: Jeffy Chen +Cc: Robin Murphy +Cc: Marc Zyngier +Cc: Brian Norris +Cc: Doug Anderson +Cc: stable@vger.kernel.org +Suggested-by: JeffyChen +Suggested-by: Robin Murphy +Signed-off-by: Vicente Bergas +[adapted commit message to explain the history] +Signed-off-by: Heiko Stuebner +Tested-by: Brian Norris +Tested-by: Douglas Anderson +Acked-by: Marc Zyngier +Link: https://patchwork.freedesktop.org/patch/msgid/20190402113753.10118-1-heiko@sntech.de +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +@@ -442,6 +442,14 @@ static int rockchip_drm_platform_remove( + return 0; + } + ++static void rockchip_drm_platform_shutdown(struct platform_device *pdev) ++{ ++ struct drm_device *drm = platform_get_drvdata(pdev); ++ ++ if (drm) ++ drm_atomic_helper_shutdown(drm); ++} ++ + static const struct of_device_id rockchip_drm_dt_ids[] = { + { .compatible = "rockchip,display-subsystem", }, + { /* sentinel */ }, +@@ -451,6 +459,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ + static struct platform_driver rockchip_drm_platform_driver = { + .probe = rockchip_drm_platform_probe, + .remove = rockchip_drm_platform_remove, ++ .shutdown = rockchip_drm_platform_shutdown, + .driver = { + .name = "rockchip-drm", + .of_match_table = rockchip_drm_dt_ids, diff --git a/queue-4.19/drm-sun4i-fix-sun8i-hdmi-phy-clock-initialization.patch b/queue-4.19/drm-sun4i-fix-sun8i-hdmi-phy-clock-initialization.patch new file mode 100644 index 0000000000..0e0b94d417 --- /dev/null +++ b/queue-4.19/drm-sun4i-fix-sun8i-hdmi-phy-clock-initialization.patch @@ -0,0 +1,86 @@ +From 8a943c6021ba8b95a36c842327e468df1fddd4a7 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Tue, 14 May 2019 22:43:36 +0200 +Subject: drm/sun4i: Fix sun8i HDMI PHY clock initialization + +From: Jernej Skrabec + +commit 8a943c6021ba8b95a36c842327e468df1fddd4a7 upstream. + +Current code initializes HDMI PHY clock driver before reset line is +deasserted and clocks enabled. Because of that, initial readout of +clock divider is incorrect (0 instead of 2). This causes any clock +rate with divider 1 (register value 0) to be set incorrectly. + +Fix this by moving initialization of HDMI PHY clock driver after reset +line is deasserted and clocks enabled. + +Cc: stable@vger.kernel.org # 4.17+ +Fixes: 4f86e81748fe ("drm/sun4i: Add support for H3 HDMI PHY variant") +Signed-off-by: Jernej Skrabec +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20190514204337.11068-2-jernej.skrabec@siol.net +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c ++++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +@@ -501,22 +501,13 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw + goto err_put_clk_pll0; + } + } +- +- ret = sun8i_phy_clk_create(phy, dev, +- phy->variant->has_second_pll); +- if (ret) { +- dev_err(dev, "Couldn't create the PHY clock\n"); +- goto err_put_clk_pll1; +- } +- +- clk_prepare_enable(phy->clk_phy); + } + + phy->rst_phy = of_reset_control_get_shared(node, "phy"); + if (IS_ERR(phy->rst_phy)) { + dev_err(dev, "Could not get phy reset control\n"); + ret = PTR_ERR(phy->rst_phy); +- goto err_disable_clk_phy; ++ goto err_put_clk_pll1; + } + + ret = reset_control_deassert(phy->rst_phy); +@@ -537,18 +528,29 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw + goto err_disable_clk_bus; + } + ++ if (phy->variant->has_phy_clk) { ++ ret = sun8i_phy_clk_create(phy, dev, ++ phy->variant->has_second_pll); ++ if (ret) { ++ dev_err(dev, "Couldn't create the PHY clock\n"); ++ goto err_disable_clk_mod; ++ } ++ ++ clk_prepare_enable(phy->clk_phy); ++ } ++ + hdmi->phy = phy; + + return 0; + ++err_disable_clk_mod: ++ clk_disable_unprepare(phy->clk_mod); + err_disable_clk_bus: + clk_disable_unprepare(phy->clk_bus); + err_deassert_rst_phy: + reset_control_assert(phy->rst_phy); + err_put_rst_phy: + reset_control_put(phy->rst_phy); +-err_disable_clk_phy: +- clk_disable_unprepare(phy->clk_phy); + err_put_clk_pll1: + clk_put(phy->clk_pll1); + err_put_clk_pll0: diff --git a/queue-4.19/drm-sun4i-fix-sun8i-hdmi-phy-configuration-for-148.5-mhz.patch b/queue-4.19/drm-sun4i-fix-sun8i-hdmi-phy-configuration-for-148.5-mhz.patch new file mode 100644 index 0000000000..3c73495567 --- /dev/null +++ b/queue-4.19/drm-sun4i-fix-sun8i-hdmi-phy-configuration-for-148.5-mhz.patch @@ -0,0 +1,37 @@ +From 831adffb3b7b8df4c8e20b7b00843129fb87a166 Mon Sep 17 00:00:00 2001 +From: Jernej Skrabec +Date: Tue, 14 May 2019 22:43:37 +0200 +Subject: drm/sun4i: Fix sun8i HDMI PHY configuration for > 148.5 MHz + +From: Jernej Skrabec + +commit 831adffb3b7b8df4c8e20b7b00843129fb87a166 upstream. + +Vendor provided documentation says that EMP bits should be set to 3 for +pixel clocks greater than 148.5 MHz. + +Fix that. + +Cc: stable@vger.kernel.org # 4.17+ +Fixes: 4f86e81748fe ("drm/sun4i: Add support for H3 HDMI PHY variant") +Signed-off-by: Jernej Skrabec +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20190514204337.11068-3-jernej.skrabec@siol.net +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c ++++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +@@ -177,7 +177,8 @@ static int sun8i_hdmi_phy_config_h3(stru + SUN8I_HDMI_PHY_ANA_CFG2_REG_BIGSW | + SUN8I_HDMI_PHY_ANA_CFG2_REG_SLV(4); + ana_cfg3_init |= SUN8I_HDMI_PHY_ANA_CFG3_REG_AMPCK(9) | +- SUN8I_HDMI_PHY_ANA_CFG3_REG_AMP(13); ++ SUN8I_HDMI_PHY_ANA_CFG3_REG_AMP(13) | ++ SUN8I_HDMI_PHY_ANA_CFG3_REG_EMP(3); + } + + regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, diff --git a/queue-4.19/drm-tegra-gem-fix-cpu-cache-maintenance-for-bo-s-allocated-using-get_pages.patch b/queue-4.19/drm-tegra-gem-fix-cpu-cache-maintenance-for-bo-s-allocated-using-get_pages.patch new file mode 100644 index 0000000000..d5fd331c9c --- /dev/null +++ b/queue-4.19/drm-tegra-gem-fix-cpu-cache-maintenance-for-bo-s-allocated-using-get_pages.patch @@ -0,0 +1,51 @@ +From 61b51fb51c01a519a249d28ec55c6513a13be5a3 Mon Sep 17 00:00:00 2001 +From: Dmitry Osipenko +Date: Thu, 7 Mar 2019 01:55:19 +0300 +Subject: drm/tegra: gem: Fix CPU-cache maintenance for BO's allocated using get_pages() + +From: Dmitry Osipenko + +commit 61b51fb51c01a519a249d28ec55c6513a13be5a3 upstream. + +The allocated pages need to be invalidated in CPU caches. On ARM32 the +DMA_BIDIRECTIONAL flag only ensures that data is written-back to DRAM and +the data stays in CPU cache lines. While the DMA_FROM_DEVICE flag ensures +that the corresponding CPU cache lines are getting invalidated and nothing +more, that's exactly what is needed for a newly allocated pages. + +This fixes randomly failing rendercheck tests on Tegra30 using the +Opentegra driver for tests that use small-sized pixmaps (10x10 and less, +i.e. 1-2 memory pages) because apparently CPU reads out stale data from +caches and/or that data is getting evicted to DRAM at the time of HW job +execution. + +Fixes: bd43c9f0fa1f ("drm/tegra: gem: Map pages via the DMA API") +Cc: stable +Signed-off-by: Dmitry Osipenko +Signed-off-by: Thierry Reding +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/tegra/gem.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/tegra/gem.c ++++ b/drivers/gpu/drm/tegra/gem.c +@@ -204,7 +204,7 @@ static void tegra_bo_free(struct drm_dev + { + if (bo->pages) { + dma_unmap_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents, +- DMA_BIDIRECTIONAL); ++ DMA_FROM_DEVICE); + drm_gem_put_pages(&bo->gem, bo->pages, true, true); + sg_free_table(bo->sgt); + kfree(bo->sgt); +@@ -230,7 +230,7 @@ static int tegra_bo_get_pages(struct drm + } + + err = dma_map_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents, +- DMA_BIDIRECTIONAL); ++ DMA_FROM_DEVICE); + if (err == 0) { + err = -EFAULT; + goto free_sgt; diff --git a/queue-4.19/drm-vmwgfx-don-t-send-drm-sysfs-hotplug-events-on-initial-master-set.patch b/queue-4.19/drm-vmwgfx-don-t-send-drm-sysfs-hotplug-events-on-initial-master-set.patch new file mode 100644 index 0000000000..cc0687af94 --- /dev/null +++ b/queue-4.19/drm-vmwgfx-don-t-send-drm-sysfs-hotplug-events-on-initial-master-set.patch @@ -0,0 +1,40 @@ +From 63cb44441826e842b7285575b96db631cc9f2505 Mon Sep 17 00:00:00 2001 +From: Thomas Hellstrom +Date: Tue, 7 May 2019 11:07:53 +0200 +Subject: drm/vmwgfx: Don't send drm sysfs hotplug events on initial master set + +From: Thomas Hellstrom + +commit 63cb44441826e842b7285575b96db631cc9f2505 upstream. + +This may confuse user-space clients like plymouth that opens a drm +file descriptor as a result of a hotplug event and then generates a +new event... + +Cc: +Fixes: 5ea1734827bb ("drm/vmwgfx: Send a hotplug event at master_set") +Signed-off-by: Thomas Hellstrom +Reviewed-by: Deepak Rawat +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +@@ -1291,7 +1291,13 @@ static int vmw_master_set(struct drm_dev + } + + dev_priv->active_master = vmaster; +- drm_sysfs_hotplug_event(dev); ++ ++ /* ++ * Inform a new master that the layout may have changed while ++ * it was gone. ++ */ ++ if (!from_open) ++ drm_sysfs_hotplug_event(dev); + + return 0; + } diff --git a/queue-4.19/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch b/queue-4.19/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch new file mode 100644 index 0000000000..ab482fad0c --- /dev/null +++ b/queue-4.19/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch @@ -0,0 +1,86 @@ +From 4e78921ba4dd0aca1cc89168f45039add4183f8e Mon Sep 17 00:00:00 2001 +From: Gen Zhang +Date: Sat, 25 May 2019 13:25:58 +0200 +Subject: efi/x86/Add missing error handling to old_memmap 1:1 mapping code + +From: Gen Zhang + +commit 4e78921ba4dd0aca1cc89168f45039add4183f8e upstream. + +The old_memmap flow in efi_call_phys_prolog() performs numerous memory +allocations, and either does not check for failure at all, or it does +but fails to propagate it back to the caller, which may end up calling +into the firmware with an incomplete 1:1 mapping. + +So let's fix this by returning NULL from efi_call_phys_prolog() on +memory allocation failures only, and by handling this condition in the +caller. Also, clean up any half baked sets of page tables that we may +have created before returning with a NULL return value. + +Note that any failure at this level will trigger a panic() two levels +up, so none of this makes a huge difference, but it is a nice cleanup +nonetheless. + +[ardb: update commit log, add efi_call_phys_epilog() call on error path] + +Signed-off-by: Gen Zhang +Signed-off-by: Ard Biesheuvel +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Rob Bradford +Cc: Thomas Gleixner +Cc: linux-efi@vger.kernel.org +Link: http://lkml.kernel.org/r/20190525112559.7917-2-ard.biesheuvel@linaro.org +Signed-off-by: Ingo Molnar +Cc: Zubin Mithra +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/platform/efi/efi.c | 2 ++ + arch/x86/platform/efi/efi_64.c | 9 ++++++--- + 2 files changed, 8 insertions(+), 3 deletions(-) + +--- a/arch/x86/platform/efi/efi.c ++++ b/arch/x86/platform/efi/efi.c +@@ -86,6 +86,8 @@ static efi_status_t __init phys_efi_set_ + pgd_t *save_pgd; + + save_pgd = efi_call_phys_prolog(); ++ if (!save_pgd) ++ return EFI_ABORTED; + + /* Disable interrupts around EFI calls: */ + local_irq_save(flags); +--- a/arch/x86/platform/efi/efi_64.c ++++ b/arch/x86/platform/efi/efi_64.c +@@ -84,13 +84,15 @@ pgd_t * __init efi_call_phys_prolog(void + + if (!efi_enabled(EFI_OLD_MEMMAP)) { + efi_switch_mm(&efi_mm); +- return NULL; ++ return efi_mm.pgd; + } + + early_code_mapping_set_exec(1); + + n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); + save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL); ++ if (!save_pgd) ++ return NULL; + + /* + * Build 1:1 identity mapping for efi=old_map usage. Note that +@@ -138,10 +140,11 @@ pgd_t * __init efi_call_phys_prolog(void + pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; + } + +-out: + __flush_tlb_all(); +- + return save_pgd; ++out: ++ efi_call_phys_epilog(save_pgd); ++ return NULL; + } + + void __init efi_call_phys_epilog(pgd_t *save_pgd) diff --git a/queue-4.19/series b/queue-4.19/series index e73f1ece4c..1313b28805 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -53,3 +53,10 @@ cifs-fix-memory-leak-of-pneg_inbuf-on-eopnotsupp-ioctl-case.patch cifs-cifs_read_allocate_pages-don-t-iterate-through-whole-page-array-on-enomem.patch revert-lockd-show-pid-of-lockd-for-remote-locks.patch gcc-plugins-fix-build-failures-under-darwin-host.patch +efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch +drm-tegra-gem-fix-cpu-cache-maintenance-for-bo-s-allocated-using-get_pages.patch +drm-vmwgfx-don-t-send-drm-sysfs-hotplug-events-on-initial-master-set.patch +drm-sun4i-fix-sun8i-hdmi-phy-clock-initialization.patch +drm-sun4i-fix-sun8i-hdmi-phy-configuration-for-148.5-mhz.patch +drm-rockchip-shutdown-drm-subsystem-on-shutdown.patch +drm-lease-make-sure-implicit-planes-are-leased.patch