lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202301112313.9He3Rw1Y-lkp@intel.com>
Date:   Wed, 11 Jan 2023 23:20:06 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Peng Fan (OSS)" <peng.fan@....nxp.com>, andersson@...nel.org,
        mathieu.poirier@...aro.org, shawnguo@...nel.org,
        s.hauer@...gutronix.de, arnaud.pouliquen@...s.st.com
Cc:     oe-kbuild-all@...ts.linux.dev, kernel@...gutronix.de,
        festevam@...il.com, linux-imx@....com,
        linux-remoteproc@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Peng Fan <peng.fan@....com>
Subject: Re: [PATCH 4/5] remoteproc: imx_rproc: set Cortex-M stack/pc to TCML

Hi Peng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on remoteproc/rproc-next]
[also build test WARNING on linus/master v6.2-rc3 next-20230111]
[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/Peng-Fan-OSS/remoteproc-elf_loader-introduce-rproc_elf_find_shdr/20230106-114403
base:   git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rproc-next
patch link:    https://lore.kernel.org/r/20230106034305.2868740-5-peng.fan%40oss.nxp.com
patch subject: [PATCH 4/5] remoteproc: imx_rproc: set Cortex-M stack/pc to TCML
config: arm-randconfig-s031-20230110
compiler: arm-linux-gnueabi-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://github.com/intel-lab-lkp/linux/commit/40239477bcfaaea196729da9c6e4b68b862eeff7
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Peng-Fan-OSS/remoteproc-elf_loader-introduce-rproc_elf_find_shdr/20230106-114403
        git checkout 40239477bcfaaea196729da9c6e4b68b862eeff7
        # 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=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash drivers/remoteproc/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

sparse warnings: (new ones prefixed by >>)
   drivers/remoteproc/imx_rproc.c:503:12: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *va @@     got void [noderef] __iomem * @@
   drivers/remoteproc/imx_rproc.c:503:12: sparse:     expected void *va
   drivers/remoteproc/imx_rproc.c:503:12: sparse:     got void [noderef] __iomem *
   drivers/remoteproc/imx_rproc.c:520:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *va @@
   drivers/remoteproc/imx_rproc.c:520:20: sparse:     expected void volatile [noderef] __iomem *io_addr
   drivers/remoteproc/imx_rproc.c:520:20: sparse:     got void *va
   drivers/remoteproc/imx_rproc.c:636:17: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/remoteproc/imx_rproc.c:665:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void *[assigned] va @@
   drivers/remoteproc/imx_rproc.c:665:17: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/remoteproc/imx_rproc.c:665:17: sparse:     got void *[assigned] va
>> drivers/remoteproc/imx_rproc.c:666:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void * @@
   drivers/remoteproc/imx_rproc.c:666:17: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/remoteproc/imx_rproc.c:666:17: sparse:     got void *

vim +665 drivers/remoteproc/imx_rproc.c

   495	
   496	static int imx_rproc_mem_alloc(struct rproc *rproc,
   497				       struct rproc_mem_entry *mem)
   498	{
   499		struct device *dev = rproc->dev.parent;
   500		void *va;
   501	
   502		dev_dbg(dev, "map memory: %p+%zx\n", &mem->dma, mem->len);
 > 503		va = ioremap_wc(mem->dma, mem->len);
   504		if (IS_ERR_OR_NULL(va)) {
   505			dev_err(dev, "Unable to map memory region: %p+%zx\n",
   506				&mem->dma, mem->len);
   507			return -ENOMEM;
   508		}
   509	
   510		/* Update memory entry va */
   511		mem->va = va;
   512	
   513		return 0;
   514	}
   515	
   516	static int imx_rproc_mem_release(struct rproc *rproc,
   517					 struct rproc_mem_entry *mem)
   518	{
   519		dev_dbg(rproc->dev.parent, "unmap memory: %pa\n", &mem->dma);
   520		iounmap(mem->va);
   521	
   522		return 0;
   523	}
   524	
   525	static int imx_rproc_prepare(struct rproc *rproc)
   526	{
   527		struct imx_rproc *priv = rproc->priv;
   528		struct device_node *np = priv->dev->of_node;
   529		struct of_phandle_iterator it;
   530		struct rproc_mem_entry *mem;
   531		struct reserved_mem *rmem;
   532		u32 da;
   533	
   534		/* Register associated reserved memory regions */
   535		of_phandle_iterator_init(&it, np, "memory-region", NULL, 0);
   536		while (of_phandle_iterator_next(&it) == 0) {
   537			/*
   538			 * Ignore the first memory region which will be used vdev buffer.
   539			 * No need to do extra handlings, rproc_add_virtio_dev will handle it.
   540			 */
   541			if (!strcmp(it.node->name, "vdev0buffer"))
   542				continue;
   543	
   544			if (!strcmp(it.node->name, "rsc-table"))
   545				continue;
   546	
   547			rmem = of_reserved_mem_lookup(it.node);
   548			if (!rmem) {
   549				dev_err(priv->dev, "unable to acquire memory-region\n");
   550				return -EINVAL;
   551			}
   552	
   553			/* No need to translate pa to da, i.MX use same map */
   554			da = rmem->base;
   555	
   556			/* Register memory region */
   557			mem = rproc_mem_entry_init(priv->dev, NULL, (dma_addr_t)rmem->base, rmem->size, da,
   558						   imx_rproc_mem_alloc, imx_rproc_mem_release,
   559						   it.node->name);
   560	
   561			if (mem)
   562				rproc_coredump_add_segment(rproc, da, rmem->size);
   563			else
   564				return -ENOMEM;
   565	
   566			rproc_add_carveout(rproc, mem);
   567		}
   568	
   569		return  0;
   570	}
   571	
   572	static int imx_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
   573	{
   574		int ret;
   575	
   576		ret = rproc_elf_load_rsc_table(rproc, fw);
   577		if (ret)
   578			dev_info(&rproc->dev, "No resource table in elf\n");
   579	
   580		return 0;
   581	}
   582	
   583	static void imx_rproc_kick(struct rproc *rproc, int vqid)
   584	{
   585		struct imx_rproc *priv = rproc->priv;
   586		int err;
   587		__u32 mmsg;
   588	
   589		if (!priv->tx_ch) {
   590			dev_err(priv->dev, "No initialized mbox tx channel\n");
   591			return;
   592		}
   593	
   594		/*
   595		 * Send the index of the triggered virtqueue as the mu payload.
   596		 * Let remote processor know which virtqueue is used.
   597		 */
   598		mmsg = vqid << 16;
   599	
   600		err = mbox_send_message(priv->tx_ch, (void *)&mmsg);
   601		if (err < 0)
   602			dev_err(priv->dev, "%s: failed (%d, err:%d)\n",
   603				__func__, vqid, err);
   604	}
   605	
   606	static int imx_rproc_attach(struct rproc *rproc)
   607	{
   608		return imx_rproc_xtr_mbox_init(rproc);
   609	}
   610	
   611	static int imx_rproc_detach(struct rproc *rproc)
   612	{
   613		struct imx_rproc *priv = rproc->priv;
   614		const struct imx_rproc_dcfg *dcfg = priv->dcfg;
   615	
   616		if (dcfg->method != IMX_RPROC_SCU_API)
   617			return -EOPNOTSUPP;
   618	
   619		if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id))
   620			return -EOPNOTSUPP;
   621	
   622		imx_rproc_free_mbox(rproc);
   623	
   624		return 0;
   625	}
   626	
   627	static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz)
   628	{
   629		struct imx_rproc *priv = rproc->priv;
   630	
   631		/* The resource table has already been mapped in imx_rproc_addr_init */
   632		if (!priv->rsc_table)
   633			return NULL;
   634	
   635		*table_sz = SZ_1K;
   636		return (struct resource_table *)priv->rsc_table;
   637	}
   638	
   639	static u64 imx_rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
   640	{
   641		struct imx_rproc *priv = rproc->priv;
   642		const u8 *elf_data = (void *)fw->data;
   643		u8 class = fw_elf_get_class(fw);
   644		u64 bootaddr = rproc_elf_get_boot_addr(rproc, fw);
   645		const void *shdr;
   646		void *va;
   647		u64 sh_addr, offset;
   648	
   649		if (priv->dcfg->devtype == IMX_RPROC_IMX8M) {
   650			/*
   651			 * i.MX8M Cortex-M requires [stack, pc] be put in address
   652			 * [0, 4], so the da address is 0, size is 8 words.
   653			 */
   654			va = rproc_da_to_va(rproc, 0, 8, NULL);
   655			shdr = rproc_elf_find_shdr(rproc, fw, ".interrupts");
   656			if (!shdr || !va)
   657				return bootaddr;
   658			sh_addr = elf_shdr_get_sh_addr(class, shdr);
   659			offset = elf_shdr_get_sh_offset(class, shdr);
   660	
   661			/*
   662			 * Write stack, pc to TCML start address. The TCML region
   663			 * is marked with ATT_IOMEM, so use writel.
   664			 */
 > 665			writel(*(u32 *)(elf_data + offset), va);
 > 666			writel(*(u32 *)(elf_data + offset + 4), va + 4);
   667		}
   668	
   669		return bootaddr;
   670	}
   671	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

View attachment "config" of type "text/plain" (184905 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