Lines Matching refs:device

9 #include <linux/device.h>

53 struct device *dev;
81 static int iommu_alloc_default_domain(struct iommu_group *group, struct device *dev);
83 static int iommu_attach_device_ext(struct iommu_domain *domain, struct device *dev);
86 static int iommu_create_device_direct_mappings(struct iommu_group *group, struct device *dev);
87 static struct iommu_group *iommu_group_get_for_dev(struct device *dev);
159 static struct dev_iommu *dev_iommu_get(struct device *dev)
177 static void dev_iommu_free(struct device *dev)
189 static int iommu_probe_device_ext(struct device *dev, struct list_head *group_list)
244 int iommu_probe_device(struct device *dev)
293 void iommu_release_device(struct device *dev)
457 struct group_device *device;
461 list_for_each_entry(device, &group->devices, list)
466 iommu_get_resv_regions(device->dev, &dev_resv_regions);
468 iommu_put_resv_regions(device->dev, &dev_resv_regions);
723 static int iommu_create_device_direct_mappings(struct iommu_group *group, struct device *dev)
781 static bool iommu_is_attach_deferred(struct iommu_domain *domain, struct device *dev)
791 * iommu_group_add_device - add a device to an iommu group
792 * @group: the group into which to add the device (reference should be held)
793 * @dev: the device
795 * This function is called by an iommu driver to add a device into a
796 * group. Adding a device increments the group reference count.
798 int iommu_group_add_device(struct iommu_group *group, struct device *dev)
801 struct group_device *device;
803 device = kzalloc(sizeof(*device), GFP_KERNEL);
804 if (!device) {
808 device->dev = dev;
815 device->name = kasprintf(GFP_KERNEL, "%s", kobject_name(&dev->kobj));
817 if (!device->name) {
822 ret = sysfs_create_link_nowarn(group->devices_kobj, &dev->kobj, device->name);
829 kfree(device->name);
830 device->name = kasprintf(GFP_KERNEL, "%s.%d", kobject_name(&dev->kobj), i++);
843 list_add_tail(&device->list, &group->devices);
863 list_del(&device->list);
867 sysfs_remove_link(group->devices_kobj, device->name);
869 kfree(device->name);
873 kfree(device);
880 * iommu_group_remove_device - remove a device from it's current group
881 * @dev: device to be removed
883 * This function is called by an iommu driver to remove the device from
886 void iommu_group_remove_device(struct device *dev)
889 struct group_device *tmp_device, *device = NULL;
897 /* Pre-notify listeners that a device is being removed. */
904 device = tmp_device;
905 list_del(&device->list);
911 if (!device) {
915 sysfs_remove_link(group->devices_kobj, device->name);
920 kfree(device->name);
921 kfree(device);
938 * iommu_group_for_each_dev - iterate over each device in the group
948 static int iommu_group_for_each_dev_ext(struct iommu_group *group, void *data, int (*fn)(struct device *, void *))
950 struct group_device *device;
953 list_for_each_entry(device, &group->devices, list)
955 ret = fn(device->dev, data);
963 int iommu_group_for_each_dev(struct iommu_group *group, void *data, int (*fn)(struct device *, void *))
976 * iommu_group_get - Return the group for a device and increment reference
977 * @dev: get the group that this device belongs to
980 * for the specified device. If found, the group is returned and the group
983 struct iommu_group *iommu_group_get(struct device *dev)
1053 * iommu_register_device_fault_handler() - Register a device fault handler
1054 * @dev: the device
1070 int iommu_register_device_fault_handler(struct device *dev, iommu_dev_fault_handler_t handler, void *data)
1080 /* Only allow one fault handler registered for each device */
1106 * iommu_unregister_device_fault_handler() - Unregister the device fault handler
1107 * @dev: the device
1109 * Remove the device fault handler installed with
1114 int iommu_unregister_device_fault_handler(struct device *dev)
1146 * iommu_report_device_fault() - Report fault event to device driver
1147 * @dev: the device
1156 int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt)
1167 /* we only report device fault if there is a handler registered */
1199 int iommu_page_response(struct device *dev, struct iommu_page_response *msg)
1282 * To consider a PCI device isolated, we require ACS to support Source
1287 * bridge where the target device is downstream.
1324 * Look for aliases to or from the given device for existing groups. DMA
1327 * device, and therefore only expect multiple slots on the root complex or
1377 * DMA alias iterator callback, return the last seen device. Stop and return
1392 * iommu-group per device.
1394 struct iommu_group *generic_device_group(struct device *dev)
1402 * to find or create an IOMMU group for a device.
1404 struct iommu_group *pci_device_group(struct device *dev)
1417 * Find the upstream DMA alias for the device. A device must not
1452 * Look for existing groups on device aliases. If we alias another
1453 * device or another device aliases us, use the same group.
1475 /* Get the IOMMU group for device on fsl-mc bus */
1476 struct iommu_group *fsl_mc_device_group(struct device *dev)
1478 struct device *cont_dev = fsl_mc_cont_dev(dev);
1489 static int iommu_get_def_domain_type(struct device *dev)
1532 static int iommu_alloc_default_domain(struct iommu_group *group, struct device *dev)
1546 * iommu_group_get_for_dev - Find or create the IOMMU group for a device
1547 * @dev: target device
1551 * IOMMU group for a device. On success, the caller will hold a reference
1553 * device. The reference should be released with iommu_group_put().
1555 static struct iommu_group *iommu_group_get_for_dev(struct device *dev)
1597 static int probe_iommu_group(struct device *dev, void *data)
1618 static int remove_iommu_group(struct device *dev, void *data)
1628 struct device *dev = data;
1680 struct device *dev;
1684 static int probe_get_default_domain_type(struct device *dev, void *data)
1698 "Device needs domain type %s, but device %s in the same iommu group requires type %s - using default\n",
1728 static int iommu_group_do_dma_attach(struct device *dev, void *data)
1745 static int iommu_group_do_probe_finalize(struct device *dev, void *data)
1761 static int iommu_do_create_direct_mappings(struct device *dev, void *data)
1965 static int iommu_attach_device_ext(struct iommu_domain *domain, struct device *dev)
1980 int iommu_attach_device(struct iommu_domain *domain, struct device *dev)
1991 * Lock the group to make sure the device-count doesn't
2071 int iommu_uapi_cache_invalidate(struct iommu_domain *domain, struct device *dev, void __user *uinfo)
2192 int iommu_uapi_sva_bind_gpasid(struct iommu_domain *domain, struct device *dev, void __user *udata)
2210 int iommu_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev, ioasid_t pasid)
2220 int iommu_uapi_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev, void __user *udata)
2238 static void __iommu_detach_device(struct iommu_domain *domain, struct device *dev)
2252 void iommu_detach_device(struct iommu_domain *domain, struct device *dev)
2276 struct iommu_domain *iommu_get_domain_for_dev(struct device *dev)
2298 struct iommu_domain *iommu_get_dma_domain(struct device *dev)
2307 * device which represents the requestor ID of the group, but we also
2311 * PCI devices). Thus we attach each device.
2313 static int iommu_group_do_attach_device(struct device *dev, void *data)
2348 static int iommu_group_do_detach_device(struct device *dev, void *data)
2740 * @dev: the device where the fault has happened
2751 * - if restarting of the faulting device is required
2761 int report_iommu_fault(struct iommu_domain *domain, struct device *dev, unsigned long iova, int flags)
2830 void iommu_get_resv_regions(struct device *dev, struct list_head *list)
2839 void iommu_put_resv_regions(struct device *dev, struct list_head *list)
2850 * @dev: device for which to free reserved regions
2851 * @list: reserved region list for device
2858 void generic_iommu_put_resv_regions(struct device *dev, struct list_head *list)
2925 int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode, const struct iommu_ops *ops)
2951 void iommu_fwspec_free(struct device *dev)
2963 int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids)
2992 * Per device IOMMU features.
2994 bool iommu_dev_has_feature(struct device *dev, enum iommu_dev_features feat)
3006 int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
3021 * The device drivers should do the necessary cleanups before calling this.
3022 * For example, before disabling the aux-domain feature, the device driver
3025 int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
3039 bool iommu_dev_feature_enabled(struct device *dev, enum iommu_dev_features feat)
3057 * true. Also, as long as domains are attached to a device through this
3060 * This should make us safe against a device being attached to a guest as a
3063 int iommu_aux_attach_device(struct iommu_domain *domain, struct device *dev)
3079 void iommu_aux_detach_device(struct iommu_domain *domain, struct device *dev)
3088 int iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev)
3101 * iommu_sva_bind_device() - Bind a process address space to a device
3102 * @dev: the device
3105 * Create a bond between device and address space, allowing the device to access
3106 * the mm using the returned PASID. If a bond already exists between @device and
3115 struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata)
3130 /* Ensure device count and domain don't change while we're binding */
3135 * with more than one device. Existing SVA-capable systems are not
3137 * isolation, device ID aliasing and other hardware issues).
3157 * Put reference to a bond between device and address space. The device should
3166 struct device *dev = handle->dev;