From 16c511220ecda4a0220976f649fddabcfbee86e0 Mon Sep 17 00:00:00 2001 From: Kenneth Adams Date: Wed, 1 Oct 2014 08:27:17 -0700 Subject: gpu: nvgpu: t18x, gp10b framework This change adds gp10b to the nvgpu build as well as enabling CMA for buffer allocation. Change-Id: Id3d45ad6ffdab14120395952e68b285dd7364c76 Signed-off-by: Ken Adams Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/553324 GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/Makefile | 10 ++++ drivers/gpu/nvgpu/gp10b/Makefile | 13 +++++ drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 54 +++++++++++++++++++ drivers/gpu/nvgpu/gp10b/gr_gp10b.h | 31 +++++++++++ drivers/gpu/nvgpu/gp10b/gr_ops_gp10b.h | 28 ++++++++++ drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 98 ++++++++++++++++++++++++++++++++++ drivers/gpu/nvgpu/gp10b/hal_gp10b.h | 21 ++++++++ drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h | 30 +++++++++++ include/uapi/linux/nvgpu-t18x.h | 32 +++++++++++ 9 files changed, 317 insertions(+) create mode 100644 drivers/gpu/nvgpu/Makefile create mode 100644 drivers/gpu/nvgpu/gp10b/Makefile create mode 100644 drivers/gpu/nvgpu/gp10b/gr_gp10b.c create mode 100644 drivers/gpu/nvgpu/gp10b/gr_gp10b.h create mode 100644 drivers/gpu/nvgpu/gp10b/gr_ops_gp10b.h create mode 100644 drivers/gpu/nvgpu/gp10b/hal_gp10b.c create mode 100644 drivers/gpu/nvgpu/gp10b/hal_gp10b.h create mode 100644 drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h create mode 100644 include/uapi/linux/nvgpu-t18x.h diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile new file mode 100644 index 00000000..c583f6d5 --- /dev/null +++ b/drivers/gpu/nvgpu/Makefile @@ -0,0 +1,10 @@ +GCOV_PROFILE := y + +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel/drivers/gpu/nvgpu +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel/include/linux +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/include +ccflags-$(CONFIG_GK20A) += -Wno-multichar +ccflags-$(CONFIG_GK20A) += -Werror + +obj-$(CONFIG_GK20A) += gp10b/ + diff --git a/drivers/gpu/nvgpu/gp10b/Makefile b/drivers/gpu/nvgpu/gp10b/Makefile new file mode 100644 index 00000000..64cd4179 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/Makefile @@ -0,0 +1,13 @@ +GCOV_PROFILE := y + +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel/drivers/gpu/nvgpu +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel/include +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/drivers/gpu/nvgpu +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/include +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/include/uapi + +ccflags-$(CONFIG_GK20A) += -Wno-multichar + +obj-$(CONFIG_GK20A) += \ + gr_gp10b.o \ + hal_gp10b.o diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c new file mode 100644 index 00000000..f4a63fad --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c @@ -0,0 +1,54 @@ +/* + * GP10B GPU GR + * + * Copyright (c) 2014, 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 "gk20a/gr_gk20a.h" + +#include "gm20b/gr_gm20b.h" /* for MAXWELL classes */ +#include "gp10b/gr_gp10b.h" + + +bool gr_gp10b_is_valid_class(struct gk20a *g, u32 class_num) +{ + bool valid = false; + + switch (class_num) { + case PASCAL_COMPUTE_A: + case PASCAL_A: + case PASCAL_DMA_COPY_A: + valid = true; + break; + + case MAXWELL_COMPUTE_B: + case MAXWELL_B: + case FERMI_TWOD_A: + case KEPLER_DMA_COPY_A: + case MAXWELL_DMA_COPY_A: + valid = true; + break; + + default: + break; + } + gk20a_dbg_info("class=0x%x valid=%d", class_num, valid); + return valid; +} + +void gp10b_init_gr(struct gpu_ops *gops) +{ + gm20b_init_gr(gops); + gops->gr.is_valid_class = gr_gp10b_is_valid_class; +} diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h new file mode 100644 index 00000000..58616deb --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h @@ -0,0 +1,31 @@ +/* + * GM20B GPU GR + * + * Copyright (c) 2014, 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_GP10B_H_ +#define _NVGPU_GR_GP10B_H_ + +struct gk20a; + +enum { + PASCAL_CHANNEL_GPFIFO_A = 0xC06F, + PASCAL_A = 0xC097, + PASCAL_COMPUTE_A = 0xC0C0, + PASCAL_DMA_COPY_A = 0xC0B5, +}; + +void gp10b_init_gr(struct gpu_ops *ops); + + +#endif diff --git a/drivers/gpu/nvgpu/gp10b/gr_ops_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_ops_gp10b.h new file mode 100644 index 00000000..c3277017 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/gr_ops_gp10b.h @@ -0,0 +1,28 @@ +/* + * GP10B GPU graphics ops + * + * Copyright (c) 2014, 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 _GR_OPS_GP10B_H_ +#define _GR_OPS_GP10B_H_ + +#include "gr_ops.h" + +#define __gr_gp10b_op(X) gr_gp10b_ ## X +#define __set_gr_gp10b_op(X) . X = gr_gp10b_ ## X + +bool __gr_gp10b_op(is_valid_class)(struct gk20a *, u32); +int __gr_gp10b_op(alloc_obj_ctx)(struct channel_gk20a *, struct nvgpu_alloc_obj_ctx_args *); + + +#endif diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c new file mode 100644 index 00000000..61bae5c7 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -0,0 +1,98 @@ +/* + * GP10B Tegra HAL interface + * + * Copyright (c) 2014, 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 "gp10b/gr_gp10b.h" + +#include "gm20b/ltc_gm20b.h" +#include "gm20b/fb_gm20b.h" +#include "gm20b/gm20b_gating_reglist.h" +#include "gm20b/fifo_gm20b.h" +#include "gm20b/gr_ctx_gm20b.h" +#include "gm20b/mm_gm20b.h" +#include "gm20b/pmu_gm20b.h" +#include "gm20b/clk_gm20b.h" + +struct gpu_ops gp10b_ops = { + .clock_gating = { + .slcg_bus_load_gating_prod = + gm20b_slcg_bus_load_gating_prod, + .slcg_ce2_load_gating_prod = + gm20b_slcg_ce2_load_gating_prod, + .slcg_chiplet_load_gating_prod = + gm20b_slcg_chiplet_load_gating_prod, + .slcg_ctxsw_firmware_load_gating_prod = + gm20b_slcg_ctxsw_firmware_load_gating_prod, + .slcg_fb_load_gating_prod = + gm20b_slcg_fb_load_gating_prod, + .slcg_fifo_load_gating_prod = + gm20b_slcg_fifo_load_gating_prod, + .slcg_gr_load_gating_prod = + gr_gm20b_slcg_gr_load_gating_prod, + .slcg_ltc_load_gating_prod = + ltc_gm20b_slcg_ltc_load_gating_prod, + .slcg_perf_load_gating_prod = + gm20b_slcg_perf_load_gating_prod, + .slcg_priring_load_gating_prod = + gm20b_slcg_priring_load_gating_prod, + .slcg_pmu_load_gating_prod = + gm20b_slcg_pmu_load_gating_prod, + .slcg_therm_load_gating_prod = + gm20b_slcg_therm_load_gating_prod, + .slcg_xbar_load_gating_prod = + gm20b_slcg_xbar_load_gating_prod, + .blcg_bus_load_gating_prod = + gm20b_blcg_bus_load_gating_prod, + .blcg_ctxsw_firmware_load_gating_prod = + gm20b_blcg_ctxsw_firmware_load_gating_prod, + .blcg_fb_load_gating_prod = + gm20b_blcg_fb_load_gating_prod, + .blcg_fifo_load_gating_prod = + gm20b_blcg_fifo_load_gating_prod, + .blcg_gr_load_gating_prod = + gm20b_blcg_gr_load_gating_prod, + .blcg_ltc_load_gating_prod = + gm20b_blcg_ltc_load_gating_prod, + .blcg_pwr_csb_load_gating_prod = + gm20b_blcg_pwr_csb_load_gating_prod, + .blcg_pmu_load_gating_prod = + gm20b_blcg_pmu_load_gating_prod, + .pg_gr_load_gating_prod = + gr_gm20b_pg_gr_load_gating_prod, + } +}; + +int gp10b_init_hal(struct gpu_ops *gops) +{ + *gops = gp10b_ops; + gm20b_init_ltc(gops); + gp10b_init_gr(gops); + gm20b_init_ltc(gops); + gm20b_init_fb(gops); + gm20b_init_fifo(gops); + gm20b_init_gr_ctx(gops); + gm20b_init_mm(gops); + gm20b_init_pmu_ops(gops); + gm20b_init_clk_ops(gops); + gops->name = "gp10b"; + + return 0; +} diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.h b/drivers/gpu/nvgpu/gp10b/hal_gp10b.h new file mode 100644 index 00000000..78615ed1 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.h @@ -0,0 +1,21 @@ +/* + * GP10B Tegra HAL interface + * + * Copyright (c) 2014, 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_GP10B_H +#define _NVGPU_HAL_GP10B_H +struct gpu_ops; + +int gp10b_init_hal(struct gpu_ops *gops); +#endif diff --git a/drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h b/drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h new file mode 100644 index 00000000..fe027fb0 --- /dev/null +++ b/drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h @@ -0,0 +1,30 @@ +/* + * NVIDIA GPU ID functions, definitions. + * + * Copyright (c) 2014, 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_T18X_H_ +#define _NVGPU_GPUID_T18X_H_ + +#define NVGPU_GPUID_GP10B \ + GK20A_GPUID(NVGPU_GPU_ARCH_GP100, NVGPU_GPU_IMPL_GP10B) + +#define NVGPU_COMPAT_TEGRA_GP10B "nvidia,tegra186-gp10b" +#define NVGPU_COMPAT_GENERIC_GP10B "nvidia,generic-gp10b" + +#define TEGRA_18x_GPUID NVGPU_GPUID_GP10B +#define TEGRA_18x_GPUID_HAL gp10b_init_hal +#define TEGRA_18x_GPU_COMPAT_TEGRA NVGPU_COMPAT_TEGRA_GP10B +#define TEGRA_18x_GPU_COMPAT_GENERIC NVGPU_COMPAT_GENERIC_GP10B +struct gpu_ops; +extern int gp10b_init_hal(struct gpu_ops *); +#endif diff --git a/include/uapi/linux/nvgpu-t18x.h b/include/uapi/linux/nvgpu-t18x.h new file mode 100644 index 00000000..3ec0544a --- /dev/null +++ b/include/uapi/linux/nvgpu-t18x.h @@ -0,0 +1,32 @@ +/* + * NVGPU Public Interface Header + * + * Copyright (c) 2011-2014, 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. + */ + +/* This file is meant to extend nvgpu.h, not replace it + * as such, be sure that nvgpu.h is actually the file performing the + * inclusion, to the extent that's possible. + */ +#ifndef _UAPI__LINUX_NVGPU_IOCTL_H +# error "This file is to be included within nvgpu.h only." +#endif + +#ifndef _UAPI__LINUX_NVGPU_T18X_IOCTL_H_ +#define _UAPI__LINUX_NVGPU_T18X_IOCTL_H_ + +#define NVGPU_GPU_ARCH_GP100 0x00000130 +#define NVGPU_GPU_IMPL_GP10B 0x0000000B + +#endif /* _UAPI__LINUX_NVGPU_T18X_IOCTL_H_ */ + + -- cgit v1.2.2