mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
gpu: nvgpu: add remove_gr_sysfs gpu op
Add remove_gr_sys() op to gpu_ops to reverse steps done in create_gr_sysfs(). Make gv11b_tegra_remove() specific to gv11b instead to properly remove sysfs nodes. This also helps in having gv11b specific remove steps. Also, update platform remove function of dGPU i.e. nvgpu_pci_tegra_remove() to remove sysfs nodes. This adds parity with iGPU platform remove. Bug 1987855 Change-Id: Ibbaffac5c24346709347f86444a951461894354d Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1735987 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
000b10782d
commit
8963318b14
@@ -52,6 +52,11 @@ static int nvgpu_pci_tegra_probe(struct device *dev)
|
|||||||
|
|
||||||
static int nvgpu_pci_tegra_remove(struct device *dev)
|
static int nvgpu_pci_tegra_remove(struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct gk20a *g = get_gk20a(dev);
|
||||||
|
|
||||||
|
if (g->ops.gr.remove_gr_sysfs)
|
||||||
|
g->ops.gr.remove_gr_sysfs(g);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ static struct {
|
|||||||
{"gpu", GPCCLK_INIT_RATE},
|
{"gpu", GPCCLK_INIT_RATE},
|
||||||
{"gpu_sys", 204000000} };
|
{"gpu_sys", 204000000} };
|
||||||
|
|
||||||
static void gr_gp10b_remove_sysfs(struct device *dev);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gp10b_tegra_get_clocks()
|
* gp10b_tegra_get_clocks()
|
||||||
*
|
*
|
||||||
@@ -174,9 +172,12 @@ static int gp10b_tegra_late_probe(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gp10b_tegra_remove(struct device *dev)
|
static int gp10b_tegra_remove(struct device *dev)
|
||||||
{
|
{
|
||||||
gr_gp10b_remove_sysfs(dev);
|
struct gk20a *g = get_gk20a(dev);
|
||||||
|
|
||||||
|
if (g->ops.gr.remove_gr_sysfs)
|
||||||
|
g->ops.gr.remove_gr_sysfs(g);
|
||||||
|
|
||||||
/* deinitialise tegra specific scaling quirks */
|
/* deinitialise tegra specific scaling quirks */
|
||||||
gp10b_tegra_scale_exit(dev);
|
gp10b_tegra_scale_exit(dev);
|
||||||
@@ -792,9 +793,9 @@ void gr_gp10b_create_sysfs(struct gk20a *g)
|
|||||||
dev_err(dev, "Failed to create sysfs attributes!\n");
|
dev_err(dev, "Failed to create sysfs attributes!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gr_gp10b_remove_sysfs(struct device *dev)
|
void gr_gp10b_remove_sysfs(struct gk20a *g)
|
||||||
{
|
{
|
||||||
struct gk20a *g = get_gk20a(dev);
|
struct device *dev = dev_from_gk20a(g);
|
||||||
|
|
||||||
if (!g->ecc.gr.sm_lrf_single_err_count.counters)
|
if (!g->ecc.gr.sm_lrf_single_err_count.counters)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -43,6 +43,4 @@ void gp10b_ecc_stat_remove(struct device *dev,
|
|||||||
struct gk20a_ecc_stat *ecc_stat,
|
struct gk20a_ecc_stat *ecc_stat,
|
||||||
struct device_attribute *dev_attr_array);
|
struct device_attribute *dev_attr_array);
|
||||||
|
|
||||||
int gp10b_tegra_remove(struct device *dev);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,7 +44,15 @@
|
|||||||
#include "platform_gk20a_tegra.h"
|
#include "platform_gk20a_tegra.h"
|
||||||
#include "gv11b/gr_gv11b.h"
|
#include "gv11b/gr_gv11b.h"
|
||||||
|
|
||||||
static void gr_gv11b_remove_sysfs(struct device *dev);
|
static void gv11b_tegra_scale_exit(struct device *dev)
|
||||||
|
{
|
||||||
|
struct gk20a_platform *platform = gk20a_get_platform(dev);
|
||||||
|
struct gk20a_scale_profile *profile = platform->g->scale_profile;
|
||||||
|
|
||||||
|
if (profile)
|
||||||
|
tegra_bwmgr_unregister(
|
||||||
|
(struct tegra_bwmgr_client *)profile->private_data);
|
||||||
|
}
|
||||||
|
|
||||||
static int gv11b_tegra_probe(struct device *dev)
|
static int gv11b_tegra_probe(struct device *dev)
|
||||||
{
|
{
|
||||||
@@ -82,11 +90,19 @@ static int gv11b_tegra_late_probe(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int gv11b_tegra_remove(struct device *dev)
|
static int gv11b_tegra_remove(struct device *dev)
|
||||||
{
|
{
|
||||||
gp10b_tegra_remove(dev);
|
struct gk20a *g = get_gk20a(dev);
|
||||||
|
|
||||||
gr_gv11b_remove_sysfs(dev);
|
if (g->ops.gr.remove_gr_sysfs)
|
||||||
|
g->ops.gr.remove_gr_sysfs(g);
|
||||||
|
|
||||||
|
gv11b_tegra_scale_exit(dev);
|
||||||
|
|
||||||
|
#ifdef CONFIG_TEGRA_GK20A_NVHOST
|
||||||
|
nvgpu_free_nvhost_dev(get_gk20a(dev));
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -498,12 +514,13 @@ void gr_gv11b_create_sysfs(struct gk20a *g)
|
|||||||
dev_err(dev, "Failed to create gv11b sysfs attributes!\n");
|
dev_err(dev, "Failed to create gv11b sysfs attributes!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gr_gv11b_remove_sysfs(struct device *dev)
|
void gr_gv11b_remove_sysfs(struct gk20a *g)
|
||||||
{
|
{
|
||||||
struct gk20a *g = get_gk20a(dev);
|
struct device *dev = dev_from_gk20a(g);
|
||||||
|
|
||||||
if (!g->ecc.gr.sm_l1_tag_corrected_err_count.counters)
|
if (!g->ecc.gr.sm_l1_tag_corrected_err_count.counters)
|
||||||
return;
|
return;
|
||||||
|
gr_gp10b_remove_sysfs(g);
|
||||||
|
|
||||||
gr_gp10b_ecc_stat_remove(dev,
|
gr_gp10b_ecc_stat_remove(dev,
|
||||||
0,
|
0,
|
||||||
|
|||||||
@@ -367,6 +367,7 @@ struct gpu_ops {
|
|||||||
void (*enable_gpc_exceptions)(struct gk20a *g);
|
void (*enable_gpc_exceptions)(struct gk20a *g);
|
||||||
void (*enable_exceptions)(struct gk20a *g);
|
void (*enable_exceptions)(struct gk20a *g);
|
||||||
void (*create_gr_sysfs)(struct gk20a *g);
|
void (*create_gr_sysfs)(struct gk20a *g);
|
||||||
|
void (*remove_gr_sysfs)(struct gk20a *g);
|
||||||
u32 (*get_lrf_tex_ltc_dram_override)(struct gk20a *g);
|
u32 (*get_lrf_tex_ltc_dram_override)(struct gk20a *g);
|
||||||
int (*record_sm_error_state)(struct gk20a *g, u32 gpc, u32 tpc,
|
int (*record_sm_error_state)(struct gk20a *g, u32 gpc, u32 tpc,
|
||||||
u32 sm, struct channel_gk20a *fault_ch);
|
u32 sm, struct channel_gk20a *fault_ch);
|
||||||
|
|||||||
@@ -381,7 +381,10 @@ static const struct gpu_ops gp106_ops = {
|
|||||||
.update_boosted_ctx = NULL,
|
.update_boosted_ctx = NULL,
|
||||||
.set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3,
|
.set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3,
|
||||||
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
||||||
|
#ifdef CONFIG_SYSFS
|
||||||
.create_gr_sysfs = NULL,
|
.create_gr_sysfs = NULL,
|
||||||
|
.remove_gr_sysfs = NULL,
|
||||||
|
#endif
|
||||||
.set_ctxsw_preemption_mode = gr_gp106_set_ctxsw_preemption_mode,
|
.set_ctxsw_preemption_mode = gr_gp106_set_ctxsw_preemption_mode,
|
||||||
.load_ctxsw_ucode = gr_gm20b_load_ctxsw_ucode,
|
.load_ctxsw_ucode = gr_gm20b_load_ctxsw_ucode,
|
||||||
.fecs_host_int_enable = gr_gk20a_fecs_host_int_enable,
|
.fecs_host_int_enable = gr_gk20a_fecs_host_int_enable,
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ int gr_gp10b_init_fs_state(struct gk20a *g);
|
|||||||
int gr_gp10b_alloc_buffer(struct vm_gk20a *vm, size_t size,
|
int gr_gp10b_alloc_buffer(struct vm_gk20a *vm, size_t size,
|
||||||
struct nvgpu_mem *mem);
|
struct nvgpu_mem *mem);
|
||||||
void gr_gp10b_create_sysfs(struct gk20a *g);
|
void gr_gp10b_create_sysfs(struct gk20a *g);
|
||||||
|
void gr_gp10b_remove_sysfs(struct gk20a *g);
|
||||||
int gr_gp10b_handle_fecs_error(struct gk20a *g,
|
int gr_gp10b_handle_fecs_error(struct gk20a *g,
|
||||||
struct channel_gk20a *__ch,
|
struct channel_gk20a *__ch,
|
||||||
struct gr_gk20a_isr_data *isr_data);
|
struct gr_gk20a_isr_data *isr_data);
|
||||||
|
|||||||
@@ -341,6 +341,7 @@ static const struct gpu_ops gp10b_ops = {
|
|||||||
.set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3,
|
.set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3,
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
.create_gr_sysfs = gr_gp10b_create_sysfs,
|
.create_gr_sysfs = gr_gp10b_create_sysfs,
|
||||||
|
.remove_gr_sysfs = gr_gp10b_remove_sysfs,
|
||||||
#endif
|
#endif
|
||||||
.set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode,
|
.set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode,
|
||||||
.init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data,
|
.init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data,
|
||||||
|
|||||||
@@ -413,6 +413,7 @@ static const struct gpu_ops gv100_ops = {
|
|||||||
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
.create_gr_sysfs = gr_gv11b_create_sysfs,
|
.create_gr_sysfs = gr_gv11b_create_sysfs,
|
||||||
|
.remove_gr_sysfs = gr_gv11b_remove_sysfs,
|
||||||
#endif
|
#endif
|
||||||
.set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode,
|
.set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode,
|
||||||
.is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
|
.is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ int gr_gv11b_alloc_buffer(struct vm_gk20a *vm, size_t size,
|
|||||||
void gr_gv11b_program_zcull_mapping(struct gk20a *g, u32 zcull_num_entries,
|
void gr_gv11b_program_zcull_mapping(struct gk20a *g, u32 zcull_num_entries,
|
||||||
u32 *zcull_map_tiles);
|
u32 *zcull_map_tiles);
|
||||||
void gr_gv11b_create_sysfs(struct gk20a *g);
|
void gr_gv11b_create_sysfs(struct gk20a *g);
|
||||||
|
void gr_gv11b_remove_sysfs(struct gk20a *g);
|
||||||
|
|
||||||
bool gr_gv11b_is_valid_class(struct gk20a *g, u32 class_num);
|
bool gr_gv11b_is_valid_class(struct gk20a *g, u32 class_num);
|
||||||
bool gr_gv11b_is_valid_gfx_class(struct gk20a *g, u32 class_num);
|
bool gr_gv11b_is_valid_gfx_class(struct gk20a *g, u32 class_num);
|
||||||
|
|||||||
@@ -370,6 +370,7 @@ static const struct gpu_ops gv11b_ops = {
|
|||||||
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
.create_gr_sysfs = gr_gv11b_create_sysfs,
|
.create_gr_sysfs = gr_gv11b_create_sysfs,
|
||||||
|
.remove_gr_sysfs = gr_gv11b_remove_sysfs,
|
||||||
#endif
|
#endif
|
||||||
.set_ctxsw_preemption_mode = gr_gv11b_set_ctxsw_preemption_mode,
|
.set_ctxsw_preemption_mode = gr_gv11b_set_ctxsw_preemption_mode,
|
||||||
.is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
|
.is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ static const struct gpu_ops vgpu_gp10b_ops = {
|
|||||||
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
.create_gr_sysfs = gr_gp10b_create_sysfs,
|
.create_gr_sysfs = gr_gp10b_create_sysfs,
|
||||||
|
.remove_gr_sysfs = gr_gp10b_remove_sysfs,
|
||||||
#endif
|
#endif
|
||||||
.set_ctxsw_preemption_mode =
|
.set_ctxsw_preemption_mode =
|
||||||
vgpu_gr_gp10b_set_ctxsw_preemption_mode,
|
vgpu_gr_gp10b_set_ctxsw_preemption_mode,
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ static const struct gpu_ops vgpu_gv11b_ops = {
|
|||||||
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
.set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
.create_gr_sysfs = gr_gv11b_create_sysfs,
|
.create_gr_sysfs = gr_gv11b_create_sysfs,
|
||||||
|
.remove_gr_sysfs = gr_gv11b_remove_sysfs,
|
||||||
#endif
|
#endif
|
||||||
.set_ctxsw_preemption_mode = vgpu_gr_gp10b_set_ctxsw_preemption_mode,
|
.set_ctxsw_preemption_mode = vgpu_gr_gp10b_set_ctxsw_preemption_mode,
|
||||||
.is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
|
.is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
|
||||||
|
|||||||
Reference in New Issue
Block a user