diff mbox series

nouveau: fix devinit paths to only handle display on GSP.

Message ID 20240408064243.2219527-1-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series nouveau: fix devinit paths to only handle display on GSP. | expand

Commit Message

Dave Airlie April 8, 2024, 6:42 a.m. UTC
This reverts:
nouveau/gsp: don't check devinit disable on GSP.
and applies a further fix.

It turns out the open gpu driver, checks this register, but only for display.

Match that behaviour and only disable displays on turings.

Fixes: 5d4e8ae6e57b ("nouveau/gsp: don't check devinit disable on GSP.")
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c | 12 ++++++++----
 drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c  |  1 +
 2 files changed, 9 insertions(+), 4 deletions(-)

Comments

Danilo Krummrich April 8, 2024, 12:02 p.m. UTC | #1
On 4/8/24 08:42, Dave Airlie wrote:
> This reverts:
> nouveau/gsp: don't check devinit disable on GSP.
> and applies a further fix.
> 
> It turns out the open gpu driver, checks this register, but only for display.
> 
> Match that behaviour and only disable displays on turings.
> 
> Fixes: 5d4e8ae6e57b ("nouveau/gsp: don't check devinit disable on GSP.")
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Danilo Krummrich <dakr@redhat.com>

> ---
>   drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c | 12 ++++++++----
>   drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c  |  1 +
>   2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
> index 7bcbc4895ec2..271bfa038f5b 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
> @@ -25,6 +25,7 @@
>   
>   #include <subdev/bios.h>
>   #include <subdev/bios/init.h>
> +#include <subdev/gsp.h>
>   
>   void
>   gm107_devinit_disable(struct nvkm_devinit *init)
> @@ -33,10 +34,13 @@ gm107_devinit_disable(struct nvkm_devinit *init)
>   	u32 r021c00 = nvkm_rd32(device, 0x021c00);
>   	u32 r021c04 = nvkm_rd32(device, 0x021c04);
>   
> -	if (r021c00 & 0x00000001)
> -		nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
> -	if (r021c00 & 0x00000004)
> -		nvkm_subdev_disable(device, NVKM_ENGINE_CE, 2);
> +	/* gsp only wants to enable/disable display */
> +	if (!nvkm_gsp_rm(device->gsp)) {
> +		if (r021c00 & 0x00000001)
> +			nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
> +		if (r021c00 & 0x00000004)
> +			nvkm_subdev_disable(device, NVKM_ENGINE_CE, 2);
> +	}
>   	if (r021c04 & 0x00000001)
>   		nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
>   }
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
> index 11b4c9c274a1..666eb93b1742 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
> @@ -41,6 +41,7 @@ r535_devinit_new(const struct nvkm_devinit_func *hw,
>   
>   	rm->dtor = r535_devinit_dtor;
>   	rm->post = hw->post;
> +	rm->disable = hw->disable;
>   
>   	ret = nv50_devinit_new_(rm, device, type, inst, pdevinit);
>   	if (ret)
Timur Tabi April 8, 2024, 1:04 p.m. UTC | #2
On Mon, 2024-04-08 at 16:42 +1000, Dave Airlie wrote:
> This reverts:
> nouveau/gsp: don't check devinit disable on GSP.
> and applies a further fix.
> 
> It turns out the open gpu driver, checks this register, but only for
> display.
> 
> Match that behaviour and only disable displays on turings.

Why only on Turings?
Dave Airlie April 9, 2024, 3:12 a.m. UTC | #3
On Mon, 8 Apr 2024 at 23:05, Timur Tabi <ttabi@nvidia.com> wrote:
>
> On Mon, 2024-04-08 at 16:42 +1000, Dave Airlie wrote:
> > This reverts:
> > nouveau/gsp: don't check devinit disable on GSP.
> > and applies a further fix.
> >
> > It turns out the open gpu driver, checks this register, but only for
> > display.
> >
> > Match that behaviour and only disable displays on turings.
>
> Why only on Turings?

The only is for disabling displays, not for the turings. The ampere
devinit path only handle displays, it never tries to disable other
engines so should be fine.

Dave.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
index 7bcbc4895ec2..271bfa038f5b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c
@@ -25,6 +25,7 @@ 
 
 #include <subdev/bios.h>
 #include <subdev/bios/init.h>
+#include <subdev/gsp.h>
 
 void
 gm107_devinit_disable(struct nvkm_devinit *init)
@@ -33,10 +34,13 @@  gm107_devinit_disable(struct nvkm_devinit *init)
 	u32 r021c00 = nvkm_rd32(device, 0x021c00);
 	u32 r021c04 = nvkm_rd32(device, 0x021c04);
 
-	if (r021c00 & 0x00000001)
-		nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
-	if (r021c00 & 0x00000004)
-		nvkm_subdev_disable(device, NVKM_ENGINE_CE, 2);
+	/* gsp only wants to enable/disable display */
+	if (!nvkm_gsp_rm(device->gsp)) {
+		if (r021c00 & 0x00000001)
+			nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
+		if (r021c00 & 0x00000004)
+			nvkm_subdev_disable(device, NVKM_ENGINE_CE, 2);
+	}
 	if (r021c04 & 0x00000001)
 		nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
index 11b4c9c274a1..666eb93b1742 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
@@ -41,6 +41,7 @@  r535_devinit_new(const struct nvkm_devinit_func *hw,
 
 	rm->dtor = r535_devinit_dtor;
 	rm->post = hw->post;
+	rm->disable = hw->disable;
 
 	ret = nv50_devinit_new_(rm, device, type, inst, pdevinit);
 	if (ret)