Message ID | 20240513064350.1050994-1-airlied@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | nouveau/firmware: using dma non-coherent interfaces for fw loading. | expand |
Hi Dave, kernel test robot noticed the following build errors: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on linus/master v6.9 next-20240513] [cannot apply to drm-tip/drm-tip] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/nouveau-firmware-using-dma-non-coherent-interfaces-for-fw-loading/20240513-144435 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20240513064350.1050994-1-airlied%40gmail.com patch subject: [PATCH] nouveau/firmware: using dma non-coherent interfaces for fw loading. config: parisc-defconfig (https://download.01.org/0day-ci/archive/20240513/202405131724.YtoCSRmy-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240513/202405131724.YtoCSRmy-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202405131724.YtoCSRmy-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/gpu/drm/nouveau/nvkm/core/firmware.c: In function 'nvkm_firmware_ctor': >> drivers/gpu/drm/nouveau/nvkm/core/firmware.c:242:54: error: passing argument 3 of 'dma_alloc_noncoherent' from incompatible pointer type [-Werror=incompatible-pointer-types] 242 | len, &fw->phys, | ^~~~~~~~~ | | | u64 * {aka long long unsigned int *} In file included from include/linux/pci.h:2693, from drivers/gpu/drm/nouveau/include/nvif/os.h:8, from drivers/gpu/drm/nouveau/include/nvkm/core/os.h:4, from drivers/gpu/drm/nouveau/include/nvkm/core/oclass.h:3, from drivers/gpu/drm/nouveau/include/nvkm/core/device.h:4, from drivers/gpu/drm/nouveau/nvkm/core/firmware.c:22: include/linux/dma-mapping.h:321:29: note: expected 'dma_addr_t *' {aka 'unsigned int *'} but argument is of type 'u64 *' {aka 'long long unsigned int *'} 321 | dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp) | ~~~~~~~~~~~~^~~~~~~~~~ cc1: some warnings being treated as errors vim +/dma_alloc_noncoherent +242 drivers/gpu/drm/nouveau/nvkm/core/firmware.c 224 225 int 226 nvkm_firmware_ctor(const struct nvkm_firmware_func *func, const char *name, 227 struct nvkm_device *device, const void *src, int len, struct nvkm_firmware *fw) 228 { 229 fw->func = func; 230 fw->name = name; 231 fw->device = device; 232 fw->len = len; 233 234 switch (fw->func->type) { 235 case NVKM_FIRMWARE_IMG_RAM: 236 fw->img = kmemdup(src, fw->len, GFP_KERNEL); 237 break; 238 case NVKM_FIRMWARE_IMG_DMA: { 239 len = ALIGN(fw->len, PAGE_SIZE); 240 241 fw->img = dma_alloc_noncoherent(fw->device->dev, > 242 len, &fw->phys,
Hi Dave, kernel test robot noticed the following build errors: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on drm-tip/drm-tip linus/master v6.9 next-20240513] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/nouveau-firmware-using-dma-non-coherent-interfaces-for-fw-loading/20240513-144435 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20240513064350.1050994-1-airlied%40gmail.com patch subject: [PATCH] nouveau/firmware: using dma non-coherent interfaces for fw loading. config: arm-defconfig (https://download.01.org/0day-ci/archive/20240513/202405132205.FVKltMCq-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240513/202405132205.FVKltMCq-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202405132205.FVKltMCq-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/gpu/drm/nouveau/nvkm/core/firmware.c:242:12: error: incompatible pointer types passing 'u64 *' (aka 'unsigned long long *') to parameter of type 'dma_addr_t *' (aka 'unsigned int *') [-Werror,-Wincompatible-pointer-types] len, &fw->phys, ^~~~~~~~~ include/linux/dma-mapping.h:321:15: note: passing argument to parameter 'dma_handle' here dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp) ^ 1 error generated. vim +242 drivers/gpu/drm/nouveau/nvkm/core/firmware.c 224 225 int 226 nvkm_firmware_ctor(const struct nvkm_firmware_func *func, const char *name, 227 struct nvkm_device *device, const void *src, int len, struct nvkm_firmware *fw) 228 { 229 fw->func = func; 230 fw->name = name; 231 fw->device = device; 232 fw->len = len; 233 234 switch (fw->func->type) { 235 case NVKM_FIRMWARE_IMG_RAM: 236 fw->img = kmemdup(src, fw->len, GFP_KERNEL); 237 break; 238 case NVKM_FIRMWARE_IMG_DMA: { 239 len = ALIGN(fw->len, PAGE_SIZE); 240 241 fw->img = dma_alloc_noncoherent(fw->device->dev, > 242 len, &fw->phys,
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c index adc60b25f8e6..c9bee980777c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c @@ -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); @@ -235,14 +236,14 @@ nvkm_firmware_ctor(const struct nvkm_firmware_func *func, const char *name, fw->img = kmemdup(src, fw->len, GFP_KERNEL); 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, &fw->phys, + DMA_TO_DEVICE, + GFP_KERNEL); if (fw->img) { memcpy(fw->img, src, fw->len); - fw->phys = addr; } sg_init_one(&fw->mem.sgl, fw->img, len); diff --git a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c index 80a480b12174..a1c8545f1249 100644 --- a/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c +++ b/drivers/gpu/drm/nouveau/nvkm/falcon/fw.c @@ -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);