gpu: nvgpu: Reorganize ltc HAL initialization

Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the ltc
sub-module of the gpu_ops struct.

Perform HAL function assignments in hal_gxxxx.c through the
population of a chip-specific copy of gpu_ops.

Jira NVGPU-74

Change-Id: If8760efb7d8e94b63dc6f1fe9efec4ddf49c0b29
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master/r/1507563
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Sunny He
2017-06-22 16:46:48 -07:00
committed by mobile promotions
parent 5572bfa86a
commit a64984e759
3 changed files with 32 additions and 22 deletions

View File

@@ -25,8 +25,10 @@
#include "gk20a/bus_gk20a.h"
#include "gk20a/flcn_gk20a.h"
#include "gm20b/ltc_gm20b.h"
#include "gm20b/gr_gm20b.h"
#include "gp10b/ltc_gp10b.h"
#include "gp10b/priv_ring_gp10b.h"
#include "hal_gv11b.h"
@@ -50,9 +52,23 @@
#include <nvgpu/hw/gv11b/hw_proj_gv11b.h>
static struct gpu_ops gv11b_ops;
static struct gpu_ops gv11b_ops = {
static const struct gpu_ops gv11b_ops = {
.ltc = {
.determine_L2_size_bytes = gp10b_determine_L2_size_bytes,
.set_zbc_s_entry = gv11b_ltc_set_zbc_stencil_entry,
.set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry,
.set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry,
.init_cbc = NULL,
.init_fs_state = gv11b_ltc_init_fs_state,
.init_comptags = gp10b_ltc_init_comptags,
.cbc_ctrl = gm20b_ltc_cbc_ctrl,
.isr = gv11b_ltc_isr,
.cbc_fix_config = gv11b_ltc_cbc_fix_config,
.flush = gm20b_flush_ltc,
#ifdef CONFIG_DEBUG_FS
.sync_debugfs = gp10b_ltc_sync_debugfs,
#endif
},
.clock_gating = {
.slcg_bus_load_gating_prod =
gv11b_slcg_bus_load_gating_prod,
@@ -187,6 +203,7 @@ int gv11b_init_hal(struct gk20a *g)
struct gpu_ops *gops = &g->ops;
struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics;
gops->ltc = gv11b_ops.ltc;
gops->clock_gating = gv11b_ops.clock_gating;
/* boot in non-secure modes for time beeing */
@@ -196,7 +213,6 @@ int gv11b_init_hal(struct gk20a *g)
gv11b_init_bus(gops);
gv11b_init_mc(gops);
gp10b_init_priv_ring(gops);
gv11b_init_ltc(gops);
gv11b_init_gr(gops);
gv11b_init_fecs_trace_ops(gops);
gv11b_init_fb(gops);

View File

@@ -14,7 +14,6 @@
*/
#include "gk20a/gk20a.h"
#include "gp10b/ltc_gp10b.h"
#include "ltc_gv11b.h"
@@ -28,7 +27,7 @@
/*
* Sets the ZBC stencil for the passed index.
*/
static void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g,
void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g,
struct zbc_entry *stencil_val,
u32 index)
{
@@ -43,7 +42,7 @@ static void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g,
gk20a_readl(g, ltc_ltcs_ltss_dstg_zbc_index_r());
}
static void gv11b_ltc_init_fs_state(struct gk20a *g)
void gv11b_ltc_init_fs_state(struct gk20a *g)
{
u32 ltc_intr;
u32 reg;
@@ -79,7 +78,7 @@ static void gv11b_ltc_init_fs_state(struct gk20a *g)
ltc_intr);
}
static void gv11b_ltc_isr(struct gk20a *g)
void gv11b_ltc_isr(struct gk20a *g)
{
u32 mc_intr, ltc_intr3;
unsigned int ltc, slice;
@@ -184,7 +183,7 @@ static void gv11b_ltc_isr(struct gk20a *g)
gp10b_ltc_isr(g);
}
static u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base)
u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base)
{
u32 val = gk20a_readl(g, ltc_ltcs_ltss_cbc_num_active_ltcs_r());
@@ -195,14 +194,3 @@ static u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base)
}
return base;
}
void gv11b_init_ltc(struct gpu_ops *gops)
{
gp10b_init_ltc(gops);
gops->ltc.set_zbc_s_entry = gv11b_ltc_set_zbc_stencil_entry;
gops->ltc.init_fs_state = gv11b_ltc_init_fs_state;
gops->ltc.cbc_fix_config = gv11b_ltc_cbc_fix_config;
gops->ltc.isr = gv11b_ltc_isr;
gops->ltc.init_cbc = NULL;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -15,5 +15,11 @@
#define LTC_GV11B_H
struct gk20a;
void gv11b_init_ltc(struct gpu_ops *gops);
void gv11b_ltc_set_zbc_stencil_entry(struct gk20a *g,
struct zbc_entry *stencil_val,
u32 index);
void gv11b_ltc_init_fs_state(struct gk20a *g);
void gv11b_ltc_isr(struct gk20a *g);
u32 gv11b_ltc_cbc_fix_config(struct gk20a *g, int base);
#endif