diff options
author | Aingara Paramakuru <aparamakuru@nvidia.com> | 2014-05-05 21:14:22 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:11:01 -0400 |
commit | 1fd722f592c2e0523c5e399a2406a4e387057188 (patch) | |
tree | 3425fb1a08ec2ccc6397e39c73a5579117e00a05 /drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | |
parent | 69e0cd3dfd8f39bc8d3529325001dcacd774f669 (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/platform_vgpu_tegra.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c new file mode 100644 index 00000000..ea4fde79 --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Tegra Virtualized GPU Platform Interface | ||
3 | * | ||
4 | * Copyright (c) 2014, 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 | #include <linux/of_platform.h> | ||
17 | |||
18 | #include "gk20a.h" | ||
19 | #include "hal_gk20a.h" | ||
20 | #include "platform_gk20a.h" | ||
21 | |||
22 | static int gk20a_tegra_probe(struct platform_device *dev) | ||
23 | { | ||
24 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
25 | struct device_node *np = dev->dev.of_node; | ||
26 | const __be32 *host1x_ptr; | ||
27 | struct platform_device *host1x_pdev = NULL; | ||
28 | |||
29 | host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); | ||
30 | if (host1x_ptr) { | ||
31 | struct device_node *host1x_node = | ||
32 | of_find_node_by_phandle(be32_to_cpup(host1x_ptr)); | ||
33 | |||
34 | host1x_pdev = of_find_device_by_node(host1x_node); | ||
35 | if (!host1x_pdev) { | ||
36 | dev_warn(&dev->dev, "host1x device not available"); | ||
37 | return -EPROBE_DEFER; | ||
38 | } | ||
39 | |||
40 | } else { | ||
41 | host1x_pdev = to_platform_device(dev->dev.parent); | ||
42 | dev_warn(&dev->dev, "host1x reference not found. assuming host1x to be parent"); | ||
43 | } | ||
44 | |||
45 | platform->g->host1x_dev = host1x_pdev; | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | struct gk20a_platform vgpu_tegra_platform = { | ||
51 | .has_syncpoints = true, | ||
52 | |||
53 | /* power management configuration */ | ||
54 | .can_railgate = false, | ||
55 | .enable_slcg = false, | ||
56 | .enable_blcg = false, | ||
57 | .enable_elcg = false, | ||
58 | .enable_elpg = false, | ||
59 | .enable_aelpg = false, | ||
60 | |||
61 | .probe = gk20a_tegra_probe, | ||
62 | |||
63 | .virtual_dev = true, | ||
64 | }; | ||