]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/{i915, xe}/panic: move panic handling to parent interface
authorJani Nikula <jani.nikula@intel.com>
Thu, 11 Dec 2025 17:37:12 +0000 (19:37 +0200)
committerJani Nikula <jani.nikula@intel.com>
Fri, 12 Dec 2025 13:17:58 +0000 (15:17 +0200)
Move the panic handling to the display parent interface, making display
more independent of i915 and xe driver implementations.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/e27eca5424479e8936b786018d0af19a34f839f6.1765474612.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
14 files changed:
drivers/gpu/drm/i915/display/i9xx_plane.c
drivers/gpu/drm/i915/display/intel_fb.c
drivers/gpu/drm/i915/display/intel_panic.h [deleted file]
drivers/gpu/drm/i915/display/intel_parent.c
drivers/gpu/drm/i915/display/intel_parent.h
drivers/gpu/drm/i915/display/intel_plane.c
drivers/gpu/drm/i915/display/skl_universal_plane.c
drivers/gpu/drm/i915/i915_driver.c
drivers/gpu/drm/i915/i915_panic.c
drivers/gpu/drm/i915/i915_panic.h [new file with mode: 0644]
drivers/gpu/drm/xe/display/xe_display.c
drivers/gpu/drm/xe/display/xe_panic.c
drivers/gpu/drm/xe/display/xe_panic.h [new file with mode: 0644]
include/drm/intel/display_parent_interface.h

index 45730ae05591a911bc09ea1aab8c7f5255a557bc..b1fecf1789061aacf963d65285ad4375f342a74d 100644 (file)
@@ -22,7 +22,6 @@
 #include "intel_fb.h"
 #include "intel_fbc.h"
 #include "intel_frontbuffer.h"
-#include "intel_panic.h"
 #include "intel_plane.h"
 #include "intel_sprite.h"
 
index 5b8e02ca2faf666f5701d42f6e2dcceec989d297..b9bd9b6dfe94708008824589d40d1cc66114a0f1 100644 (file)
@@ -20,7 +20,6 @@
 #include "intel_fb.h"
 #include "intel_fb_bo.h"
 #include "intel_frontbuffer.h"
-#include "intel_panic.h"
 #include "intel_parent.h"
 #include "intel_plane.h"
 
@@ -2217,7 +2216,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
        int ret;
        int i;
 
-       intel_fb->panic = intel_panic_alloc();
+       intel_fb->panic = intel_parent_panic_alloc(display);
        if (!intel_fb->panic)
                return -ENOMEM;
 
diff --git a/drivers/gpu/drm/i915/display/intel_panic.h b/drivers/gpu/drm/i915/display/intel_panic.h
deleted file mode 100644 (file)
index afb472e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/* Copyright © 2025 Intel Corporation */
-
-#ifndef __INTEL_PANIC_H__
-#define __INTEL_PANIC_H__
-
-struct drm_scanout_buffer;
-struct intel_panic;
-
-struct intel_panic *intel_panic_alloc(void);
-int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb);
-void intel_panic_finish(struct intel_panic *panic);
-
-#endif /* __INTEL_PANIC_H__ */
index 1d7bee7d2ccda8c213b3c60eb6eb4812fe57423e..d1c2194767e7013fb59e6207fa0bce7eec646f70 100644 (file)
@@ -47,6 +47,21 @@ void intel_parent_hdcp_gsc_context_free(struct intel_display *display,
        display->parent->hdcp->gsc_context_free(gsc_context);
 }
 
+struct intel_panic *intel_parent_panic_alloc(struct intel_display *display)
+{
+       return display->parent->panic->alloc();
+}
+
+int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb)
+{
+       return display->parent->panic->setup(panic, sb);
+}
+
+void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic)
+{
+       display->parent->panic->finish(panic);
+}
+
 bool intel_parent_irq_enabled(struct intel_display *display)
 {
        return display->parent->irq->enabled(display->drm);
index 1bb584d850e5bc485554db7cf8c520a041710079..8cd811d14fb10dfde23e6e722150174fde4ce110 100644 (file)
@@ -7,8 +7,10 @@
 #include <linux/types.h>
 
 struct dma_fence;
+struct drm_scanout_buffer;
 struct intel_display;
 struct intel_hdcp_gsc_context;
+struct intel_panic;
 struct intel_stolen_node;
 
 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
@@ -23,6 +25,10 @@ void intel_parent_hdcp_gsc_context_free(struct intel_display *display,
 bool intel_parent_irq_enabled(struct intel_display *display);
 void intel_parent_irq_synchronize(struct intel_display *display);
 
+struct intel_panic *intel_parent_panic_alloc(struct intel_display *display);
+int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb);
+void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic);
+
 bool intel_parent_rps_available(struct intel_display *display);
 void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence);
 void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive);
