Lines Matching defs:group
143 * it's freed via kref. Must support container/group/device being
167 device->group->container->iommu_driver;
171 device->group->container->iommu_data, device);
177 device->group->container->iommu_driver;
181 device->group->container->iommu_data, device);
239 struct vfio_group *group;
242 list_for_each_entry(group, &container->group_list, container_next) {
243 ret = driver->ops->attach_group(data, group->iommu_group,
244 group->type);
252 list_for_each_entry_continue_reverse(group, &container->group_list,
254 driver->ops->detach_group(data, group->iommu_group);
270 * the group can be assigned to specific users. Therefore, only by
271 * adding a group to a container does the user get the privilege of
417 struct vfio_group *group)
422 lockdep_assert_held(&group->group_lock);
424 if (group->type == VFIO_NO_IOMMU && !capable(CAP_SYS_RAWIO))
431 container->noiommu != (group->type == VFIO_NO_IOMMU)) {
436 if (group->type == VFIO_IOMMU) {
437 ret = iommu_group_claim_dma_owner(group->iommu_group, group);
445 group->iommu_group,
446 group->type);
448 if (group->type == VFIO_IOMMU)
450 group->iommu_group);
455 group->container = container;
456 group->container_users = 1;
457 container->noiommu = (group->type == VFIO_NO_IOMMU);
458 list_add(&group->container_next, &container->group_list);
460 /* Get a reference on the container and mark a user within the group */
468 void vfio_group_detach_container(struct vfio_group *group)
470 struct vfio_container *container = group->container;
473 lockdep_assert_held(&group->group_lock);
474 WARN_ON(group->container_users != 1);
481 group->iommu_group);
483 if (group->type == VFIO_IOMMU)
484 iommu_group_release_dma_owner(group->iommu_group);
486 group->container = NULL;
487 group->container_users = 0;
488 list_del(&group->container_next);
490 /* Detaching the last group deprivileges a container, remove iommu */
503 int vfio_group_use_container(struct vfio_group *group)
505 lockdep_assert_held(&group->group_lock);
511 if (!group->container->iommu_driver)
514 if (group->type == VFIO_NO_IOMMU && !capable(CAP_SYS_RAWIO))
517 get_file(group->opened_file);
518 group->container_users++;
522 void vfio_group_unuse_container(struct vfio_group *group)
524 lockdep_assert_held(&group->group_lock);
526 WARN_ON(group->container_users <= 1);
527 group->container_users--;
528 fput(group->opened_file);
535 struct vfio_container *container = device->group->container;
536 struct iommu_group *iommu_group = device->group->iommu_group;
551 struct vfio_container *container = device->group->container;
564 struct vfio_container *container = device->group->container;