gpu: nvgpu: move no_of_sm to common.gr.config

1. Move no_of_sm from gr to common.gr.config
2. Add nvgpu_gr_config_get_no_of_sm() API in gr.config
to fetch no_of_sm.

JIRA NVGPU-1884

Change-Id: I3c6c20a12cd7f9939a349a409932195f17392943
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2073583
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nitin Kumbhar
2019-03-15 13:19:42 +05:30
committed by mobile promotions
parent 03e137b552
commit a2314ee780
15 changed files with 61 additions and 36 deletions

View File

@@ -29,6 +29,7 @@
#include <nvgpu/tsg.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/error_notifier.h>
#include <nvgpu/gr/config.h>
#include <nvgpu/gr/ctx.h>
#include <nvgpu/runlist.h>
@@ -562,18 +563,18 @@ static struct tsg_gk20a *gk20a_tsg_acquire_unused_tsg(struct fifo_gk20a *f)
int gk20a_tsg_open_common(struct gk20a *g, struct tsg_gk20a *tsg)
{
u32 no_of_sm = nvgpu_gr_config_get_no_of_sm(g->gr.config);
int err;
/* we need to allocate this after g->ops.gr.init_fs_state() since
* we initialize gr->no_of_sm in this function
* we initialize gr.config->no_of_sm in this function
*/
if (g->gr.no_of_sm == 0U) {
nvgpu_err(g, "no_of_sm %d not set, failed allocation",
g->gr.no_of_sm);
if (no_of_sm == 0U) {
nvgpu_err(g, "no_of_sm %d not set, failed allocation", no_of_sm);
return -EINVAL;
}
err = gk20a_tsg_alloc_sm_error_states_mem(g, tsg, g->gr.no_of_sm);
err = gk20a_tsg_alloc_sm_error_states_mem(g, tsg, no_of_sm);
if (err != 0) {
return err;
}