Skip to content

Commit 5159b9d

Browse files
committed
Merge tag 'drm-misc-fixes-2024-08-22' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
Short summary of fixes pull: nouveau: - firmware: use dma non-coherent allocator Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents b069f63 + 9b340ae commit 5159b9d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/gpu/drm/nouveau/nvkm/core/firmware.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ nvkm_firmware_dtor(struct nvkm_firmware *fw)
205205
break;
206206
case NVKM_FIRMWARE_IMG_DMA:
207207
nvkm_memory_unref(&memory);
208-
dma_free_coherent(fw->device->dev, sg_dma_len(&fw->mem.sgl), fw->img, fw->phys);
208+
dma_free_noncoherent(fw->device->dev, sg_dma_len(&fw->mem.sgl),
209+
fw->img, fw->phys, DMA_TO_DEVICE);
209210
break;
210211
case NVKM_FIRMWARE_IMG_SGT:
211212
nvkm_memory_unref(&memory);
@@ -236,10 +237,12 @@ nvkm_firmware_ctor(const struct nvkm_firmware_func *func, const char *name,
236237
break;
237238
case NVKM_FIRMWARE_IMG_DMA: {
238239
dma_addr_t addr;
239-
240240
len = ALIGN(fw->len, PAGE_SIZE);
241241

242-
fw->img = dma_alloc_coherent(fw->device->dev, len, &addr, GFP_KERNEL);
242+
fw->img = dma_alloc_noncoherent(fw->device->dev,
243+
len, &addr,
244+
DMA_TO_DEVICE,
245+
GFP_KERNEL);
243246
if (fw->img) {
244247
memcpy(fw->img, src, fw->len);
245248
fw->phys = addr;

drivers/gpu/drm/nouveau/nvkm/falcon/fw.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ nvkm_falcon_fw_boot(struct nvkm_falcon_fw *fw, struct nvkm_subdev *user,
8989
nvkm_falcon_fw_dtor_sigs(fw);
9090
}
9191

92+
/* after last write to the img, sync dma mappings */
93+
dma_sync_single_for_device(fw->fw.device->dev,
94+
fw->fw.phys,
95+
sg_dma_len(&fw->fw.mem.sgl),
96+
DMA_TO_DEVICE);
97+
9298
FLCNFW_DBG(fw, "resetting");
9399
fw->func->reset(fw);
94100

0 commit comments

Comments
 (0)