summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/Makefile2
-rw-r--r--drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c7
-rw-r--r--drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.c29
-rw-r--r--drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.h (renamed from drivers/gpu/nvgpu/os/linux/vgpu/clk_vgpu.h)17
-rw-r--r--drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c8
-rw-r--r--drivers/gpu/nvgpu/vgpu/clk_vgpu.c (renamed from drivers/gpu/nvgpu/os/linux/vgpu/clk_vgpu.c)44
-rw-r--r--drivers/gpu/nvgpu/vgpu/clk_vgpu.h29
7 files changed, 90 insertions, 46 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index 3d7671d0..1b7dbd26 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -158,7 +158,6 @@ nvgpu-$(CONFIG_TEGRA_GK20A_NVHOST) += \
158nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \ 158nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
159 os/linux/vgpu/platform_vgpu_tegra.o \ 159 os/linux/vgpu/platform_vgpu_tegra.o \
160 os/linux/vgpu/fecs_trace_vgpu.o \ 160 os/linux/vgpu/fecs_trace_vgpu.o \
161 os/linux/vgpu/clk_vgpu.o \
162 os/linux/vgpu/sysfs_vgpu.o \ 161 os/linux/vgpu/sysfs_vgpu.o \
163 os/linux/vgpu/vgpu_ivc.o \ 162 os/linux/vgpu/vgpu_ivc.o \
164 os/linux/vgpu/vgpu_ivm.o \ 163 os/linux/vgpu/vgpu_ivm.o \
@@ -270,6 +269,7 @@ nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
270 vgpu/tsg_vgpu.o \ 269 vgpu/tsg_vgpu.o \
271 vgpu/css_vgpu.o \ 270 vgpu/css_vgpu.o \
272 vgpu/ecc_vgpu.o \ 271 vgpu/ecc_vgpu.o \
272 vgpu/clk_vgpu.o \
273 vgpu/gm20b/vgpu_gr_gm20b.o \ 273 vgpu/gm20b/vgpu_gr_gm20b.o \
274 vgpu/gp10b/vgpu_hal_gp10b.o \ 274 vgpu/gp10b/vgpu_hal_gp10b.o \
275 vgpu/gp10b/vgpu_gr_gp10b.o \ 275 vgpu/gp10b/vgpu_gr_gp10b.o \
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c b/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
index 8eada9df..e662877d 100644
--- a/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
+++ b/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
@@ -19,10 +19,11 @@
19#include <nvgpu/nvhost.h> 19#include <nvgpu/nvhost.h>
20 20
21#include "gk20a/gk20a.h" 21#include "gk20a/gk20a.h"
22#include "os/linux/vgpu/clk_vgpu.h" 22#include "vgpu/clk_vgpu.h"
23#include "os/linux/platform_gk20a.h" 23#include "os/linux/platform_gk20a.h"
24#include "os/linux/os_linux.h" 24#include "os/linux/os_linux.h"
25#include "os/linux/vgpu/vgpu_linux.h" 25#include "os/linux/vgpu/vgpu_linux.h"
26#include "os/linux/vgpu/platform_vgpu_tegra.h"
26 27
27static int gv11b_vgpu_probe(struct device *dev) 28static int gv11b_vgpu_probe(struct device *dev)
28{ 29{
@@ -88,8 +89,8 @@ struct gk20a_platform gv11b_vgpu_tegra_platform = {
88 89
89 .probe = gv11b_vgpu_probe, 90 .probe = gv11b_vgpu_probe,
90 91
91 .clk_round_rate = vgpu_clk_round_rate, 92 .clk_round_rate = vgpu_plat_clk_round_rate,
92 .get_clk_freqs = vgpu_clk_get_freqs, 93 .get_clk_freqs = vgpu_plat_clk_get_freqs,
93 94
94 /* frequency scaling configuration */ 95 /* frequency scaling configuration */
95 .devfreq_governor = "userspace", 96 .devfreq_governor = "userspace",
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.c b/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.c
index 44879a45..25b76988 100644
--- a/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.c
+++ b/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.c
@@ -20,7 +20,7 @@
20 20
21#include "gk20a/gk20a.h" 21#include "gk20a/gk20a.h"
22#include "os/linux/platform_gk20a.h" 22#include "os/linux/platform_gk20a.h"
23#include "clk_vgpu.h" 23#include "vgpu/clk_vgpu.h"
24#include "vgpu_linux.h" 24#include "vgpu_linux.h"
25 25
26static int gk20a_tegra_probe(struct device *dev) 26static int gk20a_tegra_probe(struct device *dev)
@@ -40,6 +40,29 @@ static int gk20a_tegra_probe(struct device *dev)
40#endif 40#endif
41} 41}
42 42
43long vgpu_plat_clk_round_rate(struct device *dev, unsigned long rate)
44{
45 /* server will handle frequency rounding */
46 return rate;
47}
48
49int vgpu_plat_clk_get_freqs(struct device *dev, unsigned long **freqs,
50 int *num_freqs)
51{
52 struct gk20a_platform *platform = gk20a_get_platform(dev);
53 struct gk20a *g = platform->g;
54
55 return vgpu_clk_get_freqs(g, freqs, num_freqs);
56}
57
58int vgpu_plat_clk_cap_rate(struct device *dev, unsigned long rate)
59{
60 struct gk20a_platform *platform = gk20a_get_platform(dev);
61 struct gk20a *g = platform->g;
62
63 return vgpu_clk_cap_rate(g, rate);
64}
65
43struct gk20a_platform vgpu_tegra_platform = { 66struct gk20a_platform vgpu_tegra_platform = {
44 .has_syncpoints = true, 67 .has_syncpoints = true,
45 .aggressive_sync_destroy_thresh = 64, 68 .aggressive_sync_destroy_thresh = 64,
@@ -60,8 +83,8 @@ struct gk20a_platform vgpu_tegra_platform = {
60 83
61 .probe = gk20a_tegra_probe, 84 .probe = gk20a_tegra_probe,
62 85
63 .clk_round_rate = vgpu_clk_round_rate, 86 .clk_round_rate = vgpu_plat_clk_round_rate,
64 .get_clk_freqs = vgpu_clk_get_freqs, 87 .get_clk_freqs = vgpu_plat_clk_get_freqs,
65 88
66 /* frequency scaling configuration */ 89 /* frequency scaling configuration */
67 .devfreq_governor = "userspace", 90 .devfreq_governor = "userspace",
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/clk_vgpu.h b/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.h
index 8d477643..fef346d0 100644
--- a/drivers/gpu/nvgpu/os/linux/vgpu/clk_vgpu.h
+++ b/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * Virtualized GPU Clock Interface 2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
5 * 3 *
6 * 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
7 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -16,12 +14,11 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 15 */
18 16
19#ifndef _CLK_VIRT_H_ 17#ifndef _VGPU_PLATFORM_H_
20#define _CLK_VIRT_H_ 18#define _VGPU_PLATFORM_H_
21 19
22void vgpu_init_clk_support(struct gk20a *g); 20long vgpu_plat_clk_round_rate(struct device *dev, unsigned long rate);
23long vgpu_clk_round_rate(struct device *dev, unsigned long rate); 21int vgpu_plat_clk_get_freqs(struct device *dev, unsigned long **freqs,
24int vgpu_clk_get_freqs(struct device *dev, 22 int *num_freqs);
25 unsigned long **freqs, int *num_freqs); 23int vgpu_plat_clk_cap_rate(struct device *dev, unsigned long rate);
26int vgpu_clk_cap_rate(struct device *dev, unsigned long rate);
27#endif 24#endif
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c
index 7cf22d9d..f5628bc1 100644
--- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c
+++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c
@@ -35,7 +35,7 @@
35 35
36#include "vgpu_linux.h" 36#include "vgpu_linux.h"
37#include "vgpu/fecs_trace_vgpu.h" 37#include "vgpu/fecs_trace_vgpu.h"
38#include "clk_vgpu.h" 38#include "vgpu/clk_vgpu.h"
39#include "gk20a/tsg_gk20a.h" 39#include "gk20a/tsg_gk20a.h"
40#include "gk20a/regops_gk20a.h" 40#include "gk20a/regops_gk20a.h"
41#include "gm20b/hal_gm20b.h" 41#include "gm20b/hal_gm20b.h"
@@ -46,6 +46,7 @@
46#include "os/linux/scale.h" 46#include "os/linux/scale.h"
47#include "os/linux/driver_common.h" 47#include "os/linux/driver_common.h"
48#include "os/linux/platform_gk20a.h" 48#include "os/linux/platform_gk20a.h"
49#include "os/linux/vgpu/platform_vgpu_tegra.h"
49 50
50struct vgpu_priv_data *vgpu_get_priv_data(struct gk20a *g) 51struct vgpu_priv_data *vgpu_get_priv_data(struct gk20a *g)
51{ 52{
@@ -244,7 +245,7 @@ static int vgpu_qos_notify(struct notifier_block *nb,
244 nvgpu_log_fn(g, " "); 245 nvgpu_log_fn(g, " ");
245 246
246 max_freq = (u32)pm_qos_read_max_bound(PM_QOS_GPU_FREQ_BOUNDS); 247 max_freq = (u32)pm_qos_read_max_bound(PM_QOS_GPU_FREQ_BOUNDS);
247 err = vgpu_clk_cap_rate(profile->dev, max_freq); 248 err = vgpu_plat_clk_cap_rate(profile->dev, max_freq);
248 if (err) 249 if (err)
249 nvgpu_err(g, "%s failed, err=%d", __func__, err); 250 nvgpu_err(g, "%s failed, err=%d", __func__, err);
250 251
@@ -286,6 +287,7 @@ static void vgpu_pm_qos_remove(struct device *dev)
286static int vgpu_pm_init(struct device *dev) 287static int vgpu_pm_init(struct device *dev)
287{ 288{
288 struct gk20a *g = get_gk20a(dev); 289 struct gk20a *g = get_gk20a(dev);
290 struct gk20a_platform *platform = gk20a_get_platform(dev);
289 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); 291 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
290 unsigned long *freqs; 292 unsigned long *freqs;
291 int num_freqs; 293 int num_freqs;
@@ -303,7 +305,7 @@ static int vgpu_pm_init(struct device *dev)
303 305
304 if (l->devfreq) { 306 if (l->devfreq) {
305 /* set min/max frequency based on frequency table */ 307 /* set min/max frequency based on frequency table */
306 err = vgpu_clk_get_freqs(dev, &freqs, &num_freqs); 308 err = platform->get_clk_freqs(dev, &freqs, &num_freqs);
307 if (err) 309 if (err)
308 return err; 310 return err;
309 311
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/clk_vgpu.c b/drivers/gpu/nvgpu/vgpu/clk_vgpu.c
index 9f6017d3..efcb4fb0 100644
--- a/drivers/gpu/nvgpu/os/linux/vgpu/clk_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/clk_vgpu.c
@@ -1,19 +1,23 @@
1/* 1/*
2 * Virtualized GPU Clock Interface 2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. 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:
5 * 10 *
6 * This program is free software; you can redistribute it and/or modify it 11 * The above copyright notice and this permission notice shall be included in
7 * under the terms and conditions of the GNU General Public License, 12 * all copies or substantial portions of the Software.
8 * version 2, as published by the Free Software Foundation.
9 * 13 *
10 * This program is distributed in the hope it will be useful, but WITHOUT 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
13 * more details. 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14 * 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
15 * You should have received a copy of the GNU General Public License 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * DEALINGS IN THE SOFTWARE.
17 */ 21 */
18 22
19#include <nvgpu/vgpu/vgpu.h> 23#include <nvgpu/vgpu/vgpu.h>
@@ -21,7 +25,6 @@
21#include "gk20a/gk20a.h" 25#include "gk20a/gk20a.h"
22#include "clk_vgpu.h" 26#include "clk_vgpu.h"
23#include "ctrl/ctrlclk.h" 27#include "ctrl/ctrlclk.h"
24#include "os/linux/platform_gk20a.h"
25 28
26static unsigned long 29static unsigned long
27vgpu_freq_table[TEGRA_VGPU_GPU_FREQ_TABLE_SIZE]; 30vgpu_freq_table[TEGRA_VGPU_GPU_FREQ_TABLE_SIZE];
@@ -104,17 +107,8 @@ void vgpu_init_clk_support(struct gk20a *g)
104 g->ops.clk.get_maxrate = vgpu_clk_get_maxrate; 107 g->ops.clk.get_maxrate = vgpu_clk_get_maxrate;
105} 108}
106 109
107long vgpu_clk_round_rate(struct device *dev, unsigned long rate) 110int vgpu_clk_get_freqs(struct gk20a *g, unsigned long **freqs, int *num_freqs)
108{
109 /* server will handle frequency rounding */
110 return rate;
111}
112
113int vgpu_clk_get_freqs(struct device *dev,
114 unsigned long **freqs, int *num_freqs)
115{ 111{
116 struct gk20a_platform *platform = gk20a_get_platform(dev);
117 struct gk20a *g = platform->g;
118 struct tegra_vgpu_cmd_msg msg = {}; 112 struct tegra_vgpu_cmd_msg msg = {};
119 struct tegra_vgpu_get_gpu_freq_table_params *p = 113 struct tegra_vgpu_get_gpu_freq_table_params *p =
120 &msg.params.get_gpu_freq_table; 114 &msg.params.get_gpu_freq_table;
@@ -144,10 +138,8 @@ int vgpu_clk_get_freqs(struct device *dev,
144 return 0; 138 return 0;
145} 139}
146 140
147int vgpu_clk_cap_rate(struct device *dev, unsigned long rate) 141int vgpu_clk_cap_rate(struct gk20a *g, unsigned long rate)
148{ 142{
149 struct gk20a_platform *platform = gk20a_get_platform(dev);
150 struct gk20a *g = platform->g;
151 struct tegra_vgpu_cmd_msg msg = {}; 143 struct tegra_vgpu_cmd_msg msg = {};
152 struct tegra_vgpu_gpu_clk_rate_params *p = &msg.params.gpu_clk_rate; 144 struct tegra_vgpu_gpu_clk_rate_params *p = &msg.params.gpu_clk_rate;
153 int err = 0; 145 int err = 0;
diff --git a/drivers/gpu/nvgpu/vgpu/clk_vgpu.h b/drivers/gpu/nvgpu/vgpu/clk_vgpu.h
new file mode 100644
index 00000000..ae9f8345
--- /dev/null
+++ b/drivers/gpu/nvgpu/vgpu/clk_vgpu.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (c) 2018, 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 _CLK_VGPU_H_
24#define _CLK_VGPU_H_
25
26void vgpu_init_clk_support(struct gk20a *g);
27int vgpu_clk_get_freqs(struct gk20a *g, unsigned long **freqs, int *num_freqs);
28int vgpu_clk_cap_rate(struct gk20a *g, unsigned long rate);
29#endif