mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: add new gr/config unit to initialize GR configuration
Add new unit gr/config to initialize GR configuration like GPC/TPC count, MAX count and mask Create new structure nvgpu_gr_config that stores all the configuration and that is owned by the new unit Move below fields from struct gr_gk20a to nvgpu_gr_config in gr/config.h Struct gr_gk20a now only holds the pointer to struct nvgpu_gr_config u32 max_gpc_count; u32 max_tpc_per_gpc_count; u32 max_zcull_per_gpc_count; u32 max_tpc_count; u32 gpc_count; u32 tpc_count; u32 ppc_count; u32 zcb_count; u32 pe_count_per_gpc; u32 *gpc_tpc_count; u32 *gpc_ppc_count; u32 *gpc_zcb_count; u32 *pes_tpc_count[GK20A_GR_MAX_PES_PER_GPC]; u32 *gpc_tpc_mask; u32 *pes_tpc_mask[GK20A_GR_MAX_PES_PER_GPC]; u32 *gpc_skip_mask; u8 *map_tiles; u32 map_tile_count; u32 map_row_offset; Remove gr->sys_count since it was already no longer used common/gr/config/gr_config.c unit now exposes the APIs to initialize the configuration and also to query the configuration values nvgpu_gr_config_init() is called to initialize GR configuration from gr_gk20a_init_gr_config() and gr_gk20a_init_map_tiles() is simply renamed as nvgpu_gr_config_init_map_tiles() Expose new API nvgpu_gr_config_deinit() to deinit the configuration Expose nvgpu_gr_config_get_*() APIs to query above configuration fields stored in nvgpu_gr_config structure Update vgpu_gr_init_gr_config() to initialize the configuration from gr->config structure Chip specific HALs that access GR register for initialization are implemented in common/gr/config/gr_config_gm20b.c Set these HALs for all GPUs Jira NVGPU-1879 Change-Id: Ided658b43124ea61b9f273b82b73fdde4ed3c8f0 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2012167 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
e212e851a3
commit
a5eb150635
@@ -23,6 +23,7 @@
|
||||
#include <nvgpu/ptimer.h>
|
||||
#include <nvgpu/string.h>
|
||||
#include <nvgpu/gr/global_ctx.h>
|
||||
#include <nvgpu/gr/config.h>
|
||||
|
||||
#include "os_linux.h"
|
||||
#include "sysfs.h"
|
||||
@@ -930,16 +931,17 @@ static ssize_t tpc_fs_mask_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
struct nvgpu_gr_config *config = g->gr.config;
|
||||
unsigned long val = 0;
|
||||
|
||||
if (kstrtoul(buf, 10, &val) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!g->gr.gpc_tpc_mask)
|
||||
if (!config->gpc_tpc_mask)
|
||||
return -ENODEV;
|
||||
|
||||
if (val && val != g->gr.gpc_tpc_mask[0] && g->ops.gr.set_gpc_tpc_mask) {
|
||||
g->gr.gpc_tpc_mask[0] = val;
|
||||
if (val && val != config->gpc_tpc_mask[0] && g->ops.gr.set_gpc_tpc_mask) {
|
||||
config->gpc_tpc_mask[0] = val;
|
||||
g->tpc_fs_mask_user = val;
|
||||
|
||||
g->ops.gr.set_gpc_tpc_mask(g, 0);
|
||||
@@ -951,6 +953,7 @@ static ssize_t tpc_fs_mask_store(struct device *dev,
|
||||
g->gr.ctx_vars.golden_image_initialized = false;
|
||||
}
|
||||
g->gr.ctx_vars.golden_image_size = 0;
|
||||
nvgpu_gr_config_deinit(g, g->gr.config);
|
||||
/* Cause next poweron to reinit just gr */
|
||||
g->gr.sw_ready = false;
|
||||
}
|
||||
@@ -971,11 +974,13 @@ static ssize_t tpc_fs_mask_read(struct device *dev,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
for (gpc_index = 0; gpc_index < gr->gpc_count; gpc_index++) {
|
||||
if (g->ops.gr.get_gpc_tpc_mask)
|
||||
for (gpc_index = 0;
|
||||
gpc_index < nvgpu_gr_config_get_gpc_count(gr->config);
|
||||
gpc_index++) {
|
||||
if (g->ops.gr.config.get_gpc_tpc_mask)
|
||||
tpc_fs_mask |=
|
||||
g->ops.gr.get_gpc_tpc_mask(g, gpc_index) <<
|
||||
(gr->max_tpc_per_gpc_count * gpc_index);
|
||||
g->ops.gr.config.get_gpc_tpc_mask(g, gr->config, gpc_index) <<
|
||||
(nvgpu_gr_config_get_max_tpc_per_gpc_count(gr->config) * gpc_index);
|
||||
}
|
||||
|
||||
gk20a_idle(g);
|
||||
|
||||
Reference in New Issue
Block a user