From b1d303685b384d58064d8b18ec97e1302bcbba88 Mon Sep 17 00:00:00 2001 From: Lakshmanan M Date: Wed, 10 May 2017 14:22:15 +0530 Subject: gpu: nvgpu: Add gr_t19x support for gv11b ECC This CL covers the following modification, 1) Added gr_t19x support for gv11b ECC 2) Modified the gp10b platform config for gv11b sysfs support JIRA GPUT19X-85 JIRA GPUT19X-104 JIRA GPUT19X-100 JIRA GPUT19X-103 Bug 1825948 Bug 1825962 Bug 1775457 Change-Id: I0bf13f80a73cc2184147230d098e89a517554c01 Signed-off-by: Lakshmanan M Reviewed-on: http://git-master/r/1478952 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gr_gk20a.h | 4 ++ drivers/gpu/nvgpu/gp10b/gr_gp10b.h | 48 +++++++------- .../gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | 73 +++++++++++----------- .../gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h | 35 +++++++++++ 4 files changed, 100 insertions(+), 60 deletions(-) create mode 100644 drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h index ee528c31..5e49edb8 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h @@ -374,6 +374,10 @@ struct gr_gk20a { #ifdef CONFIG_ARCH_TEGRA_18x_SOC struct gr_t18x t18x; #endif +#ifdef CONFIG_TEGRA_19x_GPU + struct gr_t19x t19x; +#endif + u32 fbp_en_mask; u32 *fbp_rop_l2_en_mask; u32 no_of_sm; diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h index c4c206c3..588a7d8f 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h @@ -22,6 +22,12 @@ struct gpu_ops; +struct gr_gp10b_ecc_stat { + char **names; + u32 *counters; + struct hlist_node hash_node; +}; + enum { PASCAL_CHANNEL_GPFIFO_A = 0xC06F, PASCAL_A = 0xC097, @@ -45,12 +51,6 @@ int gr_gp10b_alloc_buffer(struct vm_gk20a *vm, size_t size, struct nvgpu_mem *mem); void gr_gp10b_create_sysfs(struct device *dev); -struct ecc_stat { - char **names; - u32 *counters; - struct hlist_node hash_node; -}; - struct gr_t18x { struct { u32 preempt_image_size; @@ -69,24 +69,24 @@ struct gr_t18x { } ctx_vars; struct { - struct ecc_stat sm_lrf_single_err_count; - struct ecc_stat sm_lrf_double_err_count; - - struct ecc_stat sm_shm_sec_count; - struct ecc_stat sm_shm_sed_count; - struct ecc_stat sm_shm_ded_count; - - struct ecc_stat tex_total_sec_pipe0_count; - struct ecc_stat tex_total_ded_pipe0_count; - struct ecc_stat tex_unique_sec_pipe0_count; - struct ecc_stat tex_unique_ded_pipe0_count; - struct ecc_stat tex_total_sec_pipe1_count; - struct ecc_stat tex_total_ded_pipe1_count; - struct ecc_stat tex_unique_sec_pipe1_count; - struct ecc_stat tex_unique_ded_pipe1_count; - - struct ecc_stat l2_sec_count; - struct ecc_stat l2_ded_count; + struct gr_gp10b_ecc_stat sm_lrf_single_err_count; + struct gr_gp10b_ecc_stat sm_lrf_double_err_count; + + struct gr_gp10b_ecc_stat sm_shm_sec_count; + struct gr_gp10b_ecc_stat sm_shm_sed_count; + struct gr_gp10b_ecc_stat sm_shm_ded_count; + + struct gr_gp10b_ecc_stat tex_total_sec_pipe0_count; + struct gr_gp10b_ecc_stat tex_total_ded_pipe0_count; + struct gr_gp10b_ecc_stat tex_unique_sec_pipe0_count; + struct gr_gp10b_ecc_stat tex_unique_ded_pipe0_count; + struct gr_gp10b_ecc_stat tex_total_sec_pipe1_count; + struct gr_gp10b_ecc_stat tex_total_ded_pipe1_count; + struct gr_gp10b_ecc_stat tex_unique_sec_pipe1_count; + struct gr_gp10b_ecc_stat tex_unique_ded_pipe1_count; + + struct gr_gp10b_ecc_stat l2_sec_count; + struct gr_gp10b_ecc_stat l2_ded_count; } ecc_stats; u32 fecs_feature_override_ecc_val; diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c index 32cc80d9..1dedd593 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c @@ -39,6 +39,7 @@ #include "platform_gk20a_tegra.h" #include "gp10b/gp10b_sysfs.h" #include "gp10b/platform_gp10b.h" +#include "platform_gp10b_tegra.h" #include #include @@ -181,7 +182,7 @@ static int gp10b_tegra_late_probe(struct device *dev) return 0; } -static int gp10b_tegra_remove(struct device *dev) +int gp10b_tegra_remove(struct device *dev) { gr_gp10b_remove_sysfs(dev); /*Remove GP10B specific sysfs*/ @@ -483,7 +484,7 @@ static ssize_t ecc_stat_show(struct device *dev, const char *ecc_stat_full_name = attr->attr.name; const char *ecc_stat_base_name; unsigned int hw_unit; - struct ecc_stat *ecc_stat; + struct gr_gp10b_ecc_stat *ecc_stat; u32 hash_key; if (sscanf(ecc_stat_full_name, "ltc%u", &hw_unit) == 1) { @@ -508,10 +509,10 @@ static ssize_t ecc_stat_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "Error: No ECC stat found!\n"); } -static int ecc_stat_create(struct device *dev, +int gr_gp10b_ecc_stat_create(struct device *dev, int is_l2, char *ecc_stat_name, - struct ecc_stat *ecc_stat, + struct gr_gp10b_ecc_stat *ecc_stat, struct device_attribute *dev_attr_array) { int error = 0; @@ -569,9 +570,9 @@ static int ecc_stat_create(struct device *dev, return error; } -static void ecc_stat_remove(struct device *dev, +void gr_gp10b_ecc_stat_remove(struct device *dev, int is_l2, - struct ecc_stat *ecc_stat, + struct gr_gp10b_ecc_stat *ecc_stat, struct device_attribute *dev_attr_array) { struct gk20a *g = get_gk20a(dev); @@ -612,80 +613,80 @@ void gr_gp10b_create_sysfs(struct device *dev) if (g->gr.t18x.ecc_stats.sm_lrf_single_err_count.counters != NULL) return; - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "sm_lrf_ecc_single_err_count", &g->gr.t18x.ecc_stats.sm_lrf_single_err_count, dev_attr_sm_lrf_ecc_single_err_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "sm_lrf_ecc_double_err_count", &g->gr.t18x.ecc_stats.sm_lrf_double_err_count, dev_attr_sm_lrf_ecc_double_err_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "sm_shm_ecc_sec_count", &g->gr.t18x.ecc_stats.sm_shm_sec_count, dev_attr_sm_shm_ecc_sec_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "sm_shm_ecc_sed_count", &g->gr.t18x.ecc_stats.sm_shm_sed_count, dev_attr_sm_shm_ecc_sed_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "sm_shm_ecc_ded_count", &g->gr.t18x.ecc_stats.sm_shm_ded_count, dev_attr_sm_shm_ecc_ded_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_total_sec_pipe0_count", &g->gr.t18x.ecc_stats.tex_total_sec_pipe0_count, dev_attr_tex_ecc_total_sec_pipe0_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_total_ded_pipe0_count", &g->gr.t18x.ecc_stats.tex_total_ded_pipe0_count, dev_attr_tex_ecc_total_ded_pipe0_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_unique_sec_pipe0_count", &g->gr.t18x.ecc_stats.tex_unique_sec_pipe0_count, dev_attr_tex_ecc_unique_sec_pipe0_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_unique_ded_pipe0_count", &g->gr.t18x.ecc_stats.tex_unique_ded_pipe0_count, dev_attr_tex_ecc_unique_ded_pipe0_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_total_sec_pipe1_count", &g->gr.t18x.ecc_stats.tex_total_sec_pipe1_count, dev_attr_tex_ecc_total_sec_pipe1_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_total_ded_pipe1_count", &g->gr.t18x.ecc_stats.tex_total_ded_pipe1_count, dev_attr_tex_ecc_total_ded_pipe1_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_unique_sec_pipe1_count", &g->gr.t18x.ecc_stats.tex_unique_sec_pipe1_count, dev_attr_tex_ecc_unique_sec_pipe1_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 0, "tex_ecc_unique_ded_pipe1_count", &g->gr.t18x.ecc_stats.tex_unique_ded_pipe1_count, dev_attr_tex_ecc_unique_ded_pipe1_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 1, "lts0_ecc_sec_count", &g->gr.t18x.ecc_stats.l2_sec_count, dev_attr_l2_ecc_sec_count_array); - error |= ecc_stat_create(dev, + error |= gr_gp10b_ecc_stat_create(dev, 1, "lts0_ecc_ded_count", &g->gr.t18x.ecc_stats.l2_ded_count, @@ -699,66 +700,66 @@ static void gr_gp10b_remove_sysfs(struct device *dev) { struct gk20a *g = get_gk20a(dev); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.sm_lrf_single_err_count, dev_attr_sm_lrf_ecc_single_err_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.sm_lrf_double_err_count, dev_attr_sm_lrf_ecc_double_err_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.sm_shm_sec_count, dev_attr_sm_shm_ecc_sec_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.sm_shm_sed_count, dev_attr_sm_shm_ecc_sed_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.sm_shm_ded_count, dev_attr_sm_shm_ecc_ded_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_total_sec_pipe0_count, dev_attr_tex_ecc_total_sec_pipe0_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_total_ded_pipe0_count, dev_attr_tex_ecc_total_ded_pipe0_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_unique_sec_pipe0_count, dev_attr_tex_ecc_unique_sec_pipe0_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_unique_ded_pipe0_count, dev_attr_tex_ecc_unique_ded_pipe0_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_total_sec_pipe1_count, dev_attr_tex_ecc_total_sec_pipe1_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_total_ded_pipe1_count, dev_attr_tex_ecc_total_ded_pipe1_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_unique_sec_pipe1_count, dev_attr_tex_ecc_unique_sec_pipe1_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 0, &g->gr.t18x.ecc_stats.tex_unique_ded_pipe1_count, dev_attr_tex_ecc_unique_ded_pipe1_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 1, &g->gr.t18x.ecc_stats.l2_sec_count, dev_attr_l2_ecc_sec_count_array); - ecc_stat_remove(dev, + gr_gp10b_ecc_stat_remove(dev, 1, &g->gr.t18x.ecc_stats.l2_ded_count, dev_attr_l2_ecc_ded_count_array); diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h new file mode 100644 index 00000000..0fcb9f39 --- /dev/null +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 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, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _PLATFORM_GP10B_TEGRA_H_ +#define _PLATFORM_GP10B_TEGRA_H_ + +#include "gp10b/gr_gp10b.h" + +int gr_gp10b_ecc_stat_create(struct device *dev, + int is_l2, + char *ecc_stat_name, + struct gr_gp10b_ecc_stat *ecc_stat, + struct device_attribute *dev_attr_array); + +void gr_gp10b_ecc_stat_remove(struct device *dev, + int is_l2, + struct gr_gp10b_ecc_stat *ecc_stat, + struct device_attribute *dev_attr_array); + +int gp10b_tegra_remove(struct device *dev); + +#endif -- cgit v1.2.2