diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-02-25 09:00:38 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-02-25 09:00:38 +0100 |
commit | c0853867a10f9215132dccdb84c720a5f856f4d2 (patch) | |
tree | 92d3162ea2fc6fe0276dabc869e01293325f862c /mm | |
parent | Merge tag 'arc-4.5-rc6-fixes-upd' of git://git.kernel.org/pub/scm/linux/kerne... (diff) | |
parent | watchdog/hpwdt: Fix build on certain configs (diff) | |
download | linux-c0853867a10f9215132dccdb84c720a5f856f4d2.tar.xz linux-c0853867a10f9215132dccdb84c720a5f856f4d2.zip |
Merge branch 'x86/debug' into core/objtool, to pick up frame pointer fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 25 | ||||
-rw-r--r-- | mm/mmap.c | 13 |
2 files changed, 32 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c index 635451abc8f7..38090ca37a08 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1551,8 +1551,29 @@ out: int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn) { + return vm_insert_pfn_prot(vma, addr, pfn, vma->vm_page_prot); +} +EXPORT_SYMBOL(vm_insert_pfn); + +/** + * vm_insert_pfn_prot - insert single pfn into user vma with specified pgprot + * @vma: user vma to map to + * @addr: target user address of this page + * @pfn: source kernel pfn + * @pgprot: pgprot flags for the inserted page + * + * This is exactly like vm_insert_pfn, except that it allows drivers to + * to override pgprot on a per-page basis. + * + * This only makes sense for IO mappings, and it makes no sense for + * cow mappings. In general, using multiple vmas is preferable; + * vm_insert_pfn_prot should only be used if using multiple VMAs is + * impractical. + */ +int vm_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, + unsigned long pfn, pgprot_t pgprot) +{ int ret; - pgprot_t pgprot = vma->vm_page_prot; /* * Technically, architectures with pte_special can avoid all these * restrictions (same for remap_pfn_range). However we would like @@ -1574,7 +1595,7 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, return ret; } -EXPORT_SYMBOL(vm_insert_pfn); +EXPORT_SYMBOL(vm_insert_pfn_prot); int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, pfn_t pfn) diff --git a/mm/mmap.c b/mm/mmap.c index 76d1ec29149b..90e3b869a8b9 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3066,11 +3066,16 @@ static int special_mapping_fault(struct vm_area_struct *vma, pgoff_t pgoff; struct page **pages; - if (vma->vm_ops == &legacy_special_mapping_vmops) + if (vma->vm_ops == &legacy_special_mapping_vmops) { pages = vma->vm_private_data; - else - pages = ((struct vm_special_mapping *)vma->vm_private_data)-> - pages; + } else { + struct vm_special_mapping *sm = vma->vm_private_data; + + if (sm->fault) + return sm->fault(sm, vma, vmf); + + pages = sm->pages; + } for (pgoff = vmf->pgoff; pgoff && *pages; ++pages) pgoff--; |