From 907fcae63816b68e43e07e3d7abaad87954b8326 Mon Sep 17 00:00:00 2001 From: Sunny He Date: Wed, 5 Jul 2017 19:05:06 -0700 Subject: gpu: nvgpu: Reorg bus HAL initialization Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the bus 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: If03303c34d91480d41fc29e66069efd43e970d75 Signed-off-by: Sunny He Reviewed-on: https://git-master.nvidia.com/r/1514660 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Vijayakumar Subbu --- drivers/gpu/nvgpu/gm20b/bus_gm20b.c | 11 +---------- drivers/gpu/nvgpu/gm20b/bus_gm20b.h | 5 +++-- drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 12 +++++++++++- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b') diff --git a/drivers/gpu/nvgpu/gm20b/bus_gm20b.c b/drivers/gpu/nvgpu/gm20b/bus_gm20b.c index 11c11e23..0da19db8 100644 --- a/drivers/gpu/nvgpu/gm20b/bus_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/bus_gm20b.c @@ -22,7 +22,7 @@ #include -static int gm20b_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst) +int gm20b_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst) { struct nvgpu_timeout timeout; int err = 0; @@ -53,12 +53,3 @@ static int gm20b_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst) return err; } - -void gm20b_init_bus(struct gpu_ops *gops) -{ - gops->bus.init_hw = gk20a_bus_init_hw; - gops->bus.isr = gk20a_bus_isr; - gops->bus.read_ptimer = gk20a_read_ptimer; - gops->bus.get_timestamps_zipper = nvgpu_get_timestamps_zipper; - gops->bus.bar1_bind = gm20b_bus_bar1_bind; -} diff --git a/drivers/gpu/nvgpu/gm20b/bus_gm20b.h b/drivers/gpu/nvgpu/gm20b/bus_gm20b.h index 853e50a6..ad3f72ac 100644 --- a/drivers/gpu/nvgpu/gm20b/bus_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/bus_gm20b.h @@ -16,8 +16,9 @@ #ifndef _NVGPU_GM20B_BUS #define _NVGPU_GM20B_BUS -struct gpu_ops; +struct gk20a; +struct nvgpu_mem; -void gm20b_init_bus(struct gpu_ops *gops); +int gm20b_bus_bar1_bind(struct gk20a *g, struct nvgpu_mem *bar1_inst); #endif diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 300f0872..fa7cf368 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c @@ -36,11 +36,13 @@ #include "regops_gm20b.h" #include "cde_gm20b.h" #include "therm_gm20b.h" +#include "bus_gm20b.h" #include "hal_gm20b.h" #include #include #include +#include #include #include @@ -234,6 +236,13 @@ static const struct gpu_ops gm20b_ops = { .cde = { .get_program_numbers = gm20b_cde_get_program_numbers, }, + .bus = { + .init_hw = gk20a_bus_init_hw, + .isr = gk20a_bus_isr, + .read_ptimer = gk20a_read_ptimer, + .get_timestamps_zipper = nvgpu_get_timestamps_zipper, + .bar1_bind = gm20b_bus_bar1_bind, + }, #if defined(CONFIG_GK20A_CYCLE_STATS) .css = { .enable_snapshot = css_hw_enable_snapshot, @@ -263,6 +272,7 @@ int gm20b_init_hal(struct gk20a *g) gops->dbg_session_ops = gm20b_ops.dbg_session_ops; gops->debug = gm20b_ops.debug; gops->cde = gm20b_ops.cde; + gops->bus = gm20b_ops.bus; #if defined(CONFIG_GK20A_CYCLE_STATS) gops->css = gm20b_ops.css; #endif @@ -302,8 +312,8 @@ int gm20b_init_hal(struct gk20a *g) } } #endif + g->bootstrap_owner = LSF_BOOTSTRAP_OWNER_DEFAULT; - gk20a_init_bus(gops); gk20a_init_priv_ring(gops); gm20b_init_gr(gops); gm20b_init_fb(gops); -- cgit v1.2.2