linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs
       [not found] <153227752119282@kroah.com>
@ 2018-07-23 17:13 ` Lyude Paul
  2018-07-26 15:12   ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Lyude Paul @ 2018-07-23 17:13 UTC (permalink / raw)
  To: gregkh; +Cc: bskeggs, stable, David Airlie, dri-devel, nouveau, linux-kernel

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.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
---
 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(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 501d2d290e9c..70dce544984e 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -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);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index bbbf353682e1..21d28e812963 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -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);
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index bc5c4f2402b4..abe297fda046 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -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,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs
  2018-07-23 17:13 ` [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs Lyude Paul
@ 2018-07-26 15:12   ` Greg KH
  2018-07-26 15:48     ` Lyude Paul
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2018-07-26 15:12 UTC (permalink / raw)
  To: Lyude Paul
  Cc: bskeggs, stable, David Airlie, dri-devel, nouveau, linux-kernel

On Mon, Jul 23, 2018 at 01:13:20PM -0400, Lyude Paul wrote:
> 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.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs
  2018-07-26 15:12   ` Greg KH
@ 2018-07-26 15:48     ` Lyude Paul
  0 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2018-07-26 15:48 UTC (permalink / raw)
  To: Greg KH; +Cc: bskeggs, stable, David Airlie, dri-devel, nouveau, linux-kernel

On Thu, 2018-07-26 at 17:12 +0200, Greg KH wrote:
> On Mon, Jul 23, 2018 at 01:13:20PM -0400, Lyude Paul wrote:
> > 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.
> > 
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
> > ---
> >  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 :)
will note for the future, sorry about that!
> 
> thanks,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs
@ 2018-07-03 20:31 Lyude Paul
  0 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2018-07-03 20:31 UTC (permalink / raw)
  To: nouveau
  Cc: stable, Ben Skeggs, David Airlie, Daniel Vetter,
	Maarten Lankhorst, Ville Syrjälä,
	Archit Taneja, Ilia Mirkin, dri-devel, linux-kernel

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.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/nouveau/dispnv04/disp.c | 3 +++
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 6 ------
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 7 +++++++
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 501d2d290e9c..70dce544984e 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -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);
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 9382e99a0bc7..d9da69c83ae7 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -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,
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 775443c9af94..0452b18d36b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-26 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <153227752119282@kroah.com>
2018-07-23 17:13 ` [PATCH] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs Lyude Paul
2018-07-26 15:12   ` Greg KH
2018-07-26 15:48     ` Lyude Paul
2018-07-03 20:31 Lyude Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).