index ca9449589161eeaeb3158fb7a41363b302f78455..3dc2ed52147f606b7f28c7401d954a51ad4a61f2 100644 (file)
@@ -55,7 +55,6 @@
 #include "intel_fb.h"
 #include "intel_fb_pin.h"
 #include "intel_fbdev.h"
-#include "intel_panic.h"
 #include "intel_parent.h"
 #include "intel_plane.h"
 #include "intel_psr.h"
@@ -1344,7 +1343,7 @@ static void intel_panic_flush(struct drm_plane *_plane)
        const struct intel_crtc_state *crtc_state = to_intel_crtc_state(crtc->base.state);
        const struct intel_framebuffer *fb = to_intel_framebuffer(plane_state->hw.fb);
 
-       intel_panic_finish(fb->panic);
+       intel_parent_panic_finish(display, fb->panic);
 
        if (crtc_state->enable_psr2_sel_fetch) {
                /* Force a full update for psr2 */
@@ -1425,7 +1424,7 @@ static int intel_get_scanout_buffer(struct drm_plane *plane,
                                return -EOPNOTSUPP;
                }
                sb->private = fb;
-               ret = intel_panic_setup(fb->panic, sb);
+               ret = intel_parent_panic_setup(display, fb->panic, sb);
                if (ret)
                        return ret;
        }
index 40148d225410a852e3c242833a2a62bd1549533a..b3d41705448a28ae7abf7b31775d09db832cb9d6 100644 (file)
@@ -21,7 +21,6 @@
 #include "intel_fb.h"
 #include "intel_fbc.h"
 #include "intel_frontbuffer.h"
-#include "intel_panic.h"
 #include "intel_parent.h"
 #include "intel_plane.h"
 #include "intel_psr.h"
index 0300a1df8bd2afcbb33db1b3cef6caee7ec38313..a341e2d46551116f741d55c81e573323ec6b29e1 100644 (file)
 #include "i915_ioctl.h"
 #include "i915_irq.h"
 #include "i915_memcpy.h"
+#include "i915_panic.h"
 #include "i915_perf.h"
 #include "i915_query.h"
 #include "i915_reg.h"
