diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-01-15 19:56:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-15 20:56:32 -0500 |
commit | 01c8f1c44b83a0825b573e7c723b033cece37b86 (patch) | |
tree | 5900d53e74db4515aa6aa760dd120122171fdaa0 /mm/memory.c | |
parent | 69660fd797c3e52f7f20478a27687f293d1a41be (diff) |
mm, dax, gpu: convert vm_insert_mixed to pfn_t
Convert the raw unsigned long 'pfn' argument to pfn_t for the purpose of
evaluating the PFN_MAP and PFN_DEV flags. When both are set it triggers
_PAGE_DEVMAP to be set in the resulting pte.
There are no functional changes to the gpu drivers as a result of this
conversion.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave@sr71.net>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c index 5a73c6ed8e5c..7f03652723ea 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/export.h> | 50 | #include <linux/export.h> |
51 | #include <linux/delayacct.h> | 51 | #include <linux/delayacct.h> |
52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
53 | #include <linux/pfn_t.h> | ||
53 | #include <linux/writeback.h> | 54 | #include <linux/writeback.h> |
54 | #include <linux/memcontrol.h> | 55 | #include <linux/memcontrol.h> |
55 | #include <linux/mmu_notifier.h> | 56 | #include <linux/mmu_notifier.h> |
@@ -1500,7 +1501,7 @@ int vm_insert_page(struct vm_area_struct *vma, unsigned long addr, | |||
1500 | EXPORT_SYMBOL(vm_insert_page); | 1501 | EXPORT_SYMBOL(vm_insert_page); |
1501 | 1502 | ||
1502 | static int insert_pfn(struct vm_area_struct *vma, unsigned long addr, | 1503 | static int insert_pfn(struct vm_area_struct *vma, unsigned long addr, |
1503 | unsigned long pfn, pgprot_t prot) | 1504 | pfn_t pfn, pgprot_t prot) |
1504 | { | 1505 | { |
1505 | struct mm_struct *mm = vma->vm_mm; | 1506 | struct mm_struct *mm = vma->vm_mm; |
1506 | int retval; | 1507 | int retval; |
@@ -1516,7 +1517,10 @@ static int insert_pfn(struct vm_area_struct *vma, unsigned long addr, | |||
1516 | goto out_unlock; | 1517 | goto out_unlock; |
1517 | 1518 | ||
1518 | /* Ok, finally just insert the thing.. */ | 1519 | /* Ok, finally just insert the thing.. */ |
1519 | entry = pte_mkspecial(pfn_pte(pfn, prot)); | 1520 | if (pfn_t_devmap(pfn)) |
1521 | entry = pte_mkdevmap(pfn_t_pte(pfn, prot)); | ||
1522 | else | ||
1523 | entry = pte_mkspecial(pfn_t_pte(pfn, prot)); | ||
1520 | set_pte_at(mm, addr, pte, entry); | 1524 | set_pte_at(mm, addr, pte, entry); |
1521 | update_mmu_cache(vma, addr, pte); /* XXX: why not for insert_page? */ | 1525 | update_mmu_cache(vma, addr, pte); /* XXX: why not for insert_page? */ |
1522 | 1526 | ||
@@ -1566,14 +1570,14 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, | |||
1566 | if (track_pfn_insert(vma, &pgprot, pfn)) | 1570 | if (track_pfn_insert(vma, &pgprot, pfn)) |
1567 | return -EINVAL; | 1571 | return -EINVAL; |
1568 | 1572 | ||
1569 | ret = insert_pfn(vma, addr, pfn, pgprot); | 1573 | ret = insert_pfn(vma, addr, __pfn_to_pfn_t(pfn, PFN_DEV), pgprot); |
1570 | 1574 | ||
1571 | return ret; | 1575 | return ret; |
1572 | } | 1576 | } |
1573 | EXPORT_SYMBOL(vm_insert_pfn); | 1577 | EXPORT_SYMBOL(vm_insert_pfn); |
1574 | 1578 | ||
1575 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | 1579 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, |
1576 | unsigned long pfn) | 1580 | pfn_t pfn) |
1577 | { | 1581 | { |
1578 | BUG_ON(!(vma->vm_flags & VM_MIXEDMAP)); | 1582 | BUG_ON(!(vma->vm_flags & VM_MIXEDMAP)); |
1579 | 1583 | ||
@@ -1587,10 +1591,10 @@ int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | |||
1587 | * than insert_pfn). If a zero_pfn were inserted into a VM_MIXEDMAP | 1591 | * than insert_pfn). If a zero_pfn were inserted into a VM_MIXEDMAP |
1588 | * without pte special, it would there be refcounted as a normal page. | 1592 | * without pte special, it would there be refcounted as a normal page. |
1589 | */ | 1593 | */ |
1590 | if (!HAVE_PTE_SPECIAL && pfn_valid(pfn)) { | 1594 | if (!HAVE_PTE_SPECIAL && pfn_t_valid(pfn)) { |
1591 | struct page *page; | 1595 | struct page *page; |
1592 | 1596 | ||
1593 | page = pfn_to_page(pfn); | 1597 | page = pfn_t_to_page(pfn); |
1594 | return insert_page(vma, addr, page, vma->vm_page_prot); | 1598 | return insert_page(vma, addr, page, vma->vm_page_prot); |
1595 | } | 1599 | } |
1596 | return insert_pfn(vma, addr, pfn, vma->vm_page_prot); | 1600 | return insert_pfn(vma, addr, pfn, vma->vm_page_prot); |