Short summary of fixes pull:

nouveau:
 - firmware: use dma non-coherent allocator
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmbHMTIACgkQaA3BHVML
 eiOvGQf8DKiJoFPkuTdgWe2PHxBcIyCMUFuntzSHuEnmPQLTKR5Vf/QH2jbe2gM0
 DuPEK94BWXcxBw0gVsZxNTSURueWMBWbbFJPaKHUdytAWnzDyQZQLzcbL2HJ6YiL
 0VqJoEFZZnQI3Z1eNN8e7aZowLrwCa8gm+7Lqam9dXt5zYMV1jQiKQhyw8l1VrSw
 KdT8VUMOnLRQ7LwiF6zyjtpbsWoCZaryKtSMGNMSnTDJKy7t4kVCbOTuCM5Go9cD
 nNjvr+WZKYjGGP8b7+cSIz8tezAtVJk5a+dZGRvyFg6mowohG7+jysEPUb54kSWO
 WpX03PxTJi2oLWlbRhMruqXRsDA+YQ==
 =E4GZ
 -----END PGP SIGNATURE-----

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 <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240822123907.GA234335@localhost.localdomain
This commit is contained in:
Dave Airlie 2024-08-23 09:08:18 +10:00
commit 5159b9dcfa
2 changed files with 12 additions and 3 deletions

View File

@ -205,7 +205,8 @@ nvkm_firmware_dtor(struct nvkm_firmware *fw)
break;
case NVKM_FIRMWARE_IMG_DMA:
nvkm_memory_unref(&memory);
dma_free_coherent(fw->device->dev, sg_dma_len(&fw->mem.sgl), fw->img, fw->phys);
dma_free_noncoherent(fw->device->dev, sg_dma_len(&fw->mem.sgl),
fw->img, fw->phys, DMA_TO_DEVICE);
break;
case NVKM_FIRMWARE_IMG_SGT:
nvkm_memory_unref(&memory);
@ -236,10 +237,12 @@ nvkm_firmware_ctor(const struct nvkm_firmware_func *func, const char *name,
break;
case NVKM_FIRMWARE_IMG_DMA: {
dma_addr_t addr;
len = ALIGN(fw->len, PAGE_SIZE);
fw->img = dma_alloc_coherent(fw->device->dev, len, &addr, GFP_KERNEL);
fw->img = dma_alloc_noncoherent(fw->device->dev,
len, &addr,
DMA_TO_DEVICE,
GFP_KERNEL);
if (fw->img) {
memcpy(fw->img, src, fw->len);
fw->phys = addr;

View File

@ -89,6 +89,12 @@ 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);