/* This function actually applies the mapping to the page table of the dma_ops domain.  */
static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, struct unity_map_entry *e)
/* This function actually applies the mapping to the page table of the dma_ops domain.  */
static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, struct unity_map_entry *e)
{
	u64 addr;
	int ret;
	for (addr = e->address_start; addr < e->address_end;
	     addr += PAGE_SIZE) {
		ret = iommu_map_page(&dma_dom->domain, addr, addr, e->prot,
				     PM_MAP_4k);
		if (ret)
			return ret;
		if (addr < dma_dom->aperture_size)
			__set_bit(addr >> PAGE_SHIFT,
				  dma_dom->aperture[0]->bitmap);
	}
	return 0;
}