Lines Matching refs:dom
130 static struct protection_domain *to_pdomain(struct iommu_domain *dom) in to_pdomain() argument
132 return container_of(dom, struct protection_domain, domain); in to_pdomain()
1389 static int iommu_map_page(struct protection_domain *dom, in iommu_map_page() argument
1405 pte = alloc_pte(dom, bus_addr, page_size, NULL, GFP_KERNEL); in iommu_map_page()
1428 update_domain(dom); in iommu_map_page()
1433 static unsigned long iommu_unmap_page(struct protection_domain *dom, in iommu_unmap_page() argument
1447 pte = fetch_pte(dom, bus_addr, &unmap_size); in iommu_unmap_page()
1574 static void dma_ops_reserve_addresses(struct dma_ops_domain *dom, in dma_ops_reserve_addresses() argument
1578 unsigned int i, last_page = dom->aperture_size >> PAGE_SHIFT; in dma_ops_reserve_addresses()
1586 __set_bit(page, dom->aperture[index]->bitmap); in dma_ops_reserve_addresses()
1698 struct dma_ops_domain *dom, in dma_ops_area_alloc() argument
1704 unsigned long next_bit = dom->next_address % APERTURE_RANGE_SIZE; in dma_ops_area_alloc()
1705 int max_index = dom->aperture_size >> APERTURE_RANGE_SHIFT; in dma_ops_area_alloc()
1717 unsigned long offset = dom->aperture[i]->offset >> PAGE_SHIFT; in dma_ops_area_alloc()
1719 if (dom->aperture[i]->offset >= dma_mask) in dma_ops_area_alloc()
1725 address = iommu_area_alloc(dom->aperture[i]->bitmap, in dma_ops_area_alloc()
1729 address = dom->aperture[i]->offset + in dma_ops_area_alloc()
1731 dom->next_address = address + (pages << PAGE_SHIFT); in dma_ops_area_alloc()
1742 struct dma_ops_domain *dom, in dma_ops_alloc_addresses() argument
1750 dom->next_address = 0; in dma_ops_alloc_addresses()
1751 dom->need_flush = true; in dma_ops_alloc_addresses()
1754 address = dma_ops_area_alloc(dev, dom, pages, align_mask, in dma_ops_alloc_addresses()
1755 dma_mask, dom->next_address); in dma_ops_alloc_addresses()
1758 dom->next_address = 0; in dma_ops_alloc_addresses()
1759 address = dma_ops_area_alloc(dev, dom, pages, align_mask, in dma_ops_alloc_addresses()
1761 dom->need_flush = true; in dma_ops_alloc_addresses()
1767 WARN_ON((address + (PAGE_SIZE*pages)) > dom->aperture_size); in dma_ops_alloc_addresses()
1777 static void dma_ops_free_addresses(struct dma_ops_domain *dom, in dma_ops_free_addresses() argument
1782 struct aperture_range *range = dom->aperture[i]; in dma_ops_free_addresses()
1791 if (address >= dom->next_address) in dma_ops_free_addresses()
1792 dom->need_flush = true; in dma_ops_free_addresses()
1969 static void dma_ops_domain_free(struct dma_ops_domain *dom) in dma_ops_domain_free() argument
1973 if (!dom) in dma_ops_domain_free()
1976 del_domain_from_list(&dom->domain); in dma_ops_domain_free()
1978 free_pagetable(&dom->domain); in dma_ops_domain_free()
1981 if (!dom->aperture[i]) in dma_ops_domain_free()
1983 free_page((unsigned long)dom->aperture[i]->bitmap); in dma_ops_domain_free()
1984 kfree(dom->aperture[i]); in dma_ops_domain_free()
1987 kfree(dom); in dma_ops_domain_free()
2389 struct protection_domain *dom = NULL; in domain_for_device() local
2403 dom = alias_data->domain; in domain_for_device()
2408 return dom; in domain_for_device()
2552 static u64* dma_ops_get_pte(struct dma_ops_domain *dom, in dma_ops_get_pte() argument
2558 aperture = dom->aperture[APERTURE_RANGE_INDEX(address)]; in dma_ops_get_pte()
2564 pte = alloc_pte(&dom->domain, address, PAGE_SIZE, &pte_page, in dma_ops_get_pte()
2570 update_domain(&dom->domain); in dma_ops_get_pte()
2579 static dma_addr_t dma_ops_domain_map(struct dma_ops_domain *dom, in dma_ops_domain_map() argument
2586 WARN_ON(address > dom->aperture_size); in dma_ops_domain_map()
2590 pte = dma_ops_get_pte(dom, address); in dma_ops_domain_map()
2613 static void dma_ops_domain_unmap(struct dma_ops_domain *dom, in dma_ops_domain_unmap() argument
2619 if (address >= dom->aperture_size) in dma_ops_domain_unmap()
2622 aperture = dom->aperture[APERTURE_RANGE_INDEX(address)]; in dma_ops_domain_unmap()
3275 static void amd_iommu_domain_free(struct iommu_domain *dom) in amd_iommu_domain_free() argument
3279 if (!dom) in amd_iommu_domain_free()
3282 domain = to_pdomain(dom); in amd_iommu_domain_free()
3298 static void amd_iommu_detach_device(struct iommu_domain *dom, in amd_iommu_detach_device() argument
3320 static int amd_iommu_attach_device(struct iommu_domain *dom, in amd_iommu_attach_device() argument
3323 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_attach_device()
3347 static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, in amd_iommu_map() argument
3350 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_map()
3369 static size_t amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova, in amd_iommu_unmap() argument
3372 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_unmap()
3387 static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, in amd_iommu_iova_to_phys() argument
3390 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_iova_to_phys()
3485 void amd_iommu_domain_direct_map(struct iommu_domain *dom) in amd_iommu_domain_direct_map() argument
3487 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_direct_map()
3506 int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids) in amd_iommu_domain_enable_v2() argument
3508 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_enable_v2()
3617 int amd_iommu_flush_page(struct iommu_domain *dom, int pasid, in amd_iommu_flush_page() argument
3620 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_flush_page()
3640 int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid) in amd_iommu_flush_tlb() argument
3642 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_flush_tlb()
3719 int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid, in amd_iommu_domain_set_gcr3() argument
3722 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_set_gcr3()
3734 int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid) in amd_iommu_domain_clear_gcr3() argument
3736 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_clear_gcr3()