diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/vgpu')
4 files changed, 57 insertions, 2 deletions
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 66911626..8eada9df 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 | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "os/linux/vgpu/clk_vgpu.h" | 22 | #include "os/linux/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 | 26 | ||
26 | static int gv11b_vgpu_probe(struct device *dev) | 27 | static int gv11b_vgpu_probe(struct device *dev) |
27 | { | 28 | { |
@@ -94,4 +95,8 @@ struct gk20a_platform gv11b_vgpu_tegra_platform = { | |||
94 | .devfreq_governor = "userspace", | 95 | .devfreq_governor = "userspace", |
95 | 96 | ||
96 | .virtual_dev = true, | 97 | .virtual_dev = true, |
98 | |||
99 | /* power management callbacks */ | ||
100 | .suspend = vgpu_tegra_suspend, | ||
101 | .resume = vgpu_tegra_resume, | ||
97 | }; | 102 | }; |
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 e4819e7d..44879a45 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/platform_vgpu_tegra.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra Virtualized GPU Platform Interface | 2 | * Tegra Virtualized GPU Platform Interface |
3 | * | 3 | * |
4 | * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2014-2018, 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, |
@@ -21,6 +21,7 @@ | |||
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 "clk_vgpu.h" |
24 | #include "vgpu_linux.h" | ||
24 | 25 | ||
25 | static int gk20a_tegra_probe(struct device *dev) | 26 | static int gk20a_tegra_probe(struct device *dev) |
26 | { | 27 | { |
@@ -66,4 +67,8 @@ struct gk20a_platform vgpu_tegra_platform = { | |||
66 | .devfreq_governor = "userspace", | 67 | .devfreq_governor = "userspace", |
67 | 68 | ||
68 | .virtual_dev = true, | 69 | .virtual_dev = true, |
70 | |||
71 | /* power management callbacks */ | ||
72 | .suspend = vgpu_tegra_suspend, | ||
73 | .resume = vgpu_tegra_resume, | ||
69 | }; | 74 | }; |
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c index a7612e54..25024e7d 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c | |||
@@ -147,7 +147,9 @@ int vgpu_pm_prepare_poweroff(struct device *dev) | |||
147 | if (!g->power_on) | 147 | if (!g->power_on) |
148 | return 0; | 148 | return 0; |
149 | 149 | ||
150 | ret = gk20a_channel_suspend(g); | 150 | if (g->ops.fifo.channel_suspend) |
151 | ret = g->ops.fifo.channel_suspend(g); | ||
152 | |||
151 | if (ret) | 153 | if (ret) |
152 | return ret; | 154 | return ret; |
153 | 155 | ||
@@ -473,3 +475,35 @@ bool vgpu_is_reduced_bar1(struct gk20a *g) | |||
473 | 475 | ||
474 | return resource_size(l->bar1_mem) == (resource_size_t)f->userd.size; | 476 | return resource_size(l->bar1_mem) == (resource_size_t)f->userd.size; |
475 | } | 477 | } |
478 | |||
479 | int vgpu_tegra_suspend(struct device *dev) | ||
480 | { | ||
481 | struct tegra_vgpu_cmd_msg msg = {}; | ||
482 | struct gk20a *g = get_gk20a(dev); | ||
483 | int err = 0; | ||
484 | |||
485 | msg.cmd = TEGRA_VGPU_CMD_SUSPEND; | ||
486 | msg.handle = vgpu_get_handle(g); | ||
487 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); | ||
488 | err = err ? err : msg.ret; | ||
489 | if (err) | ||
490 | nvgpu_err(g, "vGPU suspend failed\n"); | ||
491 | |||
492 | return err; | ||
493 | } | ||
494 | |||
495 | int vgpu_tegra_resume(struct device *dev) | ||
496 | { | ||
497 | struct tegra_vgpu_cmd_msg msg = {}; | ||
498 | struct gk20a *g = get_gk20a(dev); | ||
499 | int err = 0; | ||
500 | |||
501 | msg.cmd = TEGRA_VGPU_CMD_RESUME; | ||
502 | msg.handle = vgpu_get_handle(g); | ||
503 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); | ||
504 | err = err ? err : msg.ret; | ||
505 | if (err) | ||
506 | nvgpu_err(g, "vGPU resume failed\n"); | ||
507 | |||
508 | return err; | ||
509 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.h b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.h index 38379cf2..ff7d3a66 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.h +++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.h | |||
@@ -33,6 +33,9 @@ int vgpu_remove(struct platform_device *dev); | |||
33 | 33 | ||
34 | void vgpu_create_sysfs(struct device *dev); | 34 | void vgpu_create_sysfs(struct device *dev); |
35 | void vgpu_remove_sysfs(struct device *dev); | 35 | void vgpu_remove_sysfs(struct device *dev); |
36 | |||
37 | int vgpu_tegra_suspend(struct device *dev); | ||
38 | int vgpu_tegra_resume(struct device *dev); | ||
36 | #else | 39 | #else |
37 | /* define placeholders for functions used outside of vgpu */ | 40 | /* define placeholders for functions used outside of vgpu */ |
38 | 41 | ||
@@ -52,6 +55,14 @@ static inline int vgpu_remove(struct platform_device *dev) | |||
52 | { | 55 | { |
53 | return -ENOSYS; | 56 | return -ENOSYS; |
54 | } | 57 | } |
58 | static inline int vgpu_tegra_suspend(struct device *dev) | ||
59 | { | ||
60 | return -ENOSYS; | ||
61 | } | ||
62 | static inline int vgpu_tegra_resume(struct device *dev) | ||
63 | { | ||
64 | return -ENOSYS; | ||
65 | } | ||
55 | #endif | 66 | #endif |
56 | 67 | ||
57 | #endif | 68 | #endif |