提交 f39dcd53 编写于 作者: D Ding Tianhong 提交者: Yang Yingliang

arm64/ascend: Don't use the DvPP mmap space for svm.

ascend inclusion
category: feature
bugzilla: NA
CVE: NA

-------------------------------------------------

The svm_get_unmapped_area is only used for real time service(RTS),
the interface should not alloc virtual address from the DvPP mmap
space, so add restrictions to avoid this..
Signed-off-by: NJiankang Chen <chenjiankang1@huawei.com>
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NLijun Fang <fanglijun3@huawei.com>
Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 97f31b31
...@@ -1500,6 +1500,10 @@ static unsigned long svm_get_unmapped_area(struct file *file, ...@@ -1500,6 +1500,10 @@ static unsigned long svm_get_unmapped_area(struct file *file,
struct vm_area_struct *vma = NULL; struct vm_area_struct *vma = NULL;
addr = ALIGN(addr, len); addr = ALIGN(addr, len);
if (dvpp_mmap_check(addr, len, flags))
return -ENOMEM;
vma = find_vma(mm, addr); vma = find_vma(mm, addr);
if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
(vma == NULL || addr + len <= vm_start_gap(vma))) (vma == NULL || addr + len <= vm_start_gap(vma)))
...@@ -1509,16 +1513,22 @@ static unsigned long svm_get_unmapped_area(struct file *file, ...@@ -1509,16 +1513,22 @@ static unsigned long svm_get_unmapped_area(struct file *file,
info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.flags = VM_UNMAPPED_AREA_TOPDOWN;
info.length = len; info.length = len;
info.low_limit = max(PAGE_SIZE, mmap_min_addr); info.low_limit = max(PAGE_SIZE, mmap_min_addr);
info.high_limit = mm->mmap_base; info.high_limit = ((mm->mmap_base <= DVPP_MMAP_BASE) ?
mm->mmap_base : DVPP_MMAP_BASE);
info.align_mask = ((len >> PAGE_SHIFT) - 1) << PAGE_SHIFT; info.align_mask = ((len >> PAGE_SHIFT) - 1) << PAGE_SHIFT;
info.align_offset = pgoff << PAGE_SHIFT; info.align_offset = pgoff << PAGE_SHIFT;
addr = vm_unmapped_area(&info); addr = vm_unmapped_area(&info);
if (offset_in_page(addr)) { if (offset_in_page(addr)) {
VM_BUG_ON(addr != -ENOMEM); VM_BUG_ON(addr != -ENOMEM);
info.flags = 0; info.flags = 0;
info.low_limit = TASK_UNMAPPED_BASE; info.low_limit = TASK_UNMAPPED_BASE;
info.high_limit = TASK_SIZE; info.high_limit = DVPP_MMAP_BASE;
if (enable_map_dvpp)
dvpp_mmap_get_area(info);
addr = vm_unmapped_area(&info); addr = vm_unmapped_area(&info);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册