gpu: nvgpu: sim: make ring buffer independent of PAGE_SIZE

The simulator ring buffer DMA interface supports buffers of the following sizes:
4, 8, 12 and 16K. At present, it is configured to 4K and it  happens to match
with the kernel PAGE_SIZE, which is used to wrap back the GET/PUT pointers once
4K is reached. However, this is not always true; for instance, take 64K pages.
Hence, replace PAGE_SIZE with SIM_BFR_SIZE.

Introduce macro NVGPU_CPU_PAGE_SIZE which aliases to PAGE_SIZE and replace
latter with former.

Bug 200658101
Jira NVGPU-6018

Change-Id: I83cc62b87291734015c51f3e5a98173549e065de
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2420728
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Antony Clince Alex
2020-09-28 16:44:40 +05:30
committed by Alex Waterman
parent 09857ecd91
commit c36752fe3d
37 changed files with 120 additions and 103 deletions

View File

@@ -373,7 +373,7 @@ static int nvgpu_init_sema_pool(struct vm_gk20a *vm)
nvgpu_semaphore_sea_allocate_gpu_va(sema_sea, &vm->kernel,
nvgpu_safe_sub_u64(vm->va_limit,
mm->channel.kernel_size),
512U * PAGE_SIZE,
512U * NVGPU_CPU_PAGE_SIZE,
nvgpu_safe_cast_u64_to_u32(SZ_4K));
if (nvgpu_semaphore_sea_get_gpu_va(sema_sea) == 0ULL) {
nvgpu_free(&vm->kernel,
@@ -741,7 +741,7 @@ static int nvgpu_vm_init_attributes(struct mm_gk20a *mm,
nvgpu_safe_cast_u64_to_u32(SZ_4K);
vm->gmmu_page_sizes[GMMU_PAGE_SIZE_BIG] = big_page_size;
vm->gmmu_page_sizes[GMMU_PAGE_SIZE_KERNEL] =
nvgpu_safe_cast_u64_to_u32(PAGE_SIZE);
nvgpu_safe_cast_u64_to_u32(NVGPU_CPU_PAGE_SIZE);
/* Set up vma pointers. */
vm->vma[GMMU_PAGE_SIZE_SMALL] = &vm->user;