From 33f637585ecd617a9f4423f56e2aa6df0691ac64 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Wed, 15 Mar 2017 15:10:43 +0200 Subject: 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 Reviewed-on: http://git-master/r/1321303 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Kconfig.nvgpu | 14 +++++++++++--- drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 11 +++-------- drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 4 ---- drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 11 +++++++---- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 4 +++- drivers/gpu/nvgpu/gk20a/gk20a.c | 3 +-- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 7 ++++--- drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | 8 ++++++++ 8 files changed, 37 insertions(+), 25 deletions(-) (limited to 'drivers') 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 allows tracking context switches on GR engine, as well as identifying processes that submitted work. +config TEGRA_GK20A_NVHOST + bool "Support interfacing with nvhost hardware" + depends on TEGRA_GRHOST || TEGRA_HOST1X + depends on GK20A + default y + help + Enable support in GK20A for the nvhost (host1x) dma engine hardware + that includes things like hardware syncpts. This requires either + TEGRA_GRHOST or TEGRA_HOST1X. + config TEGRA_GK20A bool "Enable the GK20A GPU on Tegra" - depends on TEGRA_GRHOST || TEGRA_HOST1X depends on GK20A default y help Enable support for the GK20A graphics engine on Tegra by adding a Tegra platfrom interface to the GK20A driver. - The Tegra platform interface requires TEGRA_GRHOST (host1x). config TEGRA_ACR bool "Enable HS bin support on GM20B GPU on Tegra" - depends on GK20A_PMU + depends on GK20A && GK20A_PMU default n help 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 @@ #include "../drivers/staging/android/sync.h" #endif -#ifdef CONFIG_TEGRA_GK20A +#ifdef CONFIG_TEGRA_GK20A_NVHOST #include -#endif - -#ifdef CONFIG_TEGRA_GK20A struct gk20a_channel_syncpt { struct gk20a_channel_sync ops; @@ -382,7 +379,7 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c) return &sp->ops; } -#endif /* CONFIG_TEGRA_GK20A */ +#endif /* CONFIG_TEGRA_GK20A_NVHOST */ struct gk20a_channel_semaphore { struct gk20a_channel_sync ops; @@ -972,7 +969,7 @@ void gk20a_channel_sync_destroy(struct gk20a_channel_sync *sync) struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c) { -#ifdef CONFIG_TEGRA_GK20A +#ifdef CONFIG_TEGRA_GK20A_NVHOST if (gk20a_platform_has_syncpoints(c->g->dev)) return gk20a_channel_syncpt_create(c); #endif @@ -981,9 +978,7 @@ struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c) bool gk20a_channel_sync_needs_sync_framework(struct channel_gk20a *c) { -#ifdef CONFIG_TEGRA_GK20A if (gk20a_platform_has_syncpoints(c->g->dev)) return false; -#endif return true; } 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 @@ * */ -#ifdef CONFIG_TEGRA_GK20A -#include -#endif - #include #include #include 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 @@ #include "../drivers/staging/android/sync.h" #endif -#ifdef CONFIG_TEGRA_GK20A +#ifdef CONFIG_TEGRA_GK20A_NVHOST #include #include #endif @@ -262,7 +262,7 @@ int gk20a_fence_from_semaphore( return 0; } -#ifdef CONFIG_TEGRA_GK20A +#ifdef CONFIG_TEGRA_GK20A_NVHOST /* Fences that are backed by host1x syncpoints: */ static int gk20a_syncpt_fence_wait(struct gk20a_fence *f, long timeout) @@ -341,8 +341,11 @@ int gk20a_fence_from_syncpt( return 0; } #else -int gk20a_fence_from_syncpt(struct platform_device *host1x_pdev, - u32 id, u32 value, bool wfi) +int gk20a_fence_from_syncpt( + struct gk20a_fence *fence_out, + struct platform_device *host1x_pdev, + u32 id, u32 value, bool wfi, + bool need_sync_fence) { return -EINVAL; } 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 @@ #include #include #include +#ifdef CONFIG_TEGRA_GK20A_NVHOST #include +#endif #include #include @@ -3714,7 +3716,7 @@ void gk20a_dump_channel_status_ramfc(struct gk20a *g, atomic_read(&hw_sema->next_value), nvgpu_hw_sema_addr(hw_sema)); -#ifdef CONFIG_TEGRA_GK20A +#ifdef CONFIG_TEGRA_GK20A_NVHOST if ((pbdma_syncpointb_op_v(syncpointb) == pbdma_syncpointb_op_wait_v()) && (pbdma_syncpointb_wait_switch_v(syncpointb) == 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) if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g)) gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_SPARSE_ALLOCS; - if (IS_ENABLED(CONFIG_TEGRA_GK20A) && - gk20a_platform_has_syncpoints(g->dev)) + if (gk20a_platform_has_syncpoints(g->dev)) gpu->flags |= NVGPU_GPU_FLAGS_HAS_SYNCPOINTS; 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 { }; struct gk20a_platform { -#ifdef CONFIG_TEGRA_GK20A - u32 syncpt_base; -#endif /* Populated by the gk20a driver before probing the platform. */ struct gk20a *g; @@ -277,8 +274,12 @@ extern struct gk20a_platform vgpu_tegra_platform; static inline bool gk20a_platform_has_syncpoints(struct device *dev) { +#ifdef CONFIG_TEGRA_GK20A_NVHOST struct gk20a_platform *p = dev_get_drvdata(dev); return p->has_syncpoints && !p->disable_syncpoints; +#else + return false; +#endif } int 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 @@ #include #include +#ifdef CONFIG_TEGRA_GK20A_NVHOST #include +#endif #include #include #include @@ -843,30 +845,36 @@ static void gk20a_tegra_scale_exit(struct device *dev) void gk20a_tegra_debug_dump(struct device *dev) { +#ifdef CONFIG_TEGRA_GK20A_NVHOST struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a *g = platform->g; if (g->host1x_dev) nvhost_debug_dump_device(g->host1x_dev); +#endif } int gk20a_tegra_busy(struct device *dev) { +#ifdef CONFIG_TEGRA_GK20A_NVHOST struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a *g = platform->g; if (g->host1x_dev) return nvhost_module_busy_ext(g->host1x_dev); +#endif return 0; } void gk20a_tegra_idle(struct device *dev) { +#ifdef CONFIG_TEGRA_GK20A_NVHOST struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a *g = platform->g; if (g->host1x_dev) nvhost_module_idle_ext(g->host1x_dev); +#endif } static int gk20a_tegra_probe(struct device *dev) -- cgit v1.2.2