@@ -768,6 +769,7 @@ static bool has_auxccs(struct drm_device *drm)
 
 static const struct intel_display_parent_interface parent = {
        .hdcp = &i915_display_hdcp_interface,
+       .panic = &i915_display_panic_interface,
        .rpm = &i915_display_rpm_interface,
        .irq = &i915_display_irq_interface,
        .rps = &i915_display_rps_interface,
index 028ff83b251940b472ef3bda4e7db6f1fea50d5e..728be077e8e8c322c66a877a647a07a73324c15f 100644 (file)
@@ -2,18 +2,20 @@
 /* Copyright © 2025 Intel Corporation */
 
 #include <drm/drm_panic.h>
+#include <drm/intel/display_parent_interface.h>
 
 #include "display/intel_display_types.h"
 #include "display/intel_fb.h"
-#include "display/intel_panic.h"
 #include "gem/i915_gem_object.h"
 
-struct intel_panic *intel_panic_alloc(void)
+#include "i915_panic.h"
+
+static struct intel_panic *intel_panic_alloc(void)
 {
        return i915_gem_object_alloc_panic();
 }
 
-int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
+static int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
 {
        struct intel_framebuffer *fb = sb->private;
        struct drm_gem_object *obj = intel_fb_bo(&fb->base);
@@ -21,7 +23,13 @@ int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
        return i915_gem_object_panic_setup(panic, sb, obj, fb->panic_tiling);
 }
 
-void intel_panic_finish(struct intel_panic *panic)
+static void intel_panic_finish(struct intel_panic *panic)
 {
        return i915_gem_object_panic_finish(panic);
 }
+
+const struct intel_display_panic_interface i915_display_panic_interface = {
+       .alloc = intel_panic_alloc,
+       .setup = intel_panic_setup,
+       .finish = intel_panic_finish,
+};
diff --git a/drivers/gpu/drm/i915/i915_panic.h b/drivers/gpu/drm/i915/i915_panic.h
new file mode 100644 (file)
index 0000000..743d8c8
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright © 2025 Intel Corporation */
+
+#ifndef __I915_PANIC_H__
+#define __I915_PANIC_H__
+
+extern const struct intel_display_panic_interface i915_display_panic_interface;
+
+#endif /* __I915_PANIC_H__ */
index 9fb5c2f3ddd855cdfbe9b12163ebba5b9f194051..56796cedbd06f175521db3c7bc1ba2437f9f41e1 100644 (file)
@@ -38,6 +38,7 @@
 #include "xe_display_rpm.h"
 #include "xe_hdcp_gsc.h"
 #include "xe_module.h"
+#include "xe_panic.h"
 #include "xe_stolen.h"
 
 /* Ensure drm and display members are placed properly. */
@@ -537,6 +538,7 @@ static const struct intel_display_irq_interface xe_display_irq_interface = {
 
 static const struct intel_display_parent_interface parent = {
        .hdcp = &xe_display_hdcp_interface,
+       .panic = &xe_display_panic_interface,
        .rpm = &xe_display_rpm_interface,
        .irq = &xe_display_irq_interface,
        .stolen = &xe_display_stolen_interface,
index df663286092abe8de1e1ca931f6bf63603b51839..e078494dc8ba8826697a54fe7783a0b153ea01d9 100644 (file)
@@ -3,11 +3,12 @@
 
 #include <drm/drm_cache.h>
 #include <drm/drm_panic.h>
+#include <drm/intel/display_parent_interface.h>
 
 #include "intel_display_types.h"
 #include "intel_fb.h"
-#include "intel_panic.h"
 #include "xe_bo.h"
+#include "xe_panic.h"
 #include "xe_res_cursor.h"
 
 struct intel_panic {
@@ -74,7 +75,7 @@ static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int
                iosys_map_wr(&panic->vmap, offset, u32, color);
 }
 
-struct intel_panic *intel_panic_alloc(void)
+static struct intel_panic *xe_panic_alloc(void)
 {
        struct intel_panic *panic;
 
@@ -83,7 +84,7 @@ struct intel_panic *intel_panic_alloc(void)
        return panic;
 }
 
-int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
+static int xe_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
 {
        struct intel_framebuffer *fb = (struct intel_framebuffer *)sb->private;
        struct xe_bo *bo = gem_to_xe_bo(intel_fb_bo(&fb->base));
@@ -96,7 +97,8 @@ int intel_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb)
        return 0;
 }
 
-void intel_panic_finish(struct intel_panic *panic)
-{
-       xe_panic_kunmap(panic);
-}
+const struct intel_display_panic_interface xe_display_panic_interface = {
+       .alloc = xe_panic_alloc,
+       .setup = xe_panic_setup,
+       .finish = xe_panic_kunmap,
+};
diff --git a/drivers/gpu/drm/xe/display/xe_panic.h b/drivers/gpu/drm/xe/display/xe_panic.h
new file mode 100644 (file)
index 0000000..3054b51
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright © 2025 Intel Corporation */
+
+#ifndef __XE_PANIC_H__
+#define __XE_PANIC_H__
+
+extern const struct intel_display_panic_interface xe_display_panic_interface;
+
+#endif
index 9733c508ad4c50be7360d1da575e9c0ac5a12ea3..477ee9e735f9e80f0ee8d0be88aad0af1e2cc2e3 100644 (file)
@@ -8,7 +8,9 @@
 
 struct dma_fence;
 struct drm_device;
+struct drm_scanout_buffer;
 struct intel_hdcp_gsc_context;
+struct intel_panic;
 struct intel_stolen_node;
 struct ref_tracker;
 
@@ -42,6 +44,12 @@ struct intel_display_irq_interface {
        void (*synchronize)(struct drm_device *drm);
 };
 
+struct intel_display_panic_interface {
+       struct intel_panic *(*alloc)(void);
+       int (*setup)(struct intel_panic *panic, struct drm_scanout_buffer *sb);
+       void (*finish)(struct intel_panic *panic);
+};
+
 struct intel_display_rps_interface {
        void (*boost_if_not_started)(struct dma_fence *fence);
        void (*mark_interactive)(struct drm_device *drm, bool interactive);
@@ -86,6 +94,9 @@ struct intel_display_parent_interface {
        /** @irq: IRQ interface */
        const struct intel_display_irq_interface *irq;
 
+       /** @panic: Panic interface */
+       const struct intel_display_panic_interface *panic;
+
        /** @rpm: RPS interface. Optional. */
        const struct intel_display_rps_interface *rps;