From: Greg Kroah-Hartman Date: Fri, 12 Mar 2021 14:03:44 +0000 (+0100) Subject: 5.11-stable patches X-Git-Tag: v4.4.262~83 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c17807ac3676bca7d65baa48460a98212681e5d8;p=thirdparty%2Fkernel%2Fstable-queue.git 5.11-stable patches added patches: drm-i915-wedge-the-gpu-if-command-parser-setup-fails.patch drm-meson_drv-add-shutdown-function.patch drm-shmem-helpers-vunmap-don-t-put-pages-for-dma-buf.patch qxl-fix-uninitialised-struct-field-head.surface_id.patch s390-cio-return-efault-if-copy_to_user-fails-take-2.patch s390-crypto-return-efault-if-copy_to_user-fails.patch --- diff --git a/queue-5.11/drm-i915-wedge-the-gpu-if-command-parser-setup-fails.patch b/queue-5.11/drm-i915-wedge-the-gpu-if-command-parser-setup-fails.patch new file mode 100644 index 00000000000..3285ab4a1b4 --- /dev/null +++ b/queue-5.11/drm-i915-wedge-the-gpu-if-command-parser-setup-fails.patch @@ -0,0 +1,138 @@ +From a829f033e966d5e4aa27c3ef2b381f51734e4a7f Mon Sep 17 00:00:00 2001 +From: Tvrtko Ursulin +Date: Tue, 2 Mar 2021 11:42:13 +0000 +Subject: drm/i915: Wedge the GPU if command parser setup fails + +From: Tvrtko Ursulin + +commit a829f033e966d5e4aa27c3ef2b381f51734e4a7f upstream. + +Commit 311a50e76a33 ("drm/i915: Add support for mandatory cmdparsing") +introduced mandatory command parsing but setup failures were not +translated into wedging the GPU which was probably the intent. + +Possible errors come in two categories. Either the sanity check on +internal tables has failed, which should be caught in CI unless an +affected platform would be missed in testing; or memory allocation failure +happened during driver load, which should be extremely unlikely but for +correctness should still be handled. + +v2: + * Tidy coding style. (Chris) + +[airlied: cherry-picked to avoid rc1 base] +Signed-off-by: Tvrtko Ursulin +Fixes: 311a50e76a33 ("drm/i915: Add support for mandatory cmdparsing") +Cc: Jon Bloomfield +Cc: Joonas Lahtinen +Cc: Chris Wilson +Reviewed-by: Chris Wilson +Link: https://patchwork.freedesktop.org/patch/msgid/20210302114213.1102223-1-tvrtko.ursulin@linux.intel.com +(cherry picked from commit 5a1a659762d35a6dc51047c9127c011303c77b7f) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Dave Airlie +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 ++++++- + drivers/gpu/drm/i915/i915_cmd_parser.c | 19 +++++++++++++------ + drivers/gpu/drm/i915/i915_drv.h | 2 +- + 3 files changed, 20 insertions(+), 8 deletions(-) + +--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c ++++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c +@@ -709,9 +709,12 @@ static int engine_setup_common(struct in + goto err_status; + } + ++ err = intel_engine_init_cmd_parser(engine); ++ if (err) ++ goto err_cmd_parser; ++ + intel_engine_init_active(engine, ENGINE_PHYSICAL); + intel_engine_init_execlists(engine); +- intel_engine_init_cmd_parser(engine); + intel_engine_init__pm(engine); + intel_engine_init_retire(engine); + +@@ -725,6 +728,8 @@ static int engine_setup_common(struct in + + return 0; + ++err_cmd_parser: ++ intel_breadcrumbs_free(engine->breadcrumbs); + err_status: + cleanup_status_page(engine); + return err; +--- a/drivers/gpu/drm/i915/i915_cmd_parser.c ++++ b/drivers/gpu/drm/i915/i915_cmd_parser.c +@@ -939,7 +939,7 @@ static void fini_hash_table(struct intel + * struct intel_engine_cs based on whether the platform requires software + * command parsing. + */ +-void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) ++int intel_engine_init_cmd_parser(struct intel_engine_cs *engine) + { + const struct drm_i915_cmd_table *cmd_tables; + int cmd_table_count; +@@ -947,7 +947,7 @@ void intel_engine_init_cmd_parser(struct + + if (!IS_GEN(engine->i915, 7) && !(IS_GEN(engine->i915, 9) && + engine->class == COPY_ENGINE_CLASS)) +- return; ++ return 0; + + switch (engine->class) { + case RENDER_CLASS: +@@ -1012,19 +1012,19 @@ void intel_engine_init_cmd_parser(struct + break; + default: + MISSING_CASE(engine->class); +- return; ++ goto out; + } + + if (!validate_cmds_sorted(engine, cmd_tables, cmd_table_count)) { + drm_err(&engine->i915->drm, + "%s: command descriptions are not sorted\n", + engine->name); +- return; ++ goto out; + } + if (!validate_regs_sorted(engine)) { + drm_err(&engine->i915->drm, + "%s: registers are not sorted\n", engine->name); +- return; ++ goto out; + } + + ret = init_hash_table(engine, cmd_tables, cmd_table_count); +@@ -1032,10 +1032,17 @@ void intel_engine_init_cmd_parser(struct + drm_err(&engine->i915->drm, + "%s: initialised failed!\n", engine->name); + fini_hash_table(engine); +- return; ++ goto out; + } + + engine->flags |= I915_ENGINE_USING_CMD_PARSER; ++ ++out: ++ if (intel_engine_requires_cmd_parser(engine) && ++ !intel_engine_using_cmd_parser(engine)) ++ return -EINVAL; ++ ++ return 0; + } + + /** +--- a/drivers/gpu/drm/i915/i915_drv.h ++++ b/drivers/gpu/drm/i915/i915_drv.h +@@ -1947,7 +1947,7 @@ const char *i915_cache_level_str(struct + + /* i915_cmd_parser.c */ + int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv); +-void intel_engine_init_cmd_parser(struct intel_engine_cs *engine); ++int intel_engine_init_cmd_parser(struct intel_engine_cs *engine); + void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine); + int intel_engine_cmd_parser(struct intel_engine_cs *engine, + struct i915_vma *batch, diff --git a/queue-5.11/drm-meson_drv-add-shutdown-function.patch b/queue-5.11/drm-meson_drv-add-shutdown-function.patch new file mode 100644 index 00000000000..29b4e7faa70 --- /dev/null +++ b/queue-5.11/drm-meson_drv-add-shutdown-function.patch @@ -0,0 +1,73 @@ +From fa0c16caf3d73ab4d2e5d6fa2ef2394dbec91791 Mon Sep 17 00:00:00 2001 +From: Artem Lapkin +Date: Tue, 2 Mar 2021 12:22:02 +0800 +Subject: drm: meson_drv add shutdown function + +From: Artem Lapkin + +commit fa0c16caf3d73ab4d2e5d6fa2ef2394dbec91791 upstream. + +Problem: random stucks on reboot stage about 1/20 stuck/reboots +// debug kernel log +[ 4.496660] reboot: kernel restart prepare CMD:(null) +[ 4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin +[ 4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU... +...STUCK... + +Solution: add shutdown function to meson_drm driver +// debug kernel log +[ 5.231896] reboot: kernel restart prepare CMD:(null) +[ 5.246135] [drm:meson_drv_shutdown] +... +[ 5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin +[ 5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU... +[ 5.338331] reboot: Restarting system +[ 5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null) +bl31 reboot reason: 0xd +bl31 reboot reason: 0x0 +system cmd 1. +...REBOOT... + +Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots +and Odroid boards, WeTek Play2 (GXBB) + +Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller") +Signed-off-by: Artem Lapkin +Tested-by: Christian Hewitt +Acked-by: Neil Armstrong +Acked-by: Kevin Hilman +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20210302042202.3728113-1-art@khadas.com +Signed-off-by: Maarten Lankhorst +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/gpu/drm/meson/meson_drv.c ++++ b/drivers/gpu/drm/meson/meson_drv.c +@@ -482,6 +482,16 @@ static int meson_probe_remote(struct pla + return count; + } + ++static void meson_drv_shutdown(struct platform_device *pdev) ++{ ++ struct meson_drm *priv = dev_get_drvdata(&pdev->dev); ++ struct drm_device *drm = priv->drm; ++ ++ DRM_DEBUG_DRIVER("\n"); ++ drm_kms_helper_poll_fini(drm); ++ drm_atomic_helper_shutdown(drm); ++} ++ + static int meson_drv_probe(struct platform_device *pdev) + { + struct component_match *match = NULL; +@@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv + + static struct platform_driver meson_drm_platform_driver = { + .probe = meson_drv_probe, ++ .shutdown = meson_drv_shutdown, + .driver = { + .name = "meson-drm", + .of_match_table = dt_match, diff --git a/queue-5.11/drm-shmem-helpers-vunmap-don-t-put-pages-for-dma-buf.patch b/queue-5.11/drm-shmem-helpers-vunmap-don-t-put-pages-for-dma-buf.patch new file mode 100644 index 00000000000..95bf9e0cbd4 --- /dev/null +++ b/queue-5.11/drm-shmem-helpers-vunmap-don-t-put-pages-for-dma-buf.patch @@ -0,0 +1,54 @@ +From 64e194e278673bceb68fb2dde7dbc3d812bfceb3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 19 Feb 2021 13:22:03 +0100 +Subject: drm/shmem-helpers: vunmap: Don't put pages for dma-buf +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Noralf Trønnes + +commit 64e194e278673bceb68fb2dde7dbc3d812bfceb3 upstream. + +dma-buf importing was reworked in commit 7d2cd72a9aa3 +("drm/shmem-helpers: Simplify dma-buf importing"). Before that commit +drm_gem_shmem_prime_import_sg_table() did set ->pages_use_count=1 and +drm_gem_shmem_vunmap_locked() could call drm_gem_shmem_put_pages() +unconditionally. Now without the use count set, put pages is called also +on dma-bufs. Fix this by only putting pages if it's not imported. + +Signed-off-by: Noralf Trønnes +Fixes: 7d2cd72a9aa3 ("drm/shmem-helpers: Simplify dma-buf importing") +Cc: Daniel Vetter +Cc: Thomas Zimmermann +Acked-by: Thomas Zimmermann +Tested-by: Thomas Zimmermann +Link: https://patchwork.freedesktop.org/patch/msgid/20210219122203.51130-1-noralf@tronnes.org +(cherry picked from commit cdea72518a2b38207146e92e1c9e2fac15975679) +Signed-off-by: Thomas Zimmermann +Signed-off-by: Maarten Lankhorst +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/drm_gem_shmem_helper.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/gpu/drm/drm_gem_shmem_helper.c ++++ b/drivers/gpu/drm/drm_gem_shmem_helper.c +@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked( + if (--shmem->vmap_use_count > 0) + return; + +- if (obj->import_attach) ++ if (obj->import_attach) { + dma_buf_vunmap(obj->import_attach->dmabuf, map); +- else ++ } else { + vunmap(shmem->vaddr); ++ drm_gem_shmem_put_pages(shmem); ++ } + + shmem->vaddr = NULL; +- drm_gem_shmem_put_pages(shmem); + } + + /* diff --git a/queue-5.11/qxl-fix-uninitialised-struct-field-head.surface_id.patch b/queue-5.11/qxl-fix-uninitialised-struct-field-head.surface_id.patch new file mode 100644 index 00000000000..08f3ca67cbe --- /dev/null +++ b/queue-5.11/qxl-fix-uninitialised-struct-field-head.surface_id.patch @@ -0,0 +1,35 @@ +From 738acd49eb018feb873e0fac8f9517493f6ce2c7 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Thu, 4 Mar 2021 09:49:28 +0000 +Subject: qxl: Fix uninitialised struct field head.surface_id + +From: Colin Ian King + +commit 738acd49eb018feb873e0fac8f9517493f6ce2c7 upstream. + +The surface_id struct field in head is not being initialized and +static analysis warns that this is being passed through to +dev->monitors_config->heads[i] on an assignment. Clear up this +warning by initializing it to zero. + +Addresses-Coverity: ("Uninitialized scalar variable") +Fixes: a6d3c4d79822 ("qxl: hook monitors_config updates into crtc, not encoder.") +Signed-off-by: Colin Ian King +Link: http://patchwork.freedesktop.org/patch/msgid/20210304094928.2280722-1-colin.king@canonical.com +Signed-off-by: Gerd Hoffmann +Signed-off-by: Maarten Lankhorst +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/qxl/qxl_display.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/gpu/drm/qxl/qxl_display.c ++++ b/drivers/gpu/drm/qxl/qxl_display.c +@@ -328,6 +328,7 @@ static void qxl_crtc_update_monitors_con + + head.id = i; + head.flags = 0; ++ head.surface_id = 0; + oldcount = qdev->monitors_config->count; + if (crtc->state->active) { + struct drm_display_mode *mode = &crtc->mode; diff --git a/queue-5.11/s390-cio-return-efault-if-copy_to_user-fails-take-2.patch b/queue-5.11/s390-cio-return-efault-if-copy_to_user-fails-take-2.patch new file mode 100644 index 00000000000..f3447b231a8 --- /dev/null +++ b/queue-5.11/s390-cio-return-efault-if-copy_to_user-fails-take-2.patch @@ -0,0 +1,28 @@ +From d9c48a948d29bcb22f4fe61a81b718ef6de561a0 Mon Sep 17 00:00:00 2001 +From: Eric Farman +Date: Mon, 1 Mar 2021 19:33:24 +0100 +Subject: s390/cio: return -EFAULT if copy_to_user() fails + +From: Eric Farman + +commit d9c48a948d29bcb22f4fe61a81b718ef6de561a0 upstream. + +Fixes: 120e214e504f ("vfio: ccw: realize VFIO_DEVICE_G(S)ET_IRQ_INFO ioctls") +Signed-off-by: Eric Farman +Signed-off-by: Heiko Carstens +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/cio/vfio_ccw_ops.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/s390/cio/vfio_ccw_ops.c ++++ b/drivers/s390/cio/vfio_ccw_ops.c +@@ -582,7 +582,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struc + if (info.count == -1) + return -EINVAL; + +- return copy_to_user((void __user *)arg, &info, minsz); ++ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; + } + case VFIO_DEVICE_SET_IRQS: + { diff --git a/queue-5.11/s390-crypto-return-efault-if-copy_to_user-fails.patch b/queue-5.11/s390-crypto-return-efault-if-copy_to_user-fails.patch new file mode 100644 index 00000000000..58d66ee0668 --- /dev/null +++ b/queue-5.11/s390-crypto-return-efault-if-copy_to_user-fails.patch @@ -0,0 +1,34 @@ +From 942df4be7ab40195e2a839e9de81951a5862bc5b Mon Sep 17 00:00:00 2001 +From: Wang Qing +Date: Mon, 1 Mar 2021 20:08:21 +0800 +Subject: s390/crypto: return -EFAULT if copy_to_user() fails + +From: Wang Qing + +commit 942df4be7ab40195e2a839e9de81951a5862bc5b upstream. + +The copy_to_user() function returns the number of bytes remaining to be +copied, but we want to return -EFAULT if the copy doesn't complete. + +Fixes: e06670c5fe3b ("s390: vfio-ap: implement VFIO_DEVICE_GET_INFO ioctl") +Signed-off-by: Wang Qing +Reviewed-by: Tony Krowiak +Signed-off-by: Heiko Carstens +Link: https://lore.kernel.org/r/1614600502-16714-1-git-send-email-wangqing@vivo.com +Signed-off-by: Heiko Carstens +Signed-off-by: Greg Kroah-Hartman +--- + drivers/s390/crypto/vfio_ap_ops.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/s390/crypto/vfio_ap_ops.c ++++ b/drivers/s390/crypto/vfio_ap_ops.c +@@ -1286,7 +1286,7 @@ static int vfio_ap_mdev_get_device_info( + info.num_regions = 0; + info.num_irqs = 0; + +- return copy_to_user((void __user *)arg, &info, minsz); ++ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; + } + + static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev, diff --git a/queue-5.11/series b/queue-5.11/series index c37c3d9d1f9..b19ab8b1874 100644 --- a/queue-5.11/series +++ b/queue-5.11/series @@ -107,3 +107,9 @@ drm-shmem-helper-check-for-purged-buffers-in-fault-handler.patch drm-shmem-helper-don-t-remove-the-offset-in-vm_area_struct-pgoff.patch drm-use-usb-controller-s-dma-mask-when-importing-dmabufs.patch drm-amdgpu-fix-s0ix-handling-when-the-config_amd_pmc-m.patch +drm-meson_drv-add-shutdown-function.patch +drm-shmem-helpers-vunmap-don-t-put-pages-for-dma-buf.patch +drm-i915-wedge-the-gpu-if-command-parser-setup-fails.patch +s390-cio-return-efault-if-copy_to_user-fails-take-2.patch +s390-crypto-return-efault-if-copy_to_user-fails.patch +qxl-fix-uninitialised-struct-field-head.surface_id.patch