diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-05-01 16:37:03 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-11 14:05:31 -0400 |
commit | bd68f98ba76f43954e9858252a30e6c3b054c146 (patch) | |
tree | faa4e213603b9fe91d911cf5e0f06977c4232db4 /drivers/gpu/nvgpu/tegra/linux | |
parent | c3fa78b1d9cba28547ca59154207d434931ae746 (diff) |
gpu: nvgpu: Move secure_alloc to struct gk20a
Move the function pointer for VPR page allocation to struct gk20a
and use it from there. At the same time remove secure_page_alloc
pointer and add a direct call to it in probe.
Move platform_tegra.h as tegra/linux/platform_gk20a_tegra.h, as it's
only declaring functions defined in platform_gk20a_tegra.c to other
files in the same directory.
JIRA NVGPU-16
Change-Id: I19ac9ee0b2f6734203ae32a1f51d67fd51aced9f
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1473706
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/tegra/linux')
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.h | 25 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | 9 |
3 files changed, 46 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c index 99c7e8b3..996fd251 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | |||
@@ -110,6 +110,8 @@ static void gk20a_tegra_secure_page_destroy(struct device *dev, | |||
110 | dma_free_attrs(&tegra_vpr_dev, secure_buffer->size, | 110 | dma_free_attrs(&tegra_vpr_dev, secure_buffer->size, |
111 | (void *)(uintptr_t)secure_buffer->iova, | 111 | (void *)(uintptr_t)secure_buffer->iova, |
112 | secure_buffer->iova, __DMA_ATTR(attrs)); | 112 | secure_buffer->iova, __DMA_ATTR(attrs)); |
113 | |||
114 | secure_buffer->destroy = NULL; | ||
113 | } | 115 | } |
114 | 116 | ||
115 | int gk20a_tegra_secure_page_alloc(struct device *dev) | 117 | int gk20a_tegra_secure_page_alloc(struct device *dev) |
@@ -153,7 +155,7 @@ static void gk20a_tegra_secure_destroy(struct gk20a *g, | |||
153 | } | 155 | } |
154 | } | 156 | } |
155 | 157 | ||
156 | int gk20a_tegra_secure_alloc(struct device *dev, | 158 | static int gk20a_tegra_secure_alloc(struct device *dev, |
157 | struct gr_ctx_buffer_desc *desc, | 159 | struct gr_ctx_buffer_desc *desc, |
158 | size_t size) | 160 | size_t size) |
159 | { | 161 | { |
@@ -164,9 +166,6 @@ int gk20a_tegra_secure_alloc(struct device *dev, | |||
164 | struct page *page; | 166 | struct page *page; |
165 | int err = 0; | 167 | int err = 0; |
166 | 168 | ||
167 | if (!platform->secure_alloc_ready) | ||
168 | return -EINVAL; | ||
169 | |||
170 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs)); | 169 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs)); |
171 | (void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova, | 170 | (void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova, |
172 | GFP_KERNEL, __DMA_ATTR(attrs)); | 171 | GFP_KERNEL, __DMA_ATTR(attrs)); |
@@ -194,6 +193,9 @@ int gk20a_tegra_secure_alloc(struct device *dev, | |||
194 | desc->mem.size = size; | 193 | desc->mem.size = size; |
195 | desc->mem.aperture = APERTURE_SYSMEM; | 194 | desc->mem.aperture = APERTURE_SYSMEM; |
196 | 195 | ||
196 | if (platform->secure_buffer.destroy) | ||
197 | platform->secure_buffer.destroy(dev, &platform->secure_buffer); | ||
198 | |||
197 | return err; | 199 | return err; |
198 | 200 | ||
199 | fail_sgt: | 201 | fail_sgt: |
@@ -896,6 +898,11 @@ void gk20a_tegra_idle(struct device *dev) | |||
896 | #endif | 898 | #endif |
897 | } | 899 | } |
898 | 900 | ||
901 | void gk20a_tegra_init_secure_alloc(struct gk20a *g) | ||
902 | { | ||
903 | g->ops.mm.secure_alloc = gk20a_tegra_secure_alloc; | ||
904 | } | ||
905 | |||
899 | static int gk20a_tegra_probe(struct device *dev) | 906 | static int gk20a_tegra_probe(struct device *dev) |
900 | { | 907 | { |
901 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 908 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
@@ -974,6 +981,7 @@ static int gk20a_tegra_probe(struct device *dev) | |||
974 | 981 | ||
975 | gk20a_tegra_get_clocks(dev); | 982 | gk20a_tegra_get_clocks(dev); |
976 | nvgpu_linux_init_clk_support(platform->g); | 983 | nvgpu_linux_init_clk_support(platform->g); |
984 | gk20a_tegra_init_secure_alloc(platform->g); | ||
977 | 985 | ||
978 | if (platform->clk_register) { | 986 | if (platform->clk_register) { |
979 | ret = platform->clk_register(platform->g); | 987 | ret = platform->clk_register(platform->g); |
@@ -988,8 +996,11 @@ static int gk20a_tegra_probe(struct device *dev) | |||
988 | return 0; | 996 | return 0; |
989 | } | 997 | } |
990 | 998 | ||
991 | static int gk20a_tegra_late_probe(struct device *dev) | 999 | int gk20a_tegra_late_probe(struct device *dev) |
992 | { | 1000 | { |
1001 | /* Cause early VPR resize */ | ||
1002 | gk20a_tegra_secure_page_alloc(dev); | ||
1003 | |||
993 | /* Initialise tegra specific scaling quirks */ | 1004 | /* Initialise tegra specific scaling quirks */ |
994 | gk20a_tegra_scale_init(dev); | 1005 | gk20a_tegra_scale_init(dev); |
995 | 1006 | ||
@@ -1085,8 +1096,6 @@ struct gk20a_platform gk20a_tegra_platform = { | |||
1085 | .devfreq_governor = "nvhost_podgov", | 1096 | .devfreq_governor = "nvhost_podgov", |
1086 | .qos_notify = gk20a_scale_qos_notify, | 1097 | .qos_notify = gk20a_scale_qos_notify, |
1087 | 1098 | ||
1088 | .secure_alloc = gk20a_tegra_secure_alloc, | ||
1089 | .secure_page_alloc = gk20a_tegra_secure_page_alloc, | ||
1090 | .dump_platform_dependencies = gk20a_tegra_debug_dump, | 1099 | .dump_platform_dependencies = gk20a_tegra_debug_dump, |
1091 | 1100 | ||
1092 | .soc_name = "tegra12x", | 1101 | .soc_name = "tegra12x", |
@@ -1157,8 +1166,6 @@ struct gk20a_platform gm20b_tegra_platform = { | |||
1157 | .devfreq_governor = "nvhost_podgov", | 1166 | .devfreq_governor = "nvhost_podgov", |
1158 | .qos_notify = gk20a_scale_qos_notify, | 1167 | .qos_notify = gk20a_scale_qos_notify, |
1159 | 1168 | ||
1160 | .secure_alloc = gk20a_tegra_secure_alloc, | ||
1161 | .secure_page_alloc = gk20a_tegra_secure_page_alloc, | ||
1162 | .dump_platform_dependencies = gk20a_tegra_debug_dump, | 1169 | .dump_platform_dependencies = gk20a_tegra_debug_dump, |
1163 | 1170 | ||
1164 | .has_cde = true, | 1171 | .has_cde = true, |
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.h b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.h new file mode 100644 index 00000000..1aa7c1e3 --- /dev/null +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * GK20A Platform (SoC) Interface | ||
3 | * | ||
4 | * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
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, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef _NVGPU_PLATFORM_GK20A_TEGRA_H_ | ||
17 | #define _NVGPU_PLATFORM_GK20A_TEGRA_H_ | ||
18 | |||
19 | struct device; | ||
20 | struct gk20a; | ||
21 | |||
22 | void gk20a_tegra_init_secure_alloc(struct gk20a *g); | ||
23 | int gk20a_tegra_secure_page_alloc(struct device *dev); | ||
24 | |||
25 | #endif | ||
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c index 77b4b536..138b8fda 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "gk20a/gk20a.h" | 36 | #include "gk20a/gk20a.h" |
37 | #include "gk20a/gk20a_scale.h" | 37 | #include "gk20a/gk20a_scale.h" |
38 | 38 | ||
39 | #include "platform_tegra.h" | 39 | #include "platform_gk20a_tegra.h" |
40 | #include "gp10b/gp10b_sysfs.h" | 40 | #include "gp10b/gp10b_sysfs.h" |
41 | #include "gp10b/platform_gp10b.h" | 41 | #include "gp10b/platform_gp10b.h" |
42 | 42 | ||
@@ -163,12 +163,16 @@ static int gp10b_tegra_probe(struct device *dev) | |||
163 | 163 | ||
164 | gp10b_tegra_get_clocks(dev); | 164 | gp10b_tegra_get_clocks(dev); |
165 | nvgpu_linux_init_clk_support(platform->g); | 165 | nvgpu_linux_init_clk_support(platform->g); |
166 | gk20a_tegra_init_secure_alloc(platform->g); | ||
166 | 167 | ||
167 | return 0; | 168 | return 0; |
168 | } | 169 | } |
169 | 170 | ||
170 | static int gp10b_tegra_late_probe(struct device *dev) | 171 | static int gp10b_tegra_late_probe(struct device *dev) |
171 | { | 172 | { |
173 | /* Cause early VPR resize */ | ||
174 | gk20a_tegra_secure_page_alloc(dev); | ||
175 | |||
172 | /*Create GP10B specific sysfs*/ | 176 | /*Create GP10B specific sysfs*/ |
173 | gp10b_create_sysfs(dev); | 177 | gp10b_create_sysfs(dev); |
174 | 178 | ||
@@ -423,9 +427,6 @@ struct gk20a_platform gp10b_tegra_platform = { | |||
423 | 427 | ||
424 | .qos_notify = gk20a_scale_qos_notify, | 428 | .qos_notify = gk20a_scale_qos_notify, |
425 | 429 | ||
426 | .secure_alloc = gk20a_tegra_secure_alloc, | ||
427 | .secure_page_alloc = gk20a_tegra_secure_page_alloc, | ||
428 | |||
429 | .reset_assert = gp10b_tegra_reset_assert, | 430 | .reset_assert = gp10b_tegra_reset_assert, |
430 | .reset_deassert = gp10b_tegra_reset_deassert, | 431 | .reset_deassert = gp10b_tegra_reset_deassert, |
431 | 432 | ||