From fa3f8cc10186ab18952433f1838fb657f220adc5 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Wed, 11 Jan 2017 12:40:13 -0800 Subject: gpu: nvgpu: Remove circular dependency in PMU includes Remove including gk20a.h from pmu_gk20a.h. This causes a fallout as some #includes were missing. gr_gp10b.h uses mem_desc, but did not include mm_gk20a.h. Add the include. Including mm_gk20a.h in gr_gp10b.h causes recursive include, as mm_gk20a.h has some gr defines. Move the defines to gr_gk20a.h to remove the dependency. gr_ctx_gk20a.h used struct gk20a pointers, but did not forward declare it. Add a forward declaration. gr_gk20a.h uses dbg_session_gk20a, but was missing forward declaration. gr_gk20a.h did not include nvgpu.h but it uses preemption types from that header. Add include. Change-Id: I2168e2303b55e0d187b816bcb26f37c8af1649ba Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1283717 Reviewed-by: Alex Waterman Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu --- drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.h | 4 +++- drivers/gpu/nvgpu/gk20a/gr_gk20a.h | 29 +++++++++++++++++++++++++++++ drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 28 +--------------------------- drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 1 - drivers/gpu/nvgpu/gk20a/tsg_gk20a.h | 6 +++++- drivers/gpu/nvgpu/gp10b/gr_gp10b.h | 2 ++ 6 files changed, 40 insertions(+), 30 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.h index 2b384993..4b3f3ae6 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_ctx_gk20a.h @@ -1,7 +1,7 @@ /* * GK20A Graphics Context * - * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2017, 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, @@ -18,6 +18,8 @@ #ifndef __GR_CTX_GK20A_H__ #define __GR_CTX_GK20A_H__ +struct gr_gk20a; + /* production netlist, one and only one from below */ /*#undef GK20A_NETLIST_IMAGE_FW_NAME*/ #define GK20A_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_B diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h index e5d7e83b..f43e57fd 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h @@ -19,6 +19,7 @@ #define GR_GK20A_H #include +#include #ifdef CONFIG_ARCH_TEGRA_18x_SOC #include "gr_t18x.h" #endif @@ -29,6 +30,7 @@ #include "tsg_gk20a.h" #include "gr_ctx_gk20a.h" +#include "mm_gk20a.h" #define GR_IDLE_CHECK_DEFAULT 10 /* usec */ #define GR_IDLE_CHECK_MAX 200 /* usec */ @@ -42,6 +44,8 @@ #define GK20A_GR_MAX_PES_PER_GPC 3 +struct channel_gk20a; + enum /* global_ctx_buffer */ { CIRCULAR = 0, PAGEPOOL = 1, @@ -201,6 +205,12 @@ struct gr_gk20a_isr_data { u32 class_num; }; +struct gr_ctx_buffer_desc { + void (*destroy)(struct gk20a *, struct gr_ctx_buffer_desc *); + struct mem_desc mem; + void *priv; +}; + struct nvgpu_preemption_modes_rec { u32 graphics_preemption_mode_flags; /* supported preemption modes */ u32 compute_preemption_mode_flags; /* supported preemption modes */ @@ -376,6 +386,23 @@ struct gr_gk20a { void gk20a_fecs_dump_falcon_stats(struct gk20a *g); +struct gr_ctx_desc { + struct mem_desc mem; + + u32 graphics_preempt_mode; + u32 compute_preempt_mode; +#ifdef CONFIG_ARCH_TEGRA_18x_SOC + struct gr_ctx_desc_t18x t18x; +#endif +#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION + u64 virt_ctx; +#endif +}; + +struct ctx_header_desc { + struct mem_desc mem; +}; + struct gk20a_ctxsw_ucode_segment { u32 offset; u32 size; @@ -665,6 +692,8 @@ u32 gk20a_mask_hww_warp_esr(u32 hww_warp_esr); int gr_gk20a_wait_fe_idle(struct gk20a *g, unsigned long duration_ms, u32 expect_delay); +struct dbg_session_gk20a; + bool gr_gk20a_suspend_context(struct channel_gk20a *ch); bool gr_gk20a_resume_context(struct channel_gk20a *ch); int gr_gk20a_suspend_contexts(struct gk20a *g, diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 2b741451..5ef8ae25 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -1,7 +1,7 @@ /* * GK20A memory management * - * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2017, 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, @@ -112,32 +112,6 @@ struct pm_ctx_desc { }; struct gk20a; -struct gr_ctx_buffer_desc { - void (*destroy)(struct gk20a *, struct gr_ctx_buffer_desc *); - struct mem_desc mem; - void *priv; -}; - -#ifdef CONFIG_ARCH_TEGRA_18x_SOC -#include "gr_t18x.h" -#endif - -struct gr_ctx_desc { - struct mem_desc mem; - - u32 graphics_preempt_mode; - u32 compute_preempt_mode; -#ifdef CONFIG_ARCH_TEGRA_18x_SOC - struct gr_ctx_desc_t18x t18x; -#endif -#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION - u64 virt_ctx; -#endif -}; - -struct ctx_header_desc { - struct mem_desc mem; -}; struct compbit_store_desc { struct mem_desc mem; diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index 0a2d36fe..bd9d4f2b 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c @@ -26,7 +26,6 @@ #include -#include "gk20a.h" #include "gr_gk20a.h" #include "semaphore_gk20a.h" #include "nvgpu_common.h" diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h index 8509398c..a6642682 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, 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, @@ -18,6 +18,10 @@ #define NVGPU_INVALID_TSG_ID (-1) +struct channel_gk20a; +struct gpu_ops; +struct file; + bool gk20a_is_channel_marked_as_tsg(struct channel_gk20a *ch); diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h index 0a70903f..ffb15d91 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h @@ -18,6 +18,8 @@ #include +#include "gk20a/mm_gk20a.h" + struct gpu_ops; enum { -- cgit v1.2.2