summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2017-03-15 09:10:43 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-03-23 11:04:23 -0400
commit33f637585ecd617a9f4423f56e2aa6df0691ac64 (patch)
treee6f67da9b18ec64cae039b6af76c6abb27a70323 /drivers/gpu
parent7505a759542c2d95e5abb42d44b8fb6afda74a87 (diff)
gpu: nvgpu: split nvhost dependency on plat interface
Add CONFIG_TEGRA_GK20A_NVHOST and remove the TEGRA_GRHOST || TEGRA_HOST1X dependency in CONFIG_TEGRA_GK20A to allow using the iGPU without the nvhost driver. Use the new config to guard syncpt-related code. Also make TEGRA_ACR depend on GK20A too so that it aligns properly under gk20a in menuconfig. Bug 1853519 Change-Id: I9e9b0a7915d000aae7930821627b7a01d08d3f5c Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/1321303 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/Kconfig.nvgpu14
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c11
-rw-r--r--drivers/gpu/nvgpu/gk20a/debug_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/fence_gk20a.c11
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c3
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a.h7
-rw-r--r--drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c8
8 files changed, 37 insertions, 25 deletions
diff --git a/drivers/gpu/nvgpu/Kconfig.nvgpu b/drivers/gpu/nvgpu/Kconfig.nvgpu
index d15a9fd0..4d7e0f12 100644
--- a/drivers/gpu/nvgpu/Kconfig.nvgpu
+++ b/drivers/gpu/nvgpu/Kconfig.nvgpu
@@ -75,19 +75,27 @@ config GK20A_CTXSW_TRACE
75 allows tracking context switches on GR engine, as well as 75 allows tracking context switches on GR engine, as well as
76 identifying processes that submitted work. 76 identifying processes that submitted work.
77 77
78config TEGRA_GK20A_NVHOST
79 bool "Support interfacing with nvhost hardware"
80 depends on TEGRA_GRHOST || TEGRA_HOST1X
81 depends on GK20A
82 default y
83 help
84 Enable support in GK20A for the nvhost (host1x) dma engine hardware
85 that includes things like hardware syncpts. This requires either
86 TEGRA_GRHOST or TEGRA_HOST1X.
87
78config TEGRA_GK20A 88config TEGRA_GK20A
79 bool "Enable the GK20A GPU on Tegra" 89 bool "Enable the GK20A GPU on Tegra"
80 depends on TEGRA_GRHOST || TEGRA_HOST1X
81 depends on GK20A 90 depends on GK20A
82 default y 91 default y
83 help 92 help
84 Enable support for the GK20A graphics engine on Tegra 93 Enable support for the GK20A graphics engine on Tegra
85 by adding a Tegra platfrom interface to the GK20A driver. 94 by adding a Tegra platfrom interface to the GK20A driver.
86 The Tegra platform interface requires TEGRA_GRHOST (host1x).
87 95
88config TEGRA_ACR 96config TEGRA_ACR
89 bool "Enable HS bin support on GM20B GPU on Tegra" 97 bool "Enable HS bin support on GM20B GPU on Tegra"
90 depends on GK20A_PMU 98 depends on GK20A && GK20A_PMU
91 default n 99 default n
92 help 100 help
93 Enable Support for Loading High Secure binary, and using 101 Enable Support for Loading High Secure binary, and using
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 11448094..ae22ee7d 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -31,11 +31,8 @@
31#include "../drivers/staging/android/sync.h" 31#include "../drivers/staging/android/sync.h"
32#endif 32#endif
33 33
34#ifdef CONFIG_TEGRA_GK20A 34#ifdef CONFIG_TEGRA_GK20A_NVHOST
35#include <linux/nvhost.h> 35#include <linux/nvhost.h>
36#endif
37
38#ifdef CONFIG_TEGRA_GK20A
39 36
40struct gk20a_channel_syncpt { 37struct gk20a_channel_syncpt {
41 struct gk20a_channel_sync ops; 38 struct gk20a_channel_sync ops;
@@ -382,7 +379,7 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c)
382 379
383 return &sp->ops; 380 return &sp->ops;
384} 381}
385#endif /* CONFIG_TEGRA_GK20A */ 382#endif /* CONFIG_TEGRA_GK20A_NVHOST */
386 383
387struct gk20a_channel_semaphore { 384struct gk20a_channel_semaphore {
388 struct gk20a_channel_sync ops; 385 struct gk20a_channel_sync ops;
@@ -972,7 +969,7 @@ void gk20a_channel_sync_destroy(struct gk20a_channel_sync *sync)
972 969
973struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c) 970struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c)
974{ 971{
975#ifdef CONFIG_TEGRA_GK20A 972#ifdef CONFIG_TEGRA_GK20A_NVHOST
976 if (gk20a_platform_has_syncpoints(c->g->dev)) 973 if (gk20a_platform_has_syncpoints(c->g->dev))
977 return gk20a_channel_syncpt_create(c); 974 return gk20a_channel_syncpt_create(c);
978#endif 975#endif
@@ -981,9 +978,7 @@ struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c)
981 978
982bool gk20a_channel_sync_needs_sync_framework(struct channel_gk20a *c) 979bool gk20a_channel_sync_needs_sync_framework(struct channel_gk20a *c)
983{ 980{
984#ifdef CONFIG_TEGRA_GK20A
985 if (gk20a_platform_has_syncpoints(c->g->dev)) 981 if (gk20a_platform_has_syncpoints(c->g->dev))
986 return false; 982 return false;
987#endif
988 return true; 983 return true;
989} 984}
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
index 89bfd0cf..4836e386 100644
--- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
@@ -12,10 +12,6 @@
12 * 12 *
13 */ 13 */
14 14
15#ifdef CONFIG_TEGRA_GK20A
16#include <linux/nvhost.h>
17#endif
18
19#include <linux/debugfs.h> 15#include <linux/debugfs.h>
20#include <linux/seq_file.h> 16#include <linux/seq_file.h>
21#include <linux/io.h> 17#include <linux/io.h>
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
index 115cd2b5..ea3cd3ff 100644
--- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
@@ -27,7 +27,7 @@
27#include "../drivers/staging/android/sync.h" 27#include "../drivers/staging/android/sync.h"
28#endif 28#endif
29 29
30#ifdef CONFIG_TEGRA_GK20A 30#ifdef CONFIG_TEGRA_GK20A_NVHOST
31#include <linux/nvhost.h> 31#include <linux/nvhost.h>
32#include <linux/nvhost_ioctl.h> 32#include <linux/nvhost_ioctl.h>
33#endif 33#endif
@@ -262,7 +262,7 @@ int gk20a_fence_from_semaphore(
262 return 0; 262 return 0;
263} 263}
264 264
265#ifdef CONFIG_TEGRA_GK20A 265#ifdef CONFIG_TEGRA_GK20A_NVHOST
266/* Fences that are backed by host1x syncpoints: */ 266/* Fences that are backed by host1x syncpoints: */
267 267
268static int gk20a_syncpt_fence_wait(struct gk20a_fence *f, long timeout) 268static int gk20a_syncpt_fence_wait(struct gk20a_fence *f, long timeout)
@@ -341,8 +341,11 @@ int gk20a_fence_from_syncpt(
341 return 0; 341 return 0;
342} 342}
343#else 343#else
344int gk20a_fence_from_syncpt(struct platform_device *host1x_pdev, 344int gk20a_fence_from_syncpt(
345 u32 id, u32 value, bool wfi) 345 struct gk20a_fence *fence_out,
346 struct platform_device *host1x_pdev,
347 u32 id, u32 value, bool wfi,
348 bool need_sync_fence)
346{ 349{
347 return -EINVAL; 350 return -EINVAL;
348} 351}
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index b390daa4..58020d41 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -21,7 +21,9 @@
21#include <linux/scatterlist.h> 21#include <linux/scatterlist.h>
22#include <trace/events/gk20a.h> 22#include <trace/events/gk20a.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#ifdef CONFIG_TEGRA_GK20A_NVHOST
24#include <linux/nvhost.h> 25#include <linux/nvhost.h>
26#endif
25#include <linux/sort.h> 27#include <linux/sort.h>
26 28
27#include <nvgpu/timers.h> 29#include <nvgpu/timers.h>
@@ -3714,7 +3716,7 @@ void gk20a_dump_channel_status_ramfc(struct gk20a *g,
3714 atomic_read(&hw_sema->next_value), 3716 atomic_read(&hw_sema->next_value),
3715 nvgpu_hw_sema_addr(hw_sema)); 3717 nvgpu_hw_sema_addr(hw_sema));
3716 3718
3717#ifdef CONFIG_TEGRA_GK20A 3719#ifdef CONFIG_TEGRA_GK20A_NVHOST
3718 if ((pbdma_syncpointb_op_v(syncpointb) == pbdma_syncpointb_op_wait_v()) 3720 if ((pbdma_syncpointb_op_v(syncpointb) == pbdma_syncpointb_op_wait_v())
3719 && (pbdma_syncpointb_wait_switch_v(syncpointb) == 3721 && (pbdma_syncpointb_wait_switch_v(syncpointb) ==
3720 pbdma_syncpointb_wait_switch_en_v())) 3722 pbdma_syncpointb_wait_switch_en_v()))
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index c8e2b19e..76484dd5 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -1842,8 +1842,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
1842 if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g)) 1842 if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g))
1843 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_SPARSE_ALLOCS; 1843 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_SPARSE_ALLOCS;
1844 1844
1845 if (IS_ENABLED(CONFIG_TEGRA_GK20A) && 1845 if (gk20a_platform_has_syncpoints(g->dev))
1846 gk20a_platform_has_syncpoints(g->dev))
1847 gpu->flags |= NVGPU_GPU_FLAGS_HAS_SYNCPOINTS; 1846 gpu->flags |= NVGPU_GPU_FLAGS_HAS_SYNCPOINTS;
1848 1847
1849 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_USERSPACE_MANAGED_AS; 1848 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_USERSPACE_MANAGED_AS;
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
index 99ea1bb7..d685639b 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
@@ -35,9 +35,6 @@ struct secure_page_buffer {
35}; 35};
36 36
37struct gk20a_platform { 37struct gk20a_platform {
38#ifdef CONFIG_TEGRA_GK20A
39 u32 syncpt_base;
40#endif
41 /* Populated by the gk20a driver before probing the platform. */ 38 /* Populated by the gk20a driver before probing the platform. */
42 struct gk20a *g; 39 struct gk20a *g;
43 40
@@ -277,8 +274,12 @@ extern struct gk20a_platform vgpu_tegra_platform;
277 274
278static inline bool gk20a_platform_has_syncpoints(struct device *dev) 275static inline bool gk20a_platform_has_syncpoints(struct device *dev)
279{ 276{
277#ifdef CONFIG_TEGRA_GK20A_NVHOST
280 struct gk20a_platform *p = dev_get_drvdata(dev); 278 struct gk20a_platform *p = dev_get_drvdata(dev);
281 return p->has_syncpoints && !p->disable_syncpoints; 279 return p->has_syncpoints && !p->disable_syncpoints;
280#else
281 return false;
282#endif
282} 283}
283 284
284int gk20a_tegra_busy(struct device *dev); 285int gk20a_tegra_busy(struct device *dev);
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
index ceb1d67e..538c2eb1 100644
--- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c
@@ -15,7 +15,9 @@
15 15
16#include <linux/version.h> 16#include <linux/version.h>
17#include <linux/of_platform.h> 17#include <linux/of_platform.h>
18#ifdef CONFIG_TEGRA_GK20A_NVHOST
18#include <linux/nvhost.h> 19#include <linux/nvhost.h>
20#endif
19#include <linux/debugfs.h> 21#include <linux/debugfs.h>
20#include <linux/platform_data/tegra_edp.h> 22#include <linux/platform_data/tegra_edp.h>
21#include <linux/delay.h> 23#include <linux/delay.h>
@@ -843,30 +845,36 @@ static void gk20a_tegra_scale_exit(struct device *dev)
843 845
844void gk20a_tegra_debug_dump(struct device *dev) 846void gk20a_tegra_debug_dump(struct device *dev)
845{ 847{
848#ifdef CONFIG_TEGRA_GK20A_NVHOST
846 struct gk20a_platform *platform = gk20a_get_platform(dev); 849 struct gk20a_platform *platform = gk20a_get_platform(dev);
847 struct gk20a *g = platform->g; 850 struct gk20a *g = platform->g;
848 851
849 if (g->host1x_dev) 852 if (g->host1x_dev)
850 nvhost_debug_dump_device(g->host1x_dev); 853 nvhost_debug_dump_device(g->host1x_dev);
854#endif
851} 855}
852 856
853int gk20a_tegra_busy(struct device *dev) 857int gk20a_tegra_busy(struct device *dev)
854{ 858{
859#ifdef CONFIG_TEGRA_GK20A_NVHOST
855 struct gk20a_platform *platform = gk20a_get_platform(dev); 860 struct gk20a_platform *platform = gk20a_get_platform(dev);
856 struct gk20a *g = platform->g; 861 struct gk20a *g = platform->g;
857 862
858 if (g->host1x_dev) 863 if (g->host1x_dev)
859 return nvhost_module_busy_ext(g->host1x_dev); 864 return nvhost_module_busy_ext(g->host1x_dev);
865#endif
860 return 0; 866 return 0;
861} 867}
862 868
863void gk20a_tegra_idle(struct device *dev) 869void gk20a_tegra_idle(struct device *dev)
864{ 870{
871#ifdef CONFIG_TEGRA_GK20A_NVHOST
865 struct gk20a_platform *platform = gk20a_get_platform(dev); 872 struct gk20a_platform *platform = gk20a_get_platform(dev);
866 struct gk20a *g = platform->g; 873 struct gk20a *g = platform->g;
867 874
868 if (g->host1x_dev) 875 if (g->host1x_dev)
869 nvhost_module_idle_ext(g->host1x_dev); 876 nvhost_module_idle_ext(g->host1x_dev);
877#endif
870} 878}
871 879
872static int gk20a_tegra_probe(struct device *dev) 880static int gk20a_tegra_probe(struct device *dev)