Skip to content
Snippets Groups Projects
Commit cd59f951 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Ed Tam
Browse files

uio: provide vm access to UIO_MEM_PHYS maps


This makes it possible to let gdb access mappings of the process that is
being debugged.

uio_mmap_logical was moved and uio_vm_ops renamed to group related code
and differentiate to new stuff.

CRs-Fixed: 570735
Change-Id: I8a5ff343727cc58fedfeb73f3466cc9a7f153e84
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 7294151d
Git-repo: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarPratibhasagar V <pratibha@codeaurora.org>
Signed-off-by: default avatarEd Tam <etam@google.com>
parent 93d5429e
No related branches found
No related tags found
No related merge requests found
...@@ -640,12 +640,26 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -640,12 +640,26 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return 0; return 0;
} }
static const struct vm_operations_struct uio_vm_ops = { static const struct vm_operations_struct uio_logical_vm_ops = {
.open = uio_vma_open, .open = uio_vma_open,
.close = uio_vma_close, .close = uio_vma_close,
.fault = uio_vma_fault, .fault = uio_vma_fault,
}; };
static int uio_mmap_logical(struct vm_area_struct *vma)
{
vma->vm_flags |= VM_DONTEXPAND | VM_NODUMP;
vma->vm_ops = &uio_logical_vm_ops;
uio_vma_open(vma);
return 0;
}
static const struct vm_operations_struct uio_physical_vm_ops = {
#ifdef CONFIG_HAVE_IOREMAP_PROT
.access = generic_access_phys,
#endif
};
static int uio_mmap_physical(struct vm_area_struct *vma) static int uio_mmap_physical(struct vm_area_struct *vma)
{ {
struct uio_device *idev = vma->vm_private_data; struct uio_device *idev = vma->vm_private_data;
...@@ -653,7 +667,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma) ...@@ -653,7 +667,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
if (mi < 0) if (mi < 0)
return -EINVAL; return -EINVAL;
vma->vm_flags |= VM_IO | VM_RESERVED; vma->vm_ops = &uio_physical_vm_ops;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
...@@ -664,14 +678,6 @@ static int uio_mmap_physical(struct vm_area_struct *vma) ...@@ -664,14 +678,6 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
vma->vm_page_prot); vma->vm_page_prot);
} }
static int uio_mmap_logical(struct vm_area_struct *vma)
{
vma->vm_flags |= VM_RESERVED;
vma->vm_ops = &uio_vm_ops;
uio_vma_open(vma);
return 0;
}
static int uio_mmap(struct file *filep, struct vm_area_struct *vma) static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
{ {
struct uio_listener *listener = filep->private_data; struct uio_listener *listener = filep->private_data;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment