[mani-mhi:mhi-next 21/30] drivers/bus/mhi/ep/main.c:213:34: sparse: sparse: incorrect type in argument 4 (different address spaces)

From: kernel test robot
Date: Wed Mar 02 2022 - 19:35:27 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git mhi-next
head: 4aa2b597db8f8808b7e0f89239cd98c3a56b21b1
commit: a0b0a77f43f02c80b9b942edf45233635cd6850f [21/30] bus: mhi: ep: Add support for powering up the MHI endpoint stack
config: ia64-randconfig-s031-20220302 (https://download.01.org/0day-ci/archive/20220303/202203030804.CVhSRnt6-lkp@xxxxxxxxx/config)
compiler: ia64-linux-gcc (GCC) 11.2.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-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git/commit/?id=a0b0a77f43f02c80b9b942edf45233635cd6850f
git remote add mani-mhi https://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git
git fetch --no-tags mani-mhi mhi-next
git checkout a0b0a77f43f02c80b9b942edf45233635cd6850f
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/bus/mhi/ep/ drivers/nvmem/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> drivers/bus/mhi/ep/main.c:213:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_cmd_ctxt *cmd_ctx_cache @@
drivers/bus/mhi/ep/main.c:213:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:213:34: sparse: got struct mhi_cmd_ctxt *cmd_ctx_cache
>> drivers/bus/mhi/ep/main.c:217:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_event_ctxt *ev_ctx_cache @@
drivers/bus/mhi/ep/main.c:217:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:217:34: sparse: got struct mhi_event_ctxt *ev_ctx_cache
>> drivers/bus/mhi/ep/main.c:221:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_chan_ctxt *ch_ctx_cache @@
drivers/bus/mhi/ep/main.c:221:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:221:34: sparse: got struct mhi_chan_ctxt *ch_ctx_cache
drivers/bus/mhi/ep/main.c:235:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_cmd_ctxt *cmd_ctx_cache @@
drivers/bus/mhi/ep/main.c:235:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:235:34: sparse: got struct mhi_cmd_ctxt *cmd_ctx_cache
drivers/bus/mhi/ep/main.c:237:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_event_ctxt *ev_ctx_cache @@
drivers/bus/mhi/ep/main.c:237:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:237:34: sparse: got struct mhi_event_ctxt *ev_ctx_cache
drivers/bus/mhi/ep/main.c:239:34: sparse: sparse: incorrect type in argument 4 (different address spaces) @@ expected void [noderef] __iomem *virt @@ got struct mhi_chan_ctxt *ch_ctx_cache @@
drivers/bus/mhi/ep/main.c:239:34: sparse: expected void [noderef] __iomem *virt
drivers/bus/mhi/ep/main.c:239:34: sparse: got struct mhi_chan_ctxt *ch_ctx_cache

vim +213 drivers/bus/mhi/ep/main.c

148
149 static int mhi_ep_cache_host_cfg(struct mhi_ep_cntrl *mhi_cntrl)
150 {
151 size_t cmd_ctx_host_size, ch_ctx_host_size, ev_ctx_host_size;
152 struct device *dev = &mhi_cntrl->mhi_dev->dev;
153 int ret;
154
155 /* Update the number of event rings (NER) programmed by the host */
156 mhi_ep_mmio_update_ner(mhi_cntrl);
157
158 dev_dbg(dev, "Number of Event rings: %u, HW Event rings: %u\n",
159 mhi_cntrl->event_rings, mhi_cntrl->hw_event_rings);
160
161 ch_ctx_host_size = sizeof(struct mhi_chan_ctxt) * mhi_cntrl->max_chan;
162 ev_ctx_host_size = sizeof(struct mhi_event_ctxt) * mhi_cntrl->event_rings;
163 cmd_ctx_host_size = sizeof(struct mhi_cmd_ctxt) * NR_OF_CMD_RINGS;
164
165 /* Get the channel context base pointer from host */
166 mhi_ep_mmio_get_chc_base(mhi_cntrl);
167
168 /* Allocate and map memory for caching host channel context */
169 ret = mhi_ep_alloc_map(mhi_cntrl, mhi_cntrl->ch_ctx_host_pa, ch_ctx_host_size,
170 &mhi_cntrl->ch_ctx_cache_phys,
171 (void __iomem **)&mhi_cntrl->ch_ctx_cache);
172 if (ret) {
173 dev_err(dev, "Failed to allocate and map ch_ctx_cache\n");
174 return ret;
175 }
176
177 /* Get the event context base pointer from host */
178 mhi_ep_mmio_get_erc_base(mhi_cntrl);
179
180 /* Allocate and map memory for caching host event context */
181 ret = mhi_ep_alloc_map(mhi_cntrl, mhi_cntrl->ev_ctx_host_pa, ev_ctx_host_size,
182 &mhi_cntrl->ev_ctx_cache_phys,
183 (void __iomem **)&mhi_cntrl->ev_ctx_cache);
184 if (ret) {
185 dev_err(dev, "Failed to allocate and map ev_ctx_cache\n");
186 goto err_ch_ctx;
187 }
188
189 /* Get the command context base pointer from host */
190 mhi_ep_mmio_get_crc_base(mhi_cntrl);
191
192 /* Allocate and map memory for caching host command context */
193 ret = mhi_ep_alloc_map(mhi_cntrl, mhi_cntrl->cmd_ctx_host_pa, cmd_ctx_host_size,
194 &mhi_cntrl->cmd_ctx_cache_phys,
195 (void __iomem **)&mhi_cntrl->cmd_ctx_cache);
196 if (ret) {
197 dev_err(dev, "Failed to allocate and map cmd_ctx_cache\n");
198 goto err_ev_ctx;
199 }
200
201 /* Initialize command ring */
202 ret = mhi_ep_ring_start(mhi_cntrl, &mhi_cntrl->mhi_cmd->ring,
203 (union mhi_ep_ring_ctx *)mhi_cntrl->cmd_ctx_cache);
204 if (ret) {
205 dev_err(dev, "Failed to start the command ring\n");
206 goto err_cmd_ctx;
207 }
208
209 return ret;
210
211 err_cmd_ctx:
212 mhi_ep_unmap_free(mhi_cntrl, mhi_cntrl->cmd_ctx_host_pa, mhi_cntrl->cmd_ctx_cache_phys,
> 213 mhi_cntrl->cmd_ctx_cache, cmd_ctx_host_size);
214
215 err_ev_ctx:
216 mhi_ep_unmap_free(mhi_cntrl, mhi_cntrl->ev_ctx_host_pa, mhi_cntrl->ev_ctx_cache_phys,
> 217 mhi_cntrl->ev_ctx_cache, ev_ctx_host_size);
218
219 err_ch_ctx:
220 mhi_ep_unmap_free(mhi_cntrl, mhi_cntrl->ch_ctx_host_pa, mhi_cntrl->ch_ctx_cache_phys,
> 221 mhi_cntrl->ch_ctx_cache, ch_ctx_host_size);
222
223 return ret;
224 }
225

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx