Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd

Pull iommufd updates from Jason Gunthorpe:
"Two minor fixes:

- Make the selftest work again on x86 platforms with iommus enabled

- Fix a compiler warning in the userspace kselftest"

* tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd:
iommufd: Register iommufd mock devices with fwspec
iommu/selftest: prevent use of uninitialized variable

+32 -6
+2
drivers/iommu/iommu-priv.h
··· 37 37 const struct bus_type *bus, 38 38 struct notifier_block *nb); 39 39 40 + int iommu_mock_device_add(struct device *dev, struct iommu_device *iommu); 41 + 40 42 struct iommu_attach_handle *iommu_attach_handle_get(struct iommu_group *group, 41 43 ioasid_t pasid, 42 44 unsigned int type);
+26
drivers/iommu/iommu.c
··· 304 304 struct notifier_block *nb) 305 305 { 306 306 bus_unregister_notifier(bus, nb); 307 + fwnode_remove_software_node(iommu->fwnode); 307 308 iommu_device_unregister(iommu); 308 309 } 309 310 EXPORT_SYMBOL_GPL(iommu_device_unregister_bus); ··· 327 326 if (err) 328 327 return err; 329 328 329 + iommu->fwnode = fwnode_create_software_node(NULL, NULL); 330 + if (IS_ERR(iommu->fwnode)) { 331 + bus_unregister_notifier(bus, nb); 332 + return PTR_ERR(iommu->fwnode); 333 + } 334 + 330 335 spin_lock(&iommu_device_lock); 331 336 list_add_tail(&iommu->list, &iommu_device_list); 332 337 spin_unlock(&iommu_device_lock); ··· 342 335 iommu_device_unregister_bus(iommu, bus, nb); 343 336 return err; 344 337 } 338 + WRITE_ONCE(iommu->ready, true); 345 339 return 0; 346 340 } 347 341 EXPORT_SYMBOL_GPL(iommu_device_register_bus); 342 + 343 + int iommu_mock_device_add(struct device *dev, struct iommu_device *iommu) 344 + { 345 + int rc; 346 + 347 + mutex_lock(&iommu_probe_device_lock); 348 + rc = iommu_fwspec_init(dev, iommu->fwnode); 349 + mutex_unlock(&iommu_probe_device_lock); 350 + 351 + if (rc) 352 + return rc; 353 + 354 + rc = device_add(dev); 355 + if (rc) 356 + iommu_fwspec_free(dev); 357 + return rc; 358 + } 359 + EXPORT_SYMBOL_GPL(iommu_mock_device_add); 348 360 #endif 349 361 350 362 static struct dev_iommu *dev_iommu_get(struct device *dev)
+1 -1
drivers/iommu/iommufd/selftest.c
··· 1126 1126 goto err_put; 1127 1127 } 1128 1128 1129 - rc = device_add(&mdev->dev); 1129 + rc = iommu_mock_device_add(&mdev->dev, &mock_iommu.iommu_dev); 1130 1130 if (rc) 1131 1131 goto err_put; 1132 1132 return mdev;
+3 -5
tools/testing/selftests/iommu/iommufd_utils.h
··· 1042 1042 .dev_id = dev_id, 1043 1043 }, 1044 1044 }; 1045 - int ret; 1046 1045 1047 1046 while (nvevents--) { 1048 - ret = ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_TRIGGER_VEVENT), 1049 - &trigger_vevent_cmd); 1050 - if (ret < 0) 1047 + if (!ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_TRIGGER_VEVENT), 1048 + &trigger_vevent_cmd)) 1051 1049 return -1; 1052 1050 } 1053 - return ret; 1051 + return 0; 1054 1052 } 1055 1053 1056 1054 #define test_cmd_trigger_vevents(dev_id, nvevents) \