video: tegra: nvmap: Add support for querying granule size

Add support for querying the granule size using NvRmMemQueryHeapParams.
In case of compression carveout it returns granule size in which memory
is allocated while in case of IOVMM heap, it returns PAGE_SIZE.

Bug 3956637

Change-Id: I3ec4f5388caecbca0a728e1878007f6b3d4320ef
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2899867
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ketan Patil
2023-05-04 09:49:37 +00:00
committed by mobile promotions
parent faa6040875
commit 30ebc1a639
2 changed files with 4 additions and 0 deletions

View File

@@ -1354,6 +1354,8 @@ int nvmap_ioctl_query_heap_params(struct file *filp, void __user *arg)
heap = nvmap_dev->heaps[i].carveout; heap = nvmap_dev->heaps[i].carveout;
op.total = nvmap_query_heap_size(heap); op.total = nvmap_query_heap_size(heap);
op.free = heap->free_size; op.free = heap->free_size;
if (nvmap_dev->heaps[i].carveout->is_compression_co)
op.granule_size = nvmap_dev->heaps[i].carveout->granule_size;
break; break;
} }
} }
@@ -1367,6 +1369,7 @@ int nvmap_ioctl_query_heap_params(struct file *filp, void __user *arg)
if (ret) if (ret)
goto exit; goto exit;
op.free = free_mem; op.free = free_mem;
op.granule_size = PAGE_SIZE;
} }
if (copy_to_user(arg, &op, sizeof(op))) if (copy_to_user(arg, &op, sizeof(op)))

View File

@@ -239,6 +239,7 @@ struct nvmap_query_heap_params {
__u64 total; __u64 total;
__u64 free; __u64 free;
__u64 largest_free_block; __u64 largest_free_block;
__u32 granule_size;
}; };
/** /**