drivers/vfio/vfio.c:293: warning: expecting prototype for Container objects(). Prototype was for vfio_container_get() instead
From: kernel test robot
Date: Mon Sep 27 2021 - 16:35:09 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 92477dd1faa650e50bd3bb35a6c0b8d09198cc35
commit: 179209fa12709a3df8888c323b37315da2683c24 vfio: IOMMU_API should be selected
date: 7 months ago
config: microblaze-buildonly-randconfig-r004-20210927 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=179209fa12709a3df8888c323b37315da2683c24
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 179209fa12709a3df8888c323b37315da2683c24
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bash arch/microblaze/kernel/ drivers/base/ drivers/char/ drivers/clk/ drivers/clocksource/ drivers/dax/ drivers/firewire/ drivers/gpu/drm/amd/amdgpu/ drivers/gpu/drm/amd/display/amdgpu_dm/ drivers/gpu/drm/amd/display/dc/dce/ drivers/gpu/drm/amd/display/dc/dce110/ drivers/gpu/drm/exynos/ drivers/i3c/ drivers/iio/accel/ drivers/memstick/host/ drivers/misc/ drivers/nvmem/ drivers/pci/ drivers/phy/qualcomm/ drivers/power/supply/ drivers/rapidio/ drivers/rtc/ drivers/soc/qcom/ drivers/thermal/ drivers/tty/ drivers/vfio/ drivers/video/fbdev/ drivers/w1/masters/ drivers/w1/slaves/ fs/ init/ kernel/ lib/ mm/ net/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/vfio/vfio.c:224: warning: Function parameter or member 'ops' not described in 'vfio_register_iommu_driver'
drivers/vfio/vfio.c:224: warning: expecting prototype for IOMMU driver registration(). Prototype was for vfio_register_iommu_driver() instead
drivers/vfio/vfio.c:273: warning: Function parameter or member 'group' not described in 'vfio_alloc_group_minor'
drivers/vfio/vfio.c:273: warning: expecting prototype for free(). Prototype was for vfio_alloc_group_minor() instead
drivers/vfio/vfio.c:293: warning: Function parameter or member 'container' not described in 'vfio_container_get'
>> drivers/vfio/vfio.c:293: warning: expecting prototype for Container objects(). Prototype was for vfio_container_get() instead
drivers/vfio/vfio.c:325: warning: Function parameter or member 'iommu_group' not described in 'vfio_create_group'
>> drivers/vfio/vfio.c:325: warning: expecting prototype for Group objects(). Prototype was for vfio_create_group() instead
drivers/vfio/vfio.c:540: warning: Function parameter or member 'group' not described in 'vfio_group_create_device'
drivers/vfio/vfio.c:540: warning: Function parameter or member 'dev' not described in 'vfio_group_create_device'
drivers/vfio/vfio.c:540: warning: Function parameter or member 'ops' not described in 'vfio_group_create_device'
drivers/vfio/vfio.c:540: warning: Function parameter or member 'device_data' not described in 'vfio_group_create_device'
drivers/vfio/vfio.c:540: warning: expecting prototype for Device objects(). Prototype was for vfio_group_create_device() instead
drivers/vfio/vfio.c:694: warning: Function parameter or member 'group' not described in 'vfio_group_nb_add_dev'
drivers/vfio/vfio.c:694: warning: Function parameter or member 'dev' not described in 'vfio_group_nb_add_dev'
drivers/vfio/vfio.c:694: warning: expecting prototype for Async device support(). Prototype was for vfio_group_nb_add_dev() instead
drivers/vfio/vfio.c:806: warning: Function parameter or member 'dev' not described in 'vfio_add_group_dev'
drivers/vfio/vfio.c:806: warning: Function parameter or member 'ops' not described in 'vfio_add_group_dev'
drivers/vfio/vfio.c:806: warning: Function parameter or member 'device_data' not described in 'vfio_add_group_dev'
drivers/vfio/vfio.c:806: warning: expecting prototype for VFIO driver API(). Prototype was for vfio_add_group_dev() instead
drivers/vfio/vfio.c:864: warning: Function parameter or member 'dev' not described in 'vfio_device_get_from_dev'
drivers/vfio/vfio.c:864: warning: expecting prototype for Even if the(). Prototype was for vfio_device_get_from_dev() instead
drivers/vfio/vfio.c:1022: warning: Function parameter or member 'container' not described in 'vfio_ioctl_check_extension'
drivers/vfio/vfio.c:1022: warning: Function parameter or member 'arg' not described in 'vfio_ioctl_check_extension'
drivers/vfio/vfio.c:1022: warning: expecting prototype for vfio(). Prototype was for vfio_ioctl_check_extension() instead
drivers/vfio/vfio.c:1298: warning: Function parameter or member 'group' not described in '__vfio_group_unset_container'
drivers/vfio/vfio.c:1298: warning: expecting prototype for GROUP(). Prototype was for __vfio_group_unset_container() instead
drivers/vfio/vfio.c:1633: warning: Function parameter or member 'inode' not described in 'vfio_device_fops_release'
drivers/vfio/vfio.c:1633: warning: Function parameter or member 'filep' not described in 'vfio_device_fops_release'
drivers/vfio/vfio.c:1633: warning: expecting prototype for VFIO Device fd(). Prototype was for vfio_device_fops_release() instead
drivers/vfio/vfio.c:1700: warning: wrong kernel-doc identifier on line:
* External user API, exported by symbols to be linked dynamically.
drivers/vfio/vfio.c:1745: warning: wrong kernel-doc identifier on line:
* External user API, exported by symbols to be linked dynamically.
drivers/vfio/vfio.c:1824: warning: Function parameter or member 'caps' not described in 'vfio_info_cap_add'
drivers/vfio/vfio.c:1824: warning: Function parameter or member 'size' not described in 'vfio_info_cap_add'
drivers/vfio/vfio.c:1824: warning: Function parameter or member 'id' not described in 'vfio_info_cap_add'
drivers/vfio/vfio.c:1824: warning: Function parameter or member 'version' not described in 'vfio_info_cap_add'
>> drivers/vfio/vfio.c:1824: warning: expecting prototype for Sub(). Prototype was for vfio_info_cap_add() instead
drivers/vfio/vfio.c:2361: warning: Function parameter or member 'dev' not described in 'vfio_devnode'
drivers/vfio/vfio.c:2361: warning: Function parameter or member 'mode' not described in 'vfio_devnode'
drivers/vfio/vfio.c:2361: warning: expecting prototype for class support(). Prototype was for vfio_devnode() instead
vim +293 drivers/vfio/vfio.c
03a76b60f8ba27 Alex Williamson 2015-12-21 218
03a76b60f8ba27 Alex Williamson 2015-12-21 219
cba3345cc494ad Alex Williamson 2012-07-31 220 /**
cba3345cc494ad Alex Williamson 2012-07-31 221 * IOMMU driver registration
cba3345cc494ad Alex Williamson 2012-07-31 222 */
cba3345cc494ad Alex Williamson 2012-07-31 223 int vfio_register_iommu_driver(const struct vfio_iommu_driver_ops *ops)
cba3345cc494ad Alex Williamson 2012-07-31 @224 {
cba3345cc494ad Alex Williamson 2012-07-31 225 struct vfio_iommu_driver *driver, *tmp;
cba3345cc494ad Alex Williamson 2012-07-31 226
cba3345cc494ad Alex Williamson 2012-07-31 227 driver = kzalloc(sizeof(*driver), GFP_KERNEL);
cba3345cc494ad Alex Williamson 2012-07-31 228 if (!driver)
cba3345cc494ad Alex Williamson 2012-07-31 229 return -ENOMEM;
cba3345cc494ad Alex Williamson 2012-07-31 230
cba3345cc494ad Alex Williamson 2012-07-31 231 driver->ops = ops;
cba3345cc494ad Alex Williamson 2012-07-31 232
cba3345cc494ad Alex Williamson 2012-07-31 233 mutex_lock(&vfio.iommu_drivers_lock);
cba3345cc494ad Alex Williamson 2012-07-31 234
cba3345cc494ad Alex Williamson 2012-07-31 235 /* Check for duplicates */
cba3345cc494ad Alex Williamson 2012-07-31 236 list_for_each_entry(tmp, &vfio.iommu_drivers_list, vfio_next) {
cba3345cc494ad Alex Williamson 2012-07-31 237 if (tmp->ops == ops) {
cba3345cc494ad Alex Williamson 2012-07-31 238 mutex_unlock(&vfio.iommu_drivers_lock);
cba3345cc494ad Alex Williamson 2012-07-31 239 kfree(driver);
cba3345cc494ad Alex Williamson 2012-07-31 240 return -EINVAL;
cba3345cc494ad Alex Williamson 2012-07-31 241 }
cba3345cc494ad Alex Williamson 2012-07-31 242 }
cba3345cc494ad Alex Williamson 2012-07-31 243
cba3345cc494ad Alex Williamson 2012-07-31 244 list_add(&driver->vfio_next, &vfio.iommu_drivers_list);
cba3345cc494ad Alex Williamson 2012-07-31 245
cba3345cc494ad Alex Williamson 2012-07-31 246 mutex_unlock(&vfio.iommu_drivers_lock);
cba3345cc494ad Alex Williamson 2012-07-31 247
cba3345cc494ad Alex Williamson 2012-07-31 248 return 0;
cba3345cc494ad Alex Williamson 2012-07-31 249 }
cba3345cc494ad Alex Williamson 2012-07-31 250 EXPORT_SYMBOL_GPL(vfio_register_iommu_driver);
cba3345cc494ad Alex Williamson 2012-07-31 251
cba3345cc494ad Alex Williamson 2012-07-31 252 void vfio_unregister_iommu_driver(const struct vfio_iommu_driver_ops *ops)
cba3345cc494ad Alex Williamson 2012-07-31 253 {
cba3345cc494ad Alex Williamson 2012-07-31 254 struct vfio_iommu_driver *driver;
cba3345cc494ad Alex Williamson 2012-07-31 255
cba3345cc494ad Alex Williamson 2012-07-31 256 mutex_lock(&vfio.iommu_drivers_lock);
cba3345cc494ad Alex Williamson 2012-07-31 257 list_for_each_entry(driver, &vfio.iommu_drivers_list, vfio_next) {
cba3345cc494ad Alex Williamson 2012-07-31 258 if (driver->ops == ops) {
cba3345cc494ad Alex Williamson 2012-07-31 259 list_del(&driver->vfio_next);
cba3345cc494ad Alex Williamson 2012-07-31 260 mutex_unlock(&vfio.iommu_drivers_lock);
cba3345cc494ad Alex Williamson 2012-07-31 261 kfree(driver);
cba3345cc494ad Alex Williamson 2012-07-31 262 return;
cba3345cc494ad Alex Williamson 2012-07-31 263 }
cba3345cc494ad Alex Williamson 2012-07-31 264 }
cba3345cc494ad Alex Williamson 2012-07-31 265 mutex_unlock(&vfio.iommu_drivers_lock);
cba3345cc494ad Alex Williamson 2012-07-31 266 }
cba3345cc494ad Alex Williamson 2012-07-31 267 EXPORT_SYMBOL_GPL(vfio_unregister_iommu_driver);
cba3345cc494ad Alex Williamson 2012-07-31 268
cba3345cc494ad Alex Williamson 2012-07-31 269 /**
cba3345cc494ad Alex Williamson 2012-07-31 270 * Group minor allocation/free - both called with vfio.group_lock held
cba3345cc494ad Alex Williamson 2012-07-31 271 */
cba3345cc494ad Alex Williamson 2012-07-31 272 static int vfio_alloc_group_minor(struct vfio_group *group)
cba3345cc494ad Alex Williamson 2012-07-31 273 {
d10999016f4164 Alex Williamson 2013-12-19 274 return idr_alloc(&vfio.group_idr, group, 0, MINORMASK + 1, GFP_KERNEL);
cba3345cc494ad Alex Williamson 2012-07-31 275 }
cba3345cc494ad Alex Williamson 2012-07-31 276
cba3345cc494ad Alex Williamson 2012-07-31 277 static void vfio_free_group_minor(int minor)
cba3345cc494ad Alex Williamson 2012-07-31 278 {
cba3345cc494ad Alex Williamson 2012-07-31 279 idr_remove(&vfio.group_idr, minor);
cba3345cc494ad Alex Williamson 2012-07-31 280 }
cba3345cc494ad Alex Williamson 2012-07-31 281
cba3345cc494ad Alex Williamson 2012-07-31 282 static int vfio_iommu_group_notifier(struct notifier_block *nb,
cba3345cc494ad Alex Williamson 2012-07-31 283 unsigned long action, void *data);
cba3345cc494ad Alex Williamson 2012-07-31 284 static void vfio_group_get(struct vfio_group *group);
cba3345cc494ad Alex Williamson 2012-07-31 285
cba3345cc494ad Alex Williamson 2012-07-31 286 /**
cba3345cc494ad Alex Williamson 2012-07-31 287 * Container objects - containers are created when /dev/vfio/vfio is
cba3345cc494ad Alex Williamson 2012-07-31 288 * opened, but their lifecycle extends until the last user is done, so
cba3345cc494ad Alex Williamson 2012-07-31 289 * it's freed via kref. Must support container/group/device being
cba3345cc494ad Alex Williamson 2012-07-31 290 * closed in any order.
cba3345cc494ad Alex Williamson 2012-07-31 291 */
cba3345cc494ad Alex Williamson 2012-07-31 292 static void vfio_container_get(struct vfio_container *container)
cba3345cc494ad Alex Williamson 2012-07-31 @293 {
cba3345cc494ad Alex Williamson 2012-07-31 294 kref_get(&container->kref);
cba3345cc494ad Alex Williamson 2012-07-31 295 }
cba3345cc494ad Alex Williamson 2012-07-31 296
cba3345cc494ad Alex Williamson 2012-07-31 297 static void vfio_container_release(struct kref *kref)
cba3345cc494ad Alex Williamson 2012-07-31 298 {
cba3345cc494ad Alex Williamson 2012-07-31 299 struct vfio_container *container;
cba3345cc494ad Alex Williamson 2012-07-31 300 container = container_of(kref, struct vfio_container, kref);
cba3345cc494ad Alex Williamson 2012-07-31 301
cba3345cc494ad Alex Williamson 2012-07-31 302 kfree(container);
cba3345cc494ad Alex Williamson 2012-07-31 303 }
cba3345cc494ad Alex Williamson 2012-07-31 304
cba3345cc494ad Alex Williamson 2012-07-31 305 static void vfio_container_put(struct vfio_container *container)
cba3345cc494ad Alex Williamson 2012-07-31 306 {
cba3345cc494ad Alex Williamson 2012-07-31 307 kref_put(&container->kref, vfio_container_release);
cba3345cc494ad Alex Williamson 2012-07-31 308 }
cba3345cc494ad Alex Williamson 2012-07-31 309
9df7b25ab71cee Jiang Liu 2012-12-07 310 static void vfio_group_unlock_and_free(struct vfio_group *group)
9df7b25ab71cee Jiang Liu 2012-12-07 311 {
9df7b25ab71cee Jiang Liu 2012-12-07 312 mutex_unlock(&vfio.group_lock);
9df7b25ab71cee Jiang Liu 2012-12-07 313 /*
9df7b25ab71cee Jiang Liu 2012-12-07 314 * Unregister outside of lock. A spurious callback is harmless now
9df7b25ab71cee Jiang Liu 2012-12-07 315 * that the group is no longer in vfio.group_list.
9df7b25ab71cee Jiang Liu 2012-12-07 316 */
9df7b25ab71cee Jiang Liu 2012-12-07 317 iommu_group_unregister_notifier(group->iommu_group, &group->nb);
9df7b25ab71cee Jiang Liu 2012-12-07 318 kfree(group);
9df7b25ab71cee Jiang Liu 2012-12-07 319 }
9df7b25ab71cee Jiang Liu 2012-12-07 320
cba3345cc494ad Alex Williamson 2012-07-31 321 /**
cba3345cc494ad Alex Williamson 2012-07-31 322 * Group objects - create, release, get, put, search
cba3345cc494ad Alex Williamson 2012-07-31 323 */
16ab8a5cbea463 Alex Williamson 2016-01-27 324 static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group)
cba3345cc494ad Alex Williamson 2012-07-31 @325 {
cba3345cc494ad Alex Williamson 2012-07-31 326 struct vfio_group *group, *tmp;
cba3345cc494ad Alex Williamson 2012-07-31 327 struct device *dev;
cba3345cc494ad Alex Williamson 2012-07-31 328 int ret, minor;
cba3345cc494ad Alex Williamson 2012-07-31 329
cba3345cc494ad Alex Williamson 2012-07-31 330 group = kzalloc(sizeof(*group), GFP_KERNEL);
cba3345cc494ad Alex Williamson 2012-07-31 331 if (!group)
cba3345cc494ad Alex Williamson 2012-07-31 332 return ERR_PTR(-ENOMEM);
cba3345cc494ad Alex Williamson 2012-07-31 333
cba3345cc494ad Alex Williamson 2012-07-31 334 kref_init(&group->kref);
cba3345cc494ad Alex Williamson 2012-07-31 335 INIT_LIST_HEAD(&group->device_list);
cba3345cc494ad Alex Williamson 2012-07-31 336 mutex_init(&group->device_lock);
60720a0fc6469e Alex Williamson 2015-02-06 337 INIT_LIST_HEAD(&group->unbound_list);
60720a0fc6469e Alex Williamson 2015-02-06 338 mutex_init(&group->unbound_lock);
cba3345cc494ad Alex Williamson 2012-07-31 339 atomic_set(&group->container_users, 0);
6d6768c61b39a2 Alex Williamson 2013-06-25 340 atomic_set(&group->opened, 0);
6586b561a91cd8 Alex Williamson 2017-08-17 341 init_waitqueue_head(&group->container_q);
cba3345cc494ad Alex Williamson 2012-07-31 342 group->iommu_group = iommu_group;
16ab8a5cbea463 Alex Williamson 2016-01-27 343 #ifdef CONFIG_VFIO_NOIOMMU
16ab8a5cbea463 Alex Williamson 2016-01-27 344 group->noiommu = (iommu_group_get_iommudata(iommu_group) == &noiommu);
16ab8a5cbea463 Alex Williamson 2016-01-27 345 #endif
ccd46dbae77dbf Jike Song 2016-12-01 346 BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
cba3345cc494ad Alex Williamson 2012-07-31 347
cba3345cc494ad Alex Williamson 2012-07-31 348 group->nb.notifier_call = vfio_iommu_group_notifier;
cba3345cc494ad Alex Williamson 2012-07-31 349
cba3345cc494ad Alex Williamson 2012-07-31 350 /*
cba3345cc494ad Alex Williamson 2012-07-31 351 * blocking notifiers acquire a rwsem around registering and hold
cba3345cc494ad Alex Williamson 2012-07-31 352 * it around callback. Therefore, need to register outside of
cba3345cc494ad Alex Williamson 2012-07-31 353 * vfio.group_lock to avoid A-B/B-A contention. Our callback won't
cba3345cc494ad Alex Williamson 2012-07-31 354 * do anything unless it can find the group in vfio.group_list, so
cba3345cc494ad Alex Williamson 2012-07-31 355 * no harm in registering early.
cba3345cc494ad Alex Williamson 2012-07-31 356 */
cba3345cc494ad Alex Williamson 2012-07-31 357 ret = iommu_group_register_notifier(iommu_group, &group->nb);
cba3345cc494ad Alex Williamson 2012-07-31 358 if (ret) {
cba3345cc494ad Alex Williamson 2012-07-31 359 kfree(group);
cba3345cc494ad Alex Williamson 2012-07-31 360 return ERR_PTR(ret);
cba3345cc494ad Alex Williamson 2012-07-31 361 }
cba3345cc494ad Alex Williamson 2012-07-31 362
cba3345cc494ad Alex Williamson 2012-07-31 363 mutex_lock(&vfio.group_lock);
cba3345cc494ad Alex Williamson 2012-07-31 364
cba3345cc494ad Alex Williamson 2012-07-31 365 /* Did we race creating this group? */
cba3345cc494ad Alex Williamson 2012-07-31 366 list_for_each_entry(tmp, &vfio.group_list, vfio_next) {
cba3345cc494ad Alex Williamson 2012-07-31 367 if (tmp->iommu_group == iommu_group) {
cba3345cc494ad Alex Williamson 2012-07-31 368 vfio_group_get(tmp);
9df7b25ab71cee Jiang Liu 2012-12-07 369 vfio_group_unlock_and_free(group);
cba3345cc494ad Alex Williamson 2012-07-31 370 return tmp;
cba3345cc494ad Alex Williamson 2012-07-31 371 }
cba3345cc494ad Alex Williamson 2012-07-31 372 }
cba3345cc494ad Alex Williamson 2012-07-31 373
2f51bf4be99386 Zhen Lei 2015-03-16 374 minor = vfio_alloc_group_minor(group);
2f51bf4be99386 Zhen Lei 2015-03-16 375 if (minor < 0) {
2f51bf4be99386 Zhen Lei 2015-03-16 376 vfio_group_unlock_and_free(group);
2f51bf4be99386 Zhen Lei 2015-03-16 377 return ERR_PTR(minor);
2f51bf4be99386 Zhen Lei 2015-03-16 378 }
2f51bf4be99386 Zhen Lei 2015-03-16 379
d10999016f4164 Alex Williamson 2013-12-19 380 dev = device_create(vfio.class, NULL,
d10999016f4164 Alex Williamson 2013-12-19 381 MKDEV(MAJOR(vfio.group_devt), minor),
03a76b60f8ba27 Alex Williamson 2015-12-21 382 group, "%s%d", group->noiommu ? "noiommu-" : "",
03a76b60f8ba27 Alex Williamson 2015-12-21 383 iommu_group_id(iommu_group));
cba3345cc494ad Alex Williamson 2012-07-31 384 if (IS_ERR(dev)) {
cba3345cc494ad Alex Williamson 2012-07-31 385 vfio_free_group_minor(minor);
9df7b25ab71cee Jiang Liu 2012-12-07 386 vfio_group_unlock_and_free(group);
7b3a10df1d4bd8 Dan Carpenter 2017-05-18 387 return ERR_CAST(dev);
cba3345cc494ad Alex Williamson 2012-07-31 388 }
cba3345cc494ad Alex Williamson 2012-07-31 389
cba3345cc494ad Alex Williamson 2012-07-31 390 group->minor = minor;
cba3345cc494ad Alex Williamson 2012-07-31 391 group->dev = dev;
cba3345cc494ad Alex Williamson 2012-07-31 392
cba3345cc494ad Alex Williamson 2012-07-31 393 list_add(&group->vfio_next, &vfio.group_list);
cba3345cc494ad Alex Williamson 2012-07-31 394
cba3345cc494ad Alex Williamson 2012-07-31 395 mutex_unlock(&vfio.group_lock);
cba3345cc494ad Alex Williamson 2012-07-31 396
cba3345cc494ad Alex Williamson 2012-07-31 397 return group;
cba3345cc494ad Alex Williamson 2012-07-31 398 }
cba3345cc494ad Alex Williamson 2012-07-31 399
:::::: The code at line 293 was first introduced by commit
:::::: cba3345cc494ad286ca8823f44b2c16cae496679 vfio: VFIO core
:::::: TO: Alex Williamson <alex.williamson@xxxxxxxxxx>
:::::: CC: Alex Williamson <alex.williamson@xxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip