diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-08-07 07:02:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-12 18:46:51 -0400 |
commit | 7294151d0592e0ff48c61fca9fd7c93d613134da (patch) | |
tree | 0f47ae996e2811f92f7c430d93cbae6acf8ccd47 /drivers/uio | |
parent | 5a73633ef01cd8772defa6a3c34a588376a1df4c (diff) |
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.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/uio.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 3b96f18593b3..c4279b2234ac 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -630,12 +630,26 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
630 | return 0; | 630 | return 0; |
631 | } | 631 | } |
632 | 632 | ||
633 | static const struct vm_operations_struct uio_vm_ops = { | 633 | static const struct vm_operations_struct uio_logical_vm_ops = { |
634 | .open = uio_vma_open, | 634 | .open = uio_vma_open, |
635 | .close = uio_vma_close, | 635 | .close = uio_vma_close, |
636 | .fault = uio_vma_fault, | 636 | .fault = uio_vma_fault, |
637 | }; | 637 | }; |
638 | 638 | ||
639 | static int uio_mmap_logical(struct vm_area_struct *vma) | ||
640 | { | ||
641 | vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; | ||
642 | vma->vm_ops = &uio_logical_vm_ops; | ||
643 | uio_vma_open(vma); | ||
644 | return 0; | ||
645 | } | ||
646 | |||
647 | static const struct vm_operations_struct uio_physical_vm_ops = { | ||
648 | #ifdef CONFIG_HAVE_IOREMAP_PROT | ||
649 | .access = generic_access_phys, | ||
650 | #endif | ||
651 | }; | ||
652 | |||
639 | static int uio_mmap_physical(struct vm_area_struct *vma) | 653 | static int uio_mmap_physical(struct vm_area_struct *vma) |
640 | { | 654 | { |
641 | struct uio_device *idev = vma->vm_private_data; | 655 | struct uio_device *idev = vma->vm_private_data; |
@@ -643,6 +657,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
643 | if (mi < 0) | 657 | if (mi < 0) |
644 | return -EINVAL; | 658 | return -EINVAL; |
645 | 659 | ||
660 | vma->vm_ops = &uio_physical_vm_ops; | ||
661 | |||
646 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 662 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
647 | 663 | ||
648 | return remap_pfn_range(vma, | 664 | return remap_pfn_range(vma, |
@@ -652,14 +668,6 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
652 | vma->vm_page_prot); | 668 | vma->vm_page_prot); |
653 | } | 669 | } |
654 | 670 | ||
655 | static int uio_mmap_logical(struct vm_area_struct *vma) | ||
656 | { | ||
657 | vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; | ||
658 | vma->vm_ops = &uio_vm_ops; | ||
659 | uio_vma_open(vma); | ||
660 | return 0; | ||
661 | } | ||
662 | |||
663 | static int uio_mmap(struct file *filep, struct vm_area_struct *vma) | 671 | static int uio_mmap(struct file *filep, struct vm_area_struct *vma) |
664 | { | 672 | { |
665 | struct uio_listener *listener = filep->private_data; | 673 | struct uio_listener *listener = filep->private_data; |