aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorvenkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com>2008-12-19 16:47:28 -0500
committerH. Peter Anvin <hpa@zytor.com>2008-12-19 18:40:30 -0500
commit982d789ab76c8a11426852fec2fdf2f412e21c0c (patch)
tree41e6932764facecb11bc9ca831ffd67ded384d68 /arch/x86/mm
parentd87fe6607c31944f7572f965c1507ae77026c133 (diff)
x86: PAT: remove follow_pfnmap_pte in favor of follow_phys
Impact: Cleanup - removes a new function in favor of a recently modified older one. Replace follow_pfnmap_pte in pat code with follow_phys. follow_phys lso returns protection eliminating the need of pte_pgprot call. Using follow_phys also eliminates the need for pte_pa. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/pat.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index d5254bae84f4..541bcc944a5b 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -685,8 +685,7 @@ int track_pfn_vma_copy(struct vm_area_struct *vma)
685 int retval = 0; 685 int retval = 0;
686 unsigned long i, j; 686 unsigned long i, j;
687 u64 paddr; 687 u64 paddr;
688 pgprot_t prot; 688 unsigned long prot;
689 pte_t pte;
690 unsigned long vma_start = vma->vm_start; 689 unsigned long vma_start = vma->vm_start;
691 unsigned long vma_end = vma->vm_end; 690 unsigned long vma_end = vma->vm_end;
692 unsigned long vma_size = vma_end - vma_start; 691 unsigned long vma_size = vma_end - vma_start;
@@ -696,26 +695,22 @@ int track_pfn_vma_copy(struct vm_area_struct *vma)
696 695
697 if (is_linear_pfn_mapping(vma)) { 696 if (is_linear_pfn_mapping(vma)) {
698 /* 697 /*
699 * reserve the whole chunk starting from vm_pgoff, 698 * reserve the whole chunk covered by vma. We need the
700 * But, we have to get the protection from pte. 699 * starting address and protection from pte.
701 */ 700 */
702 if (follow_pfnmap_pte(vma, vma_start, &pte)) { 701 if (follow_phys(vma, vma_start, 0, &prot, &paddr)) {
703 WARN_ON_ONCE(1); 702 WARN_ON_ONCE(1);
704 return -1; 703 return -EINVAL;
705 } 704 }
706 prot = pte_pgprot(pte); 705 return reserve_pfn_range(paddr, vma_size, __pgprot(prot));
707 paddr = (u64)vma->vm_pgoff << PAGE_SHIFT;
708 return reserve_pfn_range(paddr, vma_size, prot);
709 } 706 }
710 707
711 /* reserve entire vma page by page, using pfn and prot from pte */ 708 /* reserve entire vma page by page, using pfn and prot from pte */
712 for (i = 0; i < vma_size; i += PAGE_SIZE) { 709 for (i = 0; i < vma_size; i += PAGE_SIZE) {
713 if (follow_pfnmap_pte(vma, vma_start + i, &pte)) 710 if (follow_phys(vma, vma_start + i, 0, &prot, &paddr))
714 continue; 711 continue;
715 712
716 paddr = pte_pa(pte); 713 retval = reserve_pfn_range(paddr, PAGE_SIZE, __pgprot(prot));
717 prot = pte_pgprot(pte);
718 retval = reserve_pfn_range(paddr, PAGE_SIZE, prot);
719 if (retval) 714 if (retval)
720 goto cleanup_ret; 715 goto cleanup_ret;
721 } 716 }
@@ -724,10 +719,9 @@ int track_pfn_vma_copy(struct vm_area_struct *vma)
724cleanup_ret: 719cleanup_ret:
725 /* Reserve error: Cleanup partial reservation and return error */ 720 /* Reserve error: Cleanup partial reservation and return error */
726 for (j = 0; j < i; j += PAGE_SIZE) { 721 for (j = 0; j < i; j += PAGE_SIZE) {
727 if (follow_pfnmap_pte(vma, vma_start + j, &pte)) 722 if (follow_phys(vma, vma_start + j, 0, &prot, &paddr))
728 continue; 723 continue;
729 724
730 paddr = pte_pa(pte);
731 free_pfn_range(paddr, PAGE_SIZE); 725 free_pfn_range(paddr, PAGE_SIZE);
732 } 726 }
733 727
@@ -797,6 +791,7 @@ void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
797{ 791{
798 unsigned long i; 792 unsigned long i;
799 u64 paddr; 793 u64 paddr;
794 unsigned long prot;
800 unsigned long vma_start = vma->vm_start; 795 unsigned long vma_start = vma->vm_start;
801 unsigned long vma_end = vma->vm_end; 796 unsigned long vma_end = vma->vm_end;
802 unsigned long vma_size = vma_end - vma_start; 797 unsigned long vma_size = vma_end - vma_start;
@@ -821,12 +816,9 @@ void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
821 } else { 816 } else {
822 /* free entire vma, page by page, using the pfn from pte */ 817 /* free entire vma, page by page, using the pfn from pte */
823 for (i = 0; i < vma_size; i += PAGE_SIZE) { 818 for (i = 0; i < vma_size; i += PAGE_SIZE) {
824 pte_t pte; 819 if (follow_phys(vma, vma_start + i, 0, &prot, &paddr))
825
826 if (follow_pfnmap_pte(vma, vma_start + i, &pte))
827 continue; 820 continue;
828 821
829 paddr = pte_pa(pte);
830 free_pfn_range(paddr, PAGE_SIZE); 822 free_pfn_range(paddr, PAGE_SIZE);
831 } 823 }
832 } 824 }