提交 b76dd2fa 编写于 作者: S Stephen Hemminger 提交者: Yang Yingliang

uio: introduce UIO_MEM_IOVA

mainline inclusion
from mainline-v4.20-rc1
commit bfddabfa
category: bugfix
bugzilla: 180968
CVE: NA

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

Introduce the concept of mapping physical memory locations that
are normal memory. The new type UIO_MEM_IOVA are similar to
existing UIO_MEM_PHYS but the backing memory is not marked as uncached.

Also, indent related switch to the currently used style.
Signed-off-by: NStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Huang <chenhuang5@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 13755d5b
...@@ -738,7 +738,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) ...@@ -738,7 +738,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
return -EINVAL; return -EINVAL;
vma->vm_ops = &uio_physical_vm_ops; vma->vm_ops = &uio_physical_vm_ops;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); if (idev->info->mem[mi].memtype == UIO_MEM_PHYS)
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
/* /*
* We cannot use the vm_iomap_memory() helper here, * We cannot use the vm_iomap_memory() helper here,
...@@ -795,18 +796,19 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma) ...@@ -795,18 +796,19 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
} }
switch (idev->info->mem[mi].memtype) { switch (idev->info->mem[mi].memtype) {
case UIO_MEM_PHYS: case UIO_MEM_IOVA:
ret = uio_mmap_physical(vma); case UIO_MEM_PHYS:
break; ret = uio_mmap_physical(vma);
case UIO_MEM_LOGICAL: break;
case UIO_MEM_VIRTUAL: case UIO_MEM_LOGICAL:
ret = uio_mmap_logical(vma); case UIO_MEM_VIRTUAL:
break; ret = uio_mmap_logical(vma);
default: break;
ret = -EINVAL; default:
ret = -EINVAL;
} }
out: out:
mutex_unlock(&idev->info_lock); mutex_unlock(&idev->info_lock);
return ret; return ret;
} }
......
...@@ -133,6 +133,7 @@ extern void uio_event_notify(struct uio_info *info); ...@@ -133,6 +133,7 @@ extern void uio_event_notify(struct uio_info *info);
#define UIO_MEM_PHYS 1 #define UIO_MEM_PHYS 1
#define UIO_MEM_LOGICAL 2 #define UIO_MEM_LOGICAL 2
#define UIO_MEM_VIRTUAL 3 #define UIO_MEM_VIRTUAL 3
#define UIO_MEM_IOVA 4
/* defines for uio_port->porttype */ /* defines for uio_port->porttype */
#define UIO_PORT_NONE 0 #define UIO_PORT_NONE 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册