diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index 13d52f842..75329a8d8 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -18,7 +18,11 @@ nvgpu-y += \
$(nvgpu-t18x)/gp10b/therm_gp10b.o \
$(nvgpu-t18x)/gp10b/fecs_trace_gp10b.o \
$(nvgpu-t18x)/gp10b/gp10b_sysfs.o \
- $(nvgpu-t18x)/gp10b/gp10b.o
+ $(nvgpu-t18x)/gp10b/gp10b.o \
+ $(nvgpu-t18x)/gp106/hal_gp106.o \
+ $(nvgpu-t18x)/gp106/pmu_gp106.o \
+ $(nvgpu-t18x)/gp106/gr_gp106.o \
+ $(nvgpu-t18x)/gp106/gr_ctx_gp106.o
nvgpu-$(CONFIG_TEGRA_GK20A) += $(nvgpu-t18x)/gp10b/platform_gp10b_tegra.o
diff --git a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c
new file mode 100644
index 000000000..34e1f859d
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c
@@ -0,0 +1,35 @@
+/*
+ * GP106 Graphics Context
+ *
+ * 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"
+#include "gr_ctx_gp106.h"
+
+static int gr_gp106_get_netlist_name(int index, char *name)
+{
+ sprintf(name, GP106_NETLIST_IMAGE_FW_NAME);
+ return 0;
+}
+
+static bool gr_gp106_is_firmware_defined(void)
+{
+ return true;
+}
+
+void gp106_init_gr_ctx(struct gpu_ops *gops)
+{
+ gops->gr_ctx.get_netlist_name = gr_gp106_get_netlist_name;
+ gops->gr_ctx.is_fw_defined = gr_gp106_is_firmware_defined;
+ gops->gr_ctx.use_dma_for_fw_bootstrap = false;
+}
diff --git a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h
new file mode 100644
index 000000000..d14a9126f
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#ifndef __GR_CTX_GP106_H__
+#define __GR_CTX_GP106_H__
+
+#include "gk20a/gr_ctx_gk20a.h"
+
+/* production netlist, one and only one from below */
+#define GP106_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_C
+
+void gp106_init_gr_ctx(struct gpu_ops *gops);
+
+#endif /*__GR_CTX_GP106_H__*/
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.c b/drivers/gpu/nvgpu/gp106/gr_gp106.c
new file mode 100644
index 000000000..e4768e0db
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_gp106.c
@@ -0,0 +1,111 @@
+/*
+ * GP106 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 "gk20a/gr_gk20a.h"
+
+#include "gm20b/gr_gm20b.h" /* for MAXWELL classes */
+#include "gp10b/gr_gp10b.h"
+#include "gr_gp106.h"
+#include "hw_gr_gp106.h"
+
+static bool gr_gp106_is_valid_class(struct gk20a *g, u32 class_num)
+{
+ bool valid = false;
+
+ switch (class_num) {
+ case PASCAL_COMPUTE_A:
+ case PASCAL_COMPUTE_B:
+ case PASCAL_A:
+ case PASCAL_B:
+ 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;
+}
+
+static u32 gr_gp106_pagepool_default_size(struct gk20a *g)
+{
+ return gr_scc_pagepool_total_pages_hwmax_value_v();
+}
+
+static int gr_gp106_handle_sw_method(struct gk20a *g, u32 addr,
+ u32 class_num, u32 offset, u32 data)
+{
+ gk20a_dbg_fn("");
+
+ if (class_num == PASCAL_COMPUTE_B) {
+ switch (offset << 2) {
+ case NVC0C0_SET_SHADER_EXCEPTIONS:
+ gk20a_gr_set_shader_exceptions(g, data);
+ break;
+ default:
+ goto fail;
+ }
+ }
+
+ if (class_num == PASCAL_B) {
+ switch (offset << 2) {
+ case NVC097_SET_SHADER_EXCEPTIONS:
+ gk20a_gr_set_shader_exceptions(g, data);
+ break;
+ case NVC097_SET_CIRCULAR_BUFFER_SIZE:
+ g->ops.gr.set_circular_buffer_size(g, data);
+ break;
+ case NVC097_SET_ALPHA_CIRCULAR_BUFFER_SIZE:
+ g->ops.gr.set_alpha_circular_buffer_size(g, data);
+ break;
+ default:
+ goto fail;
+ }
+ }
+ return 0;
+
+fail:
+ return -EINVAL;
+}
+
+static void gr_gp106_cb_size_default(struct gk20a *g)
+{
+ struct gr_gk20a *gr = &g->gr;
+
+ if (!gr->attrib_cb_default_size)
+ gr->attrib_cb_default_size = 0x800;
+ gr->alpha_cb_default_size =
+ gr_gpc0_ppc0_cbm_alpha_cb_size_v_default_v();
+}
+
+void gp106_init_gr(struct gpu_ops *gops)
+{
+ gp10b_init_gr(gops);
+ gops->gr.is_valid_class = gr_gp106_is_valid_class;
+ gops->gr.pagepool_default_size = gr_gp106_pagepool_default_size;
+ gops->gr.handle_sw_method = gr_gp106_handle_sw_method;
+ gops->gr.cb_size_default = gr_gp106_cb_size_default;
+}
diff --git a/drivers/gpu/nvgpu/gp106/gr_gp106.h b/drivers/gpu/nvgpu/gp106/gr_gp106.h
new file mode 100644
index 000000000..4fe22ee96
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/gr_gp106.h
@@ -0,0 +1,26 @@
+/*
+ * GP106 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_GP106_H_
+#define _NVGPU_GR_GP106_H_
+
+enum {
+ PASCAL_B = 0xC197,
+ PASCAL_COMPUTE_B = 0xC1C0,
+};
+
+void gp106_init_gr(struct gpu_ops *gops);
+
+#endif
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c
new file mode 100644
index 000000000..5c9e012dd
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c
@@ -0,0 +1,215 @@
+/*
+ * GP106 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 "gp10b/gr_gp10b.h"
+#include "gp10b/mc_gp10b.h"
+#include "gp10b/ltc_gp10b.h"
+#include "gp10b/mm_gp10b.h"
+#include "gp10b/ce2_gp10b.h"
+#include "gp10b/fb_gp10b.h"
+#include "gp10b/fifo_gp10b.h"
+#include "gp10b/gp10b_gating_reglist.h"
+#include "gp10b/regops_gp10b.h"
+#include "gp10b/cde_gp10b.h"
+#include "gp10b/therm_gp10b.h"
+
+#include "gm206/bios_gm206.h"
+
+#include "gm20b/gr_gm20b.h"
+#include "gm20b/fifo_gm20b.h"
+#include "gm20b/pmu_gm20b.h"
+#include "gm20b/clk_gm20b.h"
+
+#include "gp106/pmu_gp106.h"
+#include "gp106/gr_ctx_gp106.h"
+#include "gp106/gr_gp106.h"
+#include "nvgpu_gpuid_t18x.h"
+#include "hw_proj_gp106.h"
+
+static struct gpu_ops gp106_ops = {
+ .clock_gating = {
+ .slcg_bus_load_gating_prod =
+ gp10b_slcg_bus_load_gating_prod,
+ .slcg_ce2_load_gating_prod =
+ gp10b_slcg_ce2_load_gating_prod,
+ .slcg_chiplet_load_gating_prod =
+ gp10b_slcg_chiplet_load_gating_prod,
+ .slcg_ctxsw_firmware_load_gating_prod =
+ gp10b_slcg_ctxsw_firmware_load_gating_prod,
+ .slcg_fb_load_gating_prod =
+ gp10b_slcg_fb_load_gating_prod,
+ .slcg_fifo_load_gating_prod =
+ gp10b_slcg_fifo_load_gating_prod,
+ .slcg_gr_load_gating_prod =
+ gr_gp10b_slcg_gr_load_gating_prod,
+ .slcg_ltc_load_gating_prod =
+ ltc_gp10b_slcg_ltc_load_gating_prod,
+ .slcg_perf_load_gating_prod =
+ gp10b_slcg_perf_load_gating_prod,
+ .slcg_priring_load_gating_prod =
+ gp10b_slcg_priring_load_gating_prod,
+ .slcg_pmu_load_gating_prod =
+ gp10b_slcg_pmu_load_gating_prod,
+ .slcg_therm_load_gating_prod =
+ gp10b_slcg_therm_load_gating_prod,
+ .slcg_xbar_load_gating_prod =
+ gp10b_slcg_xbar_load_gating_prod,
+ .blcg_bus_load_gating_prod =
+ gp10b_blcg_bus_load_gating_prod,
+ .blcg_ce_load_gating_prod =
+ gp10b_blcg_ce_load_gating_prod,
+ .blcg_ctxsw_firmware_load_gating_prod =
+ gp10b_blcg_ctxsw_firmware_load_gating_prod,
+ .blcg_fb_load_gating_prod =
+ gp10b_blcg_fb_load_gating_prod,
+ .blcg_fifo_load_gating_prod =
+ gp10b_blcg_fifo_load_gating_prod,
+ .blcg_gr_load_gating_prod =
+ gp10b_blcg_gr_load_gating_prod,
+ .blcg_ltc_load_gating_prod =
+ gp10b_blcg_ltc_load_gating_prod,
+ .blcg_pwr_csb_load_gating_prod =
+ gp10b_blcg_pwr_csb_load_gating_prod,
+ .blcg_pmu_load_gating_prod =
+ gp10b_blcg_pmu_load_gating_prod,
+ .blcg_xbar_load_gating_prod =
+ gp10b_blcg_xbar_load_gating_prod,
+ .pg_gr_load_gating_prod =
+ gr_gp10b_pg_gr_load_gating_prod,
+ }
+};
+
+static int gp106_get_litter_value(struct gk20a *g,
+ enum nvgpu_litter_value value)
+{
+ int ret = -EINVAL;
+
+ switch (value) {
+ case GPU_LIT_NUM_GPCS:
+ ret = proj_scal_litter_num_gpcs_v();
+ break;
+ case GPU_LIT_NUM_PES_PER_GPC:
+ ret = proj_scal_litter_num_pes_per_gpc_v();
+ break;
+ case GPU_LIT_NUM_ZCULL_BANKS:
+ ret = proj_scal_litter_num_zcull_banks_v();
+ break;
+ case GPU_LIT_NUM_TPC_PER_GPC:
+ ret = proj_scal_litter_num_tpc_per_gpc_v();
+ break;
+ case GPU_LIT_NUM_FBPS:
+ ret = proj_scal_litter_num_fbps_v();
+ break;
+ case GPU_LIT_GPC_BASE:
+ ret = proj_gpc_base_v();
+ break;
+ case GPU_LIT_GPC_STRIDE:
+ ret = proj_gpc_stride_v();
+ break;
+ case GPU_LIT_GPC_SHARED_BASE:
+ ret = proj_gpc_shared_base_v();
+ break;
+ case GPU_LIT_TPC_IN_GPC_BASE:
+ ret = proj_tpc_in_gpc_base_v();
+ break;
+ case GPU_LIT_TPC_IN_GPC_STRIDE:
+ ret = proj_tpc_in_gpc_stride_v();
+ break;
+ case GPU_LIT_TPC_IN_GPC_SHARED_BASE:
+ ret = proj_tpc_in_gpc_shared_base_v();
+ break;
+ case GPU_LIT_PPC_IN_GPC_STRIDE:
+ ret = proj_ppc_in_gpc_stride_v();
+ break;
+ case GPU_LIT_ROP_BASE:
+ ret = proj_rop_base_v();
+ break;
+ case GPU_LIT_ROP_STRIDE:
+ ret = proj_rop_stride_v();
+ break;
+ case GPU_LIT_ROP_SHARED_BASE:
+ ret = proj_rop_shared_base_v();
+ break;
+ case GPU_LIT_HOST_NUM_PBDMA:
+ ret = proj_host_num_pbdma_v();
+ break;
+ case GPU_LIT_LTC_STRIDE:
+ ret = proj_ltc_stride_v();
+ break;
+ case GPU_LIT_LTS_STRIDE:
+ ret = proj_lts_stride_v();
+ break;
+ case GPU_LIT_NUM_FBPAS:
+ ret = proj_scal_litter_num_fbpas_v();
+ break;
+ case GPU_LIT_FBPA_STRIDE:
+ ret = proj_fbpa_stride_v();
+ break;
+ default:
+ BUG();
+ break;
+ }
+
+ return ret;
+}
+
+int gp106_init_hal(struct gk20a *g)
+{
+ struct gpu_ops *gops = &g->ops;
+ struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics;
+
+ gk20a_dbg_fn("");
+
+ *gops = gp106_ops;
+
+ gops->privsecurity = 0;
+ gops->securegpccs = 0;
+
+ gp10b_init_mc(gops);
+ gp106_init_gr(gops);
+ gp10b_init_ltc(gops);
+ gp10b_init_fb(gops);
+ gp10b_init_fifo(gops);
+ gp10b_init_ce2(gops);
+ gp106_init_gr_ctx(gops);
+ gp10b_init_mm(gops);
+ gp106_init_pmu_ops(gops);
+ gk20a_init_debug_ops(gops);
+ gp10b_init_regops(gops);
+ gp10b_init_cde_ops(gops);
+ gp10b_init_therm_ops(gops);
+ gm206_init_bios(gops);
+ gops->name = "gp106";
+ gops->get_litter_value = gp106_get_litter_value;
+ gops->chip_init_gpu_characteristics = gk20a_init_gpu_characteristics;
+
+ c->twod_class = FERMI_TWOD_A;
+ c->threed_class = PASCAL_B;
+ c->compute_class = PASCAL_COMPUTE_B;
+ c->gpfifo_class = PASCAL_CHANNEL_GPFIFO_A;
+ c->inline_to_memory_class = KEPLER_INLINE_TO_MEMORY_B;
+ c->dma_copy_class = PASCAL_DMA_COPY_A;
+
+ gk20a_dbg_fn("done");
+
+ return 0;
+}
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.h b/drivers/gpu/nvgpu/gp106/hal_gp106.h
new file mode 100644
index 000000000..af91267b2
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hal_gp106.h
@@ -0,0 +1,21 @@
+/*
+ * GP106 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_GP106_H
+#define _NVGPU_HAL_GP106_H
+struct gk20a;
+
+int gp106_init_hal(struct gk20a *gops);
+#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_bus_gp106.h b/drivers/gpu/nvgpu/gp106/hw_bus_gp106.h
new file mode 100644
index 000000000..6d80b6a6a
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_bus_gp106.h
@@ -0,0 +1,193 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+/*
+ * Function naming determines intended use:
+ *
+ * _r(void) : Returns the offset for register .
+ *
+ * _o(void) : Returns the offset for element .
+ *
+ * _w(void) : Returns the word offset for word (4 byte) element .
+ *
+ * __s(void) : Returns size of field of register in bits.
+ *
+ * __f(u32 v) : Returns a value based on 'v' which has been shifted
+ * and masked to place it at field of register . This value
+ * can be |'d with others to produce a full register value for
+ * register .
+ *
+ * __m(void) : Returns a mask for field of register . This
+ * value can be ~'d and then &'d to clear the value of field for
+ * register .
+ *
+ * ___f(void) : Returns the constant value after being shifted
+ * to place it at field of register . This value can be |'d
+ * with others to produce a full register value for .
+ *
+ * __v(u32 r) : Returns the value of field from a full register
+ * value 'r' after being shifted to place its LSB at bit 0.
+ * This value is suitable for direct comparison with other unshifted
+ * values appropriate for use in field of register .
+ *
+ * ___v(void) : Returns the constant value for defined for
+ * field of register . This value is suitable for direct
+ * comparison with unshifted values appropriate for use in field
+ * of register .
+ */
+#ifndef _hw_bus_gp106_h_
+#define _hw_bus_gp106_h_
+
+static inline u32 bus_bar1_block_r(void)
+{
+ return 0x00001704;
+}
+static inline u32 bus_bar1_block_ptr_f(u32 v)
+{
+ return (v & 0xfffffff) << 0;
+}
+static inline u32 bus_bar1_block_target_vid_mem_f(void)
+{
+ return 0x0;
+}
+static inline u32 bus_bar1_block_target_sys_mem_coh_f(void)
+{
+ return 0x20000000;
+}
+static inline u32 bus_bar1_block_target_sys_mem_ncoh_f(void)
+{
+ return 0x30000000;
+}
+static inline u32 bus_bar1_block_mode_virtual_f(void)
+{
+ return 0x80000000;
+}
+static inline u32 bus_bar2_block_r(void)
+{
+ return 0x00001714;
+}
+static inline u32 bus_bar2_block_ptr_f(u32 v)
+{
+ return (v & 0xfffffff) << 0;
+}
+static inline u32 bus_bar2_block_target_vid_mem_f(void)
+{
+ return 0x0;
+}
+static inline u32 bus_bar2_block_target_sys_mem_coh_f(void)
+{
+ return 0x20000000;
+}
+static inline u32 bus_bar2_block_target_sys_mem_ncoh_f(void)
+{
+ return 0x30000000;
+}
+static inline u32 bus_bar2_block_mode_virtual_f(void)
+{
+ return 0x80000000;
+}
+static inline u32 bus_bar1_block_ptr_shift_v(void)
+{
+ return 0x0000000c;
+}
+static inline u32 bus_bar2_block_ptr_shift_v(void)
+{
+ return 0x0000000c;
+}
+static inline u32 bus_bind_status_r(void)
+{
+ return 0x00001710;
+}
+static inline u32 bus_bind_status_bar1_pending_v(u32 r)
+{
+ return (r >> 0) & 0x1;
+}
+static inline u32 bus_bind_status_bar1_pending_empty_f(void)
+{
+ return 0x0;
+}
+static inline u32 bus_bind_status_bar1_pending_busy_f(void)
+{
+ return 0x1;
+}
+static inline u32 bus_bind_status_bar1_outstanding_v(u32 r)
+{
+ return (r >> 1) & 0x1;
+}
+static inline u32 bus_bind_status_bar1_outstanding_false_f(void)
+{
+ return 0x0;
+}
+static inline u32 bus_bind_status_bar1_outstanding_true_f(void)
+{
+ return 0x2;
+}
+static inline u32 bus_bind_status_bar2_pending_v(u32 r)
+{
+ return (r >> 2) & 0x1;
+}
+static inline u32 bus_bind_status_bar2_pending_empty_f(void)
+{
+ return 0x0;
+}
+static inline u32 bus_bind_status_bar2_pending_busy_f(void)
+{
+ return 0x4;
+}
+static inline u32 bus_bind_status_bar2_outstanding_v(u32 r)
+{
+ return (r >> 3) & 0x1;
+}
+static inline u32 bus_bind_status_bar2_outstanding_false_f(void)
+{
+ return 0x0;
+}
+static inline u32 bus_bind_status_bar2_outstanding_true_f(void)
+{
+ return 0x8;
+}
+static inline u32 bus_intr_0_r(void)
+{
+ return 0x00001100;
+}
+static inline u32 bus_intr_0_pri_squash_m(void)
+{
+ return 0x1 << 1;
+}
+static inline u32 bus_intr_0_pri_fecserr_m(void)
+{
+ return 0x1 << 2;
+}
+static inline u32 bus_intr_0_pri_timeout_m(void)
+{
+ return 0x1 << 3;
+}
+static inline u32 bus_intr_en_0_r(void)
+{
+ return 0x00001140;
+}
+static inline u32 bus_intr_en_0_pri_squash_m(void)
+{
+ return 0x1 << 1;
+}
+static inline u32 bus_intr_en_0_pri_fecserr_m(void)
+{
+ return 0x1 << 2;
+}
+static inline u32 bus_intr_en_0_pri_timeout_m(void)
+{
+ return 0x1 << 3;
+}
+#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ccsr_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ccsr_gp106.h
new file mode 100644
index 000000000..65146d39a
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ccsr_gp106.h
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+/*
+ * Function naming determines intended use:
+ *
+ * _r(void) : Returns the offset for register .
+ *
+ * _o(void) : Returns the offset for element .
+ *
+ * _w(void) : Returns the word offset for word (4 byte) element .
+ *
+ * __s(void) : Returns size of field of register in bits.
+ *
+ * __f(u32 v) : Returns a value based on 'v' which has been shifted
+ * and masked to place it at field of register . This value
+ * can be |'d with others to produce a full register value for
+ * register .
+ *
+ * __m(void) : Returns a mask for field of register . This
+ * value can be ~'d and then &'d to clear the value of field for
+ * register .
+ *
+ * ___f(void) : Returns the constant value after being shifted
+ * to place it at field of register . This value can be |'d
+ * with others to produce a full register value for .
+ *
+ * __v(u32 r) : Returns the value of field from a full register
+ * value 'r' after being shifted to place its LSB at bit 0.
+ * This value is suitable for direct comparison with other unshifted
+ * values appropriate for use in field of register .
+ *
+ * ___v(void) : Returns the constant value for defined for
+ * field of register . This value is suitable for direct
+ * comparison with unshifted values appropriate for use in field
+ * of register .
+ */
+#ifndef _hw_ccsr_gp106_h_
+#define _hw_ccsr_gp106_h_
+
+static inline u32 ccsr_channel_inst_r(u32 i)
+{
+ return 0x00800000 + i*8;
+}
+static inline u32 ccsr_channel_inst__size_1_v(void)
+{
+ return 0x00001000;
+}
+static inline u32 ccsr_channel_inst_ptr_f(u32 v)
+{
+ return (v & 0xfffffff) << 0;
+}
+static inline u32 ccsr_channel_inst_target_vid_mem_f(void)
+{
+ return 0x0;
+}
+static inline u32 ccsr_channel_inst_target_sys_mem_coh_f(void)
+{
+ return 0x20000000;
+}
+static inline u32 ccsr_channel_inst_target_sys_mem_ncoh_f(void)
+{
+ return 0x30000000;
+}
+static inline u32 ccsr_channel_inst_bind_false_f(void)
+{
+ return 0x0;
+}
+static inline u32 ccsr_channel_inst_bind_true_f(void)
+{
+ return 0x80000000;
+}
+static inline u32 ccsr_channel_r(u32 i)
+{
+ return 0x00800004 + i*8;
+}
+static inline u32 ccsr_channel__size_1_v(void)
+{
+ return 0x00001000;
+}
+static inline u32 ccsr_channel_enable_v(u32 r)
+{
+ return (r >> 0) & 0x1;
+}
+static inline u32 ccsr_channel_enable_set_f(u32 v)
+{
+ return (v & 0x1) << 10;
+}
+static inline u32 ccsr_channel_enable_set_true_f(void)
+{
+ return 0x400;
+}
+static inline u32 ccsr_channel_enable_clr_true_f(void)
+{
+ return 0x800;
+}
+static inline u32 ccsr_channel_status_v(u32 r)
+{
+ return (r >> 24) & 0xf;
+}
+static inline u32 ccsr_channel_status_pending_ctx_reload_v(void)
+{
+ return 0x00000002;
+}
+static inline u32 ccsr_channel_busy_v(u32 r)
+{
+ return (r >> 28) & 0x1;
+}
+static inline u32 ccsr_channel_next_v(u32 r)
+{
+ return (r >> 1) & 0x1;
+}
+#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ce2_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ce2_gp106.h
new file mode 100644
index 000000000..d56b930b7
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ce2_gp106.h
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+/*
+ * Function naming determines intended use:
+ *
+ * _r(void) : Returns the offset for register .
+ *
+ * _o(void) : Returns the offset for element .
+ *
+ * _w(void) : Returns the word offset for word (4 byte) element .
+ *
+ * __s(void) : Returns size of field of register in bits.
+ *
+ * __f(u32 v) : Returns a value based on 'v' which has been shifted
+ * and masked to place it at field of register . This value
+ * can be |'d with others to produce a full register value for
+ * register .
+ *
+ * __m(void) : Returns a mask for field of register . This
+ * value can be ~'d and then &'d to clear the value of field for
+ * register .
+ *
+ * ___f(void) : Returns the constant value after being shifted
+ * to place it at field of register . This value can be |'d
+ * with others to produce a full register value for .
+ *
+ * __v(u32 r) : Returns the value of field from a full register
+ * value 'r' after being shifted to place its LSB at bit 0.
+ * This value is suitable for direct comparison with other unshifted
+ * values appropriate for use in field of register .
+ *
+ * ___v(void) : Returns the constant value for defined for
+ * field of register . This value is suitable for direct
+ * comparison with unshifted values appropriate for use in field
+ * of register .
+ */
+#ifndef _hw_ce2_gp106_h_
+#define _hw_ce2_gp106_h_
+
+static inline u32 ce2_intr_status_r(u32 i)
+{
+ return 0x00104410 + i*128;
+}
+static inline u32 ce2_intr_status_blockpipe_pending_f(void)
+{
+ return 0x1;
+}
+static inline u32 ce2_intr_status_blockpipe_reset_f(void)
+{
+ return 0x1;
+}
+static inline u32 ce2_intr_status_nonblockpipe_pending_f(void)
+{
+ return 0x2;
+}
+static inline u32 ce2_intr_status_nonblockpipe_reset_f(void)
+{
+ return 0x2;
+}
+static inline u32 ce2_intr_status_launcherr_pending_f(void)
+{
+ return 0x4;
+}
+static inline u32 ce2_intr_status_launcherr_reset_f(void)
+{
+ return 0x4;
+}
+#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_ctxsw_prog_gp106.h b/drivers/gpu/nvgpu/gp106/hw_ctxsw_prog_gp106.h
new file mode 100644
index 000000000..ed3e60098
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_ctxsw_prog_gp106.h
@@ -0,0 +1,289 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+/*
+ * Function naming determines intended use:
+ *
+ * _r(void) : Returns the offset for register .
+ *
+ * _o(void) : Returns the offset for element .
+ *
+ * _w(void) : Returns the word offset for word (4 byte) element .
+ *
+ * __s(void) : Returns size of field of register in bits.
+ *
+ * __f(u32 v) : Returns a value based on 'v' which has been shifted
+ * and masked to place it at field of register . This value
+ * can be |'d with others to produce a full register value for
+ * register .
+ *
+ * __m(void) : Returns a mask for field of register . This
+ * value can be ~'d and then &'d to clear the value of field for
+ * register .
+ *
+ * ___f(void) : Returns the constant value after being shifted
+ * to place it at field of register . This value can be |'d
+ * with others to produce a full register value for .
+ *
+ * __v(u32 r) : Returns the value of field from a full register
+ * value 'r' after being shifted to place its LSB at bit 0.
+ * This value is suitable for direct comparison with other unshifted
+ * values appropriate for use in field of register .
+ *
+ * ___v(void) : Returns the constant value for defined for
+ * field of register . This value is suitable for direct
+ * comparison with unshifted values appropriate for use in field
+ * of register .
+ */
+#ifndef _hw_ctxsw_prog_gp106_h_
+#define _hw_ctxsw_prog_gp106_h_
+
+static inline u32 ctxsw_prog_fecs_header_v(void)
+{
+ return 0x00000100;
+}
+static inline u32 ctxsw_prog_main_image_num_gpcs_o(void)
+{
+ return 0x00000008;
+}
+static inline u32 ctxsw_prog_main_image_patch_count_o(void)
+{
+ return 0x00000010;
+}
+static inline u32 ctxsw_prog_main_image_patch_adr_lo_o(void)
+{
+ return 0x00000014;
+}
+static inline u32 ctxsw_prog_main_image_patch_adr_hi_o(void)
+{
+ return 0x00000018;
+}
+static inline u32 ctxsw_prog_main_image_zcull_o(void)
+{
+ return 0x0000001c;
+}
+static inline u32 ctxsw_prog_main_image_zcull_mode_no_ctxsw_v(void)
+{
+ return 0x00000001;
+}
+static inline u32 ctxsw_prog_main_image_zcull_mode_separate_buffer_v(void)
+{
+ return 0x00000002;
+}
+static inline u32 ctxsw_prog_main_image_zcull_ptr_o(void)
+{
+ return 0x00000020;
+}
+static inline u32 ctxsw_prog_main_image_pm_o(void)
+{
+ return 0x00000028;
+}
+static inline u32 ctxsw_prog_main_image_pm_mode_m(void)
+{
+ return 0x7 << 0;
+}
+static inline u32 ctxsw_prog_main_image_pm_mode_no_ctxsw_f(void)
+{
+ return 0x0;
+}
+static inline u32 ctxsw_prog_main_image_pm_smpc_mode_m(void)
+{
+ return 0x7 << 3;
+}
+static inline u32 ctxsw_prog_main_image_pm_smpc_mode_ctxsw_f(void)
+{
+ return 0x8;
+}
+static inline u32 ctxsw_prog_main_image_pm_smpc_mode_no_ctxsw_f(void)
+{
+ return 0x0;
+}
+static inline u32 ctxsw_prog_main_image_pm_ptr_o(void)
+{
+ return 0x0000002c;
+}
+static inline u32 ctxsw_prog_main_image_num_save_ops_o(void)
+{
+ return 0x000000f4;
+}
+static inline u32 ctxsw_prog_main_image_num_wfi_save_ops_o(void)
+{
+ return 0x000000d0;
+}
+static inline u32 ctxsw_prog_main_image_num_cta_save_ops_o(void)
+{
+ return 0x000000d4;
+}
+static inline u32 ctxsw_prog_main_image_num_gfxp_save_ops_o(void)
+{
+ return 0x000000d8;
+}
+static inline u32 ctxsw_prog_main_image_num_cilp_save_ops_o(void)
+{
+ return 0x000000dc;
+}
+static inline u32 ctxsw_prog_main_image_num_restore_ops_o(void)
+{
+ return 0x000000f8;
+}
+static inline u32 ctxsw_prog_main_image_magic_value_o(void)
+{
+ return 0x000000fc;
+}
+static inline u32 ctxsw_prog_main_image_magic_value_v_value_v(void)
+{
+ return 0x600dc0de;
+}
+static inline u32 ctxsw_prog_local_priv_register_ctl_o(void)
+{
+ return 0x0000000c;
+}
+static inline u32 ctxsw_prog_local_priv_register_ctl_offset_v(u32 r)
+{
+ return (r >> 0) & 0xffff;
+}
+static inline u32 ctxsw_prog_local_image_ppc_info_o(void)
+{
+ return 0x000000f4;
+}
+static inline u32 ctxsw_prog_local_image_ppc_info_num_ppcs_v(u32 r)
+{
+ return (r >> 0) & 0xffff;
+}
+static inline u32 ctxsw_prog_local_image_ppc_info_ppc_mask_v(u32 r)
+{
+ return (r >> 16) & 0xffff;
+}
+static inline u32 ctxsw_prog_local_image_num_tpcs_o(void)
+{
+ return 0x000000f8;
+}
+static inline u32 ctxsw_prog_local_magic_value_o(void)
+{
+ return 0x000000fc;
+}
+static inline u32 ctxsw_prog_local_magic_value_v_value_v(void)
+{
+ return 0xad0becab;
+}
+static inline u32 ctxsw_prog_main_extended_buffer_ctl_o(void)
+{
+ return 0x000000ec;
+}
+static inline u32 ctxsw_prog_main_extended_buffer_ctl_offset_v(u32 r)
+{
+ return (r >> 0) & 0xffff;
+}
+static inline u32 ctxsw_prog_main_extended_buffer_ctl_size_v(u32 r)
+{
+ return (r >> 16) & 0xff;
+}
+static inline u32 ctxsw_prog_extended_buffer_segments_size_in_bytes_v(void)
+{
+ return 0x00000100;
+}
+static inline u32 ctxsw_prog_extended_marker_size_in_bytes_v(void)
+{
+ return 0x00000004;
+}
+static inline u32 ctxsw_prog_extended_sm_dsm_perf_counter_register_stride_v(void)
+{
+ return 0x00000000;
+}
+static inline u32 ctxsw_prog_extended_sm_dsm_perf_counter_control_register_stride_v(void)
+{
+ return 0x00000002;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_config_o(void)
+{
+ return 0x000000a0;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_s(void)
+{
+ return 2;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_f(u32 v)
+{
+ return (v & 0x3) << 0;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_m(void)
+{
+ return 0x3 << 0;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_v(u32 r)
+{
+ return (r >> 0) & 0x3;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_allow_all_f(void)
+{
+ return 0x0;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_config_mode_use_map_f(void)
+{
+ return 0x2;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_addr_lo_o(void)
+{
+ return 0x000000a4;
+}
+static inline u32 ctxsw_prog_main_image_priv_access_map_addr_hi_o(void)
+{
+ return 0x000000a8;
+}
+static inline u32 ctxsw_prog_main_image_misc_options_o(void)
+{
+ return 0x0000003c;
+}
+static inline u32 ctxsw_prog_main_image_misc_options_verif_features_m(void)
+{
+ return 0x1 << 3;
+}
+static inline u32 ctxsw_prog_main_image_misc_options_verif_features_disabled_f(void)
+{
+ return 0x0;
+}
+static inline u32 ctxsw_prog_main_image_graphics_preemption_options_o(void)
+{
+ return 0x00000080;
+}
+static inline u32 ctxsw_prog_main_image_graphics_preemption_options_control_f(u32 v)
+{
+ return (v & 0x3) << 0;
+}
+static inline u32 ctxsw_prog_main_image_graphics_preemption_options_control_gfxp_f(void)
+{
+ return 0x1;
+}
+static inline u32 ctxsw_prog_main_image_full_preemption_ptr_o(void)
+{
+ return 0x00000068;
+}
+static inline u32 ctxsw_prog_main_image_compute_preemption_options_o(void)
+{
+ return 0x00000084;
+}
+static inline u32 ctxsw_prog_main_image_compute_preemption_options_control_f(u32 v)
+{
+ return (v & 0x3) << 0;
+}
+static inline u32 ctxsw_prog_main_image_compute_preemption_options_control_cta_f(void)
+{
+ return 0x1;
+}
+static inline u32 ctxsw_prog_main_image_compute_preemption_options_control_cilp_f(void)
+{
+ return 0x2;
+}
+#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h
new file mode 100644
index 000000000..42d32ab38
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_fb_gp106.h
@@ -0,0 +1,489 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+/*
+ * Function naming determines intended use:
+ *
+ * _r(void) : Returns the offset for register .
+ *
+ * _o(void) : Returns the offset for element .
+ *
+ * _w(void) : Returns the word offset for word (4 byte) element .
+ *
+ * __s(void) : Returns size of field of register in bits.
+ *
+ * __f(u32 v) : Returns a value based on 'v' which has been shifted
+ * and masked to place it at field of register . This value
+ * can be |'d with others to produce a full register value for
+ * register .
+ *
+ * __m(void) : Returns a mask for field of register . This
+ * value can be ~'d and then &'d to clear the value of field for
+ * register .
+ *
+ * ___f(void) : Returns the constant value after being shifted
+ * to place it at field of register . This value can be |'d
+ * with others to produce a full register value for .
+ *
+ * __v(u32 r) : Returns the value of field from a full register
+ * value 'r' after being shifted to place its LSB at bit 0.
+ * This value is suitable for direct comparison with other unshifted
+ * values appropriate for use in field of register .
+ *
+ * ___v(void) : Returns the constant value for defined for
+ * field of register . This value is suitable for direct
+ * comparison with unshifted values appropriate for use in field
+ * of register .
+ */
+#ifndef _hw_fb_gp106_h_
+#define _hw_fb_gp106_h_
+
+static inline u32 fb_fbhub_num_active_ltcs_r(void)
+{
+ return 0x00100800;
+}
+static inline u32 fb_mmu_ctrl_r(void)
+{
+ return 0x00100c80;
+}
+static inline u32 fb_mmu_ctrl_vm_pg_size_f(u32 v)
+{
+ return (v & 0x1) << 0;
+}
+static inline u32 fb_mmu_ctrl_vm_pg_size_128kb_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_ctrl_vm_pg_size_64kb_f(void)
+{
+ return 0x1;
+}
+static inline u32 fb_mmu_ctrl_pri_fifo_empty_v(u32 r)
+{
+ return (r >> 15) & 0x1;
+}
+static inline u32 fb_mmu_ctrl_pri_fifo_empty_false_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_ctrl_pri_fifo_space_v(u32 r)
+{
+ return (r >> 16) & 0xff;
+}
+static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_v(u32 r)
+{
+ return (r >> 11) & 0x1;
+}
+static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_true_f(void)
+{
+ return 0x800;
+}
+static inline u32 fb_mmu_ctrl_use_pdb_big_page_size_false_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_priv_mmu_phy_secure_r(void)
+{
+ return 0x00100ce4;
+}
+static inline u32 fb_mmu_invalidate_pdb_r(void)
+{
+ return 0x00100cb8;
+}
+static inline u32 fb_mmu_invalidate_pdb_aperture_vid_mem_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_invalidate_pdb_aperture_sys_mem_f(void)
+{
+ return 0x2;
+}
+static inline u32 fb_mmu_invalidate_pdb_addr_f(u32 v)
+{
+ return (v & 0xfffffff) << 4;
+}
+static inline u32 fb_mmu_invalidate_r(void)
+{
+ return 0x00100cbc;
+}
+static inline u32 fb_mmu_invalidate_all_va_true_f(void)
+{
+ return 0x1;
+}
+static inline u32 fb_mmu_invalidate_all_pdb_true_f(void)
+{
+ return 0x2;
+}
+static inline u32 fb_mmu_invalidate_hubtlb_only_s(void)
+{
+ return 1;
+}
+static inline u32 fb_mmu_invalidate_hubtlb_only_f(u32 v)
+{
+ return (v & 0x1) << 2;
+}
+static inline u32 fb_mmu_invalidate_hubtlb_only_m(void)
+{
+ return 0x1 << 2;
+}
+static inline u32 fb_mmu_invalidate_hubtlb_only_v(u32 r)
+{
+ return (r >> 2) & 0x1;
+}
+static inline u32 fb_mmu_invalidate_hubtlb_only_true_f(void)
+{
+ return 0x4;
+}
+static inline u32 fb_mmu_invalidate_replay_s(void)
+{
+ return 3;
+}
+static inline u32 fb_mmu_invalidate_replay_f(u32 v)
+{
+ return (v & 0x7) << 3;
+}
+static inline u32 fb_mmu_invalidate_replay_m(void)
+{
+ return 0x7 << 3;
+}
+static inline u32 fb_mmu_invalidate_replay_v(u32 r)
+{
+ return (r >> 3) & 0x7;
+}
+static inline u32 fb_mmu_invalidate_replay_none_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_invalidate_replay_start_f(void)
+{
+ return 0x8;
+}
+static inline u32 fb_mmu_invalidate_replay_start_ack_all_f(void)
+{
+ return 0x10;
+}
+static inline u32 fb_mmu_invalidate_replay_cancel_targeted_f(void)
+{
+ return 0x18;
+}
+static inline u32 fb_mmu_invalidate_replay_cancel_global_f(void)
+{
+ return 0x20;
+}
+static inline u32 fb_mmu_invalidate_replay_cancel_f(void)
+{
+ return 0x20;
+}
+static inline u32 fb_mmu_invalidate_sys_membar_s(void)
+{
+ return 1;
+}
+static inline u32 fb_mmu_invalidate_sys_membar_f(u32 v)
+{
+ return (v & 0x1) << 6;
+}
+static inline u32 fb_mmu_invalidate_sys_membar_m(void)
+{
+ return 0x1 << 6;
+}
+static inline u32 fb_mmu_invalidate_sys_membar_v(u32 r)
+{
+ return (r >> 6) & 0x1;
+}
+static inline u32 fb_mmu_invalidate_sys_membar_true_f(void)
+{
+ return 0x40;
+}
+static inline u32 fb_mmu_invalidate_ack_s(void)
+{
+ return 2;
+}
+static inline u32 fb_mmu_invalidate_ack_f(u32 v)
+{
+ return (v & 0x3) << 7;
+}
+static inline u32 fb_mmu_invalidate_ack_m(void)
+{
+ return 0x3 << 7;
+}
+static inline u32 fb_mmu_invalidate_ack_v(u32 r)
+{
+ return (r >> 7) & 0x3;
+}
+static inline u32 fb_mmu_invalidate_ack_ack_none_required_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_invalidate_ack_ack_intranode_f(void)
+{
+ return 0x100;
+}
+static inline u32 fb_mmu_invalidate_ack_ack_globally_f(void)
+{
+ return 0x80;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_id_s(void)
+{
+ return 6;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_id_f(u32 v)
+{
+ return (v & 0x3f) << 9;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_id_m(void)
+{
+ return 0x3f << 9;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_id_v(u32 r)
+{
+ return (r >> 9) & 0x3f;
+}
+static inline u32 fb_mmu_invalidate_cancel_gpc_id_s(void)
+{
+ return 5;
+}
+static inline u32 fb_mmu_invalidate_cancel_gpc_id_f(u32 v)
+{
+ return (v & 0x1f) << 15;
+}
+static inline u32 fb_mmu_invalidate_cancel_gpc_id_m(void)
+{
+ return 0x1f << 15;
+}
+static inline u32 fb_mmu_invalidate_cancel_gpc_id_v(u32 r)
+{
+ return (r >> 15) & 0x1f;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_type_s(void)
+{
+ return 1;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_type_f(u32 v)
+{
+ return (v & 0x1) << 20;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_type_m(void)
+{
+ return 0x1 << 20;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_type_v(u32 r)
+{
+ return (r >> 20) & 0x1;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_type_gpc_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_invalidate_cancel_client_type_hub_f(void)
+{
+ return 0x100000;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_s(void)
+{
+ return 3;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_f(u32 v)
+{
+ return (v & 0x7) << 24;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_m(void)
+{
+ return 0x7 << 24;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_v(u32 r)
+{
+ return (r >> 24) & 0x7;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_all_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_pte_only_f(void)
+{
+ return 0x1000000;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde0_f(void)
+{
+ return 0x2000000;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde1_f(void)
+{
+ return 0x3000000;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde2_f(void)
+{
+ return 0x4000000;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde3_f(void)
+{
+ return 0x5000000;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde4_f(void)
+{
+ return 0x6000000;
+}
+static inline u32 fb_mmu_invalidate_cancel_cache_level_up_to_pde5_f(void)
+{
+ return 0x7000000;
+}
+static inline u32 fb_mmu_invalidate_trigger_s(void)
+{
+ return 1;
+}
+static inline u32 fb_mmu_invalidate_trigger_f(u32 v)
+{
+ return (v & 0x1) << 31;
+}
+static inline u32 fb_mmu_invalidate_trigger_m(void)
+{
+ return 0x1 << 31;
+}
+static inline u32 fb_mmu_invalidate_trigger_v(u32 r)
+{
+ return (r >> 31) & 0x1;
+}
+static inline u32 fb_mmu_invalidate_trigger_true_f(void)
+{
+ return 0x80000000;
+}
+static inline u32 fb_mmu_debug_wr_r(void)
+{
+ return 0x00100cc8;
+}
+static inline u32 fb_mmu_debug_wr_aperture_s(void)
+{
+ return 2;
+}
+static inline u32 fb_mmu_debug_wr_aperture_f(u32 v)
+{
+ return (v & 0x3) << 0;
+}
+static inline u32 fb_mmu_debug_wr_aperture_m(void)
+{
+ return 0x3 << 0;
+}
+static inline u32 fb_mmu_debug_wr_aperture_v(u32 r)
+{
+ return (r >> 0) & 0x3;
+}
+static inline u32 fb_mmu_debug_wr_aperture_vid_mem_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_debug_wr_aperture_sys_mem_coh_f(void)
+{
+ return 0x2;
+}
+static inline u32 fb_mmu_debug_wr_aperture_sys_mem_ncoh_f(void)
+{
+ return 0x3;
+}
+static inline u32 fb_mmu_debug_wr_vol_false_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_debug_wr_vol_true_v(void)
+{
+ return 0x00000001;
+}
+static inline u32 fb_mmu_debug_wr_vol_true_f(void)
+{
+ return 0x4;
+}
+static inline u32 fb_mmu_debug_wr_addr_f(u32 v)
+{
+ return (v & 0xfffffff) << 4;
+}
+static inline u32 fb_mmu_debug_wr_addr_alignment_v(void)
+{
+ return 0x0000000c;
+}
+static inline u32 fb_mmu_debug_rd_r(void)
+{
+ return 0x00100ccc;
+}
+static inline u32 fb_mmu_debug_rd_aperture_vid_mem_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_debug_rd_aperture_sys_mem_coh_f(void)
+{
+ return 0x2;
+}
+static inline u32 fb_mmu_debug_rd_aperture_sys_mem_ncoh_f(void)
+{
+ return 0x3;
+}
+static inline u32 fb_mmu_debug_rd_vol_false_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_debug_rd_addr_f(u32 v)
+{
+ return (v & 0xfffffff) << 4;
+}
+static inline u32 fb_mmu_debug_rd_addr_alignment_v(void)
+{
+ return 0x0000000c;
+}
+static inline u32 fb_mmu_debug_ctrl_r(void)
+{
+ return 0x00100cc4;
+}
+static inline u32 fb_mmu_debug_ctrl_debug_v(u32 r)
+{
+ return (r >> 16) & 0x1;
+}
+static inline u32 fb_mmu_debug_ctrl_debug_m(void)
+{
+ return 0x1 << 16;
+}
+static inline u32 fb_mmu_debug_ctrl_debug_enabled_v(void)
+{
+ return 0x00000001;
+}
+static inline u32 fb_mmu_debug_ctrl_debug_enabled_f(void)
+{
+ return 0x10000;
+}
+static inline u32 fb_mmu_debug_ctrl_debug_disabled_v(void)
+{
+ return 0x00000000;
+}
+static inline u32 fb_mmu_debug_ctrl_debug_disabled_f(void)
+{
+ return 0x0;
+}
+static inline u32 fb_mmu_vpr_info_r(void)
+{
+ return 0x00100cd0;
+}
+static inline u32 fb_mmu_vpr_info_fetch_v(u32 r)
+{
+ return (r >> 2) & 0x1;
+}
+static inline u32 fb_mmu_vpr_info_fetch_false_v(void)
+{
+ return 0x00000000;
+}
+static inline u32 fb_mmu_vpr_info_fetch_true_v(void)
+{
+ return 0x00000001;
+}
+static inline u32 fb_niso_flush_sysmem_addr_r(void)
+{
+ return 0x00100c10;
+}
+#endif
diff --git a/drivers/gpu/nvgpu/gp106/hw_fifo_gp106.h b/drivers/gpu/nvgpu/gp106/hw_fifo_gp106.h
new file mode 100644
index 000000000..763b58df5
--- /dev/null
+++ b/drivers/gpu/nvgpu/gp106/hw_fifo_gp106.h
@@ -0,0 +1,681 @@
+/*
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+/*
+ * Function naming determines intended use:
+ *
+ * _r(void) : Returns the offset for register .
+ *
+ * _o(void) : Returns the offset for element .
+ *
+ * _w(void) : Returns the word offset for word (4 byte) element .
+ *
+ * __s(void) : Returns size of field of register in bits.
+ *
+ * __f(u32 v) : Returns a value based on 'v' which has been shifted
+ * and masked to place it at field of register . This value
+ * can be |'d with others to produce a full register value for
+ * register .
+ *
+ * __m(void) : Returns a mask for field of register . This
+ * value can be ~'d and then &'d to clear the value of field for
+ * register .
+ *
+ * ___f(void) : Returns the constant value after being shifted
+ * to place it at field of register . This value can be |'d
+ * with others to produce a full register value for .
+ *
+ * __v(u32 r) : Returns the value of field from a full register
+ * value 'r' after being shifted to place its LSB at bit 0.
+ * This value is suitable for direct comparison with other unshifted
+ * values appropriate for use in field of register .
+ *
+ * ___v(void) : Returns the constant value for defined for
+ * field of register . This value is suitable for direct
+ * comparison with unshifted values appropriate for use in field
+ * of register