summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Kumbhar <nkumbhar@nvidia.com>2018-05-30 05:02:41 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-06-15 08:03:58 -0400
commit8963318b140d8ad7a98281bf083c23f08735c57e (patch)
treeccdf9778c56254b376bc2bbe1cfa7f48fe68b61e
parent000b10782deb1ff854fb0a1d0224ff218bfe25ae (diff)
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>
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c5
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c13
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.h4
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c27
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gp106/hal_gp106.c3
-rw-r--r--drivers/gpu/nvgpu/gp10b/gr_gp10b.h1
-rw-r--r--drivers/gpu/nvgpu/gp10b/hal_gp10b.c1
-rw-r--r--drivers/gpu/nvgpu/gv100/hal_gv100.c1
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.h1
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c1
-rw-r--r--drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c1
-rw-r--r--drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c1
13 files changed, 46 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index 6b3f1092..6caf5ad9 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -52,6 +52,11 @@ static int nvgpu_pci_tegra_probe(struct device *dev)
52 52
53static int nvgpu_pci_tegra_remove(struct device *dev) 53static int nvgpu_pci_tegra_remove(struct device *dev)
54{ 54{
55 struct gk20a *g = get_gk20a(dev);
56
57 if (g->ops.gr.remove_gr_sysfs)
58 g->ops.gr.remove_gr_sysfs(g);
59
55 return 0; 60 return 0;
56} 61}
57 62
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
index 5d7ee84d..a2506341 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
@@ -67,8 +67,6 @@ static struct {
67 {"gpu", GPCCLK_INIT_RATE}, 67 {"gpu", GPCCLK_INIT_RATE},
68 {"gpu_sys", 204000000} }; 68 {"gpu_sys", 204000000} };
69 69
70static void gr_gp10b_remove_sysfs(struct device *dev);
71
72/* 70/*
73 * gp10b_tegra_get_clocks() 71 * gp10b_tegra_get_clocks()
74 * 72 *
@@ -174,9 +172,12 @@ static int gp10b_tegra_late_probe(struct device *dev)
174 return 0; 172 return 0;
175} 173}
176 174
177int gp10b_tegra_remove(struct device *dev) 175static int gp10b_tegra_remove(struct device *dev)
178{ 176{
179 gr_gp10b_remove_sysfs(dev); 177 struct gk20a *g = get_gk20a(dev);
178
179 if (g->ops.gr.remove_gr_sysfs)
180 g->ops.gr.remove_gr_sysfs(g);
180 181
181 /* deinitialise tegra specific scaling quirks */ 182 /* deinitialise tegra specific scaling quirks */
182 gp10b_tegra_scale_exit(dev); 183 gp10b_tegra_scale_exit(dev);
@@ -792,9 +793,9 @@ void gr_gp10b_create_sysfs(struct gk20a *g)
792 dev_err(dev, "Failed to create sysfs attributes!\n"); 793 dev_err(dev, "Failed to create sysfs attributes!\n");
793} 794}
794 795
795static void gr_gp10b_remove_sysfs(struct device *dev) 796void gr_gp10b_remove_sysfs(struct gk20a *g)
796{ 797{
797 struct gk20a *g = get_gk20a(dev); 798 struct device *dev = dev_from_gk20a(g);
798 799
799 if (!g->ecc.gr.sm_lrf_single_err_count.counters) 800 if (!g->ecc.gr.sm_lrf_single_err_count.counters)
800 return; 801 return;
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.h b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.h
index 05832e87..725bd0cf 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.h
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -43,6 +43,4 @@ void gp10b_ecc_stat_remove(struct device *dev,
43 struct gk20a_ecc_stat *ecc_stat, 43 struct gk20a_ecc_stat *ecc_stat,
44 struct device_attribute *dev_attr_array); 44 struct device_attribute *dev_attr_array);
45 45
46int gp10b_tegra_remove(struct device *dev);
47
48#endif 46#endif
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
index df760478..f681fe4b 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
@@ -44,7 +44,15 @@
44#include "platform_gk20a_tegra.h" 44#include "platform_gk20a_tegra.h"
45#include "gv11b/gr_gv11b.h" 45#include "gv11b/gr_gv11b.h"
46 46
47static void gr_gv11b_remove_sysfs(struct device *dev); 47static void gv11b_tegra_scale_exit(struct device *dev)
48{
49 struct gk20a_platform *platform = gk20a_get_platform(dev);
50 struct gk20a_scale_profile *profile = platform->g->scale_profile;
51
52 if (profile)
53 tegra_bwmgr_unregister(
54 (struct tegra_bwmgr_client *)profile->private_data);
55}
48 56
49static int gv11b_tegra_probe(struct device *dev) 57static int gv11b_tegra_probe(struct device *dev)
50{ 58{
@@ -82,11 +90,19 @@ static int gv11b_tegra_late_probe(struct device *dev)
82 return 0; 90 return 0;
83} 91}
84 92
93
85static int gv11b_tegra_remove(struct device *dev) 94static int gv11b_tegra_remove(struct device *dev)
86{ 95{
87 gp10b_tegra_remove(dev); 96 struct gk20a *g = get_gk20a(dev);
97
98 if (g->ops.gr.remove_gr_sysfs)
99 g->ops.gr.remove_gr_sysfs(g);
100
101 gv11b_tegra_scale_exit(dev);
88 102
89 gr_gv11b_remove_sysfs(dev); 103#ifdef CONFIG_TEGRA_GK20A_NVHOST
104 nvgpu_free_nvhost_dev(get_gk20a(dev));
105#endif
90 106
91 return 0; 107 return 0;
92} 108}
@@ -498,12 +514,13 @@ void gr_gv11b_create_sysfs(struct gk20a *g)
498 dev_err(dev, "Failed to create gv11b sysfs attributes!\n"); 514 dev_err(dev, "Failed to create gv11b sysfs attributes!\n");
499} 515}
500 516
501static void gr_gv11b_remove_sysfs(struct device *dev) 517void gr_gv11b_remove_sysfs(struct gk20a *g)
502{ 518{
503 struct gk20a *g = get_gk20a(dev); 519 struct device *dev = dev_from_gk20a(g);
504 520
505 if (!g->ecc.gr.sm_l1_tag_corrected_err_count.counters) 521 if (!g->ecc.gr.sm_l1_tag_corrected_err_count.counters)
506 return; 522 return;
523 gr_gp10b_remove_sysfs(g);
507 524
508 gr_gp10b_ecc_stat_remove(dev, 525 gr_gp10b_ecc_stat_remove(dev,
509 0, 526 0,
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 2605f954..3b8c5cd2 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -367,6 +367,7 @@ struct gpu_ops {
367 void (*enable_gpc_exceptions)(struct gk20a *g); 367 void (*enable_gpc_exceptions)(struct gk20a *g);
368 void (*enable_exceptions)(struct gk20a *g); 368 void (*enable_exceptions)(struct gk20a *g);
369 void (*create_gr_sysfs)(struct gk20a *g); 369 void (*create_gr_sysfs)(struct gk20a *g);
370 void (*remove_gr_sysfs)(struct gk20a *g);
370 u32 (*get_lrf_tex_ltc_dram_override)(struct gk20a *g); 371 u32 (*get_lrf_tex_ltc_dram_override)(struct gk20a *g);
371 int (*record_sm_error_state)(struct gk20a *g, u32 gpc, u32 tpc, 372 int (*record_sm_error_state)(struct gk20a *g, u32 gpc, u32 tpc,
372 u32 sm, struct channel_gk20a *fault_ch); 373 u32 sm, struct channel_gk20a *fault_ch);
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
index f46f20ef..8af70cf5 100644
--- a/drivers/gpu/nvgpu/gp106/hal_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -381,7 +381,10 @@ static const struct gpu_ops gp106_ops = {
381 .update_boosted_ctx = NULL, 381 .update_boosted_ctx = NULL,
382 .set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3, 382 .set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3,
383 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4, 383 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
384#ifdef CONFIG_SYSFS
384 .create_gr_sysfs = NULL, 385 .create_gr_sysfs = NULL,
386 .remove_gr_sysfs = NULL,
387#endif
385 .set_ctxsw_preemption_mode = gr_gp106_set_ctxsw_preemption_mode, 388 .set_ctxsw_preemption_mode = gr_gp106_set_ctxsw_preemption_mode,
386 .load_ctxsw_ucode = gr_gm20b_load_ctxsw_ucode, 389 .load_ctxsw_ucode = gr_gm20b_load_ctxsw_ucode,
387 .fecs_host_int_enable = gr_gk20a_fecs_host_int_enable, 390 .fecs_host_int_enable = gr_gk20a_fecs_host_int_enable,
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
index 61634668..31e1e6e9 100644
--- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
+++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h
@@ -60,6 +60,7 @@ int gr_gp10b_init_fs_state(struct gk20a *g);
60int gr_gp10b_alloc_buffer(struct vm_gk20a *vm, size_t size, 60int gr_gp10b_alloc_buffer(struct vm_gk20a *vm, size_t size,
61 struct nvgpu_mem *mem); 61 struct nvgpu_mem *mem);
62void gr_gp10b_create_sysfs(struct gk20a *g); 62void gr_gp10b_create_sysfs(struct gk20a *g);
63void gr_gp10b_remove_sysfs(struct gk20a *g);
63int gr_gp10b_handle_fecs_error(struct gk20a *g, 64int gr_gp10b_handle_fecs_error(struct gk20a *g,
64 struct channel_gk20a *__ch, 65 struct channel_gk20a *__ch,
65 struct gr_gk20a_isr_data *isr_data); 66 struct gr_gk20a_isr_data *isr_data);
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
index d8e69dd8..2430be79 100644
--- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c
@@ -341,6 +341,7 @@ static const struct gpu_ops gp10b_ops = {
341 .set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3, 341 .set_bes_crop_debug3 = gr_gp10b_set_bes_crop_debug3,
342#ifdef CONFIG_SYSFS 342#ifdef CONFIG_SYSFS
343 .create_gr_sysfs = gr_gp10b_create_sysfs, 343 .create_gr_sysfs = gr_gp10b_create_sysfs,
344 .remove_gr_sysfs = gr_gp10b_remove_sysfs,
344#endif 345#endif
345 .set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode, 346 .set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode,
346 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data, 347 .init_ctxsw_hdr_data = gr_gp10b_init_ctxsw_hdr_data,
diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c
index b881aaf7..13d0a871 100644
--- a/drivers/gpu/nvgpu/gv100/hal_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c
@@ -413,6 +413,7 @@ static const struct gpu_ops gv100_ops = {
413 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4, 413 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
414#ifdef CONFIG_SYSFS 414#ifdef CONFIG_SYSFS
415 .create_gr_sysfs = gr_gv11b_create_sysfs, 415 .create_gr_sysfs = gr_gv11b_create_sysfs,
416 .remove_gr_sysfs = gr_gv11b_remove_sysfs,
416#endif 417#endif
417 .set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode, 418 .set_ctxsw_preemption_mode = gr_gp10b_set_ctxsw_preemption_mode,
418 .is_etpc_addr = gv11b_gr_pri_is_etpc_addr, 419 .is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h
index fb4c8b69..a8dbd3a8 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h
@@ -88,6 +88,7 @@ int gr_gv11b_alloc_buffer(struct vm_gk20a *vm, size_t size,
88void gr_gv11b_program_zcull_mapping(struct gk20a *g, u32 zcull_num_entries, 88void gr_gv11b_program_zcull_mapping(struct gk20a *g, u32 zcull_num_entries,
89 u32 *zcull_map_tiles); 89 u32 *zcull_map_tiles);
90void gr_gv11b_create_sysfs(struct gk20a *g); 90void gr_gv11b_create_sysfs(struct gk20a *g);
91void gr_gv11b_remove_sysfs(struct gk20a *g);
91 92
92bool gr_gv11b_is_valid_class(struct gk20a *g, u32 class_num); 93bool gr_gv11b_is_valid_class(struct gk20a *g, u32 class_num);
93bool gr_gv11b_is_valid_gfx_class(struct gk20a *g, u32 class_num); 94bool gr_gv11b_is_valid_gfx_class(struct gk20a *g, u32 class_num);
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 84d8a811..1a7f0874 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -370,6 +370,7 @@ static const struct gpu_ops gv11b_ops = {
370 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4, 370 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
371#ifdef CONFIG_SYSFS 371#ifdef CONFIG_SYSFS
372 .create_gr_sysfs = gr_gv11b_create_sysfs, 372 .create_gr_sysfs = gr_gv11b_create_sysfs,
373 .remove_gr_sysfs = gr_gv11b_remove_sysfs,
373#endif 374#endif
374 .set_ctxsw_preemption_mode = gr_gv11b_set_ctxsw_preemption_mode, 375 .set_ctxsw_preemption_mode = gr_gv11b_set_ctxsw_preemption_mode,
375 .is_etpc_addr = gv11b_gr_pri_is_etpc_addr, 376 .is_etpc_addr = gv11b_gr_pri_is_etpc_addr,
diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
index 6a946a6e..5c210519 100644
--- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
+++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_hal_gp10b.c
@@ -216,6 +216,7 @@ static const struct gpu_ops vgpu_gp10b_ops = {
216 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4, 216 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
217#ifdef CONFIG_SYSFS 217#ifdef CONFIG_SYSFS
218 .create_gr_sysfs = gr_gp10b_create_sysfs, 218 .create_gr_sysfs = gr_gp10b_create_sysfs,
219 .remove_gr_sysfs = gr_gp10b_remove_sysfs,
219#endif 220#endif
220 .set_ctxsw_preemption_mode = 221 .set_ctxsw_preemption_mode =
221 vgpu_gr_gp10b_set_ctxsw_preemption_mode, 222 vgpu_gr_gp10b_set_ctxsw_preemption_mode,
diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
index 09ce2492..fd408e3a 100644
--- a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
+++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_hal_gv11b.c
@@ -232,6 +232,7 @@ static const struct gpu_ops vgpu_gv11b_ops = {
232 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4, 232 .set_bes_crop_debug4 = gr_gp10b_set_bes_crop_debug4,
233#ifdef CONFIG_SYSFS 233#ifdef CONFIG_SYSFS
234 .create_gr_sysfs = gr_gv11b_create_sysfs, 234 .create_gr_sysfs = gr_gv11b_create_sysfs,
235 .remove_gr_sysfs = gr_gv11b_remove_sysfs,
235#endif 236#endif
236 .set_ctxsw_preemption_mode = vgpu_gr_gp10b_set_ctxsw_preemption_mode, 237 .set_ctxsw_preemption_mode = vgpu_gr_gp10b_set_ctxsw_preemption_mode,
237 .is_etpc_addr = gv11b_gr_pri_is_etpc_addr, 238 .is_etpc_addr = gv11b_gr_pri_is_etpc_addr,