gpu: nvgpu: add .init_golden_image HAL

golden image is created differently on native and VF.

Jira GVSCI-15772

Change-Id: I8d78d1214d8aac1d39d6529b68adef1dd6f8a516
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2863440
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Richard Zhao
2023-02-16 22:25:07 -08:00
committed by mobile promotions
parent 067e3590d5
commit 41823694a3
8 changed files with 20 additions and 14 deletions

View File

@@ -1151,10 +1151,6 @@ int nvgpu_gr_obj_ctx_init_golden_context_image(struct gk20a *g)
struct nvgpu_gr_ctx gr_ctx = {};
int err = 0;
if (g->is_virtual) {
return 0;
}
err = gk20a_busy(g);
if (err != 0) {
nvgpu_err(g, "failed to power on, %d", err);

View File

@@ -63,6 +63,7 @@
#include <nvgpu/gr/gr_falcon.h>
#include <nvgpu/gr/gr.h>
#include <nvgpu/gr/gr_intr.h>
#include <nvgpu/gr/obj_ctx.h>
#include <nvgpu/pmu/pmu_perfmon.h>
#include <nvgpu/nvgpu_init.h>
#include <nvgpu/sbr.h>
@@ -563,6 +564,7 @@ static const struct gops_gr_fecs_trace ga100_ops_gr_fecs_trace = {
#endif
static const struct gops_gr_setup ga100_ops_gr_setup = {
.init_golden_image = nvgpu_gr_obj_ctx_init_golden_context_image,
.alloc_obj_ctx = nvgpu_gr_setup_alloc_obj_ctx,
.free_gr_ctx = nvgpu_gr_setup_free_gr_ctx,
.free_subctx = nvgpu_gr_setup_free_subctx,

View File

@@ -42,6 +42,7 @@
#include <nvgpu/gr/gr_falcon.h>
#include <nvgpu/gr/gr.h>
#include <nvgpu/gr/fs_state.h>
#include <nvgpu/gr/obj_ctx.h>
#include <nvgpu/nvhost.h>
#ifdef CONFIG_NVGPU_LS_PMU
#include <nvgpu/pmu/pmu_perfmon.h>
@@ -556,6 +557,7 @@ static const struct gops_gr_fecs_trace ga10b_ops_gr_fecs_trace = {
#endif
static const struct gops_gr_setup ga10b_ops_gr_setup = {
.init_golden_image = nvgpu_gr_obj_ctx_init_golden_context_image,
.alloc_obj_ctx = nvgpu_gr_setup_alloc_obj_ctx,
.free_gr_ctx = nvgpu_gr_setup_free_gr_ctx,
.free_subctx = nvgpu_gr_setup_free_subctx,

View File

@@ -40,6 +40,7 @@
#include <nvgpu/gr/gr.h>
#include <nvgpu/gr/gr_intr.h>
#include <nvgpu/gr/gr_falcon.h>
#include <nvgpu/gr/obj_ctx.h>
#include <nvgpu/gr/setup.h>
#ifdef CONFIG_NVGPU_LS_PMU
#include <nvgpu/pmu/pmu_perfmon.h>
@@ -293,6 +294,7 @@ static const struct gops_gr_fecs_trace gm20b_ops_gr_fecs_trace = {
#endif
static const struct gops_gr_setup gm20b_ops_gr_setup = {
.init_golden_image = nvgpu_gr_obj_ctx_init_golden_context_image,
.alloc_obj_ctx = nvgpu_gr_setup_alloc_obj_ctx,
.free_gr_ctx = nvgpu_gr_setup_free_gr_ctx,
#ifdef CONFIG_NVGPU_GRAPHICS

View File

@@ -40,6 +40,7 @@
#include <nvgpu/regops.h>
#include <nvgpu/gr/gr_falcon.h>
#include <nvgpu/gr/gr.h>
#include <nvgpu/gr/obj_ctx.h>
#include <nvgpu/nvhost.h>
#ifdef CONFIG_NVGPU_LS_PMU
#include <nvgpu/pmu/pmu_perfmon.h>
@@ -448,6 +449,7 @@ static const struct gops_gr_fecs_trace gv11b_ops_gr_fecs_trace = {
#endif
static const struct gops_gr_setup gv11b_ops_gr_setup = {
.init_golden_image = nvgpu_gr_obj_ctx_init_golden_context_image,
.alloc_obj_ctx = nvgpu_gr_setup_alloc_obj_ctx,
.free_gr_ctx = nvgpu_gr_setup_free_gr_ctx,
.free_subctx = nvgpu_gr_setup_free_subctx,

View File

@@ -243,6 +243,7 @@
#include <nvgpu/gr/gr_falcon.h>
#include <nvgpu/gr/gr.h>
#include <nvgpu/gr/gr_intr.h>
#include <nvgpu/gr/obj_ctx.h>
#include <nvgpu/pmu/pmu_perfmon.h>
#include <nvgpu/nvgpu_init.h>
#include <nvgpu/sbr.h>
@@ -491,6 +492,7 @@ static const struct gops_gr_fecs_trace tu104_ops_gr_fecs_trace = {
#endif
static const struct gops_gr_setup tu104_ops_gr_setup = {
.init_golden_image = nvgpu_gr_obj_ctx_init_golden_context_image,
.alloc_obj_ctx = nvgpu_gr_setup_alloc_obj_ctx,
.free_gr_ctx = nvgpu_gr_setup_free_gr_ctx,
.free_subctx = nvgpu_gr_setup_free_subctx,

View File

@@ -163,6 +163,7 @@ struct gops_gr_ecc {
* @see gops_gr
*/
struct gops_gr_setup {
int (*init_golden_image)(struct gk20a *g);
/**
* @brief Allocate and setup object context s/w image
* for GPU channel.

View File

@@ -984,19 +984,18 @@ static int nvgpu_ioctl_channel_alloc_obj_ctx(struct nvgpu_channel *ch,
u32 class_num, u32 user_flags)
{
struct gk20a *g = ch->g;
int err;
/*
* Allocate VEID0 channel and initialize the golden context image.
*/
err = nvgpu_gr_obj_ctx_init_golden_context_image(g);
if (err != 0) {
nvgpu_err(g, "golden context image init failed (%d).",
err);
return -ENOSYS;
if (g->ops.gr.setup.init_golden_image != NULL) {
int err = g->ops.gr.setup.init_golden_image(g);
if (err != 0) {
nvgpu_err(g, "golden context image init failed (%d).",
err);
return -ENOSYS;
}
}
return ch->g->ops.gr.setup.alloc_obj_ctx(ch, class_num,
return g->ops.gr.setup.alloc_obj_ctx(ch, class_num,
nvgpu_obj_ctx_user_flags_to_common_flags(user_flags));
}