Skip to content

Commit bfddabf

Browse files
shemmingergregkh
authored andcommitted
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>
1 parent ae6935e commit bfddabf

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

drivers/uio/uio.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
738738
return -EINVAL;
739739

740740
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);
742743

743744
/*
744745
* 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)
795796
}
796797

797798
switch (idev->info->mem[mi].memtype) {
798-
case UIO_MEM_PHYS:
799-
ret = uio_mmap_physical(vma);
800-
break;
801-
case UIO_MEM_LOGICAL:
802-
case UIO_MEM_VIRTUAL:
803-
ret = uio_mmap_logical(vma);
804-
break;
805-
default:
806-
ret = -EINVAL;
799+
case UIO_MEM_IOVA:
800+
case UIO_MEM_PHYS:
801+
ret = uio_mmap_physical(vma);
802+
break;
803+
case UIO_MEM_LOGICAL:
804+
case UIO_MEM_VIRTUAL:
805+
ret = uio_mmap_logical(vma);
806+
break;
807+
default:
808+
ret = -EINVAL;
807809
}
808810

809-
out:
811+
out:
810812
mutex_unlock(&idev->info_lock);
811813
return ret;
812814
}

include/linux/uio_driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ extern void uio_event_notify(struct uio_info *info);
133133
#define UIO_MEM_PHYS 1
134134
#define UIO_MEM_LOGICAL 2
135135
#define UIO_MEM_VIRTUAL 3
136+
#define UIO_MEM_IOVA 4
136137

137138
/* defines for uio_port->porttype */
138139
#define UIO_PORT_NONE 0

0 commit comments

Comments
 (0)