summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a.c
diff options
context:
space:
mode:
authorAingara Paramakuru <aparamakuru@nvidia.com>2014-05-05 21:14:22 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:01 -0400
commit1fd722f592c2e0523c5e399a2406a4e387057188 (patch)
tree3425fb1a08ec2ccc6397e39c73a5579117e00a05 /drivers/gpu/nvgpu/gk20a/gk20a.c
parent69e0cd3dfd8f39bc8d3529325001dcacd774f669 (diff)
gpu: nvgpu: support gk20a virtualization
The nvgpu driver now supports using the Tegra graphics virtualization interfaces to support gk20a in a virtualized environment. Bug 1509608 Change-Id: I6ede15ee7bf0b0ad8a13e8eb5f557c3516ead676 Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com> Reviewed-on: http://git-master/r/440122 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 0816878a..3499cc89 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -40,6 +40,7 @@
40#include <linux/tegra-powergate.h> 40#include <linux/tegra-powergate.h>
41#include <linux/tegra_pm_domains.h> 41#include <linux/tegra_pm_domains.h>
42#include <linux/clk/tegra.h> 42#include <linux/clk/tegra.h>
43#include <linux/kthread.h>
43 44
44#include <linux/sched.h> 45#include <linux/sched.h>
45#include <linux/input-cfboost.h> 46#include <linux/input-cfboost.h>
@@ -57,6 +58,9 @@
57#include "dbg_gpu_gk20a.h" 58#include "dbg_gpu_gk20a.h"
58#include "hal.h" 59#include "hal.h"
59#include "nvhost_acm.h" 60#include "nvhost_acm.h"
61#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
62#include "vgpu/vgpu.h"
63#endif
60 64
61#define CREATE_TRACE_POINTS 65#define CREATE_TRACE_POINTS
62#include <trace/events/gk20a.h> 66#include <trace/events/gk20a.h>
@@ -737,6 +741,17 @@ static int gk20a_init_client(struct platform_device *dev)
737 741
738 gk20a_dbg_fn(""); 742 gk20a_dbg_fn("");
739 743
744#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
745 {
746 struct gk20a_platform *platform = gk20a_get_platform(dev);
747
748 if (platform->virtual_dev) {
749 err = vgpu_pm_finalize_poweron(&dev->dev);
750 if (err)
751 return err;
752 }
753 }
754#endif
740#ifndef CONFIG_PM_RUNTIME 755#ifndef CONFIG_PM_RUNTIME
741 gk20a_pm_finalize_poweron(&dev->dev); 756 gk20a_pm_finalize_poweron(&dev->dev);
742#endif 757#endif
@@ -753,6 +768,16 @@ static int gk20a_init_client(struct platform_device *dev)
753static void gk20a_deinit_client(struct platform_device *dev) 768static void gk20a_deinit_client(struct platform_device *dev)
754{ 769{
755 gk20a_dbg_fn(""); 770 gk20a_dbg_fn("");
771#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
772 {
773 struct gk20a_platform *platform = gk20a_get_platform(dev);
774
775 if (platform->virtual_dev) {
776 vgpu_pm_prepare_poweroff(&dev->dev);
777 return;
778 }
779 }
780#endif
756#ifndef CONFIG_PM_RUNTIME 781#ifndef CONFIG_PM_RUNTIME
757 gk20a_pm_prepare_poweroff(&dev->dev); 782 gk20a_pm_prepare_poweroff(&dev->dev);
758#endif 783#endif
@@ -1006,6 +1031,10 @@ static struct of_device_id tegra_gk20a_of_match[] = {
1006 .data = &gk20a_tegra_platform }, 1031 .data = &gk20a_tegra_platform },
1007 { .compatible = "nvidia,tegra210-gm20b", 1032 { .compatible = "nvidia,tegra210-gm20b",
1008 .data = &gm20b_tegra_platform }, 1033 .data = &gm20b_tegra_platform },
1034#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
1035 { .compatible = "nvidia,tegra124-gk20a-vgpu",
1036 .data = &vgpu_tegra_platform },
1037#endif
1009#else 1038#else
1010 { .compatible = "nvidia,tegra124-gk20a", 1039 { .compatible = "nvidia,tegra124-gk20a",
1011 .data = &gk20a_generic_platform }, 1040 .data = &gk20a_generic_platform },
@@ -1057,7 +1086,7 @@ static int gk20a_create_device(
1057 return 0; 1086 return 0;
1058} 1087}
1059 1088
1060static void gk20a_user_deinit(struct platform_device *dev) 1089void gk20a_user_deinit(struct platform_device *dev)
1061{ 1090{
1062 struct gk20a *g = get_gk20a(dev); 1091 struct gk20a *g = get_gk20a(dev);
1063 1092
@@ -1098,7 +1127,7 @@ static void gk20a_user_deinit(struct platform_device *dev)
1098 class_destroy(g->class); 1127 class_destroy(g->class);
1099} 1128}
1100 1129
1101static int gk20a_user_init(struct platform_device *dev) 1130int gk20a_user_init(struct platform_device *dev)
1102{ 1131{
1103 int err; 1132 int err;
1104 dev_t devno; 1133 dev_t devno;
@@ -1403,6 +1432,11 @@ static int gk20a_probe(struct platform_device *dev)
1403 1432
1404 platform_set_drvdata(dev, platform); 1433 platform_set_drvdata(dev, platform);
1405 1434
1435#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
1436 if (platform->virtual_dev)
1437 return vgpu_probe(dev);
1438#endif
1439
1406 gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL); 1440 gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL);
1407 if (!gk20a) { 1441 if (!gk20a) {
1408 dev_err(&dev->dev, "couldn't allocate gk20a support"); 1442 dev_err(&dev->dev, "couldn't allocate gk20a support");
@@ -1546,8 +1580,16 @@ static int gk20a_probe(struct platform_device *dev)
1546static int __exit gk20a_remove(struct platform_device *dev) 1580static int __exit gk20a_remove(struct platform_device *dev)
1547{ 1581{
1548 struct gk20a *g = get_gk20a(dev); 1582 struct gk20a *g = get_gk20a(dev);
1583#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
1584 struct gk20a_platform *platform = gk20a_get_platform(dev);
1585#endif
1549 gk20a_dbg_fn(""); 1586 gk20a_dbg_fn("");
1550 1587
1588#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
1589 if (platform->virtual_dev)
1590 return vgpu_remove(dev);
1591#endif
1592
1551#ifdef CONFIG_INPUT_CFBOOST 1593#ifdef CONFIG_INPUT_CFBOOST
1552 if (g->boost_added) 1594 if (g->boost_added)
1553 cfb_remove_device(&dev->dev); 1595 cfb_remove_device(&dev->dev);