gpu: nvgpu: unit: increase coverage and docs for mm

For common.mm subunits, this patch:
- adds extra test cases for some lesser used APIs
- updates SWUTS to add several functions to Targets fields.

JIRA NVGPU-3510

Change-Id: I350fbe0927472e1a07385a8cf87e0f0a8bbb6a8c
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2280067
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nicolas Benech
2020-01-16 13:45:41 -05:00
committed by Alex Waterman
parent a3d91c4f47
commit ea2563c033
17 changed files with 615 additions and 99 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -249,6 +249,32 @@ int test_as_alloc_share(struct unit_module *m, struct gk20a *g, void *args)
return UNIT_SUCCESS;
}
int test_gk20a_from_as(struct unit_module *m, struct gk20a *g, void *args)
{
int ret = UNIT_FAIL;
struct gk20a_as_share *out;
int err;
err = gk20a_as_alloc_share(g, SZ_64K, NVGPU_AS_ALLOC_USERSPACE_MANAGED,
&out);
if (err != 0) {
unit_return_fail(m, "gk20a_as_alloc_share failed err=%d\n",
err);
}
if (g != gk20a_from_as(out->as)) {
unit_err(m, "ptr mismatch in gk20a_from_as\n");
goto exit;
}
ret = UNIT_SUCCESS;
exit:
gk20a_as_release_share(out);
return ret;
}
struct unit_module_test nvgpu_mm_as_tests[] = {
UNIT_TEST(init, test_init_mm, NULL, 0),
UNIT_TEST(as_alloc_share_64k_um_as_fail, test_as_alloc_share,
@@ -270,7 +296,8 @@ struct unit_module_test nvgpu_mm_as_tests[] = {
UNIT_TEST(as_alloc_share_uva, test_as_alloc_share,
(void *) &test_64k_unified_va, 0),
UNIT_TEST(as_alloc_share_uva_enabled, test_as_alloc_share,
(void *) &test_64k_unified_va_enabled, 0)
(void *) &test_64k_unified_va_enabled, 0),
UNIT_TEST(gk20a_from_as, test_gk20a_from_as, NULL, 0),
};
UNIT_MODULE(mm.as, nvgpu_mm_as_tests, UNIT_PRIO_NVGPU_TEST);