drivers/remoteproc/imx_dsp_rproc.c:602:49: sparse: sparse: incorrect type in argument 2 (different address spaces)
From: kernel test robot
Date: Tue Aug 09 2022 - 13:27:32 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eb555cb5b794f4e12a9897f3d46d5a72104cd4a7
commit: ec0e5549f3586d2cb99a05edd006d722ebad912c remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX
date: 10 months ago
config: arm64-randconfig-s041-20220808 (https://download.01.org/0day-ci/archive/20220810/202208100114.eOo1r59A-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ec0e5549f3586d2cb99a05edd006d722ebad912c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ec0e5549f3586d2cb99a05edd006d722ebad912c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/remoteproc/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> drivers/remoteproc/imx_dsp_rproc.c:602:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *va @@ got void [noderef] __iomem *[assigned] cpu_addr @@
drivers/remoteproc/imx_dsp_rproc.c:602:49: sparse: expected void *va
drivers/remoteproc/imx_dsp_rproc.c:602:49: sparse: got void [noderef] __iomem *[assigned] cpu_addr
drivers/remoteproc/imx_dsp_rproc.c:638:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *va @@ got void [noderef] __iomem *[assigned] cpu_addr @@
drivers/remoteproc/imx_dsp_rproc.c:638:49: sparse: expected void *va
drivers/remoteproc/imx_dsp_rproc.c:638:49: sparse: got void [noderef] __iomem *[assigned] cpu_addr
vim +602 drivers/remoteproc/imx_dsp_rproc.c
563
564 /**
565 * imx_dsp_rproc_add_carveout() - request mailbox channels
566 * @priv: private data pointer
567 *
568 * This function registers specified memory entry in @rproc carveouts list
569 * The carveouts can help to mapping the memory address for DSP.
570 */
571 static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv)
572 {
573 const struct imx_dsp_rproc_dcfg *dsp_dcfg = priv->dsp_dcfg;
574 const struct imx_rproc_dcfg *dcfg = dsp_dcfg->dcfg;
575 struct rproc *rproc = priv->rproc;
576 struct device *dev = rproc->dev.parent;
577 struct device_node *np = dev->of_node;
578 struct of_phandle_iterator it;
579 struct rproc_mem_entry *mem;
580 struct reserved_mem *rmem;
581 void __iomem *cpu_addr;
582 int a;
583 u64 da;
584
585 /* Remap required addresses */
586 for (a = 0; a < dcfg->att_size; a++) {
587 const struct imx_rproc_att *att = &dcfg->att[a];
588
589 if (!(att->flags & ATT_OWN))
590 continue;
591
592 if (imx_dsp_rproc_sys_to_da(priv, att->sa, att->size, &da))
593 return -EINVAL;
594
595 cpu_addr = devm_ioremap_wc(dev, att->sa, att->size);
596 if (!cpu_addr) {
597 dev_err(dev, "failed to map memory %p\n", &att->sa);
598 return -ENOMEM;
599 }
600
601 /* Register memory region */
> 602 mem = rproc_mem_entry_init(dev, cpu_addr, (dma_addr_t)att->sa,
603 att->size, da, NULL, NULL, "dsp_mem");
604
605 if (mem)
606 rproc_coredump_add_segment(rproc, da, att->size);
607 else
608 return -ENOMEM;
609
610 rproc_add_carveout(rproc, mem);
611 }
612
613 of_phandle_iterator_init(&it, np, "memory-region", NULL, 0);
614 while (of_phandle_iterator_next(&it) == 0) {
615 /*
616 * Ignore the first memory region which will be used vdev buffer.
617 * No need to do extra handlings, rproc_add_virtio_dev will handle it.
618 */
619 if (!strcmp(it.node->name, "vdev0buffer"))
620 continue;
621
622 rmem = of_reserved_mem_lookup(it.node);
623 if (!rmem) {
624 dev_err(dev, "unable to acquire memory-region\n");
625 return -EINVAL;
626 }
627
628 if (imx_dsp_rproc_sys_to_da(priv, rmem->base, rmem->size, &da))
629 return -EINVAL;
630
631 cpu_addr = devm_ioremap_wc(dev, rmem->base, rmem->size);
632 if (!cpu_addr) {
633 dev_err(dev, "failed to map memory %p\n", &rmem->base);
634 return -ENOMEM;
635 }
636
637 /* Register memory region */
638 mem = rproc_mem_entry_init(dev, cpu_addr, (dma_addr_t)rmem->base,
639 rmem->size, da, NULL, NULL, it.node->name);
640
641 if (mem)
642 rproc_coredump_add_segment(rproc, da, rmem->size);
643 else
644 return -ENOMEM;
645
646 rproc_add_carveout(rproc, mem);
647 }
648
649 return 0;
650 }
651
--
0-DAY CI Kernel Test Service
https://01.org/lkp