gpu: nvgpu: Add nvgpu_early_poweron() support

1) NvGpu dev node needs to be created in gpu power on
early stage to avoid latency introduced by udevd.
For creating dev node, device and grmgr init
needs to move to early stage of GPU power on.
After grmgr init, NvGpu can identify the number of MIG
instance required for each physical GPU.
For that, added a new API nvgpu_early_poweron() to handle
early init which is required for before dev node creation.

2) Removed fifo dependency in nvgpu_init_gr_manager()

3) Used get_max_subctx_count() directly to query
the veid/subctx count.

JIRA NVGPU-6633

Change-Id: Ib9d7c3e184c71237b0da9305515ccd8ceda1d5ad
Signed-off-by: Lakshmanan M <lm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2517173
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Lakshmanan M
2021-04-19 22:56:18 +05:30
committed by mobile promotions
parent 3648fe4655
commit 3f8c562004
4 changed files with 63 additions and 15 deletions

View File

@@ -42,6 +42,7 @@
#include <nvgpu/gr/gr.h>
#include <nvgpu/pm_reservation.h>
#include <nvgpu/netlist.h>
#include <nvgpu/hal_init.h>
#ifdef CONFIG_NVGPU_LS_PMU
#include <nvgpu/pmu/pmu_pstate.h>
@@ -585,6 +586,38 @@ static bool needs_init(struct gk20a *g, nvgpu_init_func_t func, u32 enable_flag)
nvgpu_is_enabled(g, enable_flag)) && (func != NULL);
}
int nvgpu_early_poweron(struct gk20a *g)
{
int err = 0;
err = nvgpu_detect_chip(g);
if (err != 0) {
nvgpu_err(g, "nvgpu_detect_chip failed[%d]", err);
goto done;
}
/*
* Initialize the GPU's device list. Needed before NVLINK
* init since the NVLINK IOCTRL block is enumerated in the
* device list.
*/
err = nvgpu_device_init(g);
if (err != 0) {
nvgpu_err(g, "nvgpu_device_init failed[%d]", err);
goto done;
}
err = g->ops.grmgr.init_gr_manager(g);
if (err != 0) {
nvgpu_device_cleanup(g);
nvgpu_err(g, "g->ops.grmgr.init_gr_manager failed[%d]", err);
goto done;
}
done:
return err;
}
int nvgpu_finalize_poweron(struct gk20a *g)
{
int err = 0;
@@ -610,12 +643,6 @@ int nvgpu_finalize_poweron(struct gk20a *g)
NVGPU_INIT_TABLE_ENTRY(&nvgpu_falcons_sw_init, NO_FLAG),
NVGPU_INIT_TABLE_ENTRY(g->ops.pmu.pmu_early_init, NO_FLAG),
/*
* Initialize the GPU's device list. Needed before NVLINK
* init since the NVLINK IOCTRL block is enumerated in the
* device list.
*/
NVGPU_INIT_TABLE_ENTRY(&nvgpu_device_init, NO_FLAG),
#ifdef CONFIG_NVGPU_DGPU
NVGPU_INIT_TABLE_ENTRY(g->ops.sec2.init_sec2_setup_sw,
NVGPU_SUPPORT_SEC2_RTOS),
@@ -665,7 +692,6 @@ int nvgpu_finalize_poweron(struct gk20a *g)
NVGPU_INIT_TABLE_ENTRY(&nvgpu_init_acquire_tpc_pg_lock, NO_FLAG),
NVGPU_INIT_TABLE_ENTRY(&nvgpu_init_power_gate_gr, NO_FLAG),
#endif
NVGPU_INIT_TABLE_ENTRY(g->ops.grmgr.init_gr_manager, NO_FLAG),
NVGPU_INIT_TABLE_ENTRY(&nvgpu_netlist_init_ctx_vars, NO_FLAG),
/* prepare portion of sw required for enable hw */
NVGPU_INIT_TABLE_ENTRY(&nvgpu_gr_alloc, NO_FLAG),