/* This function fetches the PTE for a given address in the aperture  */
static u64* dma_ops_get_pte(struct dma_ops_domain *dom, unsigned long address)
/* This function fetches the PTE for a given address in the aperture  */
static u64* dma_ops_get_pte(struct dma_ops_domain *dom, unsigned long address)
{
	struct aperture_range *aperture;
	u64 *pte, *pte_page;
	aperture = dom->aperture[APERTURE_RANGE_INDEX(address)];
	if (!aperture)
		return NULL;
	pte = aperture->pte_pages[APERTURE_PAGE_INDEX(address)];
	if (!pte) {
		pte = alloc_pte(&dom->domain, address, PM_MAP_4k, &pte_page,
				GFP_ATOMIC);
		aperture->pte_pages[APERTURE_PAGE_INDEX(address)] = pte_page;
	} else
		pte += PM_LEVEL_INDEX(0, address);
	update_domain(&dom->domain);
	return pte;
}