diff options
| author | Puneet Saxena <puneets@nvidia.com> | 2020-07-07 12:06:40 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2021-05-10 23:40:05 -0400 |
| commit | a3c08fdbdb3508ac4895fd159aaabff576fdcd14 (patch) | |
| tree | 9a3759df8dfbd0e988452bf2c454591da8d5e8a9 /include/linux | |
| parent | 21b3b9a3b36e6309b85cc1a048a0199da06e8f0c (diff) | |
video: tegra: nvmap: add support to create RO handle from user VA
User malloc + mprotect/mmap a buffer as RO and
as part of alloc_from_va, user pass
the ACCESS_FLAGS as RO and expects NvMap to give dma_buf_fd with
RO access.
Below are the conditions result in NvRmMemHandle creation -
1) VA: RO and Attr: RW
- Don't create NvMap Handle
2) VA: RO and Attr: RO
- Create NvMap Handle and set dma_buf_fd as RO
3) VA: RW and Attr: RO
- Create NvMap Handle and set dma_buf_fd as RO
4) Mixed VA: RO + RW and Attr: RO
- Create NvMap Handle with dma_buf_fd as RO for the whole
buffer
5) Mixed VA: RO + RW and Attr: RW
- Don't Create NvMap Handle
If few pages of the buffer is set as RO and rest as RW,
multiple vma are created and vma->end and vma->start doesn't
differ by the buffer size, passed to create handle from VA.
Hence remove the check. Anyway the check is done in get_user_pages.
The change sets dma_buf_fd as RW/RO so that other process
should fetch the access permission just by reading f_mode
of dma_buf_fd.
Bug 200621238
Bug 200634660
Change-Id: I9c50c6f28664f0ff9f70dc08b15d93389e7d7201
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2515023
(cherry picked from commit 0514e68ce8948428b417c55057a4dd2f57acd9c2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2521313
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/nvmap.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/nvmap.h b/include/linux/nvmap.h index 8f17a1c48..b8d267691 100644 --- a/include/linux/nvmap.h +++ b/include/linux/nvmap.h | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #define NVMAP_HANDLE_PHYS_CONTIG (0x1ul << 6) | 50 | #define NVMAP_HANDLE_PHYS_CONTIG (0x1ul << 6) |
| 51 | #define NVMAP_HANDLE_CACHE_SYNC (0x1ul << 7) | 51 | #define NVMAP_HANDLE_CACHE_SYNC (0x1ul << 7) |
| 52 | #define NVMAP_HANDLE_CACHE_SYNC_AT_RESERVE (0x1ul << 8) | 52 | #define NVMAP_HANDLE_CACHE_SYNC_AT_RESERVE (0x1ul << 8) |
| 53 | #define NVMAP_HANDLE_RO (0x1ul << 9) | ||
| 53 | 54 | ||
| 54 | #ifdef CONFIG_NVMAP_PAGE_POOLS | 55 | #ifdef CONFIG_NVMAP_PAGE_POOLS |
| 55 | ulong nvmap_page_pool_get_unused_pages(void); | 56 | ulong nvmap_page_pool_get_unused_pages(void); |
