--- /dev/null
+From 5ad7bbf3dba5c4a684338df1f285080f2588b535 Mon Sep 17 00:00:00 2001
+From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
+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 <gpiccoli@igalia.com>
+
+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:
+ <TASK>
+ 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 <christian.koenig@amd.com>
+Cc: Guchun Chen <guchun.chen@amd.com>
+Cc: Luben Tuikov <luben.tuikov@amd.com>
+Cc: Mario Limonciello <mario.limonciello@amd.com>
+Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>
+Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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)
--- /dev/null
+From 6a7ff131f17f44c593173c5ee30e2c03ef211685 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>
+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ä <ville.syrjala@linux.intel.com>
+
+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ä <ville.syrjala@linux.intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20230207064337.18697-2-ville.syrjala@linux.intel.com
+Reviewed-by: Jani Nikula <jani.nikula@intel.com>
+(cherry picked from commit 118b5c136c04da705b274b0d39982bb8b7430fc5)
+Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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;
+
--- /dev/null
+From 44e4c5684fcc82d8f099656c4ea39d9571e2a8ac Mon Sep 17 00:00:00 2001
+From: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
+Date: Fri, 3 Feb 2023 19:22:05 +0530
+Subject: drm/i915: Initialize the obj flags for shmem objects
+
+From: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
+
+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: <stable@vger.kernel.org> # v5.15+
+Cc: Matthew Auld <matthew.auld@intel.com>
+Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
+Reviewed-by: Matthew Auld <matthew.auld@intel.com>
+Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
+Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
+Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
+[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 <rodrigo.vivi@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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;
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