Skip to contentSkip to conversation

drm & vgaarb: handle vgacon removal in vgaarb.

PATCH Superseded Gerd Hoffmann 2 participants 6 messages Feb 22, 2019

Subsystems (5)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Gerd Hoffmann

author maintainer
#0 lore raw

v5 cover drm & vgaarb: handle vgacon removal in vgaarb.

Gerd Hoffmann (3):
drm: move i915_kick_out_vgacon to vgaarb drm/fb-helper: call vga_remove_vgacon automatically. drm/qxl: remove conflicting framebuffers earlier

 include/drm/drm_fb_helper.h     | 14 +++++++++---
 include/linux/vgaarb.h          |  2 ++
 drivers/gpu/drm/i915/i915_drv.c | 35 +-----------------------------
 drivers/gpu/drm/qxl/qxl_drv.c   |  5 ++++-
 drivers/gpu/vga/vgaarb.c        | 48 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 66 insertions(+), 38 deletions(-)
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH v5 1/3 drm: move i915_kick_out_vgacon to vgaarb

Also rename it to vga_remove_vgacon and add kerneldoc text.

---
 include/linux/vgaarb.h          |  2 ++
 drivers/gpu/drm/i915/i915_drv.c | 35 +-----------------------------
 drivers/gpu/vga/vgaarb.c        | 48 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 34 deletions(-)
include/linux/vgaarb.h +2 -0
index ee162e3e879b..553b34c8b5f7 100644
@@ -125,9 +125,11 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
 #ifdef CONFIG_VGA_ARB
 extern struct pci_dev *vga_default_device(void);
 extern void vga_set_default_device(struct pci_dev *pdev);
+extern int vga_remove_vgacon(struct pci_dev *pdev);
 #else
 static inline struct pci_dev *vga_default_device(void) { return NULL; };
 static inline void vga_set_default_device(struct pci_dev *pdev) { };
+static inline int vga_remove_vgacon(struct pci_dev *pdev) { return 0; };
 #endif
 
 /*
drivers/gpu/drm/i915/i915_drv.c +1 -34
index 6630212f2faf..991f18db1552 100644
@@ -757,39 +757,6 @@ static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
 	return ret;
 }
 
-#if !defined(CONFIG_VGA_CONSOLE)
-static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
-{
-	return 0;
-}
-#elif !defined(CONFIG_DUMMY_CONSOLE)
-static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
-{
-	return -ENODEV;
-}
-#else
-static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
-{
-	int ret = 0;
-
-	DRM_INFO("Replacing VGA console driver\n");
-
-	console_lock();
-	if (con_is_bound(&vga_con))
-		ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
-	if (ret == 0) {
-		ret = do_unregister_con_driver(&vga_con);
-
-		/* Ignore "already unregistered". */
-		if (ret == -ENODEV)
-			ret = 0;
-	}
-	console_unlock();
-
-	return ret;
-}
-#endif
-
 static void intel_init_dpio(struct drm_i915_private *dev_priv)
 {
 	/*
@@ -1420,7 +1387,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv)
 		goto err_ggtt;
 	}
 
-	ret = i915_kick_out_vgacon(dev_priv);
+	ret = vga_remove_vgacon(dev_priv);
 	if (ret) {
 		DRM_ERROR("failed to remove conflicting VGA console\n");
 		goto err_ggtt;
drivers/gpu/vga/vgaarb.c +48 -0

60 lines not on this page · raw message

Signature · 1 line
2.9.3
author maintainer
#2 lore raw

PATCH v5 2/3 drm/fb-helper: call vga_remove_vgacon automatically.

In reply to Gerd Hoffmann

Add vga_remove_vgacon() call to drm_fb_helper_remove_conflicting_pci_framebuffers().

---
 include/drm/drm_fb_helper.h | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
include/drm/drm_fb_helper.h +11 -3
index bb9acea61369..286d58efed5d 100644
@@ -36,6 +36,7 @@ struct drm_fb_helper;
 #include <drm/drm_crtc.h>
 #include <drm/drm_device.h>
 #include <linux/kgdb.h>
+#include <linux/vgaarb.h>
 
 enum mode_set_atomic {
 	LEAVE_ATOMIC_MODE_SET,
@@ -642,11 +643,18 @@ drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
 						  int resource_id,
 						  const char *name)
 {
+	int ret = 0;
+
+	/*
+	 * WARNING: Apparently we must kick fbdev drivers before vgacon,
+	 * otherwise the vga fbdev driver falls over.
+	 */
 #if IS_REACHABLE(CONFIG_FB)
-	return remove_conflicting_pci_framebuffers(pdev, resource_id, name);
-#else
-	return 0;
+	ret = remove_conflicting_pci_framebuffers(pdev, resource_id, name);
 #endif
+	if (ret == 0)
+		ret = vga_remove_vgacon(pdev);
+	return ret;
 }
 
 #endif
