From 55a5c57bc1fd532cc6d041fdfb70d90286894b35 Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Thu, 7 Apr 2016 16:57:18 -0700 Subject: gpu: nvgpu: gv11b: added initial source code Bug 1735757 Change-Id: Iea7488551a437afa0dfc005c87ad1b9ab9673b6c Signed-off-by: Seshendra Gadagottu Reviewed-on: http://git-master/r/1122123 GVS: Gerrit_Virtual_Submit Reviewed-by: Ken Adams --- drivers/gpu/nvgpu/Makefile | 8 ++ drivers/gpu/nvgpu/gr_t19x.h | 20 ++++ drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 31 +++++ drivers/gpu/nvgpu/gv11b/gr_gv11b.h | 30 +++++ drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 45 ++++++++ drivers/gpu/nvgpu/gv11b/hal_gv11b.h | 21 ++++ drivers/gpu/nvgpu/gv11b/mc_gv11b.c | 26 +++++ drivers/gpu/nvgpu/gv11b/mc_gv11b.h | 19 ++++ drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c | 149 +++++++++++++++++++++++++ drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h | 32 ++++++ 10 files changed, 381 insertions(+) create mode 100644 drivers/gpu/nvgpu/Makefile create mode 100644 drivers/gpu/nvgpu/gr_t19x.h create mode 100644 drivers/gpu/nvgpu/gv11b/gr_gv11b.c create mode 100644 drivers/gpu/nvgpu/gv11b/gr_gv11b.h create mode 100644 drivers/gpu/nvgpu/gv11b/hal_gv11b.c create mode 100644 drivers/gpu/nvgpu/gv11b/hal_gv11b.h create mode 100644 drivers/gpu/nvgpu/gv11b/mc_gv11b.c create mode 100644 drivers/gpu/nvgpu/gv11b/mc_gv11b.h create mode 100644 drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c create mode 100644 drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile new file mode 100644 index 00000000..d70a2787 --- /dev/null +++ b/drivers/gpu/nvgpu/Makefile @@ -0,0 +1,8 @@ +nvgpu-t19x := ../../../../kernel-nvgpu-t19x/drivers/gpu/nvgpu + +nvgpu-y += \ + $(nvgpu-t19x)/gv11b/mc_gv11b.o \ + $(nvgpu-t19x)/gv11b/hal_gv11b.o \ + $(nvgpu-t19x)/gv11b/gr_gv11b.o + +nvgpu-$(CONFIG_TEGRA_GK20A) += $(nvgpu-t19x)/gv11b/platform_gv11b_tegra.o diff --git a/drivers/gpu/nvgpu/gr_t19x.h b/drivers/gpu/nvgpu/gr_t19x.h new file mode 100644 index 00000000..a4506f1c --- /dev/null +++ b/drivers/gpu/nvgpu/gr_t19x.h @@ -0,0 +1,20 @@ +/* + * NVIDIA T19x GR + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ +#ifndef _NVGPU_GR_T19X_H_ +#define _NVGPU_GR_T19X_H_ + +#include "gv11b/gr_gv11b.h" + +#endif diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c new file mode 100644 index 00000000..d775aae8 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c @@ -0,0 +1,31 @@ +/* + * GV11B GPU GR + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include "gk20a/gk20a.h" /* FERMI and MAXWELL classes defined here */ +#include +#include + +#include "gk20a/gr_gk20a.h" +#include "gk20a/semaphore_gk20a.h" +#include "gk20a/dbg_gpu_gk20a.h" + +#include "gm20b/gr_gm20b.h" /* for MAXWELL classes */ +#include "gp10b/gr_gp10b.h" +#include "gv11b/gr_gv11b.h" + +void gv11b_init_gr(struct gpu_ops *gops) +{ + gp10b_init_gr(gops); +} diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h new file mode 100644 index 00000000..c8912f91 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h @@ -0,0 +1,30 @@ +/* + * GV11B GPU GR + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef _NVGPU_GR_GV11B_H_ +#define _NVGPU_GR_GV11B_H_ + +struct gpu_ops; + +enum { + VOLTA_CHANNEL_GPFIFO_A = 0xC36F, + VOLTA_A = 0xC397, + VOLTA_COMPUTE_A = 0xC3C0, + VOLTA_DMA_COPY_A = 0xC3B5, +}; + +void gv11b_init_gr(struct gpu_ops *ops); + +#endif diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c new file mode 100644 index 00000000..0debe7ce --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c @@ -0,0 +1,45 @@ +/* + * GV11B Tegra HAL interface + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include + +#include + +#include "gk20a/gk20a.h" + +#include "gv11b/gr_gv11b.h" +#include "gv11b/mc_gv11b.h" + +#include "gm20b/gr_gm20b.h" + +int gv11b_init_hal(struct gk20a *g) +{ + struct gpu_ops *gops = &g->ops; + struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; + + gv11b_init_mc(gops); + gv11b_init_gr(gops); + gops->name = "gv11b"; + + c->twod_class = FERMI_TWOD_A; + c->threed_class = VOLTA_A; + c->compute_class = VOLTA_COMPUTE_A; + c->gpfifo_class = VOLTA_CHANNEL_GPFIFO_A; + c->inline_to_memory_class = KEPLER_INLINE_TO_MEMORY_B; + c->dma_copy_class = VOLTA_DMA_COPY_A; + + return 0; +} diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.h b/drivers/gpu/nvgpu/gv11b/hal_gv11b.h new file mode 100644 index 00000000..7acbf03b --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.h @@ -0,0 +1,21 @@ +/* + * GV11B Tegra HAL interface + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef _NVGPU_HAL_GV11B_H +#define _NVGPU_HAL_GV11B_H +struct gk20a; + +int gv11b_init_hal(struct gk20a *gops); +#endif diff --git a/drivers/gpu/nvgpu/gv11b/mc_gv11b.c b/drivers/gpu/nvgpu/gv11b/mc_gv11b.c new file mode 100644 index 00000000..bc0aee2e --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/mc_gv11b.c @@ -0,0 +1,26 @@ +/* + * GV11B master + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include + +#include "gk20a/gk20a.h" +#include "gp10b/mc_gp10b.h" +#include "gv11b/mc_gv11b.h" +#include "hw_mc_gv11b.h" + +void gv11b_init_mc(struct gpu_ops *gops) +{ + gp10b_init_mc(gops); +} diff --git a/drivers/gpu/nvgpu/gv11b/mc_gv11b.h b/drivers/gpu/nvgpu/gv11b/mc_gv11b.h new file mode 100644 index 00000000..6cb2cde0 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/mc_gv11b.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef MC_GV11B_H +#define MC_GV11B_H +struct gk20a; + +void gv11b_init_mc(struct gpu_ops *gops); +#endif diff --git a/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c new file mode 100644 index 00000000..322bebc8 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c @@ -0,0 +1,149 @@ +/* + * GV11B Tegra Platform Interface + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gk20a/platform_gk20a.h" +#include "gk20a/gk20a.h" +#include "platform_tegra.h" +#include "gr_gv11b.h" +#include "hw_gr_gv11b.h" + +/* + * gv11b_tegra_get_clocks() + * + * This function finds clocks in tegra platform and populates + * the clock information to gv11b platform data. + */ + +static int gv11b_tegra_get_clocks(struct device *dev) +{ + /* TODO */ + return 0; +} + +static int gv11b_tegra_probe(struct device *dev) +{ + struct gk20a_platform *platform = dev_get_drvdata(dev); + struct device_node *np = dev->of_node; + struct device_node *host1x_node; + struct platform_device *host1x_pdev; + const __be32 *host1x_ptr; + + host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); + if (!host1x_ptr) { + gk20a_err(dev, "host1x device not available"); + return -ENOSYS; + } + + host1x_node = of_find_node_by_phandle(be32_to_cpup(host1x_ptr)); + host1x_pdev = of_find_device_by_node(host1x_node); + if (!host1x_pdev) { + gk20a_err(dev, "host1x device not available"); + return -ENOSYS; + } + + platform->g->host1x_dev = host1x_pdev; + platform->bypass_smmu = !device_is_iommuable(dev); + platform->disable_bigpage = platform->bypass_smmu; + + platform->g->gr.t18x.ctx_vars.dump_ctxsw_stats_on_channel_close + = false; + platform->g->gr.t18x.ctx_vars.dump_ctxsw_stats_on_channel_close + = false; + + platform->g->gr.t18x.ctx_vars.force_preemption_gfxp = false; + platform->g->gr.t18x.ctx_vars.force_preemption_cilp = false; + + + gv11b_tegra_get_clocks(dev); + + return 0; +} + +static int gv11b_tegra_late_probe(struct device *dev) +{ + /* Make gk20a power domain a subdomain of host1x */ + nvhost_register_client_domain(dev_to_genpd(dev)); + return 0; +} + +static int gv11b_tegra_remove(struct device *dev) +{ + /* remove gk20a power subdomain from host1x */ + nvhost_unregister_client_domain(dev_to_genpd(dev)); + + return 0; + +} + +static bool gv11b_tegra_is_railgated(struct device *dev) +{ + bool ret = false; + + return ret; +} + +static int gv11b_tegra_railgate(struct device *dev) +{ + return 0; +} + +static int gv11b_tegra_unrailgate(struct device *dev) +{ + int ret = 0; + return ret; +} + +static int gv11b_tegra_suspend(struct device *dev) +{ + return 0; +} + +struct gk20a_platform t19x_gpu_tegra_platform = { + .has_syncpoints = false, + + /* power management configuration */ + + /* ptimer src frequency in hz*/ + .ptimer_src_freq = 31250000, + + .probe = gv11b_tegra_probe, + .late_probe = gv11b_tegra_late_probe, + .remove = gv11b_tegra_remove, + + /* power management callbacks */ + .suspend = gv11b_tegra_suspend, + .railgate = gv11b_tegra_railgate, + .unrailgate = gv11b_tegra_unrailgate, + .is_railgated = gv11b_tegra_is_railgated, + + .busy = gk20a_tegra_busy, + .idle = gk20a_tegra_idle, + + .dump_platform_dependencies = gk20a_tegra_debug_dump, + + .default_big_page_size = SZ_64K, + +}; diff --git a/drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h b/drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h new file mode 100644 index 00000000..d376f3dd --- /dev/null +++ b/drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h @@ -0,0 +1,32 @@ +/* + * NVIDIA GPU ID functions, definitions. + * + * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ +#ifndef _NVGPU_GPUID_T19X_H_ +#define _NVGPU_GPUID_T19X_H_ + +#define NVGPU_GPUID_GV11B \ + GK20A_GPUID(NVGPU_GPU_ARCH_GV110, NVGPU_GPU_IMPL_GV11B) + +#define NVGPU_COMPAT_TEGRA_GV11B "nvidia,g11b" +#define NVGPU_COMPAT_GENERIC_GV11B "nvidia,generic-gv11b" + +#define TEGRA_19x_GPUID NVGPU_GPUID_GV11B +#define TEGRA_19x_GPUID_HAL gv11b_init_hal +#define TEGRA_19x_GPU_COMPAT_TEGRA NVGPU_COMPAT_TEGRA_GV11B +#define TEGRA_19x_GPU_COMPAT_GENERIC NVGPU_COMPAT_GENERIC_GV11B +struct gpu_ops; +extern int gv11b_init_hal(struct gk20a *); +extern struct gk20a_platform t19x_gpu_tegra_platform; + +#endif -- cgit v1.2.2