Re: [PATCH 7/7] vfio/fsl-mc: Block calling interrupt handler without trigger

From: kernel test robot
Date: Thu Mar 07 2024 - 10:22:17 EST


Hi Alex,

kernel test robot noticed the following build warnings:

[auto build test WARNING on awilliam-vfio/next]
[also build test WARNING on linus/master v6.8-rc7 next-20240307]
[cannot apply to awilliam-vfio/for-linus]
[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/Alex-Williamson/vfio-pci-Disable-auto-enable-of-exclusive-INTx-IRQ/20240307-051931
base: https://github.com/awilliam/linux-vfio.git next
patch link: https://lore.kernel.org/r/20240306211445.1856768-8-alex.williamson%40redhat.com
patch subject: [PATCH 7/7] vfio/fsl-mc: Block calling interrupt handler without trigger
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240307/202403072356.jlxR3E5Q-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240307/202403072356.jlxR3E5Q-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403072356.jlxR3E5Q-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c:111:11: warning: variable 'hwirq' set but not used [-Wunused-but-set-variable]
111 | int ret, hwirq;
| ^
1 warning generated.


vim +/hwirq +111 drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c

cc0ee20bd96971 Diana Craciun 2020-10-05 104
2e0d29561f593a Diana Craciun 2020-10-05 105 static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev,
2e0d29561f593a Diana Craciun 2020-10-05 106 unsigned int index, unsigned int start,
2e0d29561f593a Diana Craciun 2020-10-05 107 unsigned int count, u32 flags,
2e0d29561f593a Diana Craciun 2020-10-05 108 void *data)
2e0d29561f593a Diana Craciun 2020-10-05 109 {
cc0ee20bd96971 Diana Craciun 2020-10-05 110 struct fsl_mc_device *mc_dev = vdev->mc_dev;
cc0ee20bd96971 Diana Craciun 2020-10-05 @111 int ret, hwirq;
cc0ee20bd96971 Diana Craciun 2020-10-05 112 struct vfio_fsl_mc_irq *irq;
cc0ee20bd96971 Diana Craciun 2020-10-05 113 struct device *cont_dev = fsl_mc_cont_dev(&mc_dev->dev);
cc0ee20bd96971 Diana Craciun 2020-10-05 114 struct fsl_mc_device *mc_cont = to_fsl_mc_device(cont_dev);
cc0ee20bd96971 Diana Craciun 2020-10-05 115
159246378d8483 Diana Craciun 2020-10-15 116 if (!count && (flags & VFIO_IRQ_SET_DATA_NONE))
159246378d8483 Diana Craciun 2020-10-15 117 return vfio_set_trigger(vdev, index, -1);
159246378d8483 Diana Craciun 2020-10-15 118
cc0ee20bd96971 Diana Craciun 2020-10-05 119 if (start != 0 || count != 1)
2e0d29561f593a Diana Craciun 2020-10-05 120 return -EINVAL;
cc0ee20bd96971 Diana Craciun 2020-10-05 121
da119f387e9464 Jason Gunthorpe 2021-08-05 122 mutex_lock(&vdev->vdev.dev_set->lock);
cc0ee20bd96971 Diana Craciun 2020-10-05 123 ret = fsl_mc_populate_irq_pool(mc_cont,
cc0ee20bd96971 Diana Craciun 2020-10-05 124 FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS);
cc0ee20bd96971 Diana Craciun 2020-10-05 125 if (ret)
cc0ee20bd96971 Diana Craciun 2020-10-05 126 goto unlock;
cc0ee20bd96971 Diana Craciun 2020-10-05 127
cc0ee20bd96971 Diana Craciun 2020-10-05 128 ret = vfio_fsl_mc_irqs_allocate(vdev);
cc0ee20bd96971 Diana Craciun 2020-10-05 129 if (ret)
cc0ee20bd96971 Diana Craciun 2020-10-05 130 goto unlock;
da119f387e9464 Jason Gunthorpe 2021-08-05 131 mutex_unlock(&vdev->vdev.dev_set->lock);
cc0ee20bd96971 Diana Craciun 2020-10-05 132
cc0ee20bd96971 Diana Craciun 2020-10-05 133 if (flags & VFIO_IRQ_SET_DATA_EVENTFD) {
cc0ee20bd96971 Diana Craciun 2020-10-05 134 s32 fd = *(s32 *)data;
cc0ee20bd96971 Diana Craciun 2020-10-05 135
cc0ee20bd96971 Diana Craciun 2020-10-05 136 return vfio_set_trigger(vdev, index, fd);
cc0ee20bd96971 Diana Craciun 2020-10-05 137 }
cc0ee20bd96971 Diana Craciun 2020-10-05 138
d86a6d47bcc6b4 Thomas Gleixner 2021-12-10 139 hwirq = vdev->mc_dev->irqs[index]->virq;
cc0ee20bd96971 Diana Craciun 2020-10-05 140
cc0ee20bd96971 Diana Craciun 2020-10-05 141 irq = &vdev->mc_irqs[index];
cc0ee20bd96971 Diana Craciun 2020-10-05 142
cc0ee20bd96971 Diana Craciun 2020-10-05 143 if (flags & VFIO_IRQ_SET_DATA_NONE) {
dce72fdf5c6be9 Alex Williamson 2024-03-06 144 if (irq->trigger)
dce72fdf5c6be9 Alex Williamson 2024-03-06 145 eventfd_signal(irq->trigger);
cc0ee20bd96971 Diana Craciun 2020-10-05 146
cc0ee20bd96971 Diana Craciun 2020-10-05 147 } else if (flags & VFIO_IRQ_SET_DATA_BOOL) {
cc0ee20bd96971 Diana Craciun 2020-10-05 148 u8 trigger = *(u8 *)data;
cc0ee20bd96971 Diana Craciun 2020-10-05 149
dce72fdf5c6be9 Alex Williamson 2024-03-06 150 if (trigger && irq->trigger)
dce72fdf5c6be9 Alex Williamson 2024-03-06 151 eventfd_signal(irq->trigger);
cc0ee20bd96971 Diana Craciun 2020-10-05 152 }
cc0ee20bd96971 Diana Craciun 2020-10-05 153
cc0ee20bd96971 Diana Craciun 2020-10-05 154 return 0;
cc0ee20bd96971 Diana Craciun 2020-10-05 155
cc0ee20bd96971 Diana Craciun 2020-10-05 156 unlock:
da119f387e9464 Jason Gunthorpe 2021-08-05 157 mutex_unlock(&vdev->vdev.dev_set->lock);
cc0ee20bd96971 Diana Craciun 2020-10-05 158 return ret;
cc0ee20bd96971 Diana Craciun 2020-10-05 159

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