Signature · 1 line
2.9.3
author maintainer
#3 lore raw

PATCH v5 3/3 drm/qxl: remove conflicting framebuffers earlier

In reply to Gerd Hoffmann

Add error checking while being at it.

---
 drivers/gpu/drm/qxl/qxl_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_drv.c +4 -1
index bb81e310eb6d..578d867a81d5 100644
@@ -79,6 +79,10 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto free_dev;
 
+	ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "qxl");
+	if (ret)
+		goto disable_pci;
+
 	ret = qxl_device_init(qdev, &qxl_driver, pdev);
 	if (ret)
 		goto disable_pci;
@@ -94,7 +98,6 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto modeset_cleanup;
 
-	drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "qxl");
 	drm_fbdev_generic_setup(&qdev->ddev, 32);
 	return 0;
 
Signature · 1 line
2.9.3
author maintainer
#4 lore raw

PATCH v5 3/3 drm/qxl: remove conflicting framebuffers earlier

In reply to Gerd Hoffmann

Add error checking while being at it.

---
 drivers/gpu/drm/qxl/qxl_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_drv.c +4 -1
index bb81e310eb6d..578d867a81d5 100644
@@ -79,6 +79,10 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto free_dev;
 
+	ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "qxl");
+	if (ret)
+		goto disable_pci;
+
 	ret = qxl_device_init(qdev, &qxl_driver, pdev);
 	if (ret)
 		goto disable_pci;
@@ -94,7 +98,6 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto modeset_cleanup;
 
-	drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "qxl");
 	drm_fbdev_generic_setup(&qdev->ddev, 32);
 	return 0;
 
Signature · 1 line
2.9.3
#5 lore raw

✗ Fi.CI.BAT: failure for drm & vgaarb: handle vgacon removal in vgaarb.

In reply to Gerd Hoffmann
== Series Details ==

== Series Details ==

Series: drm & vgaarb: handle vgacon removal in vgaarb.
URL : https://patchwork.freedesktop.org/series/57086/
State : failure

== Summary ==

CALL scripts/checksyscalls.sh
DESCEND objtool
CHK include/generated/compile.h
CC [M] drivers/gpu/drm/i915/i915_drv.o
drivers/gpu/drm/i915/i915_drv.c: In function ‘i915_driver_init_hw’:
drivers/gpu/drm/i915/i915_drv.c:1391:26: error: passing argument 1 of ‘vga_remove_vgacon’ from incompatible pointer type [-Werror=incompatible-pointer-types]

  ret = vga_remove_vgacon(dev_priv);
                          ^~~~~~~~
In file included from drivers/gpu/drm/i915/i915_drv.c:39:0:
./include/linux/vgaarb.h:128:12: note: expected ‘struct pci_dev *’ but argument is of type ‘struct drm_i915_private *’
 extern int vga_remove_vgacon(struct pci_dev *pdev);
            ^~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
scripts/Makefile.build:276: recipe for target 'drivers/gpu/drm/i915/i915_drv.o' failed make[4]: *** [drivers/gpu/drm/i915/i915_drv.o] Error 1 scripts/Makefile.build:492: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:492: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:492: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2
Makefile:1043: recipe for target 'drivers' failed
make: *** [drivers] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx