All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nouveau: fw: sync dma after setup is called.
@ 2024-11-14  0:46 Dave Airlie
  2024-11-14  1:10 ` Ben Skeggs
  2024-11-25 16:55 ` Danilo Krummrich
  0 siblings, 2 replies; 3+ messages in thread
From: Dave Airlie @ 2024-11-14  0:46 UTC (permalink / raw)
  To: dri-devel; +Cc: nouveau

From: Dave Airlie <airlied@redhat.com>

When this code moved to non-coherent allocator the sync was put too
early for some firmwares which called the setup function, move the
sync down after the setup function.

Reported-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Tested-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Fixes: 9b340aeb26d5 ("nouveau/firmware: use dma non-coherent allocator")
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/falcon/fw.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
index a1c8545f1249..cac6d64ab67d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
+++ b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
@@ -89,11 +89,6 @@ nvkm_falcon_fw_boot(struct nvkm_falcon_fw *fw, struct nvkm_subdev *user,
 		nvkm_falcon_fw_dtor_sigs(fw);
 	}
 
-	/* after last write to the img, sync dma mappings */
-	dma_sync_single_for_device(fw->fw.device->dev,
-				   fw->fw.phys,
-				   sg_dma_len(&fw->fw.mem.sgl),
-				   DMA_TO_DEVICE);
 
 	FLCNFW_DBG(fw, "resetting");
 	fw->func->reset(fw);
@@ -105,6 +100,12 @@ nvkm_falcon_fw_boot(struct nvkm_falcon_fw *fw, struct nvkm_subdev *user,
 			goto done;
 	}
 
+	/* after last write to the img, sync dma mappings */
+	dma_sync_single_for_device(fw->fw.device->dev,
+				   fw->fw.phys,
+				   sg_dma_len(&fw->fw.mem.sgl),
+				   DMA_TO_DEVICE);
+
 	ret = fw->func->load(fw);
 	if (ret)
 		goto done;
-- 
2.47.0


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

* Re: [PATCH] nouveau: fw: sync dma after setup is called.
  2024-11-14  0:46 [PATCH] nouveau: fw: sync dma after setup is called Dave Airlie
@ 2024-11-14  1:10 ` Ben Skeggs
  2024-11-25 16:55 ` Danilo Krummrich
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Skeggs @ 2024-11-14  1:10 UTC (permalink / raw)
  To: nouveau

On 14/11/24 10:46, Dave Airlie wrote:

> From: Dave Airlie <airlied@redhat.com>
>
> When this code moved to non-coherent allocator the sync was put too
> early for some firmwares which called the setup function, move the
> sync down after the setup function.
>
> Reported-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
> Tested-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
> Fixes: 9b340aeb26d5 ("nouveau/firmware: use dma non-coherent allocator")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Ben Skeggs <bskeggs@nvidia.com>

> ---
>   drivers/gpu/drm/nouveau/nvkm/falcon/fw.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
> index a1c8545f1249..cac6d64ab67d 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
> @@ -89,11 +89,6 @@ nvkm_falcon_fw_boot(struct nvkm_falcon_fw *fw, struct nvkm_subdev *user,
>   		nvkm_falcon_fw_dtor_sigs(fw);
>   	}
>   
> -	/* after last write to the img, sync dma mappings */
> -	dma_sync_single_for_device(fw->fw.device->dev,
> -				   fw->fw.phys,
> -				   sg_dma_len(&fw->fw.mem.sgl),
> -				   DMA_TO_DEVICE);
>   
>   	FLCNFW_DBG(fw, "resetting");
>   	fw->func->reset(fw);
> @@ -105,6 +100,12 @@ nvkm_falcon_fw_boot(struct nvkm_falcon_fw *fw, struct nvkm_subdev *user,
>   			goto done;
>   	}
>   
> +	/* after last write to the img, sync dma mappings */
> +	dma_sync_single_for_device(fw->fw.device->dev,
> +				   fw->fw.phys,
> +				   sg_dma_len(&fw->fw.mem.sgl),
> +				   DMA_TO_DEVICE);
> +
>   	ret = fw->func->load(fw);
>   	if (ret)
>   		goto done;

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

* Re: [PATCH] nouveau: fw: sync dma after setup is called.
  2024-11-14  0:46 [PATCH] nouveau: fw: sync dma after setup is called Dave Airlie
  2024-11-14  1:10 ` Ben Skeggs
@ 2024-11-25 16:55 ` Danilo Krummrich
  1 sibling, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2024-11-25 16:55 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel, nouveau

On 11/14/24 1:46 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> When this code moved to non-coherent allocator the sync was put too
> early for some firmwares which called the setup function, move the
> sync down after the setup function.
> 
> Reported-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>

Do you have a link of where this issue has been reported?

> Tested-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
> Fixes: 9b340aeb26d5 ("nouveau/firmware: use dma non-coherent allocator")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>   drivers/gpu/drm/nouveau/nvkm/falcon/fw.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
> index a1c8545f1249..cac6d64ab67d 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c
> @@ -89,11 +89,6 @@ nvkm_falcon_fw_boot(struct nvkm_falcon_fw *fw, struct nvkm_subdev *user,
>   		nvkm_falcon_fw_dtor_sigs(fw);
>   	}
>   
> -	/* after last write to the img, sync dma mappings */
> -	dma_sync_single_for_device(fw->fw.device->dev,
> -				   fw->fw.phys,
> -				   sg_dma_len(&fw->fw.mem.sgl),
> -				   DMA_TO_DEVICE);
>   
>   	FLCNFW_DBG(fw, "resetting");
>   	fw->func->reset(fw);
> @@ -105,6 +100,12 @@ nvkm_falcon_fw_boot(struct nvkm_falcon_fw *fw, struct nvkm_subdev *user,
>   			goto done;
>   	}
>   
> +	/* after last write to the img, sync dma mappings */
> +	dma_sync_single_for_device(fw->fw.device->dev,
> +				   fw->fw.phys,
> +				   sg_dma_len(&fw->fw.mem.sgl),
> +				   DMA_TO_DEVICE);
> +
>   	ret = fw->func->load(fw);
>   	if (ret)
>   		goto done;


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

end of thread, other threads:[~2024-11-25 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-14  0:46 [PATCH] nouveau: fw: sync dma after setup is called Dave Airlie
2024-11-14  1:10 ` Ben Skeggs
2024-11-25 16:55 ` Danilo Krummrich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.