/* prot is passed in as a parameter for the new mapping. If the vma has a linear pfn mapping for the entire range reserve the entire vma range with single reserve_pfn_range call.  */
int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, unsigned long pfn, unsigned long size)
/* prot is passed in as a parameter for the new mapping. If the vma has a linear pfn mapping for the entire range reserve the entire vma range with single reserve_pfn_range call.  */
int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, unsigned long pfn, unsigned long size)
{
	unsigned long flags;
	resource_size_t paddr;
	unsigned long vma_size = vma->vm_end - vma->vm_start;
	if (is_linear_pfn_mapping(vma)) {
		paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT;
		return reserve_pfn_range(paddr, vma_size, prot, 0);
	}
	if (!pat_enabled)
		return 0;
	flags = lookup_memtype(pfn << PAGE_SHIFT);
	*prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) |
			 flags);
	return 0;
}