nvmap: Fix coherency issues while creating subhandle

Make sure that all handles, from which sub-buffer handle needs to be
created, have same cache coherency, are of type RW, not created from VA.
Set the cache coherency of the sub-buffer handle same as the cache
coherency of the main handles, so that explicit cache flush is not
needed during vma fault.

Bug 3494980

Change-Id: I878568e4cdc4529fb3d1a6682e38798769dad9c0
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819129
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ketan Patil
2022-11-30 09:58:04 +00:00
committed by Laxman Dewangan
parent ec9ee786c4
commit abb244025f
3 changed files with 11 additions and 16 deletions

View File

@@ -1176,16 +1176,12 @@ static int nvmap_assign_pages_per_handle(struct nvmap_handle *src_h,
while (src_h_start < src_h_end) {
unsigned long next;
struct page *src_page;
struct page *dest_page;
dest_h->pgalloc.pages[*pg_cnt] =
src_h->pgalloc.pages[src_h_start >> PAGE_SHIFT];
src_page = nvmap_to_page(src_h->pgalloc.pages
[src_h_start >> PAGE_SHIFT]);
dest_page = nvmap_to_page(dest_h->pgalloc.pages[*pg_cnt]);
get_page(dest_page);
nvmap_clean_cache_page(src_page);
next = min(((src_h_start + PAGE_SIZE) & PAGE_MASK),
src_h_end);
@@ -1243,11 +1239,11 @@ int nvmap_assign_pages_to_handle(struct nvmap_client *client,
start = 0;
}
h->flags = hs[0]->flags;
h->heap_type = NVMAP_HEAP_IOVMM;
h->heap_pgalloc = true;
h->alloc = true;
h->is_subhandle = true;
atomic_set(&h->pgalloc.ndirty, 0);
mb();
return err;
err_h: