drm/panic: Report invalid or unsupported panic modes
Currently the user can write anything into the drm.panic_screen modparam,
either at runtime via sysfs, or as a kernel boot time argument. Invalid
strings will be silently accepted and ignored at use time by defaulting to
the 'user' panic mode.
Let instead add some validation in order to have immediate feedback when
something has been mistyped, or not compiled in.
For example during kernel boot:
Booting kernel: `bsod' invalid for parameter `drm.panic_screen'
Or at runtime:
# echo -n bsod > /sys/module/drm/parameters/panic_screen
-bash: echo: write error: Invalid argument
Change of behavior is that when invalid mode is attempted to be
configured, currently the code will default to the 'user' mode, while with
this change the code will ignore it, and default to the mode set at kernel
build time via CONFIG_DRM_PANIC_SCREEN.
While at it lets also fix the module parameter description to include all
compiled in modes.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
Link: https://lore.kernel.org/r/20251127090349.92717-1-tvrtko.ursulin@igalia.com