From f3c347e9c081e7592dc7051b8f23ed45b77b7802 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 13 Feb 2023 15:42:58 +0100 Subject: [PATCH] 5.15-stable patches added patches: drm-amdgpu-fence-fix-oops-due-to-non-matching-drm_sched-init-fini.patch drm-i915-fix-vbt-dsi-dvo-port-handling.patch drm-i915-initialize-the-obj-flags-for-shmem-objects.patch --- ...-to-non-matching-drm_sched-init-fini.patch | 80 +++++++++++++++++ ...m-i915-fix-vbt-dsi-dvo-port-handling.patch | 89 +++++++++++++++++++ ...lize-the-obj-flags-for-shmem-objects.patch | 42 +++++++++ queue-5.15/series | 3 + 4 files changed, 214 insertions(+) create mode 100644 queue-5.15/drm-amdgpu-fence-fix-oops-due-to-non-matching-drm_sched-init-fini.patch create mode 100644 queue-5.15/drm-i915-fix-vbt-dsi-dvo-port-handling.patch create mode 100644 queue-5.15/drm-i915-initialize-the-obj-flags-for-shmem-objects.patch diff --git a/queue-5.15/drm-amdgpu-fence-fix-oops-due-to-non-matching-drm_sched-init-fini.patch b/queue-5.15/drm-amdgpu-fence-fix-oops-due-to-non-matching-drm_sched-init-fini.patch new file mode 100644 index 00000000000..a2ad9df29d2 --- /dev/null +++ b/queue-5.15/drm-amdgpu-fence-fix-oops-due-to-non-matching-drm_sched-init-fini.patch @@ -0,0 +1,80 @@ +From 5ad7bbf3dba5c4a684338df1f285080f2588b535 Mon Sep 17 00:00:00 2001 +From: "Guilherme G. Piccoli" +Date: Thu, 2 Feb 2023 10:48:56 -0300 +Subject: drm/amdgpu/fence: Fix oops due to non-matching drm_sched init/fini +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Guilherme G. Piccoli + +commit 5ad7bbf3dba5c4a684338df1f285080f2588b535 upstream. + +Currently amdgpu calls drm_sched_fini() from the fence driver sw fini +routine - such function is expected to be called only after the +respective init function - drm_sched_init() - was executed successfully. + +Happens that we faced a driver probe failure in the Steam Deck +recently, and the function drm_sched_fini() was called even without +its counter-part had been previously called, causing the following oops: + +amdgpu: probe of 0000:04:00.0 failed with error -110 +BUG: kernel NULL pointer dereference, address: 0000000000000090 +PGD 0 P4D 0 +Oops: 0002 [#1] PREEMPT SMP NOPTI +CPU: 0 PID: 609 Comm: systemd-udevd Not tainted 6.2.0-rc3-gpiccoli #338 +Hardware name: Valve Jupiter/Jupiter, BIOS F7A0113 11/04/2022 +RIP: 0010:drm_sched_fini+0x84/0xa0 [gpu_sched] +[...] +Call Trace: + + amdgpu_fence_driver_sw_fini+0xc8/0xd0 [amdgpu] + amdgpu_device_fini_sw+0x2b/0x3b0 [amdgpu] + amdgpu_driver_release_kms+0x16/0x30 [amdgpu] + devm_drm_dev_init_release+0x49/0x70 + [...] + +To prevent that, check if the drm_sched was properly initialized for a +given ring before calling its fini counter-part. + +Notice ideally we'd use sched.ready for that; such field is set as the latest +thing on drm_sched_init(). But amdgpu seems to "override" the meaning of such +field - in the above oops for example, it was a GFX ring causing the crash, and +the sched.ready field was set to true in the ring init routine, regardless of +the state of the DRM scheduler. Hence, we ended-up using sched.ops as per +Christian's suggestion [0], and also removed the no_scheduler check [1]. + +[0] https://lore.kernel.org/amd-gfx/984ee981-2906-0eaf-ccec-9f80975cb136@amd.com/ +[1] https://lore.kernel.org/amd-gfx/cd0e2994-f85f-d837-609f-7056d5fb7231@amd.com/ + +Fixes: 067f44c8b459 ("drm/amdgpu: avoid over-handle of fence driver fini in s3 test (v2)") +Suggested-by: Christian König +Cc: Guchun Chen +Cc: Luben Tuikov +Cc: Mario Limonciello +Reviewed-by: Luben Tuikov +Signed-off-by: Guilherme G. Piccoli +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +@@ -579,7 +579,13 @@ void amdgpu_fence_driver_sw_fini(struct + if (!ring || !ring->fence_drv.initialized) + continue; + +- if (!ring->no_scheduler) ++ /* ++ * Notice we check for sched.ops since there's some ++ * override on the meaning of sched.ready by amdgpu. ++ * The natural check would be sched.ready, which is ++ * set as drm_sched_init() finishes... ++ */ ++ if (ring->sched.ops) + drm_sched_fini(&ring->sched); + + for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) diff --git a/queue-5.15/drm-i915-fix-vbt-dsi-dvo-port-handling.patch b/queue-5.15/drm-i915-fix-vbt-dsi-dvo-port-handling.patch new file mode 100644 index 00000000000..5a28715b2bf --- /dev/null +++ b/queue-5.15/drm-i915-fix-vbt-dsi-dvo-port-handling.patch @@ -0,0 +1,89 @@ +From 6a7ff131f17f44c593173c5ee30e2c03ef211685 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Tue, 7 Feb 2023 08:43:35 +0200 +Subject: drm/i915: Fix VBT DSI DVO port handling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit 6a7ff131f17f44c593173c5ee30e2c03ef211685 upstream. + +Turns out modern (icl+) VBTs still declare their DSI ports +as MIPI-A and MIPI-C despite the PHYs now being A and B. +Remap appropriately to allow the panels declared as MIPI-C +to work. + +Cc: stable@vger.kernel.org +Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8016 +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20230207064337.18697-2-ville.syrjala@linux.intel.com +Reviewed-by: Jani Nikula +(cherry picked from commit 118b5c136c04da705b274b0d39982bb8b7430fc5) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/display/intel_bios.c | 33 ++++++++++++++++++++---------- + 1 file changed, 23 insertions(+), 10 deletions(-) + +--- a/drivers/gpu/drm/i915/display/intel_bios.c ++++ b/drivers/gpu/drm/i915/display/intel_bios.c +@@ -1820,6 +1820,22 @@ static enum port dvo_port_to_port(struct + dvo_port); + } + ++static enum port ++dsi_dvo_port_to_port(struct drm_i915_private *i915, u8 dvo_port) ++{ ++ switch (dvo_port) { ++ case DVO_PORT_MIPIA: ++ return PORT_A; ++ case DVO_PORT_MIPIC: ++ if (DISPLAY_VER(i915) >= 11) ++ return PORT_B; ++ else ++ return PORT_C; ++ default: ++ return PORT_NONE; ++ } ++} ++ + static int parse_bdb_230_dp_max_link_rate(const int vbt_max_link_rate) + { + switch (vbt_max_link_rate) { +@@ -2733,19 +2749,16 @@ bool intel_bios_is_dsi_present(struct dr + + dvo_port = child->dvo_port; + +- if (dvo_port == DVO_PORT_MIPIA || +- (dvo_port == DVO_PORT_MIPIB && DISPLAY_VER(i915) >= 11) || +- (dvo_port == DVO_PORT_MIPIC && DISPLAY_VER(i915) < 11)) { +- if (port) +- *port = dvo_port - DVO_PORT_MIPIA; +- return true; +- } else if (dvo_port == DVO_PORT_MIPIB || +- dvo_port == DVO_PORT_MIPIC || +- dvo_port == DVO_PORT_MIPID) { ++ if (dsi_dvo_port_to_port(i915, dvo_port) == PORT_NONE) { + drm_dbg_kms(&i915->drm, + "VBT has unsupported DSI port %c\n", + port_name(dvo_port - DVO_PORT_MIPIA)); ++ continue; + } ++ ++ if (port) ++ *port = dsi_dvo_port_to_port(i915, dvo_port); ++ return true; + } + + return false; +@@ -2830,7 +2843,7 @@ bool intel_bios_get_dsc_params(struct in + if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT)) + continue; + +- if (child->dvo_port - DVO_PORT_MIPIA == encoder->port) { ++ if (dsi_dvo_port_to_port(i915, child->dvo_port) == encoder->port) { + if (!devdata->dsc) + return false; + diff --git a/queue-5.15/drm-i915-initialize-the-obj-flags-for-shmem-objects.patch b/queue-5.15/drm-i915-initialize-the-obj-flags-for-shmem-objects.patch new file mode 100644 index 00000000000..50a7509fcf1 --- /dev/null +++ b/queue-5.15/drm-i915-initialize-the-obj-flags-for-shmem-objects.patch @@ -0,0 +1,42 @@ +From 44e4c5684fcc82d8f099656c4ea39d9571e2a8ac Mon Sep 17 00:00:00 2001 +From: Aravind Iddamsetty +Date: Fri, 3 Feb 2023 19:22:05 +0530 +Subject: drm/i915: Initialize the obj flags for shmem objects + +From: Aravind Iddamsetty + +commit 44e4c5684fcc82d8f099656c4ea39d9571e2a8ac upstream. + +Obj flags for shmem objects is not being set correctly. Fixes in setting +BO_ALLOC_USER flag which applies to shmem objs as well. + +v2: Add fixes tag (Tvrtko, Matt A) + +Fixes: 13d29c823738 ("drm/i915/ehl: unconditionally flush the pages on acquire") +Cc: # v5.15+ +Cc: Matthew Auld +Cc: Tvrtko Ursulin +Reviewed-by: Matthew Auld +Signed-off-by: Aravind Iddamsetty +Reviewed-by: Andrzej Hajda +Signed-off-by: Tvrtko Ursulin +[tursulin: Grouped all tags together.] +Link: https://patchwork.freedesktop.org/patch/msgid/20230203135205.4051149-1-aravind.iddamsetty@intel.com +(cherry picked from commit bca0d1d3ceeb07be45a51c0fa4d57a0ce31b6aed) +Signed-off-by: Rodrigo Vivi +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +@@ -533,7 +533,7 @@ static int shmem_object_init(struct inte + mapping_set_gfp_mask(mapping, mask); + GEM_BUG_ON(!(mapping_gfp_mask(mapping) & __GFP_RECLAIM)); + +- i915_gem_object_init(obj, &i915_gem_shmem_ops, &lock_class, 0); ++ i915_gem_object_init(obj, &i915_gem_shmem_ops, &lock_class, flags); + obj->mem_flags |= I915_BO_FLAG_STRUCT_PAGE; + obj->write_domain = I915_GEM_DOMAIN_CPU; + obj->read_domains = I915_GEM_DOMAIN_CPU; diff --git a/queue-5.15/series b/queue-5.15/series index 81d87f11016..59b18a2f3db 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -61,3 +61,6 @@ arm64-dts-meson-gx-make-mmc-host-controller-interrupts-level-sensitive.patch arm64-dts-meson-g12-common-make-mmc-host-controller-interrupts-level-sensitive.patch arm64-dts-meson-axg-make-mmc-host-controller-interrupts-level-sensitive.patch fix-page-corruption-caused-by-racy-check-in-__free_pages.patch +drm-amdgpu-fence-fix-oops-due-to-non-matching-drm_sched-init-fini.patch +drm-i915-initialize-the-obj-flags-for-shmem-objects.patch +drm-i915-fix-vbt-dsi-dvo-port-handling.patch -- 2.47.2