drivers/soc/qcom/smsm.c:152:22: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Sat Nov 21 2020 - 15:05:47 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 27bba9c532a8d21050b94224ffd310ad0058c353
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date: 3 months ago
config: sh-randconfig-s032-20201122 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.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.3-134-gb59dbdaf-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5fc436f06eef54ef512ea55a9db8eb9f2e76959
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh

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/soc/qcom/smsm.c:152:22: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] *local_state @@
>> drivers/soc/qcom/smsm.c:152:22: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:152:22: sparse: got unsigned int [usertype] *local_state
drivers/soc/qcom/smsm.c:164:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] *local_state @@
drivers/soc/qcom/smsm.c:164:9: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:164:9: sparse: got unsigned int [usertype] *local_state
>> drivers/soc/qcom/smsm.c:174:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] * @@
drivers/soc/qcom/smsm.c:174:23: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:174:23: sparse: got unsigned int [usertype] *
>> drivers/soc/qcom/smsm.c:206:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] *remote_state @@
drivers/soc/qcom/smsm.c:206:15: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:206:15: sparse: got unsigned int [usertype] *remote_state
drivers/soc/qcom/smsm.c:245:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] * @@
drivers/soc/qcom/smsm.c:245:23: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:245:23: sparse: got unsigned int [usertype] *
drivers/soc/qcom/smsm.c:247:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] * @@
drivers/soc/qcom/smsm.c:247:17: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:247:17: sparse: got unsigned int [usertype] *
drivers/soc/qcom/smsm.c:272:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] * @@
drivers/soc/qcom/smsm.c:272:23: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:272:23: sparse: got unsigned int [usertype] *
drivers/soc/qcom/smsm.c:274:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] * @@
drivers/soc/qcom/smsm.c:274:17: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:274:17: sparse: got unsigned int [usertype] *
drivers/soc/qcom/smsm.c:569:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int [usertype] * @@
drivers/soc/qcom/smsm.c:569:17: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/soc/qcom/smsm.c:569:17: sparse: got unsigned int [usertype] *

vim +152 drivers/soc/qcom/smsm.c

c97c4090ff72297 Bjorn Andersson 2015-09-24 129
c97c4090ff72297 Bjorn Andersson 2015-09-24 130 /**
c97c4090ff72297 Bjorn Andersson 2015-09-24 131 * smsm_update_bits() - change bit in outgoing entry and inform subscribers
c97c4090ff72297 Bjorn Andersson 2015-09-24 132 * @data: smsm context pointer
c97c4090ff72297 Bjorn Andersson 2015-09-24 133 * @offset: bit in the entry
c97c4090ff72297 Bjorn Andersson 2015-09-24 134 * @value: new value
c97c4090ff72297 Bjorn Andersson 2015-09-24 135 *
c97c4090ff72297 Bjorn Andersson 2015-09-24 136 * Used to set and clear the bits in the outgoing/local entry and inform
c97c4090ff72297 Bjorn Andersson 2015-09-24 137 * subscribers about the change.
c97c4090ff72297 Bjorn Andersson 2015-09-24 138 */
c97c4090ff72297 Bjorn Andersson 2015-09-24 139 static int smsm_update_bits(void *data, u32 mask, u32 value)
c97c4090ff72297 Bjorn Andersson 2015-09-24 140 {
c97c4090ff72297 Bjorn Andersson 2015-09-24 141 struct qcom_smsm *smsm = data;
c97c4090ff72297 Bjorn Andersson 2015-09-24 142 struct smsm_host *hostp;
c97c4090ff72297 Bjorn Andersson 2015-09-24 143 unsigned long flags;
c97c4090ff72297 Bjorn Andersson 2015-09-24 144 u32 changes;
c97c4090ff72297 Bjorn Andersson 2015-09-24 145 u32 host;
c97c4090ff72297 Bjorn Andersson 2015-09-24 146 u32 orig;
c97c4090ff72297 Bjorn Andersson 2015-09-24 147 u32 val;
c97c4090ff72297 Bjorn Andersson 2015-09-24 148
c97c4090ff72297 Bjorn Andersson 2015-09-24 149 spin_lock_irqsave(&smsm->lock, flags);
c97c4090ff72297 Bjorn Andersson 2015-09-24 150
c97c4090ff72297 Bjorn Andersson 2015-09-24 151 /* Update the entry */
c97c4090ff72297 Bjorn Andersson 2015-09-24 @152 val = orig = readl(smsm->local_state);
c97c4090ff72297 Bjorn Andersson 2015-09-24 153 val &= ~mask;
c97c4090ff72297 Bjorn Andersson 2015-09-24 154 val |= value;
c97c4090ff72297 Bjorn Andersson 2015-09-24 155
c97c4090ff72297 Bjorn Andersson 2015-09-24 156 /* Don't signal if we didn't change the value */
c97c4090ff72297 Bjorn Andersson 2015-09-24 157 changes = val ^ orig;
c97c4090ff72297 Bjorn Andersson 2015-09-24 158 if (!changes) {
c97c4090ff72297 Bjorn Andersson 2015-09-24 159 spin_unlock_irqrestore(&smsm->lock, flags);
c97c4090ff72297 Bjorn Andersson 2015-09-24 160 goto done;
c97c4090ff72297 Bjorn Andersson 2015-09-24 161 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 162
c97c4090ff72297 Bjorn Andersson 2015-09-24 163 /* Write out the new value */
c97c4090ff72297 Bjorn Andersson 2015-09-24 164 writel(val, smsm->local_state);
c97c4090ff72297 Bjorn Andersson 2015-09-24 165 spin_unlock_irqrestore(&smsm->lock, flags);
c97c4090ff72297 Bjorn Andersson 2015-09-24 166
c97c4090ff72297 Bjorn Andersson 2015-09-24 167 /* Make sure the value update is ordered before any kicks */
c97c4090ff72297 Bjorn Andersson 2015-09-24 168 wmb();
c97c4090ff72297 Bjorn Andersson 2015-09-24 169
c97c4090ff72297 Bjorn Andersson 2015-09-24 170 /* Iterate over all hosts to check whom wants a kick */
c97c4090ff72297 Bjorn Andersson 2015-09-24 171 for (host = 0; host < smsm->num_hosts; host++) {
c97c4090ff72297 Bjorn Andersson 2015-09-24 172 hostp = &smsm->hosts[host];
c97c4090ff72297 Bjorn Andersson 2015-09-24 173
c97c4090ff72297 Bjorn Andersson 2015-09-24 @174 val = readl(smsm->subscription + host);
c97c4090ff72297 Bjorn Andersson 2015-09-24 175 if (val & changes && hostp->ipc_regmap) {
c97c4090ff72297 Bjorn Andersson 2015-09-24 176 regmap_write(hostp->ipc_regmap,
c97c4090ff72297 Bjorn Andersson 2015-09-24 177 hostp->ipc_offset,
c97c4090ff72297 Bjorn Andersson 2015-09-24 178 BIT(hostp->ipc_bit));
c97c4090ff72297 Bjorn Andersson 2015-09-24 179 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 180 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 181
c97c4090ff72297 Bjorn Andersson 2015-09-24 182 done:
c97c4090ff72297 Bjorn Andersson 2015-09-24 183 return 0;
c97c4090ff72297 Bjorn Andersson 2015-09-24 184 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 185
c97c4090ff72297 Bjorn Andersson 2015-09-24 186 static const struct qcom_smem_state_ops smsm_state_ops = {
c97c4090ff72297 Bjorn Andersson 2015-09-24 187 .update_bits = smsm_update_bits,
c97c4090ff72297 Bjorn Andersson 2015-09-24 188 };
c97c4090ff72297 Bjorn Andersson 2015-09-24 189
c97c4090ff72297 Bjorn Andersson 2015-09-24 190 /**
c97c4090ff72297 Bjorn Andersson 2015-09-24 191 * smsm_intr() - cascading IRQ handler for SMSM
c97c4090ff72297 Bjorn Andersson 2015-09-24 192 * @irq: unused
c97c4090ff72297 Bjorn Andersson 2015-09-24 193 * @data: entry related to this IRQ
c97c4090ff72297 Bjorn Andersson 2015-09-24 194 *
c97c4090ff72297 Bjorn Andersson 2015-09-24 195 * This function cascades an incoming interrupt from a remote system, based on
c97c4090ff72297 Bjorn Andersson 2015-09-24 196 * the state bits and configuration.
c97c4090ff72297 Bjorn Andersson 2015-09-24 197 */
c97c4090ff72297 Bjorn Andersson 2015-09-24 198 static irqreturn_t smsm_intr(int irq, void *data)
c97c4090ff72297 Bjorn Andersson 2015-09-24 199 {
c97c4090ff72297 Bjorn Andersson 2015-09-24 200 struct smsm_entry *entry = data;
c97c4090ff72297 Bjorn Andersson 2015-09-24 201 unsigned i;
c97c4090ff72297 Bjorn Andersson 2015-09-24 202 int irq_pin;
c97c4090ff72297 Bjorn Andersson 2015-09-24 203 u32 changed;
c97c4090ff72297 Bjorn Andersson 2015-09-24 204 u32 val;
c97c4090ff72297 Bjorn Andersson 2015-09-24 205
c97c4090ff72297 Bjorn Andersson 2015-09-24 @206 val = readl(entry->remote_state);
c97c4090ff72297 Bjorn Andersson 2015-09-24 207 changed = val ^ entry->last_value;
c97c4090ff72297 Bjorn Andersson 2015-09-24 208 entry->last_value = val;
c97c4090ff72297 Bjorn Andersson 2015-09-24 209
c97c4090ff72297 Bjorn Andersson 2015-09-24 210 for_each_set_bit(i, entry->irq_enabled, 32) {
c97c4090ff72297 Bjorn Andersson 2015-09-24 211 if (!(changed & BIT(i)))
c97c4090ff72297 Bjorn Andersson 2015-09-24 212 continue;
c97c4090ff72297 Bjorn Andersson 2015-09-24 213
c97c4090ff72297 Bjorn Andersson 2015-09-24 214 if (val & BIT(i)) {
c97c4090ff72297 Bjorn Andersson 2015-09-24 215 if (test_bit(i, entry->irq_rising)) {
c97c4090ff72297 Bjorn Andersson 2015-09-24 216 irq_pin = irq_find_mapping(entry->domain, i);
c97c4090ff72297 Bjorn Andersson 2015-09-24 217 handle_nested_irq(irq_pin);
c97c4090ff72297 Bjorn Andersson 2015-09-24 218 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 219 } else {
c97c4090ff72297 Bjorn Andersson 2015-09-24 220 if (test_bit(i, entry->irq_falling)) {
c97c4090ff72297 Bjorn Andersson 2015-09-24 221 irq_pin = irq_find_mapping(entry->domain, i);
c97c4090ff72297 Bjorn Andersson 2015-09-24 222 handle_nested_irq(irq_pin);
c97c4090ff72297 Bjorn Andersson 2015-09-24 223 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 224 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 225 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 226
c97c4090ff72297 Bjorn Andersson 2015-09-24 227 return IRQ_HANDLED;
c97c4090ff72297 Bjorn Andersson 2015-09-24 228 }
c97c4090ff72297 Bjorn Andersson 2015-09-24 229

:::::: The code at line 152 was first introduced by commit
:::::: c97c4090ff72297a878a37715bd301624b71c885 soc: qcom: smsm: Add driver for Qualcomm SMSM

:::::: TO: Bjorn Andersson <bjorn.andersson@xxxxxxxxxxxxxx>
:::::: CC: Andy Gross <agross@xxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip