Lines Matching defs: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"
39 #include "iommu-sva.h"
40 #include "iommu-priv.h"
237 if (dev->iommu && dev->iommu->iommu_dev == data)
245 * @iommu: IOMMU handle for the instance
251 int iommu_device_register(struct iommu_device *iommu,
267 iommu->ops = ops;
269 iommu->fwnode = dev_fwnode(hwdev);
272 list_add_tail(&iommu->list, &iommu_device_list);
280 iommu_device_unregister(iommu);
285 void iommu_device_unregister(struct iommu_device *iommu)
288 bus_for_each_dev(iommu_buses[i], NULL, iommu, remove_iommu_group);
291 list_del(&iommu->list);
297 void iommu_device_unregister_bus(struct iommu_device *iommu,
302 iommu_device_unregister(iommu);
307 * Register an iommu driver against a single bus. This is only used by iommufd
308 * selftest to create a mock iommu driver. The caller must provide
311 int iommu_device_register_bus(struct iommu_device *iommu,
317 iommu->ops = ops;
324 list_add_tail(&iommu->list, &iommu_device_list);
330 iommu_device_unregister_bus(iommu, bus, nb);
340 struct dev_iommu *param = dev->iommu;
350 dev->iommu = param;
356 struct dev_iommu *param = dev->iommu;
358 dev->iommu = NULL;
381 return min_t(u32, max_pasids, dev->iommu->iommu_dev->max_pasids);
385 * Init the dev->iommu and dev->iommu_group in the struct device and get the
421 dev->iommu->iommu_dev = iommu_dev;
422 dev->iommu->max_pasids = dev_iommu_get_max_pasids(dev);
424 dev->iommu->attach_deferred = ops->is_attach_deferred(dev);
446 iommu_device_unlink(dev->iommu->iommu_dev, dev);
615 if (dev->iommu && dev->iommu->iommu_dev)
638 if (dev->iommu)
658 early_param("iommu.passthrough", iommu_set_def_domain_type);
668 early_param("iommu.strict", iommu_dma_setup);
814 if (!device->dev->iommu)
916 * This function is called by an iommu driver to allocate a new iommu
917 * group. The iommu group represents the minimum granularity of the iommu.
989 * iommu drivers can store data in the group for use when doing iommu
1005 * iommu drivers can store data in the group for use when doing iommu
1022 * Allow iommu driver to set a name for a group. When set it will
1074 dev->iommu->require_direct = 1;
1160 dev_info(dev, "Adding to iommu group %d\n", group->id);
1170 dev_err(dev, "Failed to add to iommu group %d: %d\n", group->id, ret);
1175 * iommu_group_add_device - add a device to an iommu group
1179 * This function is called by an iommu driver to add a device into a
1204 * This function is called by an iommu driver to remove the device from
1205 * it's current group. This decrements the iommu group reference count.
1214 dev_info(dev, "Removing from iommu group %d\n", group->id);
1253 * This function is called by iommu drivers and users to get the group
1272 * This function is called by iommu drivers to take additional references on an
1286 * This function is called by iommu drivers and users to release the
1287 * iommu group. Once the reference count is zero, the group is released.
1318 struct dev_iommu *param = dev->iommu;
1361 struct dev_iommu *param = dev->iommu;
1401 struct dev_iommu *param = dev->iommu;
1450 struct dev_iommu *param = dev->iommu;
1629 * iommu-group per device.
1835 "Device needs domain type %s, but device %s in the same iommu group requires type %s - using default\n",
1916 if (!dev->iommu || !dev->iommu->iommu_dev)
1951 * iommu_set_fault_handler() - set a fault handler for an iommu domain
1952 * @domain: iommu domain
2046 dev->iommu->attach_deferred = 0;
2093 if (dev->iommu && dev->iommu->attach_deferred)
2219 if (dev->iommu->require_direct &&
2227 if (dev->iommu->attach_deferred) {
2230 dev->iommu->attach_deferred = 0;
2675 * @domain: the iommu domain where the fault has happened
2828 struct iommu_device *iommu;
2831 list_for_each_entry(iommu, &iommu_device_list, list)
2832 if (iommu->fwnode == fwnode) {
2833 ops = iommu->ops;
2907 if (dev->iommu && dev->iommu->iommu_dev) {
2908 const struct iommu_ops *ops = dev->iommu->iommu_dev->ops;
2923 if (dev->iommu && dev->iommu->iommu_dev) {
2924 const struct iommu_ops *ops = dev->iommu->iommu_dev->ops;
2964 * We assume that the iommu driver starts up the device in
2989 gdev->dev->iommu->iommu_dev->dev,
3000 * iommu driver and call ops->release_device. Put the domain
3046 * drivers from the devices in the iommu group, except for a DMA -> DMA-FQ
3398 * @domain: the iommu domain.
3440 * @domain: the iommu domain.
3521 if (!dev->iommu->max_pasids)
3529 dev->iommu->max_pasids - 1, GFP_KERNEL);