diff options
author | Sunny He <suhe@nvidia.com> | 2017-07-28 21:36:52 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-08-02 17:43:25 -0400 |
commit | a15e110a9b790f55a5c6e257cfbf7f7235f5a334 (patch) | |
tree | 199209146e3e67927c13e2ece240de40f973e1ea | |
parent | 43ae97000be786e4118d431637f05b1462e296c4 (diff) |
gpu: nvgpu: Reorg regops HAL initialization
Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the
regops 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: I7e2ccf158a8e7efa453a3326e86146660f18926f
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1530135
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Tested-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/regops_gm20b.c | 65 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/regops_gm20b.h | 18 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hal_gp106.c | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/regops_gp106.c | 65 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/regops_gp106.h | 16 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/regops_gp10b.c | 65 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/regops_gp10b.h | 18 |
9 files changed, 160 insertions, 162 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 407a442a..c2bccbee 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c | |||
@@ -277,6 +277,29 @@ static const struct gpu_ops gm20b_ops = { | |||
277 | .init_therm_setup_hw = gm20b_init_therm_setup_hw, | 277 | .init_therm_setup_hw = gm20b_init_therm_setup_hw, |
278 | .elcg_init_idle_filters = gk20a_elcg_init_idle_filters, | 278 | .elcg_init_idle_filters = gk20a_elcg_init_idle_filters, |
279 | }, | 279 | }, |
280 | .regops = { | ||
281 | .get_global_whitelist_ranges = | ||
282 | gm20b_get_global_whitelist_ranges, | ||
283 | .get_global_whitelist_ranges_count = | ||
284 | gm20b_get_global_whitelist_ranges_count, | ||
285 | .get_context_whitelist_ranges = | ||
286 | gm20b_get_context_whitelist_ranges, | ||
287 | .get_context_whitelist_ranges_count = | ||
288 | gm20b_get_context_whitelist_ranges_count, | ||
289 | .get_runcontrol_whitelist = gm20b_get_runcontrol_whitelist, | ||
290 | .get_runcontrol_whitelist_count = | ||
291 | gm20b_get_runcontrol_whitelist_count, | ||
292 | .get_runcontrol_whitelist_ranges = | ||
293 | gm20b_get_runcontrol_whitelist_ranges, | ||
294 | .get_runcontrol_whitelist_ranges_count = | ||
295 | gm20b_get_runcontrol_whitelist_ranges_count, | ||
296 | .get_qctl_whitelist = gm20b_get_qctl_whitelist, | ||
297 | .get_qctl_whitelist_count = gm20b_get_qctl_whitelist_count, | ||
298 | .get_qctl_whitelist_ranges = gm20b_get_qctl_whitelist_ranges, | ||
299 | .get_qctl_whitelist_ranges_count = | ||
300 | gm20b_get_qctl_whitelist_ranges_count, | ||
301 | .apply_smpc_war = gm20b_apply_smpc_war, | ||
302 | }, | ||
280 | .mc = { | 303 | .mc = { |
281 | .intr_enable = mc_gk20a_intr_enable, | 304 | .intr_enable = mc_gk20a_intr_enable, |
282 | .intr_unit_config = mc_gk20a_intr_unit_config, | 305 | .intr_unit_config = mc_gk20a_intr_unit_config, |
@@ -350,6 +373,7 @@ int gm20b_init_hal(struct gk20a *g) | |||
350 | gops->fifo = gm20b_ops.fifo; | 373 | gops->fifo = gm20b_ops.fifo; |
351 | gops->gr_ctx = gm20b_ops.gr_ctx; | 374 | gops->gr_ctx = gm20b_ops.gr_ctx; |
352 | gops->therm = gm20b_ops.therm; | 375 | gops->therm = gm20b_ops.therm; |
376 | gops->regops = gm20b_ops.regops; | ||
353 | gops->mc = gm20b_ops.mc; | 377 | gops->mc = gm20b_ops.mc; |
354 | gops->dbg_session_ops = gm20b_ops.dbg_session_ops; | 378 | gops->dbg_session_ops = gm20b_ops.dbg_session_ops; |
355 | gops->debug = gm20b_ops.debug; | 379 | gops->debug = gm20b_ops.debug; |
@@ -404,7 +428,6 @@ int gm20b_init_hal(struct gk20a *g) | |||
404 | gm20b_init_mm(gops); | 428 | gm20b_init_mm(gops); |
405 | gm20b_init_pmu_ops(g); | 429 | gm20b_init_pmu_ops(g); |
406 | gm20b_init_clk_ops(gops); | 430 | gm20b_init_clk_ops(gops); |
407 | gm20b_init_regops(gops); | ||
408 | 431 | ||
409 | g->name = "gm20b"; | 432 | g->name = "gm20b"; |
410 | 433 | ||
diff --git a/drivers/gpu/nvgpu/gm20b/regops_gm20b.c b/drivers/gpu/nvgpu/gm20b/regops_gm20b.c index 45e7ec3d..1e5f6bfd 100644 --- a/drivers/gpu/nvgpu/gm20b/regops_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/regops_gm20b.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra GK20A GPU Debugger Driver Register Ops | 2 | * Tegra GK20A GPU Debugger Driver Register Ops |
3 | * | 3 | * |
4 | * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -377,105 +377,68 @@ static const struct regop_offset_range gm20b_qctl_whitelist_ranges[] = { | |||
377 | static const u32 gm20b_qctl_whitelist_ranges_count = | 377 | static const u32 gm20b_qctl_whitelist_ranges_count = |
378 | ARRAY_SIZE(gm20b_qctl_whitelist_ranges); | 378 | ARRAY_SIZE(gm20b_qctl_whitelist_ranges); |
379 | 379 | ||
380 | static const struct regop_offset_range *gm20b_get_global_whitelist_ranges(void) | 380 | const struct regop_offset_range *gm20b_get_global_whitelist_ranges(void) |
381 | { | 381 | { |
382 | return gm20b_global_whitelist_ranges; | 382 | return gm20b_global_whitelist_ranges; |
383 | } | 383 | } |
384 | 384 | ||
385 | static int gm20b_get_global_whitelist_ranges_count(void) | 385 | int gm20b_get_global_whitelist_ranges_count(void) |
386 | { | 386 | { |
387 | return gm20b_global_whitelist_ranges_count; | 387 | return gm20b_global_whitelist_ranges_count; |
388 | } | 388 | } |
389 | 389 | ||
390 | static const struct regop_offset_range *gm20b_get_context_whitelist_ranges(void) | 390 | const struct regop_offset_range *gm20b_get_context_whitelist_ranges(void) |
391 | { | 391 | { |
392 | return gm20b_context_whitelist_ranges; | 392 | return gm20b_context_whitelist_ranges; |
393 | } | 393 | } |
394 | 394 | ||
395 | static int gm20b_get_context_whitelist_ranges_count(void) | 395 | int gm20b_get_context_whitelist_ranges_count(void) |
396 | { | 396 | { |
397 | return gm20b_context_whitelist_ranges_count; | 397 | return gm20b_context_whitelist_ranges_count; |
398 | } | 398 | } |
399 | 399 | ||
400 | static const u32 *gm20b_get_runcontrol_whitelist(void) | 400 | const u32 *gm20b_get_runcontrol_whitelist(void) |
401 | { | 401 | { |
402 | return gm20b_runcontrol_whitelist; | 402 | return gm20b_runcontrol_whitelist; |
403 | } | 403 | } |
404 | 404 | ||
405 | static int gm20b_get_runcontrol_whitelist_count(void) | 405 | int gm20b_get_runcontrol_whitelist_count(void) |
406 | { | 406 | { |
407 | return gm20b_runcontrol_whitelist_count; | 407 | return gm20b_runcontrol_whitelist_count; |
408 | } | 408 | } |
409 | 409 | ||
410 | static const | 410 | const struct regop_offset_range *gm20b_get_runcontrol_whitelist_ranges(void) |
411 | struct regop_offset_range *gm20b_get_runcontrol_whitelist_ranges(void) | ||
412 | { | 411 | { |
413 | return gm20b_runcontrol_whitelist_ranges; | 412 | return gm20b_runcontrol_whitelist_ranges; |
414 | } | 413 | } |
415 | 414 | ||
416 | static int gm20b_get_runcontrol_whitelist_ranges_count(void) | 415 | int gm20b_get_runcontrol_whitelist_ranges_count(void) |
417 | { | 416 | { |
418 | return gm20b_runcontrol_whitelist_ranges_count; | 417 | return gm20b_runcontrol_whitelist_ranges_count; |
419 | } | 418 | } |
420 | 419 | ||
421 | static const u32 *gm20b_get_qctl_whitelist(void) | 420 | const u32 *gm20b_get_qctl_whitelist(void) |
422 | { | 421 | { |
423 | return gm20b_qctl_whitelist; | 422 | return gm20b_qctl_whitelist; |
424 | } | 423 | } |
425 | 424 | ||
426 | static int gm20b_get_qctl_whitelist_count(void) | 425 | int gm20b_get_qctl_whitelist_count(void) |
427 | { | 426 | { |
428 | return gm20b_qctl_whitelist_count; | 427 | return gm20b_qctl_whitelist_count; |
429 | } | 428 | } |
430 | 429 | ||
431 | static const struct regop_offset_range *gm20b_get_qctl_whitelist_ranges(void) | 430 | const struct regop_offset_range *gm20b_get_qctl_whitelist_ranges(void) |
432 | { | 431 | { |
433 | return gm20b_qctl_whitelist_ranges; | 432 | return gm20b_qctl_whitelist_ranges; |
434 | } | 433 | } |
435 | 434 | ||
436 | static int gm20b_get_qctl_whitelist_ranges_count(void) | 435 | int gm20b_get_qctl_whitelist_ranges_count(void) |
437 | { | 436 | { |
438 | return gm20b_qctl_whitelist_ranges_count; | 437 | return gm20b_qctl_whitelist_ranges_count; |
439 | } | 438 | } |
440 | 439 | ||
441 | static int gm20b_apply_smpc_war(struct dbg_session_gk20a *dbg_s) | 440 | int gm20b_apply_smpc_war(struct dbg_session_gk20a *dbg_s) |
442 | { | 441 | { |
443 | /* Not needed on gm20b */ | 442 | /* Not needed on gm20b */ |
444 | return 0; | 443 | return 0; |
445 | } | 444 | } |
446 | |||
447 | void gm20b_init_regops(struct gpu_ops *gops) | ||
448 | { | ||
449 | gops->regops.get_global_whitelist_ranges = | ||
450 | gm20b_get_global_whitelist_ranges; | ||
451 | gops->regops.get_global_whitelist_ranges_count = | ||
452 | gm20b_get_global_whitelist_ranges_count; | ||
453 | |||
454 | gops->regops.get_context_whitelist_ranges = | ||
455 | gm20b_get_context_whitelist_ranges; | ||
456 | gops->regops.get_context_whitelist_ranges_count = | ||
457 | gm20b_get_context_whitelist_ranges_count; | ||
458 | |||
459 | gops->regops.get_runcontrol_whitelist = | ||
460 | gm20b_get_runcontrol_whitelist; | ||
461 | gops->regops.get_runcontrol_whitelist_count = | ||
462 | gm20b_get_runcontrol_whitelist_count; | ||
463 | |||
464 | gops->regops.get_runcontrol_whitelist_ranges = | ||
465 | gm20b_get_runcontrol_whitelist_ranges; | ||
466 | gops->regops.get_runcontrol_whitelist_ranges_count = | ||
467 | gm20b_get_runcontrol_whitelist_ranges_count; | ||
468 | |||
469 | gops->regops.get_qctl_whitelist = | ||
470 | gm20b_get_qctl_whitelist; | ||
471 | gops->regops.get_qctl_whitelist_count = | ||
472 | gm20b_get_qctl_whitelist_count; | ||
473 | |||
474 | gops->regops.get_qctl_whitelist_ranges = | ||
475 | gm20b_get_qctl_whitelist_ranges; | ||
476 | gops->regops.get_qctl_whitelist_ranges_count = | ||
477 | gm20b_get_qctl_whitelist_ranges_count; | ||
478 | |||
479 | gops->regops.apply_smpc_war = | ||
480 | gm20b_apply_smpc_war; | ||
481 | } | ||
diff --git a/drivers/gpu/nvgpu/gm20b/regops_gm20b.h b/drivers/gpu/nvgpu/gm20b/regops_gm20b.h index f613668b..4a40184b 100644 --- a/drivers/gpu/nvgpu/gm20b/regops_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/regops_gm20b.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * | 2 | * |
3 | * Tegra GK20A GPU Debugger Driver Register Ops | 3 | * Tegra GK20A GPU Debugger Driver Register Ops |
4 | * | 4 | * |
5 | * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. | 5 | * Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -19,6 +19,20 @@ | |||
19 | #ifndef __REGOPS_GM20B_H_ | 19 | #ifndef __REGOPS_GM20B_H_ |
20 | #define __REGOPS_GM20B_H_ | 20 | #define __REGOPS_GM20B_H_ |
21 | 21 | ||
22 | void gm20b_init_regops(struct gpu_ops *gops); | 22 | struct dbg_session_gk20a; |
23 | |||
24 | const struct regop_offset_range *gm20b_get_global_whitelist_ranges(void); | ||
25 | int gm20b_get_global_whitelist_ranges_count(void); | ||
26 | const struct regop_offset_range *gm20b_get_context_whitelist_ranges(void); | ||
27 | int gm20b_get_context_whitelist_ranges_count(void); | ||
28 | const u32 *gm20b_get_runcontrol_whitelist(void); | ||
29 | int gm20b_get_runcontrol_whitelist_count(void); | ||
30 | const struct regop_offset_range *gm20b_get_runcontrol_whitelist_ranges(void); | ||
31 | int gm20b_get_runcontrol_whitelist_ranges_count(void); | ||
32 | const u32 *gm20b_get_qctl_whitelist(void); | ||
33 | int gm20b_get_qctl_whitelist_count(void); | ||
34 | const struct regop_offset_range *gm20b_get_qctl_whitelist_ranges(void); | ||
35 | int gm20b_get_qctl_whitelist_ranges_count(void); | ||
36 | int gm20b_apply_smpc_war(struct dbg_session_gk20a *dbg_s); | ||
23 | 37 | ||
24 | #endif /* __REGOPS_GM20B_H_ */ | 38 | #endif /* __REGOPS_GM20B_H_ */ |
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index 8077c5e1..0caf890f 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c | |||
@@ -353,6 +353,29 @@ static const struct gpu_ops gp106_ops = { | |||
353 | .get_internal_sensor_limits = gp106_get_internal_sensor_limits, | 353 | .get_internal_sensor_limits = gp106_get_internal_sensor_limits, |
354 | .configure_therm_alert = gp106_configure_therm_alert, | 354 | .configure_therm_alert = gp106_configure_therm_alert, |
355 | }, | 355 | }, |
356 | .regops = { | ||
357 | .get_global_whitelist_ranges = | ||
358 | gp106_get_global_whitelist_ranges, | ||
359 | .get_global_whitelist_ranges_count = | ||
360 | gp106_get_global_whitelist_ranges_count, | ||
361 | .get_context_whitelist_ranges = | ||
362 | gp106_get_context_whitelist_ranges, | ||
363 | .get_context_whitelist_ranges_count = | ||
364 | gp106_get_context_whitelist_ranges_count, | ||
365 | .get_runcontrol_whitelist = gp106_get_runcontrol_whitelist, | ||
366 | .get_runcontrol_whitelist_count = | ||
367 | gp106_get_runcontrol_whitelist_count, | ||
368 | .get_runcontrol_whitelist_ranges = | ||
369 | gp106_get_runcontrol_whitelist_ranges, | ||
370 | .get_runcontrol_whitelist_ranges_count = | ||
371 | gp106_get_runcontrol_whitelist_ranges_count, | ||
372 | .get_qctl_whitelist = gp106_get_qctl_whitelist, | ||
373 | .get_qctl_whitelist_count = gp106_get_qctl_whitelist_count, | ||
374 | .get_qctl_whitelist_ranges = gp106_get_qctl_whitelist_ranges, | ||
375 | .get_qctl_whitelist_ranges_count = | ||
376 | gp106_get_qctl_whitelist_ranges_count, | ||
377 | .apply_smpc_war = gp106_apply_smpc_war, | ||
378 | }, | ||
356 | .mc = { | 379 | .mc = { |
357 | .intr_enable = mc_gp10b_intr_enable, | 380 | .intr_enable = mc_gp10b_intr_enable, |
358 | .intr_unit_config = mc_gp10b_intr_unit_config, | 381 | .intr_unit_config = mc_gp10b_intr_unit_config, |
@@ -447,6 +470,7 @@ int gp106_init_hal(struct gk20a *g) | |||
447 | gops->fecs_trace = gp106_ops.fecs_trace; | 470 | gops->fecs_trace = gp106_ops.fecs_trace; |
448 | gops->pramin = gp106_ops.pramin; | 471 | gops->pramin = gp106_ops.pramin; |
449 | gops->therm = gp106_ops.therm; | 472 | gops->therm = gp106_ops.therm; |
473 | gops->regops = gp106_ops.regops; | ||
450 | gops->mc = gp106_ops.mc; | 474 | gops->mc = gp106_ops.mc; |
451 | gops->debug = gp106_ops.debug; | 475 | gops->debug = gp106_ops.debug; |
452 | gops->dbg_session_ops = gp106_ops.dbg_session_ops; | 476 | gops->dbg_session_ops = gp106_ops.dbg_session_ops; |
@@ -477,7 +501,6 @@ int gp106_init_hal(struct gk20a *g) | |||
477 | gp106_init_pmu_ops(g); | 501 | gp106_init_pmu_ops(g); |
478 | gp106_init_clk_ops(gops); | 502 | gp106_init_clk_ops(gops); |
479 | gp106_init_clk_arb_ops(gops); | 503 | gp106_init_clk_arb_ops(gops); |
480 | gp106_init_regops(gops); | ||
481 | 504 | ||
482 | g->name = "gp10x"; | 505 | g->name = "gp10x"; |
483 | 506 | ||
diff --git a/drivers/gpu/nvgpu/gp106/regops_gp106.c b/drivers/gpu/nvgpu/gp106/regops_gp106.c index a165c426..f734ef49 100644 --- a/drivers/gpu/nvgpu/gp106/regops_gp106.c +++ b/drivers/gpu/nvgpu/gp106/regops_gp106.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra GP106 GPU Debugger Driver Register Ops | 2 | * Tegra GP106 GPU Debugger Driver Register Ops |
3 | * | 3 | * |
4 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -1708,105 +1708,68 @@ static const struct regop_offset_range gp106_qctl_whitelist_ranges[] = { | |||
1708 | static const u32 gp106_qctl_whitelist_ranges_count = | 1708 | static const u32 gp106_qctl_whitelist_ranges_count = |
1709 | ARRAY_SIZE(gp106_qctl_whitelist_ranges); | 1709 | ARRAY_SIZE(gp106_qctl_whitelist_ranges); |
1710 | 1710 | ||
1711 | static const struct regop_offset_range *gp106_get_global_whitelist_ranges(void) | 1711 | const struct regop_offset_range *gp106_get_global_whitelist_ranges(void) |
1712 | { | 1712 | { |
1713 | return gp106_global_whitelist_ranges; | 1713 | return gp106_global_whitelist_ranges; |
1714 | } | 1714 | } |
1715 | 1715 | ||
1716 | static int gp106_get_global_whitelist_ranges_count(void) | 1716 | int gp106_get_global_whitelist_ranges_count(void) |
1717 | { | 1717 | { |
1718 | return gp106_global_whitelist_ranges_count; | 1718 | return gp106_global_whitelist_ranges_count; |
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | static const struct regop_offset_range *gp106_get_context_whitelist_ranges(void) | 1721 | const struct regop_offset_range *gp106_get_context_whitelist_ranges(void) |
1722 | { | 1722 | { |
1723 | return gp106_global_whitelist_ranges; | 1723 | return gp106_global_whitelist_ranges; |
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | static int gp106_get_context_whitelist_ranges_count(void) | 1726 | int gp106_get_context_whitelist_ranges_count(void) |
1727 | { | 1727 | { |
1728 | return gp106_global_whitelist_ranges_count; | 1728 | return gp106_global_whitelist_ranges_count; |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | static const u32 *gp106_get_runcontrol_whitelist(void) | 1731 | const u32 *gp106_get_runcontrol_whitelist(void) |
1732 | { | 1732 | { |
1733 | return gp106_runcontrol_whitelist; | 1733 | return gp106_runcontrol_whitelist; |
1734 | } | 1734 | } |
1735 | 1735 | ||
1736 | static int gp106_get_runcontrol_whitelist_count(void) | 1736 | int gp106_get_runcontrol_whitelist_count(void) |
1737 | { | 1737 | { |
1738 | return gp106_runcontrol_whitelist_count; | 1738 | return gp106_runcontrol_whitelist_count; |
1739 | } | 1739 | } |
1740 | 1740 | ||
1741 | static const | 1741 | const struct regop_offset_range *gp106_get_runcontrol_whitelist_ranges(void) |
1742 | struct regop_offset_range *gp106_get_runcontrol_whitelist_ranges(void) | ||
1743 | { | 1742 | { |
1744 | return gp106_runcontrol_whitelist_ranges; | 1743 | return gp106_runcontrol_whitelist_ranges; |
1745 | } | 1744 | } |
1746 | 1745 | ||
1747 | static int gp106_get_runcontrol_whitelist_ranges_count(void) | 1746 | int gp106_get_runcontrol_whitelist_ranges_count(void) |
1748 | { | 1747 | { |
1749 | return gp106_runcontrol_whitelist_ranges_count; | 1748 | return gp106_runcontrol_whitelist_ranges_count; |
1750 | } | 1749 | } |
1751 | 1750 | ||
1752 | static const u32 *gp106_get_qctl_whitelist(void) | 1751 | const u32 *gp106_get_qctl_whitelist(void) |
1753 | { | 1752 | { |
1754 | return gp106_qctl_whitelist; | 1753 | return gp106_qctl_whitelist; |
1755 | } | 1754 | } |
1756 | 1755 | ||
1757 | static int gp106_get_qctl_whitelist_count(void) | 1756 | int gp106_get_qctl_whitelist_count(void) |
1758 | { | 1757 | { |
1759 | return gp106_qctl_whitelist_count; | 1758 | return gp106_qctl_whitelist_count; |
1760 | } | 1759 | } |
1761 | 1760 | ||
1762 | static const struct regop_offset_range *gp106_get_qctl_whitelist_ranges(void) | 1761 | const struct regop_offset_range *gp106_get_qctl_whitelist_ranges(void) |
1763 | { | 1762 | { |
1764 | return gp106_qctl_whitelist_ranges; | 1763 | return gp106_qctl_whitelist_ranges; |
1765 | } | 1764 | } |
1766 | 1765 | ||
1767 | static int gp106_get_qctl_whitelist_ranges_count(void) | 1766 | int gp106_get_qctl_whitelist_ranges_count(void) |
1768 | { | 1767 | { |
1769 | return gp106_qctl_whitelist_ranges_count; | 1768 | return gp106_qctl_whitelist_ranges_count; |
1770 | } | 1769 | } |
1771 | 1770 | ||
1772 | static int gp106_apply_smpc_war(struct dbg_session_gk20a *dbg_s) | 1771 | int gp106_apply_smpc_war(struct dbg_session_gk20a *dbg_s) |
1773 | { | 1772 | { |
1774 | /* Not needed on gp106 */ | 1773 | /* Not needed on gp106 */ |
1775 | return 0; | 1774 | return 0; |
1776 | } | 1775 | } |
1777 | |||
1778 | void gp106_init_regops(struct gpu_ops *gops) | ||
1779 | { | ||
1780 | gops->regops.get_global_whitelist_ranges = | ||
1781 | gp106_get_global_whitelist_ranges; | ||
1782 | gops->regops.get_global_whitelist_ranges_count = | ||
1783 | gp106_get_global_whitelist_ranges_count; | ||
1784 | |||
1785 | gops->regops.get_context_whitelist_ranges = | ||
1786 | gp106_get_context_whitelist_ranges; | ||
1787 | gops->regops.get_context_whitelist_ranges_count = | ||
1788 | gp106_get_context_whitelist_ranges_count; | ||
1789 | |||
1790 | gops->regops.get_runcontrol_whitelist = | ||
1791 | gp106_get_runcontrol_whitelist; | ||
1792 | gops->regops.get_runcontrol_whitelist_count = | ||
1793 | gp106_get_runcontrol_whitelist_count; | ||
1794 | |||
1795 | gops->regops.get_runcontrol_whitelist_ranges = | ||
1796 | gp106_get_runcontrol_whitelist_ranges; | ||
1797 | gops->regops.get_runcontrol_whitelist_ranges_count = | ||
1798 | gp106_get_runcontrol_whitelist_ranges_count; | ||
1799 | |||
1800 | gops->regops.get_qctl_whitelist = | ||
1801 | gp106_get_qctl_whitelist; | ||
1802 | gops->regops.get_qctl_whitelist_count = | ||
1803 | gp106_get_qctl_whitelist_count; | ||
1804 | |||
1805 | gops->regops.get_qctl_whitelist_ranges = | ||
1806 | gp106_get_qctl_whitelist_ranges; | ||
1807 | gops->regops.get_qctl_whitelist_ranges_count = | ||
1808 | gp106_get_qctl_whitelist_ranges_count; | ||
1809 | |||
1810 | gops->regops.apply_smpc_war = | ||
1811 | gp106_apply_smpc_war; | ||
1812 | } | ||
diff --git a/drivers/gpu/nvgpu/gp106/regops_gp106.h b/drivers/gpu/nvgpu/gp106/regops_gp106.h index 7f6b6861..271adcbf 100644 --- a/drivers/gpu/nvgpu/gp106/regops_gp106.h +++ b/drivers/gpu/nvgpu/gp106/regops_gp106.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * | 2 | * |
3 | * Tegra GP106 GPU Debugger Driver Register Ops | 3 | * Tegra GP106 GPU Debugger Driver Register Ops |
4 | * | 4 | * |
5 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | 5 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -19,6 +19,18 @@ | |||
19 | #ifndef __REGOPS_GP106_H_ | 19 | #ifndef __REGOPS_GP106_H_ |
20 | #define __REGOPS_GP106_H_ | 20 | #define __REGOPS_GP106_H_ |
21 | 21 | ||
22 | void gp106_init_regops(struct gpu_ops *gops); | 22 | const struct regop_offset_range *gp106_get_global_whitelist_ranges(void); |
23 | int gp106_get_global_whitelist_ranges_count(void); | ||
24 | const struct regop_offset_range *gp106_get_context_whitelist_ranges(void); | ||
25 | int gp106_get_context_whitelist_ranges_count(void); | ||
26 | const u32 *gp106_get_runcontrol_whitelist(void); | ||
27 | int gp106_get_runcontrol_whitelist_count(void); | ||
28 | const struct regop_offset_range *gp106_get_runcontrol_whitelist_ranges(void); | ||
29 | int gp106_get_runcontrol_whitelist_ranges_count(void); | ||
30 | const u32 *gp106_get_qctl_whitelist(void); | ||
31 | int gp106_get_qctl_whitelist_count(void); | ||
32 | const struct regop_offset_range *gp106_get_qctl_whitelist_ranges(void); | ||
33 | int gp106_get_qctl_whitelist_ranges_count(void); | ||
34 | int gp106_apply_smpc_war(struct dbg_session_gk20a *dbg_s); | ||
23 | 35 | ||
24 | #endif /* __REGOPS_GP106_H_ */ | 36 | #endif /* __REGOPS_GP106_H_ */ |
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index a2aacd2e..e2479530 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c | |||
@@ -313,6 +313,29 @@ static const struct gpu_ops gp10b_ops = { | |||
313 | .init_therm_setup_hw = gp10b_init_therm_setup_hw, | 313 | .init_therm_setup_hw = gp10b_init_therm_setup_hw, |
314 | .elcg_init_idle_filters = gp10b_elcg_init_idle_filters, | 314 | .elcg_init_idle_filters = gp10b_elcg_init_idle_filters, |
315 | }, | 315 | }, |
316 | .regops = { | ||
317 | .get_global_whitelist_ranges = | ||
318 | gp10b_get_global_whitelist_ranges, | ||
319 | .get_global_whitelist_ranges_count = | ||
320 | gp10b_get_global_whitelist_ranges_count, | ||
321 | .get_context_whitelist_ranges = | ||
322 | gp10b_get_context_whitelist_ranges, | ||
323 | .get_context_whitelist_ranges_count = | ||
324 | gp10b_get_context_whitelist_ranges_count, | ||
325 | .get_runcontrol_whitelist = gp10b_get_runcontrol_whitelist, | ||
326 | .get_runcontrol_whitelist_count = | ||
327 | gp10b_get_runcontrol_whitelist_count, | ||
328 | .get_runcontrol_whitelist_ranges = | ||
329 | gp10b_get_runcontrol_whitelist_ranges, | ||
330 | .get_runcontrol_whitelist_ranges_count = | ||
331 | gp10b_get_runcontrol_whitelist_ranges_count, | ||
332 | .get_qctl_whitelist = gp10b_get_qctl_whitelist, | ||
333 | .get_qctl_whitelist_count = gp10b_get_qctl_whitelist_count, | ||
334 | .get_qctl_whitelist_ranges = gp10b_get_qctl_whitelist_ranges, | ||
335 | .get_qctl_whitelist_ranges_count = | ||
336 | gp10b_get_qctl_whitelist_ranges_count, | ||
337 | .apply_smpc_war = gp10b_apply_smpc_war, | ||
338 | }, | ||
316 | .mc = { | 339 | .mc = { |
317 | .intr_enable = mc_gp10b_intr_enable, | 340 | .intr_enable = mc_gp10b_intr_enable, |
318 | .intr_unit_config = mc_gp10b_intr_unit_config, | 341 | .intr_unit_config = mc_gp10b_intr_unit_config, |
@@ -390,6 +413,7 @@ int gp10b_init_hal(struct gk20a *g) | |||
390 | gops->fecs_trace = gp10b_ops.fecs_trace; | 413 | gops->fecs_trace = gp10b_ops.fecs_trace; |
391 | gops->pramin = gp10b_ops.pramin; | 414 | gops->pramin = gp10b_ops.pramin; |
392 | gops->therm = gp10b_ops.therm; | 415 | gops->therm = gp10b_ops.therm; |
416 | gops->regops = gp10b_ops.regops; | ||
393 | gops->mc = gp10b_ops.mc; | 417 | gops->mc = gp10b_ops.mc; |
394 | gops->debug = gp10b_ops.debug; | 418 | gops->debug = gp10b_ops.debug; |
395 | gops->dbg_session_ops = gp10b_ops.dbg_session_ops; | 419 | gops->dbg_session_ops = gp10b_ops.dbg_session_ops; |
@@ -452,7 +476,6 @@ int gp10b_init_hal(struct gk20a *g) | |||
452 | gp10b_init_fb(gops); | 476 | gp10b_init_fb(gops); |
453 | gp10b_init_mm(gops); | 477 | gp10b_init_mm(gops); |
454 | gp10b_init_pmu_ops(g); | 478 | gp10b_init_pmu_ops(g); |
455 | gp10b_init_regops(gops); | ||
456 | 479 | ||
457 | g->name = "gp10b"; | 480 | g->name = "gp10b"; |
458 | 481 | ||
diff --git a/drivers/gpu/nvgpu/gp10b/regops_gp10b.c b/drivers/gpu/nvgpu/gp10b/regops_gp10b.c index 885221df..f90ecaa6 100644 --- a/drivers/gpu/nvgpu/gp10b/regops_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/regops_gp10b.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra GK20A GPU Debugger Driver Register Ops | 2 | * Tegra GK20A GPU Debugger Driver Register Ops |
3 | * | 3 | * |
4 | * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -406,105 +406,68 @@ static const struct regop_offset_range gp10b_qctl_whitelist_ranges[] = { | |||
406 | static const u32 gp10b_qctl_whitelist_ranges_count = | 406 | static const u32 gp10b_qctl_whitelist_ranges_count = |
407 | ARRAY_SIZE(gp10b_qctl_whitelist_ranges); | 407 | ARRAY_SIZE(gp10b_qctl_whitelist_ranges); |
408 | 408 | ||
409 | static const struct regop_offset_range *gp10b_get_global_whitelist_ranges(void) | 409 | const struct regop_offset_range *gp10b_get_global_whitelist_ranges(void) |
410 | { | 410 | { |
411 | return gp10b_global_whitelist_ranges; | 411 | return gp10b_global_whitelist_ranges; |
412 | } | 412 | } |
413 | 413 | ||
414 | static int gp10b_get_global_whitelist_ranges_count(void) | 414 | int gp10b_get_global_whitelist_ranges_count(void) |
415 | { | 415 | { |
416 | return gp10b_global_whitelist_ranges_count; | 416 | return gp10b_global_whitelist_ranges_count; |
417 | } | 417 | } |
418 | 418 | ||
419 | static const struct regop_offset_range *gp10b_get_context_whitelist_ranges(void) | 419 | const struct regop_offset_range *gp10b_get_context_whitelist_ranges(void) |
420 | { | 420 | { |
421 | return gp10b_global_whitelist_ranges; | 421 | return gp10b_global_whitelist_ranges; |
422 | } | 422 | } |
423 | 423 | ||
424 | static int gp10b_get_context_whitelist_ranges_count(void) | 424 | int gp10b_get_context_whitelist_ranges_count(void) |
425 | { | 425 | { |
426 | return gp10b_global_whitelist_ranges_count; | 426 | return gp10b_global_whitelist_ranges_count; |
427 | } | 427 | } |
428 | 428 | ||
429 | static const u32 *gp10b_get_runcontrol_whitelist(void) | 429 | const u32 *gp10b_get_runcontrol_whitelist(void) |
430 | { | 430 | { |
431 | return gp10b_runcontrol_whitelist; | 431 | return gp10b_runcontrol_whitelist; |
432 | } | 432 | } |
433 | 433 | ||
434 | static int gp10b_get_runcontrol_whitelist_count(void) | 434 | int gp10b_get_runcontrol_whitelist_count(void) |
435 | { | 435 | { |
436 | return gp10b_runcontrol_whitelist_count; | 436 | return gp10b_runcontrol_whitelist_count; |
437 | } | 437 | } |
438 | 438 | ||
439 | static const | 439 | const struct regop_offset_range *gp10b_get_runcontrol_whitelist_ranges(void) |
440 | struct regop_offset_range *gp10b_get_runcontrol_whitelist_ranges(void) | ||
441 | { | 440 | { |
442 | return gp10b_runcontrol_whitelist_ranges; | 441 | return gp10b_runcontrol_whitelist_ranges; |
443 | } | 442 | } |
444 | 443 | ||
445 | static int gp10b_get_runcontrol_whitelist_ranges_count(void) | 444 | int gp10b_get_runcontrol_whitelist_ranges_count(void) |
446 | { | 445 | { |
447 | return gp10b_runcontrol_whitelist_ranges_count; | 446 | return gp10b_runcontrol_whitelist_ranges_count; |
448 | } | 447 | } |
449 | 448 | ||
450 | static const u32 *gp10b_get_qctl_whitelist(void) | 449 | const u32 *gp10b_get_qctl_whitelist(void) |
451 | { | 450 | { |
452 | return gp10b_qctl_whitelist; | 451 | return gp10b_qctl_whitelist; |
453 | } | 452 | } |
454 | 453 | ||
455 | static int gp10b_get_qctl_whitelist_count(void) | 454 | int gp10b_get_qctl_whitelist_count(void) |
456 | { | 455 | { |
457 | return gp10b_qctl_whitelist_count; | 456 | return gp10b_qctl_whitelist_count; |
458 | } | 457 | } |
459 | 458 | ||
460 | static const struct regop_offset_range *gp10b_get_qctl_whitelist_ranges(void) | 459 | const struct regop_offset_range *gp10b_get_qctl_whitelist_ranges(void) |
461 | { | 460 | { |
462 | return gp10b_qctl_whitelist_ranges; | 461 | return gp10b_qctl_whitelist_ranges; |
463 | } | 462 | } |
464 | 463 | ||
465 | static int gp10b_get_qctl_whitelist_ranges_count(void) | 464 | int gp10b_get_qctl_whitelist_ranges_count(void) |
466 | { | 465 | { |
467 | return gp10b_qctl_whitelist_ranges_count; | 466 | return gp10b_qctl_whitelist_ranges_count; |
468 | } | 467 | } |
469 | 468 | ||
470 | static int gp10b_apply_smpc_war(struct dbg_session_gk20a *dbg_s) | 469 | int gp10b_apply_smpc_war(struct dbg_session_gk20a *dbg_s) |
471 | { | 470 | { |
472 | /* Not needed on gp10b */ | 471 | /* Not needed on gp10b */ |
473 | return 0; | 472 | return 0; |
474 | } | 473 | } |
475 | |||
476 | void gp10b_init_regops(struct gpu_ops *gops) | ||
477 | { | ||
478 | gops->regops.get_global_whitelist_ranges = | ||
479 | gp10b_get_global_whitelist_ranges; | ||
480 | gops->regops.get_global_whitelist_ranges_count = | ||
481 | gp10b_get_global_whitelist_ranges_count; | ||
482 | |||
483 | gops->regops.get_context_whitelist_ranges = | ||
484 | gp10b_get_context_whitelist_ranges; | ||
485 | gops->regops.get_context_whitelist_ranges_count = | ||
486 | gp10b_get_context_whitelist_ranges_count; | ||
487 | |||
488 | gops->regops.get_runcontrol_whitelist = | ||
489 | gp10b_get_runcontrol_whitelist; | ||
490 | gops->regops.get_runcontrol_whitelist_count = | ||
491 | gp10b_get_runcontrol_whitelist_count; | ||
492 | |||
493 | gops->regops.get_runcontrol_whitelist_ranges = | ||
494 | gp10b_get_runcontrol_whitelist_ranges; | ||
495 | gops->regops.get_runcontrol_whitelist_ranges_count = | ||
496 | gp10b_get_runcontrol_whitelist_ranges_count; | ||
497 | |||
498 | gops->regops.get_qctl_whitelist = | ||
499 | gp10b_get_qctl_whitelist; | ||
500 | gops->regops.get_qctl_whitelist_count = | ||
501 | gp10b_get_qctl_whitelist_count; | ||
502 | |||
503 | gops->regops.get_qctl_whitelist_ranges = | ||
504 | gp10b_get_qctl_whitelist_ranges; | ||
505 | gops->regops.get_qctl_whitelist_ranges_count = | ||
506 | gp10b_get_qctl_whitelist_ranges_count; | ||
507 | |||
508 | gops->regops.apply_smpc_war = | ||
509 | gp10b_apply_smpc_war; | ||
510 | } | ||
diff --git a/drivers/gpu/nvgpu/gp10b/regops_gp10b.h b/drivers/gpu/nvgpu/gp10b/regops_gp10b.h index 8727951a..524a42c8 100644 --- a/drivers/gpu/nvgpu/gp10b/regops_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/regops_gp10b.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * | 2 | * |
3 | * Tegra GP10B GPU Debugger Driver Register Ops | 3 | * Tegra GP10B GPU Debugger Driver Register Ops |
4 | * | 4 | * |
5 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. | 5 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -19,6 +19,20 @@ | |||
19 | #ifndef __REGOPS_GP10B_H_ | 19 | #ifndef __REGOPS_GP10B_H_ |
20 | #define __REGOPS_GP10B_H_ | 20 | #define __REGOPS_GP10B_H_ |
21 | 21 | ||
22 | void gp10b_init_regops(struct gpu_ops *gops); | 22 | struct dbg_session_gk20a; |
23 | |||
24 | const struct regop_offset_range *gp10b_get_global_whitelist_ranges(void); | ||
25 | int gp10b_get_global_whitelist_ranges_count(void); | ||
26 | const struct regop_offset_range *gp10b_get_context_whitelist_ranges(void); | ||
27 | int gp10b_get_context_whitelist_ranges_count(void); | ||
28 | const u32 *gp10b_get_runcontrol_whitelist(void); | ||
29 | int gp10b_get_runcontrol_whitelist_count(void); | ||
30 | const struct regop_offset_range *gp10b_get_runcontrol_whitelist_ranges(void); | ||
31 | int gp10b_get_runcontrol_whitelist_ranges_count(void); | ||
32 | const u32 *gp10b_get_qctl_whitelist(void); | ||
33 | int gp10b_get_qctl_whitelist_count(void); | ||
34 | const struct regop_offset_range *gp10b_get_qctl_whitelist_ranges(void); | ||
35 | int gp10b_get_qctl_whitelist_ranges_count(void); | ||
36 | int gp10b_apply_smpc_war(struct dbg_session_gk20a *dbg_s); | ||
23 | 37 | ||
24 | #endif /* __REGOPS_GP10B_H_ */ | 38 | #endif /* __REGOPS_GP10B_H_ */ |