drm/i915: Fix region start during initial plane readout
authorjsg <jsg@openbsd.org>
Tue, 13 Aug 2024 00:12:42 +0000 (00:12 +0000)
committerjsg <jsg@openbsd.org>
Tue, 13 Aug 2024 00:12:42 +0000 (00:12 +0000)
From Ville Syrjala
d74f3a930c1d075a876a22b44723556455526881 in mainline linux

sys/dev/pci/drm/i915/display/intel_plane_initial.c

index 41a5936..f14338b 100644 (file)
@@ -78,16 +78,18 @@ initial_plane_vma(struct drm_i915_private *i915,
                 * We don't currently expect this to ever be placed in the
                 * stolen portion.
                 */
-               if (phys_base >= resource_size(&mem->region)) {
+               if (phys_base < mem->region.start || phys_base > mem->region.end) {
                        drm_err(&i915->drm,
-                               "Initial plane programming using invalid range, phys_base=%pa\n",
-                               &phys_base);
+                               "Initial plane programming using invalid range, phys_base=%pa (%s [%pa-%pa])\n",
+                               &phys_base, mem->region.name, &mem->region.start, &mem->region.end);
                        return NULL;
                }
 
                drm_dbg(&i915->drm,
                        "Using phys_base=%pa, based on initial plane programming\n",
                        &phys_base);
+
+               phys_base -= mem->region.start;
        } else {
                phys_base = base;
                mem = i915->mm.stolen_region;