Commit 2adffd22 authored by Dave Airlie's avatar Dave Airlie Committed by Wen Zhiwei
Browse files

nouveau: fw: sync dma after setup is called.

stable inclusion
from stable-v6.6.63
commit 16abd7ce81e4fedd058035d4644b3882af16732d
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBI1RP

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=16abd7ce81e4fedd058035d4644b3882af16732d



--------------------------------

commit 21ec425eaf2cb7c0371f7683f81ad7d9679b6eb5 upstream.

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: default avatarDiogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Tested-by: default avatarDiogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Fixes: 9b340aeb26d5 ("nouveau/firmware: use dma non-coherent allocator")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241114004603.3095485-1-airlied@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 3ef76c6a
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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;