Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs" failed to apply to 4.17-stable tree

PATCH In review [email protected] 2 participants 4 messages Jul 22, 2018 – Jul 26, 2018

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.17-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From eb493fbc150f4a28151ae1ee84f24395989f3600 Mon Sep 17 00:00:00 2001

From: Lyude Paul <[email protected]>
Date: Tue, 3 Jul 2018 16:31:41 -0400
Subject: [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs

Currently nouveau doesn't actually expose the state debugfs file that's usually provided for any modesetting driver that supports atomic, even if nouveau is loaded with atomic=1. This is due to the fact that the standard debugfs files that DRM creates for atomic drivers is called when drm_get_pci_dev() is called from nouveau_drm.c. This happens well before we've initialized the display core, which is currently responsible for setting the DRIVER_ATOMIC cap.

So, move the atomic option into nouveau_drm.c and just add the DRIVER_ATOMIC cap whenever it's enabled on the kernel commandline. This shouldn't cause any actual issues, as the atomic ioctl will still fail as expected even if the display core doesn't disable it until later in the init sequence. This also provides the added benefit of being able to use the state debugfs file to check the current display state even if clients aren't allowed to modify it through anything other than the legacy ioctls.

Additionally, disable the DRIVER_ATOMIC cap in nv04's display core, as this was already disabled there previously.

drivers/gpu/drm/nouveau/dispnv04/disp.c +3 -0
index 501d2d290e9c..70dce544984e 100644
@@ -55,6 +55,9 @@ nv04_display_create(struct drm_device *dev)
 	nouveau_display(dev)->init = nv04_display_init;
 	nouveau_display(dev)->fini = nv04_display_fini;
 
+	/* Pre-nv50 doesn't support atomic, so don't expose the ioctls */
+	dev->driver->driver_features &= ~DRIVER_ATOMIC;
+
 	nouveau_hw_save_vga_fonts(dev, 1);
 
 	nv04_crtc_create(dev, 0);
drivers/gpu/drm/nouveau/dispnv50/disp.c +0 -6
index 31b12b4f321a..9bae4db84cfb 100644
@@ -2126,10 +2126,6 @@ nv50_display_destroy(struct drm_device *dev)
 	kfree(disp);
 }
 
-MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
-static int nouveau_atomic = 0;
-module_param_named(atomic, nouveau_atomic, int, 0400);
-
 int
 nv50_display_create(struct drm_device *dev)
 {
@@ -2154,8 +2150,6 @@ nv50_display_create(struct drm_device *dev)
 	disp->disp = &nouveau_display(dev)->disp;
 	dev->mode_config.funcs = &nv50_disp_func;
 	dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
-	if (nouveau_atomic)
-		dev->driver->driver_features |= DRIVER_ATOMIC;
 
 	/* small shared memory area we use for notifiers and semaphores */
 	ret = nouveau_bo_new(&drm->client, 4096, 0x1000, TTM_PL_FLAG_VRAM,
drivers/gpu/drm/nouveau/nouveau_drm.c +7 -0
index 514903338782..f5d3158f0378 100644
@@ -81,6 +81,10 @@ MODULE_PARM_DESC(modeset, "enable driver (default: auto, "
 int nouveau_modeset = -1;
 module_param_named(modeset, nouveau_modeset, int, 0400);
 
+MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
+static int nouveau_atomic = 0;
+module_param_named(atomic, nouveau_atomic, int, 0400);
+
 MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)");
 static int nouveau_runtime_pm = -1;
 module_param_named(runpm, nouveau_runtime_pm, int, 0400);
@@ -509,6 +513,9 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
+	if (nouveau_atomic)
+		driver_pci.driver_features |= DRIVER_ATOMIC;
+
 	ret = drm_get_pci_dev(pdev, pent, &driver_pci);
 	if (ret) {
 		nvkm_device_del(&device);
maintainer
#1 lore raw

PATCH 1/1 drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs

commit eb493fbc150f4a28151ae1ee84f24395989f3600 upstream

Currently nouveau doesn't actually expose the state debugfs file that's usually provided for any modesetting driver that supports atomic, even if nouveau is loaded with atomic=1. This is due to the fact that the standard debugfs files that DRM creates for atomic drivers is called when drm_get_pci_dev() is called from nouveau_drm.c. This happens well before we've initialized the display core, which is currently responsible for setting the DRIVER_ATOMIC cap.

So, move the atomic option into nouveau_drm.c and just add the DRIVER_ATOMIC cap whenever it's enabled on the kernel commandline. This shouldn't cause any actual issues, as the atomic ioctl will still fail as expected even if the display core doesn't disable it until later in the init sequence. This also provides the added benefit of being able to use the state debugfs file to check the current display state even if clients aren't allowed to modify it through anything other than the legacy ioctls.

Additionally, disable the DRIVER_ATOMIC cap in nv04's display core, as this was already disabled there previously.

---
 drivers/gpu/drm/nouveau/dispnv04/disp.c | 3 +++
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 7 +++++++
 drivers/gpu/drm/nouveau/nv50_display.c  | 6 ------
 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/disp.c +3 -0
index 501d2d290e9c..70dce544984e 100644
@@ -55,6 +55,9 @@ nv04_display_create(struct drm_device *dev)
 	nouveau_display(dev)->init = nv04_display_init;
 	nouveau_display(dev)->fini = nv04_display_fini;
 
+	/* Pre-nv50 doesn't support atomic, so don't expose the ioctls */
+	dev->driver->driver_features &= ~DRIVER_ATOMIC;
+
 	nouveau_hw_save_vga_fonts(dev, 1);
 
 	nv04_crtc_create(dev, 0);
drivers/gpu/drm/nouveau/nouveau_drm.c +7 -0
index bbbf353682e1..21d28e812963 100644
@@ -79,6 +79,10 @@ MODULE_PARM_DESC(modeset, "enable driver (default: auto, "
 int nouveau_modeset = -1;
 module_param_named(modeset, nouveau_modeset, int, 0400);
 
+MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
+static int nouveau_atomic = 0;
+module_param_named(atomic, nouveau_atomic, int, 0400);
+
 MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)");
 static int nouveau_runtime_pm = -1;
 module_param_named(runpm, nouveau_runtime_pm, int, 0400);
@@ -501,6 +505,9 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
+	if (nouveau_atomic)
+		driver_pci.driver_features |= DRIVER_ATOMIC;
+
 	ret = drm_get_pci_dev(pdev, pent, &driver_pci);
 	if (ret) {
 		nvkm_device_del(&device);
drivers/gpu/drm/nouveau/nv50_display.c +0 -6
index bc5c4f2402b4..abe297fda046 100644
@@ -4441,10 +4441,6 @@ nv50_display_destroy(struct drm_device *dev)
 	kfree(disp);
 }
 
-MODULE_PARM_DESC(atomic, "Expose atomic ioctl (default: disabled)");
-static int nouveau_atomic = 0;
-module_param_named(atomic, nouveau_atomic, int, 0400);
-
 int
 nv50_display_create(struct drm_device *dev)
 {
@@ -4469,8 +4465,6 @@ nv50_display_create(struct drm_device *dev)
 	disp->disp = &nouveau_display(dev)->disp;
 	dev->mode_config.funcs = &nv50_disp_func;
 	dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
-	if (nouveau_atomic)
-		dev->driver->driver_features |= DRIVER_ATOMIC;
 
 	/* small shared memory area we use for notifiers and semaphores */
 	ret = nouveau_bo_new(&drm->client, 4096, 0x1000, TTM_PL_FLAG_VRAM,
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

Re: [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs

Quoted 22 lines · Lyude Paul

commit eb493fbc150f4a28151ae1ee84f24395989f3600 upstream

Currently nouveau doesn't actually expose the state debugfs file that's usually provided for any modesetting driver that supports atomic, even if nouveau is loaded with atomic=1. This is due to the fact that the standard debugfs files that DRM creates for atomic drivers is called when drm_get_pci_dev() is called from nouveau_drm.c. This happens well before we've initialized the display core, which is currently responsible for setting the DRIVER_ATOMIC cap.

So, move the atomic option into nouveau_drm.c and just add the DRIVER_ATOMIC cap whenever it's enabled on the kernel commandline. This shouldn't cause any actual issues, as the atomic ioctl will still fail as expected even if the display core doesn't disable it until later in the init sequence. This also provides the added benefit of being able to use the state debugfs file to check the current display state even if clients aren't allowed to modify it through anything other than the legacy ioctls.

Additionally, disable the DRIVER_ATOMIC cap in nv04's display core, as this was already disabled there previously.

Quoted 8 lines
---
 drivers/gpu/drm/nouveau/dispnv04/disp.c | 3 +++
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 7 +++++++
 drivers/gpu/drm/nouveau/nv50_display.c  | 6 ------
 3 files changed, 10 insertions(+), 6 deletions(-)

Please give me a hint as to what kernel versions you want the patches to be applied to, otherwise I just have to guess :)

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#3 lore raw

Re: [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs

Quoted 32 lines · Greg KH
Quoted 22 lines · Lyude Paul

commit eb493fbc150f4a28151ae1ee84f24395989f3600 upstream

Currently nouveau doesn't actually expose the state debugfs file that's usually provided for any modesetting driver that supports atomic, even if nouveau is loaded with atomic=1. This is due to the fact that the standard debugfs files that DRM creates for atomic drivers is called when drm_get_pci_dev() is called from nouveau_drm.c. This happens well before we've initialized the display core, which is currently responsible for setting the DRIVER_ATOMIC cap.

So, move the atomic option into nouveau_drm.c and just add the DRIVER_ATOMIC cap whenever it's enabled on the kernel commandline. This shouldn't cause any actual issues, as the atomic ioctl will still fail as expected even if the display core doesn't disable it until later in the init sequence. This also provides the added benefit of being able to use the state debugfs file to check the current display state even if clients aren't allowed to modify it through anything other than the legacy ioctls.

Additionally, disable the DRIVER_ATOMIC cap in nv04's display core, as this was already disabled there previously.

Quoted 8 lines
---
 drivers/gpu/drm/nouveau/dispnv04/disp.c | 3 +++
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 7 +++++++
 drivers/gpu/drm/nouveau/nv50_display.c  | 6 ------
 3 files changed, 10 insertions(+), 6 deletions(-)
Quoted 2 lines

Please give me a hint as to what kernel versions you want the patches to be applied to, otherwise I just have to guess :)

will note for the future, sorry about that!

Quoted 4 lines

thanks,

greg k-h