[1/2] firmware: sysfb: Allow re-creating system framebuffer after init
Commit Message
When GPU kernel drivers have failed to load for any reason the
current experience is that the screen is frozen. This is because
one of the first things that these drivers do is to call `sysfb_disable`.
For end users this is quite jarring and hard to recover from. Allow
drivers to request the framebuffer to be re-created for a failure cleanup.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/firmware/efi/sysfb_efi.c | 6 +++---
drivers/firmware/sysfb.c | 15 ++++++++++++++-
drivers/firmware/sysfb_simplefb.c | 4 ++--
include/linux/sysfb.h | 5 +++++
4 files changed, 24 insertions(+), 6 deletions(-)
Comments
Hi Mario,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on 830b3c68c1fb1e9176028d02ef86f3cf76aa2476]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/firmware-sysfb-Allow-re-creating-system-framebuffer-after-init/20221223-023123
base: 830b3c68c1fb1e9176028d02ef86f3cf76aa2476
patch link: https://lore.kernel.org/r/20221222183012.1046-2-mario.limonciello%40amd.com
patch subject: [PATCH 1/2] firmware: sysfb: Allow re-creating system framebuffer after init
config: i386-randconfig-a015-20221219
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/cf6672cd42951659c7717b43826aac194c8b9c4b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mario-Limonciello/firmware-sysfb-Allow-re-creating-system-framebuffer-after-init/20221223-023123
git checkout cf6672cd42951659c7717b43826aac194c8b9c4b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/video/aperture.c:10:
>> include/linux/sysfb.h:71:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
}
^
1 error generated.
vim +71 include/linux/sysfb.h
68
69 static int sysfb_enable(void)
70 {
> 71 }
72
@@ -185,7 +185,7 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
&efifb_dmi_list[enumid] \
}
-static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
+static const struct dmi_system_id efifb_dmi_system_table[] = {
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac4,1", M_I17),
/* At least one of these two will be right; maybe both? */
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac5,1", M_I20),
@@ -235,7 +235,7 @@ static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
* pitch). We simply swap width and height for these devices so that we can
* correctly deal with some of them coming with multiple resolutions.
*/
-static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
+static const struct dmi_system_id efifb_dmi_swap_width_height[] = {
{
/*
* Lenovo MIIX310-10ICR, only some batches have the troublesome
@@ -333,7 +333,7 @@ static const struct fwnode_operations efifb_fwnode_ops = {
#ifdef CONFIG_EFI
static struct fwnode_handle efifb_fwnode;
-__init void sysfb_apply_efi_quirks(struct platform_device *pd)
+void sysfb_apply_efi_quirks(struct platform_device *pd)
{
if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
!(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
@@ -69,7 +69,7 @@ void sysfb_disable(void)
}
EXPORT_SYMBOL_GPL(sysfb_disable);
-static __init int sysfb_init(void)
+static int sysfb_init(void)
{
struct screen_info *si = &screen_info;
struct simplefb_platform_data mode;
@@ -124,6 +124,19 @@ static __init int sysfb_init(void)
mutex_unlock(&disable_lock);
return ret;
}
+/**
+ * sysfb_enable() - re-enable the Generic System Framebuffers support
+ *
+ * This causes the system framebuffer initialization to be re-run.
+ * It is intended to be called by DRM drivers that failed probe for cleanup.
+ *
+ */
+int sysfb_enable(void)
+{
+ disabled = false;
+ return sysfb_init();
+}
+EXPORT_SYMBOL_GPL(sysfb_enable);
/* must execute after PCI subsystem for EFI quirks */
device_initcall(sysfb_init);
@@ -24,7 +24,7 @@ static const char simplefb_resname[] = "BOOTFB";
static const struct simplefb_format formats[] = SIMPLEFB_FORMATS;
/* try parsing screen_info into a simple-framebuffer mode struct */
-__init bool sysfb_parse_mode(const struct screen_info *si,
+bool sysfb_parse_mode(const struct screen_info *si,
struct simplefb_platform_data *mode)
{
const struct simplefb_format *f;
@@ -57,7 +57,7 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
return false;
}
-__init struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
+struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
const struct simplefb_platform_data *mode)
{
struct platform_device *pd;
@@ -58,6 +58,7 @@ struct efifb_dmi_info {
#ifdef CONFIG_SYSFB
void sysfb_disable(void);
+int sysfb_enable(void);
#else /* CONFIG_SYSFB */
@@ -65,6 +66,10 @@ static inline void sysfb_disable(void)
{
}
+static int sysfb_enable(void)
+{
+}
+
#endif /* CONFIG_SYSFB */
#ifdef CONFIG_EFI