Lines Matching defs:device
9 #include <linux/device.h>
52 struct device *dev;
84 struct device *dev);
88 struct device *dev);
94 struct device *dev);
95 static struct iommu_group *iommu_group_get_for_dev(struct device *dev);
170 static struct dev_iommu *dev_iommu_get(struct device *dev)
186 static void dev_iommu_free(struct device *dev)
198 static int __iommu_probe_device(struct device *dev, struct list_head *group_list)
250 int iommu_probe_device(struct device *dev)
297 void iommu_release_device(struct device *dev)
463 struct group_device *device;
467 list_for_each_entry(device, &group->devices, list) {
471 iommu_get_resv_regions(device->dev, &dev_resv_regions);
473 iommu_put_resv_regions(device->dev, &dev_resv_regions);
726 struct device *dev)
781 struct device *dev)
790 * iommu_group_add_device - add a device to an iommu group
791 * @group: the group into which to add the device (reference should be held)
792 * @dev: the device
794 * This function is called by an iommu driver to add a device into a
795 * group. Adding a device increments the group reference count.
797 int iommu_group_add_device(struct iommu_group *group, struct device *dev)
800 struct group_device *device;
802 device = kzalloc(sizeof(*device), GFP_KERNEL);
803 if (!device)
806 device->dev = dev;
812 device->name = kasprintf(GFP_KERNEL, "%s", kobject_name(&dev->kobj));
814 if (!device->name) {
820 &dev->kobj, device->name);
827 kfree(device->name);
828 device->name = kasprintf(GFP_KERNEL, "%s.%d",
840 list_add_tail(&device->list, &group->devices);
859 list_del(&device->list);
863 sysfs_remove_link(group->devices_kobj, device->name);
865 kfree(device->name);
869 kfree(device);
876 * iommu_group_remove_device - remove a device from it's current group
877 * @dev: device to be removed
879 * This function is called by an iommu driver to remove the device from
882 void iommu_group_remove_device(struct device *dev)
885 struct group_device *tmp_device, *device = NULL;
892 /* Pre-notify listeners that a device is being removed. */
899 device = tmp_device;
900 list_del(&device->list);
906 if (!device)
909 sysfs_remove_link(group->devices_kobj, device->name);
914 kfree(device->name);
915 kfree(device);
933 * iommu_group_for_each_dev - iterate over each device in the group
944 int (*fn)(struct device *, void *))
946 struct group_device *device;
949 list_for_each_entry(device, &group->devices, list) {
950 ret = fn(device->dev, data);
959 int (*fn)(struct device *, void *))
972 * iommu_group_get - Return the group for a device and increment reference
973 * @dev: get the group that this device belongs to
976 * for the specified device. If found, the group is returned and the group
979 struct iommu_group *iommu_group_get(struct device *dev)
1049 * iommu_register_device_fault_handler() - Register a device fault handler
1050 * @dev: the device
1066 int iommu_register_device_fault_handler(struct device *dev,
1077 /* Only allow one fault handler registered for each device */
1103 * iommu_unregister_device_fault_handler() - Unregister the device fault handler
1104 * @dev: the device
1106 * Remove the device fault handler installed with
1111 int iommu_unregister_device_fault_handler(struct device *dev)
1141 * iommu_report_device_fault() - Report fault event to device driver
1142 * @dev: the device
1151 int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt)
1161 /* we only report device fault if there is a handler registered */
1195 int iommu_page_response(struct device *dev,
1275 * To consider a PCI device isolated, we require ACS to support Source
1280 * bridge where the target device is downstream.
1316 * Look for aliases to or from the given device for existing groups. DMA
1319 * device, and therefore only expect multiple slots on the root complex or
1366 * DMA alias iterator callback, return the last seen device. Stop and return
1381 * iommu-group per device.
1383 struct iommu_group *generic_device_group(struct device *dev)
1391 * to find or create an IOMMU group for a device.
1393 struct iommu_group *pci_device_group(struct device *dev)
1405 * Find the upstream DMA alias for the device. A device must not
1436 * Look for existing groups on device aliases. If we alias another
1437 * device or another device aliases us, use the same group.
1457 /* Get the IOMMU group for device on fsl-mc bus */
1458 struct iommu_group *fsl_mc_device_group(struct device *dev)
1460 struct device *cont_dev = fsl_mc_cont_dev(dev);
1470 static int iommu_get_def_domain_type(struct device *dev)
1513 struct device *dev)
1526 * iommu_group_get_for_dev - Find or create the IOMMU group for a device
1527 * @dev: target device
1531 * IOMMU group for a device. On success, the caller will hold a reference
1533 * device. The reference should be released with iommu_group_put().
1535 static struct iommu_group *iommu_group_get_for_dev(struct device *dev)
1572 static int probe_iommu_group(struct device *dev, void *data)
1592 static int remove_iommu_group(struct device *dev, void *data)
1603 struct device *dev = data;
1652 struct device *dev;
1656 static int probe_get_default_domain_type(struct device *dev, void *data)
1667 dev_warn(dev, "Device needs domain type %s, but device %s in the same iommu group requires type %s - using default\n",
1701 static int iommu_group_do_dma_attach(struct device *dev, void *data)
1718 static int iommu_group_do_probe_finalize(struct device *dev, void *data)
1734 static int iommu_do_create_direct_mappings(struct device *dev, void *data)
1933 struct device *dev)
1946 int iommu_attach_device(struct iommu_domain *domain, struct device *dev)
1956 * Lock the group to make sure the device-count doesn't
2030 int iommu_uapi_cache_invalidate(struct iommu_domain *domain, struct device *dev,
2140 int iommu_uapi_sva_bind_gpasid(struct iommu_domain *domain, struct device *dev,
2157 int iommu_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev,
2167 int iommu_uapi_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev,
2185 struct device *dev)
2197 void iommu_detach_device(struct iommu_domain *domain, struct device *dev)
2219 struct iommu_domain *iommu_get_domain_for_dev(struct device *dev)
2240 struct iommu_domain *iommu_get_dma_domain(struct device *dev)
2249 * device which represents the requestor ID of the group, but we also
2253 * PCI devices). Thus we attach each device.
2255 static int iommu_group_do_attach_device(struct device *dev, void *data)
2290 static int iommu_group_do_detach_device(struct device *dev, void *data)
2618 * @dev: the device where the fault has happened
2629 * - if restarting of the faulting device is required
2639 int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
2714 void iommu_get_resv_regions(struct device *dev, struct list_head *list)
2722 void iommu_put_resv_regions(struct device *dev, struct list_head *list)
2732 * @dev: device for which to free reserved regions
2733 * @list: reserved region list for device
2740 void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
2805 int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
2829 void iommu_fwspec_free(struct device *dev)
2841 int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids)
2868 * Per device IOMMU features.
2870 bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat)
2881 int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
2895 * The device drivers should do the necessary cleanups before calling this.
2896 * For example, before disabling the aux-domain feature, the device driver
2899 int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
2912 bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
2929 * true. Also, as long as domains are attached to a device through this
2932 * This should make us safe against a device being attached to a guest as a
2935 int iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev)
2949 void iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev)
2958 int iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev)
2970 * iommu_sva_bind_device() - Bind a process address space to a device
2971 * @dev: the device
2974 * Create a bond between device and address space, allowing the device to access
2975 * the mm using the returned PASID. If a bond already exists between @device and
2985 iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata)
2998 /* Ensure device count and domain don't change while we're binding */
3003 * with more than one device. Existing SVA-capable systems are not
3005 * isolation, device ID aliasing and other hardware issues).
3024 * Put reference to a bond between device and address space. The device should
3033 struct device *dev = handle->dev;