]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/i915/dpt: Treat the DPT BO as a framebuffer
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 20 Mar 2023 09:05:17 +0000 (11:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2023 10:12:46 +0000 (12:12 +0200)
commit 3413881e1ecc3cba722a2e87ec099692eed5be28 upstream.

Currently i915_gem_object_is_framebuffer() doesn't treat the
BO containing the framebuffer's DPT as a framebuffer itself.
This means eg. that the shrinker can evict the DPT BO while
leaving the actual FB BO bound, when the DPT is allocated
from regular shmem.

That causes an immediate oops during hibernate as we
try to rewrite the PTEs inside the already evicted
DPT obj.

TODO: presumably this might also be the reason for the
DPT related display faults under heavy memory pressure,
but I'm still not sure how that would happen as the object
should be pinned by intel_dpt_pin() while in active use by
the display engine...

Cc: stable@vger.kernel.org
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Fixes: 0dc987b699ce ("drm/i915/display: Add smem fallback allocation for dpt")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230320090522.9909-2-ville.syrjala@linux.intel.com
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
(cherry picked from commit 779cb5ba64ec7df80675a956c9022929514f517a)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/display/intel_dpt.c
drivers/gpu/drm/i915/gem/i915_gem_object.h
drivers/gpu/drm/i915/gem/i915_gem_object_types.h

index ad1a37b515fb1c8991d1832bd99a2d301bc15c20..2a9f40a2b3ed0b75e9d95e087f7532f2f05f99c0 100644 (file)
@@ -301,6 +301,7 @@ intel_dpt_create(struct intel_framebuffer *fb)
        vm->pte_encode = gen8_ggtt_pte_encode;
 
        dpt->obj = dpt_obj;
+       dpt->obj->is_dpt = true;
 
        return &dpt->vm;
 }
@@ -309,5 +310,6 @@ void intel_dpt_destroy(struct i915_address_space *vm)
 {
        struct i915_dpt *dpt = i915_vm_to_dpt(vm);
 
+       dpt->obj->is_dpt = false;
        i915_vm_put(&dpt->vm);
 }
index 3db53769864c243ecc3a00af63b4eaf7b51e4aea..2f53a6834821734b7a903b706eeff02ea6e073e7 100644 (file)
@@ -319,7 +319,7 @@ i915_gem_object_never_mmap(const struct drm_i915_gem_object *obj)
 static inline bool
 i915_gem_object_is_framebuffer(const struct drm_i915_gem_object *obj)
 {
-       return READ_ONCE(obj->frontbuffer);
+       return READ_ONCE(obj->frontbuffer) || obj->is_dpt;
 }
 
 static inline unsigned int
index ab4c2f90a56436c9dd8e8aa14a6b1c14867df0cf..1d0d8ee9d707d969d020c7e81463534be54fbae3 100644 (file)
@@ -491,6 +491,9 @@ struct drm_i915_gem_object {
         */
        unsigned int cache_dirty:1;
 
+       /* @is_dpt: Object houses a display page table (DPT) */
+       unsigned int is_dpt:1;
+
        /**
         * @read_domains: Read memory domains.
         *