summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2018-09-14 12:10:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-25 14:33:24 -0400
commitbfddabfa230452cea32aae82f9cd85ab22601acf (patch)
tree704cf589d9d5d29ffd837ec15217bba17a785ee2
parentae6935ed7d424ffa74d634da00767e7b03c98fd3 (diff)
uio: introduce UIO_MEM_IOVA
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: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/uio/uio.c24
-rw-r--r--include/linux/uio_driver.h1
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 0ffb324aa038..e601bd3fbae1 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -738,7 +738,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
738 return -EINVAL; 738 return -EINVAL;
739 739
740 vma->vm_ops = &uio_physical_vm_ops; 740 vma->vm_ops = &uio_physical_vm_ops;
741 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 741 if (idev->info->mem[mi].memtype == UIO_MEM_PHYS)
742 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
742 743
743 /* 744 /*
744 * We cannot use the vm_iomap_memory() helper here, 745 * 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 } 796 }
796 797
797 switch (idev->info->mem[mi].memtype) { 798 switch (idev->info->mem[mi].memtype) {
798 case UIO_MEM_PHYS: 799 case UIO_MEM_IOVA:
799 ret = uio_mmap_physical(vma); 800 case UIO_MEM_PHYS:
800 break; 801 ret = uio_mmap_physical(vma);
801 case UIO_MEM_LOGICAL: 802 break;
802 case UIO_MEM_VIRTUAL: 803 case UIO_MEM_LOGICAL:
803 ret = uio_mmap_logical(vma); 804 case UIO_MEM_VIRTUAL:
804 break; 805 ret = uio_mmap_logical(vma);
805 default: 806 break;
806 ret = -EINVAL; 807 default:
808 ret = -EINVAL;
807 } 809 }
808 810
809out: 811 out:
810 mutex_unlock(&idev->info_lock); 812 mutex_unlock(&idev->info_lock);
811 return ret; 813 return ret;
812} 814}
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 6f8b68cd460f..a3cd7cb67a69 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -133,6 +133,7 @@ extern void uio_event_notify(struct uio_info *info);
133#define UIO_MEM_PHYS 1 133#define UIO_MEM_PHYS 1
134#define UIO_MEM_LOGICAL 2 134#define UIO_MEM_LOGICAL 2
135#define UIO_MEM_VIRTUAL 3 135#define UIO_MEM_VIRTUAL 3
136#define UIO_MEM_IOVA 4
136 137
137/* defines for uio_port->porttype */ 138/* defines for uio_port->porttype */
138#define UIO_PORT_NONE 0 139#define UIO_PORT_NONE 0