diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/nvgpu_mem.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c index 9b9f58e1..eb51676c 100644 --- a/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/linux/nvgpu_mem.c | |||
@@ -472,6 +472,25 @@ int __nvgpu_mem_create_from_pages(struct gk20a *g, struct nvgpu_mem *dest, | |||
472 | return 0; | 472 | return 0; |
473 | } | 473 | } |
474 | 474 | ||
475 | int __nvgpu_mem_create_from_phys(struct gk20a *g, struct nvgpu_mem *dest, | ||
476 | u64 src_phys, int nr_pages) | ||
477 | { | ||
478 | struct page **pages = | ||
479 | nvgpu_kmalloc(g, sizeof(struct page *) * nr_pages); | ||
480 | int i, ret = 0; | ||
481 | |||
482 | if (!pages) | ||
483 | return -ENOMEM; | ||
484 | |||
485 | for (i = 0; i < nr_pages; i++) | ||
486 | pages[i] = phys_to_page(src_phys + PAGE_SIZE * i); | ||
487 | |||
488 | ret = __nvgpu_mem_create_from_pages(g, dest, pages, nr_pages); | ||
489 | nvgpu_kfree(g, pages); | ||
490 | |||
491 | return ret; | ||
492 | } | ||
493 | |||
475 | static void *nvgpu_mem_linux_sgl_next(void *sgl) | 494 | static void *nvgpu_mem_linux_sgl_next(void *sgl) |
476 | { | 495 | { |
477 | return sg_next((struct scatterlist *)sgl); | 496 | return sg_next((struct scatterlist *)sgl); |