|
Thomas Zimmermann |
c35bbe |
From 205bec68a0ea67b6bff6fea9603b7b8aeacc9d46 Mon Sep 17 00:00:00 2001
|
|
Thomas Zimmermann |
c35bbe |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
Thomas Zimmermann |
c35bbe |
Date: Thu, 19 May 2022 14:40:07 +0200
|
|
Thomas Zimmermann |
c35bbe |
Subject: [PATCH] drivers/firmware: skip simpledrm if nvidia-drm.modeset=1 is
|
|
Thomas Zimmermann |
c35bbe |
set
|
|
Thomas Zimmermann |
c35bbe |
Patch-mainline: Never, temporary workaround for nvidia.ko
|
|
Thomas Zimmermann |
c35bbe |
References: boo#1193472
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
The Nvidia proprietary driver has some bugs that leads to issues if used
|
|
Thomas Zimmermann |
c35bbe |
with the simpledrm driver. The most noticeable is that does not register
|
|
Thomas Zimmermann |
c35bbe |
an emulated fbdev device.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
It just relies on a fbdev to be registered by another driver, that could
|
|
Thomas Zimmermann |
c35bbe |
be that could be attached to the framebuffer console. On UEFI machines,
|
|
Thomas Zimmermann |
c35bbe |
this is the efifb driver.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
This means that disabling the efifb driver will cause virtual consoles to
|
|
Thomas Zimmermann |
c35bbe |
not be present in the system when using the Nvidia driver. Legacy BIOS is
|
|
Thomas Zimmermann |
c35bbe |
not affected just because fbcon is not used there, but instead vgacon.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
Unless a VGA mode is specified using the vga= kernel command line option,
|
|
Thomas Zimmermann |
c35bbe |
in that case the vesafb driver is used instead and its fbdev attached to
|
|
Thomas Zimmermann |
c35bbe |
the fbcon.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
This is a problem because with CONFIG_SYSFB_SIMPLEFB=y, the sysfb platform
|
|
Thomas Zimmermann |
c35bbe |
code attempts to register a "simple-framebuffer" platform device (that is
|
|
Thomas Zimmermann |
c35bbe |
matched against simpledrm) and only registers either an "efi-framebuffer"
|
|
Thomas Zimmermann |
c35bbe |
or "vesa-framebuffer" if this fails to be registered due the video modes
|
|
Thomas Zimmermann |
c35bbe |
not being compatible.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
The Nvidia driver relying on another driver to register the fbdev is quite
|
|
Thomas Zimmermann |
c35bbe |
fragile, since it can't really assume those will stick around. For example
|
|
Thomas Zimmermann |
c35bbe |
there are patches posted to remove the EFI and VESA platform devices once
|
|
Thomas Zimmermann |
c35bbe |
a real DRM or fbdev driver probes.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
But in any case, moving to a simpledrm + emulated fbdev only breaks this
|
|
Thomas Zimmermann |
c35bbe |
assumption and causes users to not have VT if the Nvidia driver is used.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
So to prevent this, let's add a workaround and make the sysfb to skip the
|
|
Thomas Zimmermann |
c35bbe |
"simple-framebuffer" registration when nvidia-drm.modeset=1 option is set.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
This is quite horrible, but honestly I can't think of any other approach.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
For this to work, the CONFIG_FB_EFI and CONFIG_FB_VESA config options must
|
|
Thomas Zimmermann |
c35bbe |
be enabled besides CONFIG_DRM_SIMPLEDRM.
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
Thomas Zimmermann |
c35bbe |
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
|
|
Thomas Zimmermann |
c35bbe |
---
|
|
Thomas Zimmermann |
c35bbe |
drivers/firmware/sysfb.c | 18 +++++++++++++++++-
|
|
Thomas Zimmermann |
c35bbe |
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
--- a/drivers/firmware/sysfb.c
|
|
Thomas Zimmermann |
c35bbe |
+++ b/drivers/firmware/sysfb.c
|
|
Thomas Zimmermann |
c35bbe |
@@ -69,6 +69,22 @@ void sysfb_disable(void)
|
|
Thomas Zimmermann |
c35bbe |
}
|
|
Thomas Zimmermann |
c35bbe |
EXPORT_SYMBOL_GPL(sysfb_disable);
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
+static int skip_simpledrm;
|
|
Thomas Zimmermann |
c35bbe |
+
|
|
Thomas Zimmermann |
c35bbe |
+static int __init simpledrm_disable(char *opt)
|
|
Thomas Zimmermann |
c35bbe |
+{
|
|
Thomas Zimmermann |
c35bbe |
+ if (!opt)
|
|
Thomas Zimmermann |
c35bbe |
+ return -EINVAL;
|
|
Thomas Zimmermann |
c35bbe |
+
|
|
Thomas Zimmermann |
c35bbe |
+ get_option(&opt, &skip_simpledrm);
|
|
Thomas Zimmermann |
c35bbe |
+
|
|
Thomas Zimmermann |
c35bbe |
+ if (skip_simpledrm)
|
|
Thomas Zimmermann |
c35bbe |
+ pr_info("The simpledrm driver will not be probed\n");
|
|
Thomas Zimmermann |
c35bbe |
+
|
|
Thomas Zimmermann |
c35bbe |
+ return 0;
|
|
Thomas Zimmermann |
c35bbe |
+}
|
|
Thomas Zimmermann |
c35bbe |
+early_param("nvidia-drm.modeset", simpledrm_disable);
|
|
Thomas Zimmermann |
c35bbe |
+
|
|
Thomas Zimmermann |
c35bbe |
static __init int sysfb_init(void)
|
|
Thomas Zimmermann |
c35bbe |
{
|
|
Thomas Zimmermann |
c35bbe |
struct screen_info *si = &screen_info;
|
|
Thomas Zimmermann |
c35bbe |
@@ -83,7 +99,7 @@ static __init int sysfb_init(void)
|
|
Thomas Zimmermann |
c35bbe |
|
|
Thomas Zimmermann |
c35bbe |
/* try to create a simple-framebuffer device */
|
|
Thomas Zimmermann |
c35bbe |
compatible = sysfb_parse_mode(si, &mode);
|
|
Thomas Zimmermann |
c35bbe |
- if (compatible) {
|
|
Thomas Zimmermann |
c35bbe |
+ if (compatible && !skip_simpledrm) {
|
|
Thomas Zimmermann |
c35bbe |
pd = sysfb_create_simplefb(si, &mode);
|
|
Thomas Zimmermann |
c35bbe |
if (!IS_ERR(pd))
|
|
Thomas Zimmermann |
c35bbe |
goto unlock_mutex;
|