gpu: nvgpu: remove cyclic dependency between gr and ecc

Removed gr dependency on ecc by moving ecc init/remove support
calls to nvgpu_init. With this, only dependency from ecc to gr
present.

Added following parameter in struct nvgpu_ecc to check/update ecc
initialization status:
bool initialized;

JIRA NVGPU-3212

Change-Id: I04611175cbd959cb8082e63c30214266f5d5b731
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2107955
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Seshendra Gadagottu
2019-04-26 12:27:24 -07:00
committed by mobile promotions
parent 258a6141fd
commit fde780300d
4 changed files with 20 additions and 7 deletions

View File

@@ -344,12 +344,18 @@ void nvgpu_ecc_free(struct gk20a *g)
nvgpu_kfree(g, ecc->fbpa.fbpa_ecc_ded_err_count);
(void)memset(ecc, 0, sizeof(*ecc));
ecc->initialized = false;
}
int nvgpu_ecc_init_support(struct gk20a *g)
{
int err;
if (g->ecc.initialized) {
return 0;
}
if (g->ops.gr.ecc.init == NULL) {
return 0;
}
@@ -366,6 +372,8 @@ int nvgpu_ecc_init_support(struct gk20a *g)
return err;
}
g->ecc.initialized = true;
return 0;
}

View File

@@ -274,7 +274,6 @@ static void gr_remove_support(struct gk20a *g)
nvgpu_gr_falcon_remove_support(g, gr->falcon);
gr->falcon = NULL;
nvgpu_ecc_remove_support(g);
nvgpu_gr_zbc_deinit(g, gr->zbc);
nvgpu_gr_zcull_deinit(g, gr->zcull);
nvgpu_gr_obj_ctx_deinit(g, gr->golden_image);
@@ -459,11 +458,6 @@ static int gr_init_setup_sw(struct gk20a *g)
gr->remove_support = gr_remove_support;
gr->sw_ready = true;
err = nvgpu_ecc_init_support(g);
if (err != 0) {
goto clean_up;
}
nvgpu_log_fn(g, "done");
return 0;

View File

@@ -35,6 +35,7 @@
#include <nvgpu/gmmu.h>
#include <nvgpu/ltc.h>
#include <nvgpu/cbc.h>
#include <nvgpu/ecc.h>
#include <nvgpu/vidmem.h>
#include <nvgpu/mm.h>
#include <nvgpu/soc.h>
@@ -377,6 +378,13 @@ int gk20a_finalize_poweron(struct gk20a *g)
goto done;
}
err = nvgpu_ecc_init_support(g);
if (err != 0) {
nvgpu_err(g, "failed to init ecc");
nvgpu_mutex_release(&g->tpc_pg_lock);
goto done;
}
nvgpu_mutex_release(&g->tpc_pg_lock);
if (nvgpu_is_enabled(g, NVGPU_PMU_PSTATE)) {
@@ -582,6 +590,8 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount)
nvgpu_cbc_remove_support(g);
nvgpu_ecc_remove_support(g);
if (g->remove_support != NULL) {
g->remove_support(g);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2019, 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"),
@@ -118,6 +118,7 @@ struct nvgpu_ecc {
struct nvgpu_list_node stats_list;
int stats_count;
bool initialized;
};
int nvgpu_ecc_counter_init_per_tpc(struct gk20a *g,