diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/gp10b')
3 files changed, 77 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c new file mode 100644 index 00000000..5ee5d1f6 --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.c | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #include <nvgpu/enabled.h> | ||
24 | |||
25 | #include "gk20a/gk20a.h" | ||
26 | |||
27 | int vgpu_gp10b_fuse_check_priv_security(struct gk20a *g) | ||
28 | { | ||
29 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { | ||
30 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); | ||
31 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | ||
32 | } else { | ||
33 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); | ||
34 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); | ||
35 | } | ||
36 | |||
37 | return 0; | ||
38 | } | ||
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.h b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.h new file mode 100644 index 00000000..2ec8f284 --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_fuse_gp10b.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #ifndef _VGPU_GP10B_FUSE | ||
24 | #define _VGPU_GP10B_FUSE | ||
25 | |||
26 | struct gk20a; | ||
27 | |||
28 | int vgpu_gp10b_fuse_check_priv_security(struct gk20a *g); | ||
29 | |||
30 | #endif | ||
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c index 78f88d4d..b35cac90 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/gp10b/vgpu_hal_gp10b.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h" | 27 | #include "common/linux/vgpu/gm20b/vgpu_gr_gm20b.h" |
28 | #include "vgpu_gr_gp10b.h" | 28 | #include "vgpu_gr_gp10b.h" |
29 | #include "vgpu_mm_gp10b.h" | 29 | #include "vgpu_mm_gp10b.h" |
30 | #include "vgpu_fuse_gp10b.h" | ||
30 | 31 | ||
31 | #include "gk20a/bus_gk20a.h" | 32 | #include "gk20a/bus_gk20a.h" |
32 | #include "gk20a/pramin_gk20a.h" | 33 | #include "gk20a/pramin_gk20a.h" |
@@ -498,6 +499,9 @@ static const struct gpu_ops vgpu_gp10b_ops = { | |||
498 | .priv_ring = { | 499 | .priv_ring = { |
499 | .isr = gp10b_priv_ring_isr, | 500 | .isr = gp10b_priv_ring_isr, |
500 | }, | 501 | }, |
502 | .fuse = { | ||
503 | .check_priv_security = vgpu_gp10b_fuse_check_priv_security, | ||
504 | }, | ||
501 | .chip_init_gpu_characteristics = vgpu_init_gpu_characteristics, | 505 | .chip_init_gpu_characteristics = vgpu_init_gpu_characteristics, |
502 | .get_litter_value = gp10b_get_litter_value, | 506 | .get_litter_value = gp10b_get_litter_value, |
503 | }; | 507 | }; |
@@ -505,7 +509,6 @@ static const struct gpu_ops vgpu_gp10b_ops = { | |||
505 | int vgpu_gp10b_init_hal(struct gk20a *g) | 509 | int vgpu_gp10b_init_hal(struct gk20a *g) |
506 | { | 510 | { |
507 | struct gpu_ops *gops = &g->ops; | 511 | struct gpu_ops *gops = &g->ops; |
508 | u32 val; | ||
509 | 512 | ||
510 | gops->ltc = vgpu_gp10b_ops.ltc; | 513 | gops->ltc = vgpu_gp10b_ops.ltc; |
511 | gops->ce2 = vgpu_gp10b_ops.ce2; | 514 | gops->ce2 = vgpu_gp10b_ops.ce2; |
@@ -531,6 +534,8 @@ int vgpu_gp10b_init_hal(struct gk20a *g) | |||
531 | 534 | ||
532 | gops->priv_ring = vgpu_gp10b_ops.priv_ring; | 535 | gops->priv_ring = vgpu_gp10b_ops.priv_ring; |
533 | 536 | ||
537 | gops->fuse = vgpu_gp10b_ops.fuse; | ||
538 | |||
534 | /* Lone Functions */ | 539 | /* Lone Functions */ |
535 | gops->chip_init_gpu_characteristics = | 540 | gops->chip_init_gpu_characteristics = |
536 | vgpu_gp10b_ops.chip_init_gpu_characteristics; | 541 | vgpu_gp10b_ops.chip_init_gpu_characteristics; |
@@ -539,23 +544,9 @@ int vgpu_gp10b_init_hal(struct gk20a *g) | |||
539 | __nvgpu_set_enabled(g, NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP, true); | 544 | __nvgpu_set_enabled(g, NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP, true); |
540 | __nvgpu_set_enabled(g, NVGPU_PMU_PSTATE, false); | 545 | __nvgpu_set_enabled(g, NVGPU_PMU_PSTATE, false); |
541 | 546 | ||
542 | if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) { | 547 | /* Read fuses to check if gpu needs to boot in secure/non-secure mode */ |
543 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); | 548 | if (gops->fuse.check_priv_security(g)) |
544 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | 549 | return -EINVAL; /* Do not boot gpu */ |
545 | } else if (g->is_virtual) { | ||
546 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); | ||
547 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); | ||
548 | } else { | ||
549 | val = gk20a_readl(g, fuse_opt_priv_sec_en_r()); | ||
550 | if (val) { | ||
551 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true); | ||
552 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, true); | ||
553 | } else { | ||
554 | gk20a_dbg_info("priv security is disabled in HW"); | ||
555 | __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, false); | ||
556 | __nvgpu_set_enabled(g, NVGPU_SEC_SECUREGPCCS, false); | ||
557 | } | ||
558 | } | ||
559 | 550 | ||
560 | /* priv security dependent ops */ | 551 | /* priv security dependent ops */ |
561 | if (nvgpu_is_enabled(g, NVGPU_SEC_PRIVSECURITY)) { | 552 | if (nvgpu_is_enabled(g, NVGPU_SEC_PRIVSECURITY)) { |