Lines Matching refs:dom

124 static struct protection_domain *to_pdomain(struct iommu_domain *dom)  in to_pdomain()  argument
126 return container_of(dom, struct protection_domain, domain); in to_pdomain()
1322 static int iommu_map_page(struct protection_domain *dom, in iommu_map_page() argument
1338 pte = alloc_pte(dom, bus_addr, page_size, NULL, GFP_KERNEL); in iommu_map_page()
1361 update_domain(dom); in iommu_map_page()
1366 static unsigned long iommu_unmap_page(struct protection_domain *dom, in iommu_unmap_page() argument
1380 pte = fetch_pte(dom, bus_addr, &unmap_size); in iommu_unmap_page()
1419 static void dma_ops_reserve_addresses(struct dma_ops_domain *dom, in dma_ops_reserve_addresses() argument
1423 unsigned int i, last_page = dom->aperture_size >> PAGE_SHIFT; in dma_ops_reserve_addresses()
1431 __set_bit(page, dom->aperture[index]->bitmap); in dma_ops_reserve_addresses()
1543 struct dma_ops_domain *dom, in dma_ops_area_alloc() argument
1549 unsigned long next_bit = dom->next_address % APERTURE_RANGE_SIZE; in dma_ops_area_alloc()
1550 int max_index = dom->aperture_size >> APERTURE_RANGE_SHIFT; in dma_ops_area_alloc()
1564 unsigned long offset = dom->aperture[i]->offset >> PAGE_SHIFT; in dma_ops_area_alloc()
1566 if (dom->aperture[i]->offset >= dma_mask) in dma_ops_area_alloc()
1572 address = iommu_area_alloc(dom->aperture[i]->bitmap, in dma_ops_area_alloc()
1576 address = dom->aperture[i]->offset + in dma_ops_area_alloc()
1578 dom->next_address = address + (pages << PAGE_SHIFT); in dma_ops_area_alloc()
1589 struct dma_ops_domain *dom, in dma_ops_alloc_addresses() argument
1597 dom->next_address = 0; in dma_ops_alloc_addresses()
1598 dom->need_flush = true; in dma_ops_alloc_addresses()
1601 address = dma_ops_area_alloc(dev, dom, pages, align_mask, in dma_ops_alloc_addresses()
1602 dma_mask, dom->next_address); in dma_ops_alloc_addresses()
1605 dom->next_address = 0; in dma_ops_alloc_addresses()
1606 address = dma_ops_area_alloc(dev, dom, pages, align_mask, in dma_ops_alloc_addresses()
1608 dom->need_flush = true; in dma_ops_alloc_addresses()
1614 WARN_ON((address + (PAGE_SIZE*pages)) > dom->aperture_size); in dma_ops_alloc_addresses()
1624 static void dma_ops_free_addresses(struct dma_ops_domain *dom, in dma_ops_free_addresses() argument
1629 struct aperture_range *range = dom->aperture[i]; in dma_ops_free_addresses()
1638 if (address >= dom->next_address) in dma_ops_free_addresses()
1639 dom->need_flush = true; in dma_ops_free_addresses()
1816 static void dma_ops_domain_free(struct dma_ops_domain *dom) in dma_ops_domain_free() argument
1820 if (!dom) in dma_ops_domain_free()
1823 del_domain_from_list(&dom->domain); in dma_ops_domain_free()
1825 free_pagetable(&dom->domain); in dma_ops_domain_free()
1828 if (!dom->aperture[i]) in dma_ops_domain_free()
1830 free_page((unsigned long)dom->aperture[i]->bitmap); in dma_ops_domain_free()
1831 kfree(dom->aperture[i]); in dma_ops_domain_free()
1834 kfree(dom); in dma_ops_domain_free()
2345 static u64* dma_ops_get_pte(struct dma_ops_domain *dom, in dma_ops_get_pte() argument
2351 aperture = dom->aperture[APERTURE_RANGE_INDEX(address)]; in dma_ops_get_pte()
2357 pte = alloc_pte(&dom->domain, address, PAGE_SIZE, &pte_page, in dma_ops_get_pte()
2363 update_domain(&dom->domain); in dma_ops_get_pte()
2372 static dma_addr_t dma_ops_domain_map(struct dma_ops_domain *dom, in dma_ops_domain_map() argument
2379 WARN_ON(address > dom->aperture_size); in dma_ops_domain_map()
2383 pte = dma_ops_get_pte(dom, address); in dma_ops_domain_map()
2406 static void dma_ops_domain_unmap(struct dma_ops_domain *dom, in dma_ops_domain_unmap() argument
2412 if (address >= dom->aperture_size) in dma_ops_domain_unmap()
2415 aperture = dom->aperture[APERTURE_RANGE_INDEX(address)]; in dma_ops_domain_unmap()
2970 static void amd_iommu_domain_free(struct iommu_domain *dom) in amd_iommu_domain_free() argument
2974 if (!dom) in amd_iommu_domain_free()
2977 domain = to_pdomain(dom); in amd_iommu_domain_free()
2993 static void amd_iommu_detach_device(struct iommu_domain *dom, in amd_iommu_detach_device() argument
3015 static int amd_iommu_attach_device(struct iommu_domain *dom, in amd_iommu_attach_device() argument
3018 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_attach_device()
3042 static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, in amd_iommu_map() argument
3045 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_map()
3064 static size_t amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova, in amd_iommu_unmap() argument
3067 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_unmap()
3082 static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, in amd_iommu_iova_to_phys() argument
3085 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_iova_to_phys()
3199 void amd_iommu_domain_direct_map(struct iommu_domain *dom) in amd_iommu_domain_direct_map() argument
3201 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_direct_map()
3220 int amd_iommu_domain_enable_v2(struct iommu_domain *dom, int pasids) in amd_iommu_domain_enable_v2() argument
3222 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_enable_v2()
3336 int amd_iommu_flush_page(struct iommu_domain *dom, int pasid, in amd_iommu_flush_page() argument
3339 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_flush_page()
3359 int amd_iommu_flush_tlb(struct iommu_domain *dom, int pasid) in amd_iommu_flush_tlb() argument
3361 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_flush_tlb()
3438 int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid, in amd_iommu_domain_set_gcr3() argument
3441 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_set_gcr3()
3453 int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid) in amd_iommu_domain_clear_gcr3() argument
3455 struct protection_domain *domain = to_pdomain(dom); in amd_iommu_domain_clear_gcr3()