diff options
author | Sunny He <suhe@nvidia.com> | 2017-07-24 15:18:38 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-07-26 05:45:14 -0400 |
commit | d59271c7b79080388371877fc2d10574ca42206a (patch) | |
tree | 921f6d1ddce07235d7fbd1f27e6510b8cfe56ae7 /drivers/gpu/nvgpu/gp10b | |
parent | de3ad1a94974b08268a485136f04b8e436ef2579 (diff) |
gpu: nvgpu: Remove privsecurity flag from gpu_ops
Replace privsecurity boolean flag in gpu_ops with entry in
common flag system.
The new common flag is NVGPU_SEC_PRIVSECURITY
Jira NVGPU-74
Change-Id: I4b258f5ffbe30a6344ffba0ece51c6f5d47ebec1
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1525713
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 18 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/pmu_gp10b.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/pmu_gp10b.h | 4 |
5 files changed, 22 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 67a38e6e..d2b86e51 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -2368,9 +2368,11 @@ int gr_gp10b_set_czf_bypass(struct gk20a *g, struct channel_gk20a *ch) | |||
2368 | return __gr_gk20a_exec_ctx_ops(ch, &ops, 1, 1, 0, false); | 2368 | return __gr_gk20a_exec_ctx_ops(ch, &ops, 1, 1, 0, false); |
2369 | } | 2369 | } |
2370 | 2370 | ||
2371 | void gp10b_init_gr(struct gpu_ops *gops) | 2371 | void gp10b_init_gr(struct gk20a *g) |
2372 | { | 2372 | { |
2373 | gm20b_init_gr(gops); | 2373 | struct gpu_ops *gops = &g->ops; |
2374 | |||
2375 | gm20b_init_gr(g); | ||
2374 | gops->gr.init_fs_state = gr_gp10b_init_fs_state; | 2376 | gops->gr.init_fs_state = gr_gp10b_init_fs_state; |
2375 | gops->gr.init_preemption_state = gr_gp10b_init_preemption_state; | 2377 | gops->gr.init_preemption_state = gr_gp10b_init_preemption_state; |
2376 | gops->gr.is_valid_class = gr_gp10b_is_valid_class; | 2378 | gops->gr.is_valid_class = gr_gp10b_is_valid_class; |
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h index aac9eb65..161fec87 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | #include "gk20a/mm_gk20a.h" | 21 | #include "gk20a/mm_gk20a.h" |
22 | 22 | ||
23 | struct gpu_ops; | 23 | struct gk20a; |
24 | struct gr_gk20a_isr_data; | 24 | struct gr_gk20a_isr_data; |
25 | 25 | ||
26 | enum { | 26 | enum { |
@@ -41,7 +41,7 @@ enum { | |||
41 | #define NVC0C0_SET_SHADER_EXCEPTIONS 0x1528 | 41 | #define NVC0C0_SET_SHADER_EXCEPTIONS 0x1528 |
42 | #define NVC0C0_SET_RD_COALESCE 0x0228 | 42 | #define NVC0C0_SET_RD_COALESCE 0x0228 |
43 | 43 | ||
44 | void gp10b_init_gr(struct gpu_ops *ops); | 44 | void gp10b_init_gr(struct gk20a *g); |
45 | int gr_gp10b_init_fs_state(struct gk20a *g); | 45 | int gr_gp10b_init_fs_state(struct gk20a *g); |
46 | int gr_gp10b_alloc_buffer(struct vm_gk20a *vm, size_t size, | 46 | int gr_gp10b_alloc_buffer(struct vm_gk20a *vm, size_t size, |
47 | struct nvgpu_mem *mem); | 47 | struct nvgpu_mem *mem); |
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 818949f0..6b4fbf40 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c | |||
@@ -368,49 +368,49 @@ int gp10b_init_hal(struct gk20a *g) | |||
368 | 368 | ||
369 | #ifdef CONFIG_TEGRA_ACR | 369 | #ifdef CONFIG_TEGRA_ACR |
370 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { | 370 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { |
371 | gops->privsecurity = 0; | 371 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); |
372 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | 372 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); |
373 | } else if (g->is_virtual) { | 373 | } else if (g->is_virtual) { |
374 | gops->privsecurity = 1; | 374 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); |
375 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); | 375 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); |
376 | } else { | 376 | } else { |
377 | val = gk20a_readl(g, fuse_opt_priv_sec_en_r()); | 377 | val = gk20a_readl(g, fuse_opt_priv_sec_en_r()); |
378 | if (val) { | 378 | if (val) { |
379 | gops->privsecurity = 1; | 379 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); |
380 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); | 380 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); |
381 | } else { | 381 | } else { |
382 | gk20a_dbg_info("priv security is disabled in HW"); | 382 | gk20a_dbg_info("priv security is disabled in HW"); |
383 | gops->privsecurity = 0; | 383 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); |
384 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | 384 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); |
385 | } | 385 | } |
386 | } | 386 | } |
387 | #else | 387 | #else |
388 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { | 388 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { |
389 | gk20a_dbg_info("running simulator with PRIV security disabled"); | 389 | gk20a_dbg_info("running simulator with PRIV security disabled"); |
390 | gops->privsecurity = 0; | 390 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); |
391 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | 391 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); |
392 | } else { | 392 | } else { |
393 | val = gk20a_readl(g, fuse_opt_priv_sec_en_r()); | 393 | val = gk20a_readl(g, fuse_opt_priv_sec_en_r()); |
394 | if (val) { | 394 | if (val) { |
395 | gk20a_dbg_info("priv security is not supported but enabled"); | 395 | gk20a_dbg_info("priv security is not supported but enabled"); |
396 | gops->privsecurity = 1; | 396 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); |
397 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); | 397 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); |
398 | return -EPERM; | 398 | return -EPERM; |
399 | } else { | 399 | } else { |
400 | gops->privsecurity = 0; | 400 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); |
401 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | 401 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); |
402 | } | 402 | } |
403 | } | 403 | } |
404 | #endif | 404 | #endif |
405 | 405 | ||
406 | g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT; | 406 | g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT; |
407 | gp10b_init_gr(gops); | 407 | gp10b_init_gr(g); |
408 | gp10b_init_fecs_trace_ops(gops); | 408 | gp10b_init_fecs_trace_ops(gops); |
409 | gp10b_init_fb(gops); | 409 | gp10b_init_fb(gops); |
410 | gp10b_init_ce(gops); | 410 | gp10b_init_ce(gops); |
411 | gp10b_init_gr_ctx(gops); | 411 | gp10b_init_gr_ctx(gops); |
412 | gp10b_init_mm(gops); | 412 | gp10b_init_mm(gops); |
413 | gp10b_init_pmu_ops(gops); | 413 | gp10b_init_pmu_ops(g); |
414 | gp10b_init_regops(gops); | 414 | gp10b_init_regops(gops); |
415 | gp10b_init_therm_ops(gops); | 415 | gp10b_init_therm_ops(gops); |
416 | gk20a_init_pramin_ops(gops); | 416 | gk20a_init_pramin_ops(gops); |
diff --git a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c index dbaf3ebf..e9a9b922 100644 --- a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <nvgpu/pmu.h> | 16 | #include <nvgpu/pmu.h> |
17 | #include <nvgpu/log.h> | 17 | #include <nvgpu/log.h> |
18 | #include <nvgpu/fuse.h> | 18 | #include <nvgpu/fuse.h> |
19 | #include <nvgpu/enabled.h> | ||
19 | 20 | ||
20 | #include "gk20a/gk20a.h" | 21 | #include "gk20a/gk20a.h" |
21 | #include "gk20a/pmu_gk20a.h" | 22 | #include "gk20a/pmu_gk20a.h" |
@@ -391,10 +392,11 @@ static bool gp10b_is_pmu_supported(struct gk20a *g) | |||
391 | return true; | 392 | return true; |
392 | } | 393 | } |
393 | 394 | ||
394 | void gp10b_init_pmu_ops(struct gpu_ops *gops) | 395 | void gp10b_init_pmu_ops(struct gk20a *g) |
395 | { | 396 | { |
397 | struct gpu_ops *gops = &g->ops; | ||
396 | gops->pmu.is_pmu_supported = gp10b_is_pmu_supported; | 398 | gops->pmu.is_pmu_supported = gp10b_is_pmu_supported; |
397 | if (gops->privsecurity) { | 399 | if (nvgpu_is_enabled(g, NVGPU_SEC_PRIVSECURITY)) { |
398 | gm20b_init_secure_pmu(gops); | 400 | gm20b_init_secure_pmu(gops); |
399 | gops->pmu.init_wpr_region = gm20b_pmu_init_acr; | 401 | gops->pmu.init_wpr_region = gm20b_pmu_init_acr; |
400 | gops->pmu.load_lsfalcon_ucode = gp10b_load_falcon_ucode; | 402 | gops->pmu.load_lsfalcon_ucode = gp10b_load_falcon_ucode; |
diff --git a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h index 9fc6228d..5ba7bb9b 100644 --- a/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/pmu_gp10b.h | |||
@@ -16,7 +16,9 @@ | |||
16 | #ifndef __PMU_GP10B_H_ | 16 | #ifndef __PMU_GP10B_H_ |
17 | #define __PMU_GP10B_H_ | 17 | #define __PMU_GP10B_H_ |
18 | 18 | ||
19 | void gp10b_init_pmu_ops(struct gpu_ops *gops); | 19 | struct gk20a; |
20 | |||
21 | void gp10b_init_pmu_ops(struct gk20a *g); | ||
20 | int gp10b_load_falcon_ucode(struct gk20a *g, u32 falconidmask); | 22 | int gp10b_load_falcon_ucode(struct gk20a *g, u32 falconidmask); |
21 | int gp10b_pg_gr_init(struct gk20a *g, u32 pg_engine_id); | 23 | int gp10b_pg_gr_init(struct gk20a *g, u32 pg_engine_id); |
22 | void gp10b_write_dmatrfbase(struct gk20a *g, u32 addr); | 24 | void gp10b_write_dmatrfbase(struct gk20a *g, u32 addr); |