* [jgunthorpe:for-nicolin 9/28] drivers/iommu/iommu.c:3523:33: warning: variable 'ops' set but not used
@ 2025-09-30 4:13 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-09-30 4:13 UTC (permalink / raw)
To: Nicolin Chen; +Cc: oe-kbuild-all
tree: https://github.com/jgunthorpe/linux for-nicolin
head: 88dcad1e4861f296ede23d6aa870ccedb3033a8b
commit: c4512f934cf0e912daa5e048c1bcd5d067f4c10a [9/28] iommu: Introduce a test_dev domain op and an internal helper
config: s390-randconfig-001-20250930 (https://download.01.org/0day-ci/archive/20250930/202509301224.PemRWcEM-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250930/202509301224.PemRWcEM-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509301224.PemRWcEM-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/iommu/iommu.c: In function 'iommu_attach_device_pasid':
>> drivers/iommu/iommu.c:3523:33: warning: variable 'ops' set but not used [-Wunused-but-set-variable]
3523 | const struct iommu_ops *ops;
| ^~~
vim +/ops +3523 drivers/iommu/iommu.c
16603704559c7a6 Lu Baolu 2022-10-31 3504
16603704559c7a6 Lu Baolu 2022-10-31 3505 /*
16603704559c7a6 Lu Baolu 2022-10-31 3506 * iommu_attach_device_pasid() - Attach a domain to pasid of device
16603704559c7a6 Lu Baolu 2022-10-31 3507 * @domain: the iommu domain.
16603704559c7a6 Lu Baolu 2022-10-31 3508 * @dev: the attached device.
16603704559c7a6 Lu Baolu 2022-10-31 3509 * @pasid: the pasid of the device.
14678219cf4093e Lu Baolu 2024-07-02 3510 * @handle: the attach handle.
16603704559c7a6 Lu Baolu 2022-10-31 3511 *
ada14b9f1aab5b6 Yi Liu 2025-03-21 3512 * Caller should always provide a new handle to avoid race with the paths
ada14b9f1aab5b6 Yi Liu 2025-03-21 3513 * that have lockless reference to handle if it intends to pass a valid handle.
ada14b9f1aab5b6 Yi Liu 2025-03-21 3514 *
16603704559c7a6 Lu Baolu 2022-10-31 3515 * Return: 0 on success, or an error.
16603704559c7a6 Lu Baolu 2022-10-31 3516 */
16603704559c7a6 Lu Baolu 2022-10-31 3517 int iommu_attach_device_pasid(struct iommu_domain *domain,
14678219cf4093e Lu Baolu 2024-07-02 3518 struct device *dev, ioasid_t pasid,
14678219cf4093e Lu Baolu 2024-07-02 3519 struct iommu_attach_handle *handle)
16603704559c7a6 Lu Baolu 2022-10-31 3520 {
e946f8e3e62bf05 Jason Gunthorpe 2023-08-22 3521 /* Caller must be a probed driver on dev */
e946f8e3e62bf05 Jason Gunthorpe 2023-08-22 3522 struct iommu_group *group = dev->iommu_group;
fb3de9f9b085d00 Yi Liu 2024-12-04 @3523 const struct iommu_ops *ops;
e1ea9d30d84c65e Yi Liu 2025-02-25 3524 void *entry;
16603704559c7a6 Lu Baolu 2022-10-31 3525 int ret;
16603704559c7a6 Lu Baolu 2022-10-31 3526
16603704559c7a6 Lu Baolu 2022-10-31 3527 if (!group)
16603704559c7a6 Lu Baolu 2022-10-31 3528 return -ENODEV;
c4512f934cf0e91 Nicolin Chen 2022-05-13 3529 if (pasid == IOMMU_NO_PASID)
c4512f934cf0e91 Nicolin Chen 2022-05-13 3530 return -EINVAL;
16603704559c7a6 Lu Baolu 2022-10-31 3531
fb3de9f9b085d00 Yi Liu 2024-12-04 3532 ops = dev_iommu_ops(dev);
fb3de9f9b085d00 Yi Liu 2024-12-04 3533
16603704559c7a6 Lu Baolu 2022-10-31 3534 mutex_lock(&group->mutex);
c4512f934cf0e91 Nicolin Chen 2022-05-13 3535
c4512f934cf0e91 Nicolin Chen 2022-05-13 3536 ret = __iommu_domain_test_device(domain, dev, pasid, NULL);
c4512f934cf0e91 Nicolin Chen 2022-05-13 3537 if (ret)
c404f55c26fc23c Jason Gunthorpe 2024-03-27 3538 goto out_unlock;
c404f55c26fc23c Jason Gunthorpe 2024-03-27 3539
e1ea9d30d84c65e Yi Liu 2025-02-25 3540 entry = iommu_make_pasid_array_entry(domain, handle);
14678219cf4093e Lu Baolu 2024-07-02 3541
5e9f822c9c683ae Yi Liu 2025-02-25 3542 /*
5e9f822c9c683ae Yi Liu 2025-02-25 3543 * Entry present is a failure case. Use xa_insert() instead of
5e9f822c9c683ae Yi Liu 2025-02-25 3544 * xa_reserve().
5e9f822c9c683ae Yi Liu 2025-02-25 3545 */
5e9f822c9c683ae Yi Liu 2025-02-25 3546 ret = xa_insert(&group->pasid_array, pasid, XA_ZERO_ENTRY, GFP_KERNEL);
14678219cf4093e Lu Baolu 2024-07-02 3547 if (ret)
16603704559c7a6 Lu Baolu 2022-10-31 3548 goto out_unlock;
16603704559c7a6 Lu Baolu 2022-10-31 3549
8a9e1e773f60080 Yi Liu 2025-03-21 3550 ret = __iommu_set_group_pasid(domain, group, pasid, NULL);
5e9f822c9c683ae Yi Liu 2025-02-25 3551 if (ret) {
5e9f822c9c683ae Yi Liu 2025-02-25 3552 xa_release(&group->pasid_array, pasid);
5e9f822c9c683ae Yi Liu 2025-02-25 3553 goto out_unlock;
5e9f822c9c683ae Yi Liu 2025-02-25 3554 }
5e9f822c9c683ae Yi Liu 2025-02-25 3555
5e9f822c9c683ae Yi Liu 2025-02-25 3556 /*
5e9f822c9c683ae Yi Liu 2025-02-25 3557 * The xa_insert() above reserved the memory, and the group->mutex is
5e9f822c9c683ae Yi Liu 2025-02-25 3558 * held, this cannot fail. The new domain cannot be visible until the
5e9f822c9c683ae Yi Liu 2025-02-25 3559 * operation succeeds as we cannot tolerate PRIs becoming concurrently
5e9f822c9c683ae Yi Liu 2025-02-25 3560 * queued and then failing attach.
5e9f822c9c683ae Yi Liu 2025-02-25 3561 */
5e9f822c9c683ae Yi Liu 2025-02-25 3562 WARN_ON(xa_is_err(xa_store(&group->pasid_array,
5e9f822c9c683ae Yi Liu 2025-02-25 3563 pasid, entry, GFP_KERNEL)));
5e9f822c9c683ae Yi Liu 2025-02-25 3564
16603704559c7a6 Lu Baolu 2022-10-31 3565 out_unlock:
16603704559c7a6 Lu Baolu 2022-10-31 3566 mutex_unlock(&group->mutex);
16603704559c7a6 Lu Baolu 2022-10-31 3567 return ret;
16603704559c7a6 Lu Baolu 2022-10-31 3568 }
16603704559c7a6 Lu Baolu 2022-10-31 3569 EXPORT_SYMBOL_GPL(iommu_attach_device_pasid);
16603704559c7a6 Lu Baolu 2022-10-31 3570
:::::: The code at line 3523 was first introduced by commit
:::::: fb3de9f9b085d003a8a869ca6a4789d1bfbb3f22 iommu: Prevent pasid attach if no ops->remove_dev_pasid
:::::: TO: Yi Liu <yi.l.liu@intel.com>
:::::: CC: Joerg Roedel <jroedel@suse.de>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-30 4:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30 4:13 [jgunthorpe:for-nicolin 9/28] drivers/iommu/iommu.c:3523:33: warning: variable 'ops' set but not used kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.