Skip to content

Commit

Permalink
uio: introduce UIO_MEM_IOVA
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
shemminger authored and gregkh committed Sep 25, 2018
1 parent ae6935e commit bfddabf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
24 changes: 13 additions & 11 deletions drivers/uio/uio.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
return -EINVAL;

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,
Expand Down Expand Up @@ -795,18 +796,19 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
}

switch (idev->info->mem[mi].memtype) {
case UIO_MEM_PHYS:
ret = uio_mmap_physical(vma);
break;
case UIO_MEM_LOGICAL:
case UIO_MEM_VIRTUAL:
ret = uio_mmap_logical(vma);
break;
default:
ret = -EINVAL;
case UIO_MEM_IOVA:
case UIO_MEM_PHYS:
ret = uio_mmap_physical(vma);
break;
case UIO_MEM_LOGICAL:
case UIO_MEM_VIRTUAL:
ret = uio_mmap_logical(vma);
break;
default:
ret = -EINVAL;
}

out:
out:
mutex_unlock(&idev->info_lock);
return ret;
}
Expand Down
1 change: 1 addition & 0 deletions include/linux/uio_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ extern void uio_event_notify(struct uio_info *info);
#define UIO_MEM_PHYS 1
#define UIO_MEM_LOGICAL 2
#define UIO_MEM_VIRTUAL 3
#define UIO_MEM_IOVA 4

/* defines for uio_port->porttype */
#define UIO_PORT_NONE 0
Expand Down

0 comments on commit bfddabf

Please sign in to comment.