gpu: nvgpu: Cleanup for gr_gk20a header

Removed unused struct from gr_gk20a.h
Change static allocation for struct gr_gk20a to dynamic type.
Change all the files that being affected by that change.

Call gr allocation from corresponding init_support functions, which
are part of the probe functions.
nvgpu_pci_init_support in pci.c
vgpu_init_support in vgpu_linux.c
gk20a_init_support in module.c

Call gr free before the gk20a free call in nvgpu_free_gk20a.

Rename struct gr_gk20a to struct nvgpu_gr

JIRA NVGPU-3132

Change-Id: Ief5e664521f141c7378c4044ed0df5f03ba06fca
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2095798
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Vinod G
2019-04-11 17:50:56 -07:00
committed by mobile promotions
parent 37253f8ccb
commit 556e139077
52 changed files with 406 additions and 353 deletions

View File

@@ -48,6 +48,7 @@
#include <nvgpu/timers.h>
#include <nvgpu/engines.h>
#include <nvgpu/channel.h>
#include <nvgpu/gr/gr.h>
#include "platform_gk20a.h"
#include "sysfs.h"
@@ -755,8 +756,8 @@ void gk20a_remove_support(struct gk20a *g)
g->sec2.remove_support(&g->sec2);
}
if (g->gr.remove_support)
g->gr.remove_support(&g->gr);
if (g->gr->remove_support)
g->gr->remove_support(g);
if (g->mm.remove_ce_support)
g->mm.remove_ce_support(&g->mm);
@@ -824,6 +825,12 @@ static int gk20a_init_support(struct platform_device *pdev)
if (err)
goto fail_sim;
err = nvgpu_gr_alloc(g);
if (err != 0) {
nvgpu_err(g, "couldn't allocate gr memory");
goto fail_sim;
}
nvgpu_init_usermode_support(g);
return 0;
@@ -1221,7 +1228,7 @@ void gk20a_driver_start_unload(struct gk20a *g)
nvgpu_set_enabled(g, NVGPU_DRIVER_IS_DYING, true);
/* GR SW ready needs to be invalidated at this time with the busy lock
* held to prevent a racing condition on the gr/mm code */
g->gr.sw_ready = false;
g->gr->sw_ready = false;
g->sw_ready = false;
up_write(&l->busy_lock);
@@ -1271,7 +1278,7 @@ static int nvgpu_read_fuse_overrides(struct gk20a *g)
g->tpc_fs_mask_user = ~value;
break;
case GP10B_FUSE_OPT_ECC_EN:
g->gr.fecs_feature_override_ecc_val = value;
g->gr->fecs_feature_override_ecc_val = value;
break;
default:
nvgpu_err(g, "ignore unknown fuse override %08x", fuse);
@@ -1412,7 +1419,7 @@ return_err:
* Last since the above allocs may use data structures in here.
*/
nvgpu_kmem_fini(gk20a, NVGPU_KMEM_FINI_FORCE_CLEANUP);
nvgpu_gr_free(gk20a);
kfree(l);
return err;