From 0dc80244eea4c7e504976d8028a3ddb72ba60b0e Mon Sep 17 00:00:00 2001 From: Sunny He Date: Thu, 22 Jun 2017 16:43:51 -0700 Subject: gpu: nvgpu: Reorganize ltc HAL initialization Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the ltc sub-module of the gpu_ops struct. Perform HAL function assignments in hal_gxxxx.c through the population of a chip-specific copy of gpu_ops. Jira NVGPU-74 Change-Id: I1110e301e57b502cf7f97e6739424cb33cc52a69 Signed-off-by: Sunny He Reviewed-on: https://git-master/r/1507564 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gp106/hal_gp106.c | 22 +++++++++++++++++++--- drivers/gpu/nvgpu/gp106/ltc_gp106.c | 27 --------------------------- drivers/gpu/nvgpu/gp106/ltc_gp106.h | 19 ------------------- 3 files changed, 19 insertions(+), 49 deletions(-) delete mode 100644 drivers/gpu/nvgpu/gp106/ltc_gp106.c delete mode 100644 drivers/gpu/nvgpu/gp106/ltc_gp106.h (limited to 'drivers/gpu/nvgpu/gp106') diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index d923e5e9..adea3eb8 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c @@ -20,6 +20,7 @@ #include "gk20a/pramin_gk20a.h" #include "gk20a/flcn_gk20a.h" +#include "gp10b/ltc_gp10b.h" #include "gp10b/gr_gp10b.h" #include "gp10b/fecs_trace_gp10b.h" #include "gp10b/mc_gp10b.h" @@ -32,6 +33,7 @@ #include "gp106/fifo_gp106.h" #include "gp106/regops_gp106.h" +#include "gm20b/ltc_gm20b.h" #include "gm20b/gr_gm20b.h" #include "gm20b/fifo_gm20b.h" #include "gm20b/pmu_gm20b.h" @@ -42,7 +44,6 @@ #include "gp106/therm_gp106.h" #include "gp106/xve_gp106.h" #include "gp106/fifo_gp106.h" -#include "gp106/ltc_gp106.h" #include "gp106/clk_gp106.h" #include "gp106/mm_gp106.h" #include "gp106/pmu_gp106.h" @@ -58,7 +59,22 @@ #include -static struct gpu_ops gp106_ops = { +static const struct gpu_ops gp106_ops = { + .ltc = { + .determine_L2_size_bytes = gp10b_determine_L2_size_bytes, + .set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry, + .set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry, + .init_cbc = NULL, + .init_fs_state = gm20b_ltc_init_fs_state, + .init_comptags = gp10b_ltc_init_comptags, + .cbc_ctrl = gm20b_ltc_cbc_ctrl, + .isr = gp10b_ltc_isr, + .cbc_fix_config = NULL, + .flush = gm20b_flush_ltc, +#ifdef CONFIG_DEBUG_FS + .sync_debugfs = gp10b_ltc_sync_debugfs, +#endif + }, .clock_gating = { .slcg_bus_load_gating_prod = gp106_slcg_bus_load_gating_prod, @@ -229,6 +245,7 @@ int gp106_init_hal(struct gk20a *g) gk20a_dbg_fn(""); + gops->ltc = gp106_ops.ltc; gops->clock_gating = gp106_ops.clock_gating; gops->privsecurity = 1; @@ -239,7 +256,6 @@ int gp106_init_hal(struct gk20a *g) gp10b_init_priv_ring(gops); gp106_init_gr(gops); gp10b_init_fecs_trace_ops(gops); - gp106_init_ltc(gops); gp106_init_fb(gops); gp106_init_fifo(gops); gp10b_init_ce(gops); diff --git a/drivers/gpu/nvgpu/gp106/ltc_gp106.c b/drivers/gpu/nvgpu/gp106/ltc_gp106.c deleted file mode 100644 index 755e4b05..00000000 --- a/drivers/gpu/nvgpu/gp106/ltc_gp106.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 "gm20b/ltc_gm20b.h" -#include "gp10b/ltc_gp10b.h" -#include "gp106/ltc_gp106.h" - -void gp106_init_ltc(struct gpu_ops *gops) -{ - gp10b_init_ltc(gops); - - /* dGPU does not need the LTC hack */ - gops->ltc.cbc_fix_config = NULL; - gops->ltc.init_cbc = NULL; - gops->ltc.init_fs_state = gm20b_ltc_init_fs_state; -} diff --git a/drivers/gpu/nvgpu/gp106/ltc_gp106.h b/drivers/gpu/nvgpu/gp106/ltc_gp106.h deleted file mode 100644 index 4720d7a1..00000000 --- a/drivers/gpu/nvgpu/gp106/ltc_gp106.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 LTC_GP106_H -#define LTC_GP106_H -struct gpu_ops; - -void gp106_init_ltc(struct gpu_ops *gops); -#endif -- cgit v1.2.2