Skip to contentSkip to conversation

drm/nouveau: add kconfig option to turn off nouveau legacy contexts.

PATCH In review Dave Airlie 2 participants 2 messages Apr 18, 2019

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/nouveau: add kconfig option to turn off nouveau legacy contexts.

From: Dave Airlie <[email protected]>

There was a nouveau DDX that relied on legacy context ioctls to work, but we fixed it years ago, give distros that have a modern DDX the option to break the uAPI and close the mess of holes that legacy context support is.

---
 drivers/gpu/drm/nouveau/Kconfig       | 10 ++++++++++
 drivers/gpu/drm/nouveau/nouveau_drm.c |  7 +++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/Kconfig +10 -0
index 00cd9ab8948d..688b6f618b65 100644
@@ -21,6 +21,16 @@ config DRM_NOUVEAU
 	help
 	  Choose this option for open-source NVIDIA support.
 
+config NOUVEAU_LEGACY_CTX_SUPPORT
+	bool "Nouveau legacy context support"
+	default y
+	help
+	  There was a version of the nouveau DDX that relied on legacy
+	  ctx ioctls not erroring out. But that was back in time a long
+	  ways, so offer a way to disable it now. For uapi compat with
+	  old nouveau ddx this should be on by default, but modern distros
+	  should consider turning it off.
+
 config NOUVEAU_PLATFORM_DRIVER
 	bool "Nouveau (NVIDIA) SoC GPUs"
 	depends on DRM_NOUVEAU && ARCH_TEGRA
drivers/gpu/drm/nouveau/nouveau_drm.c +5 -2
index 5020265bfbd9..6ab9033f49da 100644
@@ -1094,8 +1094,11 @@ nouveau_driver_fops = {
 static struct drm_driver
 driver_stub = {
 	.driver_features =
-		DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_RENDER |
-		DRIVER_KMS_LEGACY_CONTEXT,
+		DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_RENDER
+#if defined(CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT)
+		| DRIVER_KMS_LEGACY_CONTEXT
+#endif
+		,
 
 	.open = nouveau_drm_open,
 	.postclose = nouveau_drm_postclose,
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by Peter Antoine Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Dave Airlie

From: Dave Airlie <[email protected]>

There was a nouveau DDX that relied on legacy context ioctls to work, but we fixed it years ago, give distros that have a modern DDX the option to break the uAPI and close the mess of holes that legacy context support is.

Full context of the story:

commit 0e975980d435d58df2d430d688b8c18778b42218

Author: Peter Antoine <[email protected]>
Date:   Tue Jun 23 08:18:49 2015 +0100

drm: Turn off Legacy Context Functions

The context functions are not used by the i915 driver and should not be used by modeset drivers. These driver functions contain several bugs and security holes. This change makes these functions optional can be turned on by a setting, they are turned off by default for modeset driver with the exception of the nouvea driver that may require them with an old version of libdrm.

The previous attempt was

commit 7c510133d93dd6f15ca040733ba7b2891ed61fd1
Author: Daniel Vetter <[email protected]>
Date: Thu Aug 8 15:41:21 2013 +0200

drm: mark context support as a legacy subsystem

but this had to be reverted

commit c21eb21cb50d58e7cbdcb8b9e7ff68b85cfa5095
Author: Dave Airlie <[email protected]>
Date: Fri Sep 20 08:32:59 2013 +1000

Revert "drm: mark context support as a legacy subsystem"

v2: remove returns from void function, and formatting (Daniel Vetter)

v3:
- s/Nova/nouveau/ in the commit message, and add references to the previous attempts
- drop the part touching the drm hw lock, that should be a separate patch.

I think best if you quote the entire above commit message in full. Also needs

Quoted 10 lines
---
 drivers/gpu/drm/nouveau/Kconfig       | 10 ++++++++++
 drivers/gpu/drm/nouveau/nouveau_drm.c |  7 +++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/Kconfig +0 -0
index 00cd9ab8948d..688b6f618b65 100644

drivers/gpu/drm/nouveau/Kconfig config DRM_NOUVEAU · line 26

Quoted 6 lines
drivers/gpu/drm/nouveau/Kconfig +3 -0
@@ -21,6 +21,16 @@ config DRM_NOUVEAU
 	help
 	  Choose this option for open-source NVIDIA support.
 
+config NOUVEAU_LEGACY_CTX_SUPPORT
+	bool "Nouveau legacy context support"
+	default y

+1 on default y

Quoted 35 lines
drivers/gpu/drm/nouveau/Kconfig +7 -0
+	help
+	  There was a version of the nouveau DDX that relied on legacy
+	  ctx ioctls not erroring out. But that was back in time a long
+	  ways, so offer a way to disable it now. For uapi compat with
+	  old nouveau ddx this should be on by default, but modern distros
+	  should consider turning it off.
+
 config NOUVEAU_PLATFORM_DRIVER
 	bool "Nouveau (NVIDIA) SoC GPUs"
 	depends on DRM_NOUVEAU && ARCH_TEGRA
drivers/gpu/drm/nouveau/nouveau_drm.c +5 -2
index 5020265bfbd9..6ab9033f49da 100644
@@ -1094,8 +1094,11 @@ nouveau_driver_fops = {
 static struct drm_driver
 driver_stub = {
 	.driver_features =
-		DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_RENDER |
-		DRIVER_KMS_LEGACY_CONTEXT,
+		DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_RENDER
+#if defined(CONFIG_NOUVEAU_LEGACY_CTX_SUPPORT)
+		| DRIVER_KMS_LEGACY_CONTEXT
+#endif
+		,
 
 	.open = nouveau_drm_open,
 	.postclose = nouveau_drm_postclose,
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel