tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   5c8fe583cce542aa0b84adc939ce85293de36e5e
commit: 5a6338cce9f4133c478d3b10b300f96dd644379a mailbox: arm_mhuv2: Add driver
date:   3 weeks ago
config: arm64-randconfig-s031-20201221 (attached as .config)
compiler: aarch64-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-184-g1b896707-dirty
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5a6338cce9f4133c478d3b10b300f96dd644379a
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 5a6338cce9f4133c478d3b10b300f96dd644379a
        # 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=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <l...@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> drivers/mailbox/arm_mhuv2.c:506:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@     expected void const volatile 
>> [noderef] __iomem *addr @@     got unsigned int [usertype] * @@
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     expected void const volatile 
[noderef] __iomem *addr
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     got unsigned int [usertype] *
>> drivers/mailbox/arm_mhuv2.c:506:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@     expected void const volatile 
>> [noderef] __iomem *addr @@     got unsigned int [usertype] * @@
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     expected void const volatile 
[noderef] __iomem *addr
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     got unsigned int [usertype] *
>> drivers/mailbox/arm_mhuv2.c:506:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@     expected void const volatile 
>> [noderef] __iomem *addr @@     got unsigned int [usertype] * @@
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     expected void const volatile 
[noderef] __iomem *addr
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     got unsigned int [usertype] *
>> drivers/mailbox/arm_mhuv2.c:506:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@     expected void const volatile 
>> [noderef] __iomem *addr @@     got unsigned int [usertype] * @@
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     expected void const volatile 
[noderef] __iomem *addr
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     got unsigned int [usertype] *
>> drivers/mailbox/arm_mhuv2.c:506:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@     expected void const volatile 
>> [noderef] __iomem *addr @@     got unsigned int [usertype] * @@
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     expected void const volatile 
[noderef] __iomem *addr
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     got unsigned int [usertype] *
>> drivers/mailbox/arm_mhuv2.c:506:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@     expected void const volatile 
>> [noderef] __iomem *addr @@     got unsigned int [usertype] * @@
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     expected void const volatile 
[noderef] __iomem *addr
   drivers/mailbox/arm_mhuv2.c:506:24: sparse:     got unsigned int [usertype] *
>> drivers/mailbox/arm_mhuv2.c:547:42: sparse: sparse: incorrect type in 
>> argument 2 (different address spaces) @@     expected unsigned int 
>> [usertype] *reg @@     got unsigned int [noderef] __iomem * @@
   drivers/mailbox/arm_mhuv2.c:547:42: sparse:     expected unsigned int 
[usertype] *reg
   drivers/mailbox/arm_mhuv2.c:547:42: sparse:     got unsigned int [noderef] 
__iomem *
   drivers/mailbox/arm_mhuv2.c:625:42: sparse: sparse: incorrect type in 
argument 2 (different address spaces) @@     expected unsigned int [usertype] 
*reg @@     got unsigned int [noderef] __iomem * @@
   drivers/mailbox/arm_mhuv2.c:625:42: sparse:     expected unsigned int 
[usertype] *reg
   drivers/mailbox/arm_mhuv2.c:625:42: sparse:     got unsigned int [noderef] 
__iomem *
>> drivers/mailbox/arm_mhuv2.c:972:24: sparse: sparse: dereference of noderef 
>> expression
   drivers/mailbox/arm_mhuv2.c:973:22: sparse: sparse: dereference of noderef 
expression
   drivers/mailbox/arm_mhuv2.c:993:25: sparse: sparse: dereference of noderef 
expression
   drivers/mailbox/arm_mhuv2.c:1026:24: sparse: sparse: dereference of noderef 
expression
   drivers/mailbox/arm_mhuv2.c:1027:22: sparse: sparse: dereference of noderef 
expression
   drivers/mailbox/arm_mhuv2.c:1048:17: sparse: sparse: dereference of noderef 
expression

vim +506 drivers/mailbox/arm_mhuv2.c

   498  
   499  static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 *reg)
   500  {
   501          struct mbox_chan *chans = mhu->mbox.chans;
   502          int channel = 0, i, offset = 0, windows, protocol, ch_wn;
   503          u32 stat;
   504  
   505          for (i = 0; i < MHUV2_CMB_INT_ST_REG_CNT; i++) {
 > 506                  stat = readl_relaxed(reg + i);
   507                  if (!stat)
   508                          continue;
   509  
   510                  ch_wn = i * MHUV2_STAT_BITS + __builtin_ctz(stat);
   511  
   512                  for (i = 0; i < mhu->length; i += 2) {
   513                          protocol = mhu->protocols[i];
   514                          windows = mhu->protocols[i + 1];
   515  
   516                          if (ch_wn >= offset + windows) {
   517                                  if (protocol == DOORBELL)
   518                                          channel += MHUV2_STAT_BITS * 
windows;
   519                                  else
   520                                          channel++;
   521  
   522                                  offset += windows;
   523                                  continue;
   524                          }
   525  
   526                          /* Return first chan of the window in doorbell 
mode */
   527                          if (protocol == DOORBELL)
   528                                  channel += MHUV2_STAT_BITS * (ch_wn - 
offset);
   529  
   530                          return &chans[channel];
   531                  }
   532          }
   533  
   534          return ERR_PTR(-EIO);
   535  }
   536  
   537  static irqreturn_t mhuv2_sender_interrupt(int irq, void *data)
   538  {
   539          struct mhuv2 *mhu = data;
   540          struct device *dev = mhu->mbox.dev;
   541          struct mhuv2_mbox_chan_priv *priv;
   542          struct mbox_chan *chan;
   543          unsigned long flags;
   544          int i, found = 0;
   545          u32 stat;
   546  
 > 547          chan = get_irq_chan_comb(mhu, mhu->send->chcomb_int_st);
   548          if (IS_ERR(chan)) {
   549                  dev_warn(dev, "Failed to find channel for the Tx 
interrupt\n");
   550                  return IRQ_NONE;
   551          }
   552          priv = chan->con_priv;
   553  
   554          if (!IS_PROTOCOL_DOORBELL(priv)) {
   555                  writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx + 
priv->windows - 1].int_clr);
   556  
   557                  if (chan->cl) {
   558                          mbox_chan_txdone(chan, 0);
   559                          return IRQ_HANDLED;
   560                  }
   561  
   562                  dev_warn(dev, "Tx interrupt Received on channel (%u) 
not currently attached to a mailbox client\n",
   563                           priv->ch_wn_idx);
   564                  return IRQ_NONE;
   565          }
   566  
   567          /* Clear the interrupt first, so we don't miss any doorbell 
later */
   568          writel_relaxed(1, &mhu->send->ch_wn[priv->ch_wn_idx].int_clr);
   569  
   570          /*
   571           * In Doorbell mode, make sure no new transitions happen while 
the
   572           * interrupt handler is trying to find the finished doorbell tx
   573           * operations, else we may think few of the transfers were 
complete
   574           * before they actually were.
   575           */
   576          spin_lock_irqsave(&mhu->doorbell_pending_lock, flags);
   577  
   578          /*
   579           * In case of doorbell mode, the first channel of the window is 
returned
   580           * by get_irq_chan_comb(). Find all the pending channels here.
   581           */
   582          stat = readl_relaxed(&mhu->send->ch_wn[priv->ch_wn_idx].stat);
   583  
   584          for (i = 0; i < MHUV2_STAT_BITS; i++) {
   585                  priv = chan[i].con_priv;
   586  
   587                  /* Find cases where pending was 1, but stat's bit is 
cleared */
   588                  if (priv->pending ^ ((stat >> i) & 0x1)) {
   589                          BUG_ON(!priv->pending);
   590  
   591                          if (!chan->cl) {
   592                                  dev_warn(dev, "Tx interrupt received on 
doorbell (%u : %u) channel not currently attached to a mailbox client\n",
   593                                           priv->ch_wn_idx, i);
   594                                  continue;
   595                          }
   596  
   597                          mbox_chan_txdone(&chan[i], 0);
   598                          priv->pending = 0;
   599                          found++;
   600                  }
   601          }
   602  
   603          spin_unlock_irqrestore(&mhu->doorbell_pending_lock, flags);
   604  
   605          if (!found) {
   606                  /*
   607                   * We may have already processed the doorbell in the 
previous
   608                   * iteration if the interrupt came right after we 
cleared it but
   609                   * before we read the stat register.
   610                   */
   611                  dev_dbg(dev, "Couldn't find the doorbell (%u) for the 
Tx interrupt interrupt\n",
   612                          priv->ch_wn_idx);
   613                  return IRQ_NONE;
   614          }
   615  
   616          return IRQ_HANDLED;
   617  }
   618  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to