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>
This commit is contained in:
Konsta Holtta
2017-03-15 15:10:43 +02:00
committed by mobile promotions
parent 7505a75954
commit 33f637585e
8 changed files with 37 additions and 25 deletions

View File

@@ -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

View File

@@ -31,11 +31,8 @@
#include "../drivers/staging/android/sync.h"
#endif
#ifdef CONFIG_TEGRA_GK20A
#ifdef CONFIG_TEGRA_GK20A_NVHOST
#include <linux/nvhost.h>
#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;
}

View File

@@ -12,10 +12,6 @@
*
*/
#ifdef CONFIG_TEGRA_GK20A
#include <linux/nvhost.h>
#endif
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/io.h>

View File

@@ -27,7 +27,7 @@
#include "../drivers/staging/android/sync.h"
#endif
#ifdef CONFIG_TEGRA_GK20A
#ifdef CONFIG_TEGRA_GK20A_NVHOST
#include <linux/nvhost.h>
#include <linux/nvhost_ioctl.h>
#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;
}

View File

@@ -21,7 +21,9 @@
#include <linux/scatterlist.h>
#include <trace/events/gk20a.h>
#include <linux/dma-mapping.h>
#ifdef CONFIG_TEGRA_GK20A_NVHOST
#include <linux/nvhost.h>
#endif
#include <linux/sort.h>
#include <nvgpu/timers.h>
@@ -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()))

View File

@@ -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;

View File

@@ -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);

View File

@@ -15,7 +15,9 @@
#include <linux/version.h>
#include <linux/of_platform.h>
#ifdef CONFIG_TEGRA_GK20A_NVHOST
#include <linux/nvhost.h>
#endif
#include <linux/debugfs.h>
#include <linux/platform_data/tegra_edp.h>
#include <linux/delay.h>
@@ -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)