Lines Matching full:domain
57 VirtIOIOMMUDomain *domain; member
99 if (!ep || !ep->domain) { in virtio_iommu_device_bypassed()
102 bypassed = ep->domain->bypass; in virtio_iommu_device_bypassed()
305 VirtIOIOMMUDomain *domain = ep->domain; in virtio_iommu_detach_endpoint_from_domain() local
308 if (!ep->domain) { in virtio_iommu_detach_endpoint_from_domain()
311 trace_virtio_iommu_detach_endpoint_from_domain(domain->id, ep->id); in virtio_iommu_detach_endpoint_from_domain()
312 g_tree_foreach(domain->mappings, virtio_iommu_notify_unmap_cb, in virtio_iommu_detach_endpoint_from_domain()
315 ep->domain = NULL; in virtio_iommu_detach_endpoint_from_domain()
345 if (ep->domain) { in virtio_iommu_put_endpoint()
357 VirtIOIOMMUDomain *domain; in virtio_iommu_get_domain() local
359 domain = g_tree_lookup(s->domains, GUINT_TO_POINTER(domain_id)); in virtio_iommu_get_domain()
360 if (domain) { in virtio_iommu_get_domain()
361 if (domain->bypass != bypass) { in virtio_iommu_get_domain()
364 return domain; in virtio_iommu_get_domain()
366 domain = g_malloc0(sizeof(*domain)); in virtio_iommu_get_domain()
367 domain->id = domain_id; in virtio_iommu_get_domain()
368 domain->mappings = g_tree_new_full((GCompareDataFunc)interval_cmp, in virtio_iommu_get_domain()
371 domain->bypass = bypass; in virtio_iommu_get_domain()
372 g_tree_insert(s->domains, GUINT_TO_POINTER(domain_id), domain); in virtio_iommu_get_domain()
373 QLIST_INIT(&domain->endpoint_list); in virtio_iommu_get_domain()
375 return domain; in virtio_iommu_get_domain()
380 VirtIOIOMMUDomain *domain = (VirtIOIOMMUDomain *)data; in virtio_iommu_put_domain() local
383 QLIST_FOREACH_SAFE(iter, &domain->endpoint_list, next, tmp) { in virtio_iommu_put_domain()
386 g_tree_destroy(domain->mappings); in virtio_iommu_put_domain()
387 trace_virtio_iommu_put_domain(domain->id); in virtio_iommu_put_domain()
388 g_free(domain); in virtio_iommu_put_domain()
715 uint32_t domain_id = le32_to_cpu(req->domain); in virtio_iommu_attach()
718 VirtIOIOMMUDomain *domain; in virtio_iommu_attach() local
733 if (ep->domain) { in virtio_iommu_attach()
734 VirtIOIOMMUDomain *previous_domain = ep->domain; in virtio_iommu_attach()
736 * the device is already attached to a domain, in virtio_iommu_attach()
745 domain = virtio_iommu_get_domain(s, domain_id, in virtio_iommu_attach()
747 if (!domain) { in virtio_iommu_attach()
751 QLIST_INSERT_HEAD(&domain->endpoint_list, ep, next); in virtio_iommu_attach()
753 ep->domain = domain; in virtio_iommu_attach()
757 /* Replay domain mappings on the associated memory region */ in virtio_iommu_attach()
758 g_tree_foreach(domain->mappings, virtio_iommu_notify_map_cb, in virtio_iommu_attach()
767 uint32_t domain_id = le32_to_cpu(req->domain); in virtio_iommu_detach()
769 VirtIOIOMMUDomain *domain; in virtio_iommu_detach() local
779 domain = ep->domain; in virtio_iommu_detach()
781 if (!domain || domain->id != domain_id) { in virtio_iommu_detach()
787 if (QLIST_EMPTY(&domain->endpoint_list)) { in virtio_iommu_detach()
788 g_tree_remove(s->domains, GUINT_TO_POINTER(domain->id)); in virtio_iommu_detach()
797 uint32_t domain_id = le32_to_cpu(req->domain); in virtio_iommu_map()
802 VirtIOIOMMUDomain *domain; in virtio_iommu_map() local
811 domain = g_tree_lookup(s->domains, GUINT_TO_POINTER(domain_id)); in virtio_iommu_map()
812 if (!domain) { in virtio_iommu_map()
816 if (domain->bypass) { in virtio_iommu_map()
825 mapping = g_tree_lookup(domain->mappings, (gpointer)interval); in virtio_iommu_map()
837 g_tree_insert(domain->mappings, interval, mapping); in virtio_iommu_map()
839 QLIST_FOREACH(ep, &domain->endpoint_list, next) { in virtio_iommu_map()
850 uint32_t domain_id = le32_to_cpu(req->domain); in virtio_iommu_unmap()
855 VirtIOIOMMUDomain *domain; in virtio_iommu_unmap() local
861 domain = g_tree_lookup(s->domains, GUINT_TO_POINTER(domain_id)); in virtio_iommu_unmap()
862 if (!domain) { in virtio_iommu_unmap()
866 if (domain->bypass) { in virtio_iommu_unmap()
873 while (g_tree_lookup_extended(domain->mappings, &interval, in virtio_iommu_unmap()
879 QLIST_FOREACH(ep, &domain->endpoint_list, next) { in virtio_iommu_unmap()
883 g_tree_remove(domain->mappings, iter_key); in virtio_iommu_unmap()
1176 assert(ep && ep->domain && !ep->domain->bypass); in virtio_iommu_translate()
1209 if (!ep->domain) { in virtio_iommu_translate()
1211 error_report_once("%s %02x:%02x.%01x not attached to any domain", in virtio_iommu_translate()
1221 } else if (ep->domain->bypass) { in virtio_iommu_translate()
1226 found = g_tree_lookup_extended(ep->domain->mappings, (gpointer)(&interval), in virtio_iommu_translate()
1355 if (!ep || !ep->domain) { in virtio_iommu_replay()
1359 g_tree_foreach(ep->domain->mappings, virtio_iommu_remap, mr); in virtio_iommu_replay()
1566 VirtIOIOMMUDomain *domain = opaque; in domain_preload() local
1568 domain->mappings = g_tree_new_full((GCompareDataFunc)interval_cmp, in domain_preload()
1584 .name = "domain",
1612 iter->domain = d; in reconstruct_endpoints()
1616 return false; /* continue the domain traversal */ in reconstruct_endpoints()
1627 * 'config.bypass' and attached domain type if there is. After in iommu_post_load()