gpu: nvgpu: ALLOC_AS: don't fail on default big page size

gk20a_vm_alloc_share() fails when the default big page size is
requested but ops.mm.set_big_page_size is unset. Rework the logic a
bit to allow userspace to explicitly request the default big page
size, too.

Change-Id: I2a28c6d979fbf1dde5559ce9eb5f1310d232e27f
Signed-off-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-on: http://git-master/r/590456
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Sami Kiminki
2014-10-27 19:39:46 +02:00
committed by Dan Willemsen
parent d11fbfe7b1
commit ca474ca33f

View File

@@ -2341,6 +2341,7 @@ int gk20a_vm_alloc_share(struct gk20a_as_share *as_share, u32 big_page_size)
struct vm_gk20a *vm;
char name[32];
int err;
u32 default_big_page_size;
gk20a_dbg_fn("");
@@ -2354,11 +2355,15 @@ int gk20a_vm_alloc_share(struct gk20a_as_share *as_share, u32 big_page_size)
snprintf(name, sizeof(name), "gk20a_as_%d", as_share->id);
if (big_page_size && !g->ops.mm.set_big_page_size)
return -EINVAL;
default_big_page_size =
gk20a_get_platform(g->dev)->default_big_page_size;
if (big_page_size == 0)
big_page_size =
gk20a_get_platform(g->dev)->default_big_page_size;
big_page_size = default_big_page_size;
if (big_page_size != default_big_page_size &&
!g->ops.mm.set_big_page_size)
return -EINVAL;
err = gk20a_init_vm(mm, vm, big_page_size, big_page_size << 10,
mm->channel.size, true, name);