summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-09-11 14:44:05 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2026-09-17 09:16:35 +0200
commit3ae80dc240c9ea64c6129bd40db711e80b7f2c43 (patch)
tree12510c4cc11ec8924dfd6edea64623e44c25ec0b /include/drm
parentb8bc58515ac49e92dd5fdd853c11c4bf6ee33a19 (diff)
downloadlinux-next-3ae80dc240c9ea64c6129bd40db711e80b7f2c43.tar.gz
linux-next-3ae80dc240c9ea64c6129bd40db711e80b7f2c43.zip
drm/panic: Internalize panic locking in DRM core and helpers
None of the DRM drivers handles panic locking. Declare the interfaces in an internal header file. Move the trylock required during the panic into the DRM core's sources. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20260911124540.279841-13-tzimmermann@suse.de
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_panic.h65
1 files changed, 0 insertions, 65 deletions
diff --git a/include/drm/drm_panic.h b/include/drm/drm_panic.h
index 430df536de14..99572b7eeab9 100644
--- a/include/drm/drm_panic.h
+++ b/include/drm/drm_panic.h
@@ -8,11 +8,9 @@
#ifndef __DRM_PANIC_H__
#define __DRM_PANIC_H__
-#include <linux/module.h>
#include <linux/types.h>
#include <linux/iosys-map.h>
-#include <drm/drm_device.h>
#include <drm/drm_fourcc.h>
struct page;
@@ -85,71 +83,8 @@ struct drm_scanout_buffer {
* set_pixel()
*/
void *private;
-
};
-#ifdef CONFIG_DRM_PANIC
-
-/**
- * drm_panic_trylock - try to enter the panic printing critical section
- * @dev: struct drm_device
- * @flags: unsigned long irq flags you need to pass to the unlock() counterpart
- *
- * The panic-printing code calls this function. The panic printing attempt must
- * be aborted if the trylock fails.
- *
- * Return:
- * %0 when failing to acquire the raw spinlock, nonzero on success.
- */
-#define drm_panic_trylock(dev, flags) \
- raw_spin_trylock_irqsave(&(dev)->mode_config.panic_lock, flags)
-
-/**
- * drm_panic_lock - protect panic printing relevant state
- * @dev: struct drm_device
- * @flags: unsigned long irq flags you need to pass to the unlock() counterpart
- *
- * This function must be called to protect software and hardware state that the
- * panic printing code must be able to rely on. The protected sections must be
- * as small as possible. It uses the irqsave/irqrestore variant, and can be
- * called from irq handler. Examples include:
- *
- * - Access to peek/poke or other similar registers, if that is the way the
- * driver prints the pixels into the scanout buffer at panic time.
- *
- * - Updates to pointers like &drm_plane.state, allowing the panic handler to
- * safely deference these. This is done in drm_atomic_helper_swap_state().
- *
- * - An state that isn't invariant and that the driver must be able to access
- * during panic printing.
- */
-
-#define drm_panic_lock(dev, flags) \
- raw_spin_lock_irqsave(&(dev)->mode_config.panic_lock, flags)
-
-/**
- * drm_panic_unlock - end of the panic printing critical section
- * @dev: struct drm_device
- * @flags: irq flags that were returned when acquiring the lock
- *
- * Unlocks the raw spinlock acquired by either drm_panic_lock() or
- * drm_panic_trylock().
- */
-#define drm_panic_unlock(dev, flags) \
- raw_spin_unlock_irqrestore(&(dev)->mode_config.panic_lock, flags)
-
-#else
-
-static inline bool drm_panic_trylock(struct drm_device *dev, unsigned long flags)
-{
- return true;
-}
-
-static inline void drm_panic_lock(struct drm_device *dev, unsigned long flags) {}
-static inline void drm_panic_unlock(struct drm_device *dev, unsigned long flags) {}
-
-#endif
-
#if defined(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
size_t drm_panic_qr_max_data_size(u8 version, size_t url_len);