Lines Matching refs:iommu

7 #define pr_fmt(fmt)    "iommu: " fmt
20 #include <linux/iommu.h>
32 #include <trace/events/iommu.h>
36 #include "dma-iommu.h"
37 #include "iommu-priv.h"
236 if (dev->iommu && dev->iommu->iommu_dev == data)
244 * @iommu: IOMMU handle for the instance
250 int iommu_device_register(struct iommu_device *iommu,
259 iommu->ops = ops;
261 iommu->fwnode = dev_fwnode(hwdev);
264 list_add_tail(&iommu->list, &iommu_device_list);
270 iommu_device_unregister(iommu);
275 void iommu_device_unregister(struct iommu_device *iommu)
278 bus_for_each_dev(iommu_buses[i], NULL, iommu, remove_iommu_group);
281 list_del(&iommu->list);
285 iommu_group_put(iommu->singleton_group);
286 iommu->singleton_group = NULL;
291 void iommu_device_unregister_bus(struct iommu_device *iommu,
296 iommu_device_unregister(iommu);
301 * Register an iommu driver against a single bus. This is only used by iommufd
302 * selftest to create a mock iommu driver. The caller must provide
305 int iommu_device_register_bus(struct iommu_device *iommu,
312 iommu->ops = ops;
319 list_add_tail(&iommu->list, &iommu_device_list);
324 iommu_device_unregister_bus(iommu, bus, nb);
334 struct dev_iommu *param = dev->iommu;
346 dev->iommu = param;
352 struct dev_iommu *param = dev->iommu;
354 dev->iommu = NULL;
368 return dev->iommu && dev->iommu->iommu_dev;
386 return min_t(u32, max_pasids, dev->iommu->iommu_dev->max_pasids);
394 dev->iommu->priv = priv;
399 * Init the dev->iommu and dev->iommu_group in the struct device and get the
421 dev->iommu->iommu_dev = iommu_dev;
436 dev->iommu->max_pasids = dev_iommu_get_max_pasids(dev);
438 dev->iommu->attach_deferred = ops->is_attach_deferred(dev);
449 dev->iommu->iommu_dev = NULL;
461 iommu_device_unlink(dev->iommu->iommu_dev, dev);
468 * If the iommu driver provides release_domain, the core code ensures
470 * use this to enforce a translation on the idle iommu. Typically, the
473 * Otherwise, the iommu driver must set the device to either an identity
480 if (!dev->iommu->attach_deferred && ops->release_domain)
680 if (dev->iommu)
700 early_param("iommu.passthrough", iommu_set_def_domain_type);
710 early_param("iommu.strict", iommu_dma_setup);
958 * This function is called by an iommu driver to allocate a new iommu
959 * group. The iommu group represents the minimum granularity of the iommu.
1031 * iommu drivers can store data in the group for use when doing iommu
1047 * iommu drivers can store data in the group for use when doing iommu
1064 * Allow iommu driver to set a name for a group. When set it will
1116 dev->iommu->require_direct = 1;
1202 dev_info(dev, "Adding to iommu group %d\n", group->id);
1212 dev_err(dev, "Failed to add to iommu group %d: %d\n", group->id, ret);
1217 * iommu_group_add_device - add a device to an iommu group
1221 * This function is called by an iommu driver to add a device into a
1246 * This function is called by an iommu driver to remove the device from
1247 * it's current group. This decrements the iommu group reference count.
1256 dev_info(dev, "Removing from iommu group %d\n", group->id);
1267 * This function is called by an iommu driver to check whether it holds
1320 * This function is called by iommu drivers and users to get the group
1339 * This function is called by iommu drivers to take additional references on an
1353 * This function is called by iommu drivers and users to release the
1354 * iommu group. Once the reference count is zero, the group is released.
1485 * iommu-group per device.
1495 * iommu-group per iommu driver instance shared by every device
1496 * probed by that iommu driver.
1500 struct iommu_device *iommu = dev->iommu->iommu_dev;
1502 if (!iommu->singleton_group) {
1508 iommu->singleton_group = group;
1510 return iommu_group_ref_get(iommu->singleton_group);
1921 * iommu_set_fault_handler() - set a fault handler for an iommu domain
1922 * @domain: iommu domain
2072 dev->iommu->attach_deferred = 0;
2117 if (dev->iommu && dev->iommu->attach_deferred)
2243 if (dev->iommu->require_direct &&
2251 if (dev->iommu->attach_deferred) {
2254 dev->iommu->attach_deferred = 0;
2660 * @domain: the iommu domain where the fault has happened
2813 struct iommu_device *iommu;
2816 list_for_each_entry(iommu, &iommu_device_list, list)
2817 if (iommu->fwnode == fwnode) {
2818 ops = iommu->ops;
2962 gdev->dev->iommu->iommu_dev->dev,
2973 * iommu driver and call ops->release_device. Put the domain
3019 * drivers from the devices in the iommu group, except for a DMA -> DMA-FQ
3352 * @domain: the iommu domain.
3379 if (pasid >= device->dev->iommu->max_pasids) {
3402 * @domain: the iommu domain.
3462 if (!dev->iommu->max_pasids)
3470 dev->iommu->max_pasids - 1, GFP_KERNEL);