Lines Matching defs:hwpt

25 	WARN_ON(igroup->hwpt || !list_empty(&igroup->device_list));
296 struct iommufd_hw_pagetable *hwpt)
314 if (sw_msi_start != PHYS_ADDR_MAX && !hwpt->msi_cookie) {
315 rc = iommu_get_msi_cookie(hwpt->domain, sw_msi_start);
323 hwpt->msi_cookie = true;
328 int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt,
335 if (idev->igroup->hwpt != NULL && idev->igroup->hwpt != hwpt) {
342 rc = iommufd_hw_pagetable_enforce_cc(hwpt);
347 rc = iopt_table_enforce_dev_resv_regions(&hwpt->ioas->iopt, idev->dev,
355 * should attach every device individually to the hwpt as the per-device
360 rc = iommufd_group_setup_msi(idev->igroup, hwpt);
364 rc = iommu_attach_group(hwpt->domain, idev->igroup->group);
367 idev->igroup->hwpt = hwpt;
369 refcount_inc(&hwpt->obj.users);
374 iopt_remove_reserved_iova(&hwpt->ioas->iopt, idev->dev);
383 struct iommufd_hw_pagetable *hwpt = idev->igroup->hwpt;
388 iommu_detach_group(hwpt->domain, idev->igroup->group);
389 idev->igroup->hwpt = NULL;
391 iopt_remove_reserved_iova(&hwpt->ioas->iopt, idev->dev);
394 /* Caller must destroy hwpt */
395 return hwpt;
400 struct iommufd_hw_pagetable *hwpt)
404 rc = iommufd_hw_pagetable_attach(hwpt, idev);
412 struct iommufd_hw_pagetable *hwpt)
422 if (igroup->hwpt == NULL) {
427 if (hwpt == igroup->hwpt) {
436 rc = iommufd_hw_pagetable_enforce_cc(hwpt);
442 old_hwpt = igroup->hwpt;
443 if (hwpt->ioas != old_hwpt->ioas) {
446 &hwpt->ioas->iopt, cur->dev, NULL);
452 rc = iommufd_group_setup_msi(idev->igroup, hwpt);
456 rc = iommu_group_replace_domain(igroup->group, hwpt->domain);
460 if (hwpt->ioas != old_hwpt->ioas) {
466 igroup->hwpt = hwpt;
469 * Move the refcounts held by the device_list to the new hwpt. Retain a
472 refcount_add(num_devices, &hwpt->obj.users);
482 iopt_remove_reserved_iova(&hwpt->ioas->iopt, cur->dev);
489 struct iommufd_device *idev, struct iommufd_hw_pagetable *hwpt);
510 struct iommufd_hw_pagetable *hwpt;
518 list_for_each_entry(hwpt, &ioas->hwpt_list, hwpt_item) {
519 if (!hwpt->auto_domain)
522 if (!iommufd_lock_obj(&hwpt->obj))
524 destroy_hwpt = (*do_attach)(idev, hwpt);
526 iommufd_put_object(&hwpt->obj);
537 *pt_id = hwpt->obj.id;
538 iommufd_put_object(&hwpt->obj);
542 hwpt = iommufd_hw_pagetable_alloc(idev->ictx, ioas, idev,
544 if (IS_ERR(hwpt)) {
545 destroy_hwpt = ERR_CAST(hwpt);
550 destroy_hwpt = (*do_attach)(idev, hwpt);
557 hwpt->auto_domain = true;
558 *pt_id = hwpt->obj.id;
560 iommufd_object_finalize(idev->ictx, &hwpt->obj);
565 iommufd_object_abort_and_destroy(idev->ictx, &hwpt->obj);
583 struct iommufd_hw_pagetable *hwpt =
586 destroy_hwpt = (*do_attach)(idev, hwpt);
677 struct iommufd_hw_pagetable *hwpt;
679 hwpt = iommufd_hw_pagetable_detach(idev);
680 iommufd_hw_pagetable_put(idev->ictx, hwpt);