From 0aa1ef7c0cf71000c6e437cfa1fd81a451044b47 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 27 Feb 2019 16:09:53 +0530 Subject: [PATCH] gpu: nvgpu: move gv11b fecs_trace HAL to gr/fecs trace unit Rename gv11b/fecs_trace_gv11b.* files to common/gr/fecs_trace/fecs_trace_gv11b.* Also move HAL API gk20a_fecs_trace_get_buffer_full_mailbox_val() to gr/fecs_trace unit and rename it as gm20b_fecs_trace_get_buffer_full_mailbox_val() Protect gm20b/gv11b HAL code under CONFIG_GK20A_CTXSW_TRACE Remove tu104/fecs_trace_tu104.* since tu104 will re-use gv11b HAL Fix g->ops.fecs_trace.get_buffer_full_mailbox_val() for vgpu/gv11b and use gv11b HAL Jira NVGPU-1880 Change-Id: If78480e36be4e5f0fd659019518f233d8805486d Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/2029259 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Makefile | 5 +--- drivers/gpu/nvgpu/Makefile.sources | 3 +- .../common/gr/fecs_trace/fecs_trace_gm20b.c | 9 ++++++ .../common/gr/fecs_trace/fecs_trace_gm20b.h | 3 +- .../gr/fecs_trace}/fecs_trace_gv11b.c | 4 +++ .../gr/fecs_trace}/fecs_trace_gv11b.h | 0 .../nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c | 5 ++-- .../nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c | 5 ++-- drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 4 --- drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h | 1 - drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 2 +- drivers/gpu/nvgpu/gv100/hal_gv100.c | 2 +- drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 2 +- drivers/gpu/nvgpu/tu104/fecs_trace_tu104.c | 28 ----------------- drivers/gpu/nvgpu/tu104/fecs_trace_tu104.h | 30 ------------------- drivers/gpu/nvgpu/tu104/hal_tu104.c | 4 +-- 16 files changed, 26 insertions(+), 81 deletions(-) rename drivers/gpu/nvgpu/{gv11b => common/gr/fecs_trace}/fecs_trace_gv11b.c (94%) rename drivers/gpu/nvgpu/{gv11b => common/gr/fecs_trace}/fecs_trace_gv11b.h (100%) delete mode 100644 drivers/gpu/nvgpu/tu104/fecs_trace_tu104.c delete mode 100644 drivers/gpu/nvgpu/tu104/fecs_trace_tu104.h diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 69855dd7a..02707bd8e 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -90,6 +90,7 @@ nvgpu-y += \ common/gr/config/gr_config_gm20b.o \ common/gr/fecs_trace/fecs_trace.o \ common/gr/fecs_trace/fecs_trace_gm20b.o \ + common/gr/fecs_trace/fecs_trace_gv11b.o \ common/gr/zbc/gr_zbc.o \ common/gr/zbc/gr_zbc_gm20b.o \ common/gr/zbc/gr_zbc_gp10b.o \ @@ -388,10 +389,6 @@ nvgpu-y += \ gm20b/fifo_gm20b.o \ gm20b/mm_gm20b.o -nvgpu-$(CONFIG_GK20A_CTXSW_TRACE) += \ - gv11b/fecs_trace_gv11b.o \ - tu104/fecs_trace_tu104.o \ - nvgpu-$(CONFIG_GK20A_VIDMEM) += \ common/mm/vidmem.o diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index 902b00c6d..7a4298124 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -130,6 +130,7 @@ srcs += common/sim.c \ common/gr/config/gr_config_gm20b.c \ common/gr/fecs_trace/fecs_trace.c \ common/gr/fecs_trace/fecs_trace_gm20b.c \ + common/gr/fecs_trace/fecs_trace_gv11b.c \ common/gr/zbc/gr_zbc.c \ common/gr/zbc/gr_zbc_gm20b.c \ common/gr/zbc/gr_zbc_gp10b.c \ @@ -278,7 +279,6 @@ srcs += common/sim.c \ gv11b/mm_gv11b.c \ gv11b/ce_gv11b.c \ gv11b/subctx_gv11b.c \ - gv11b/fecs_trace_gv11b.c \ gv11b/ecc_gv11b.c \ gp106/gr_gp106.c \ gp106/sec2_gp106.c \ @@ -309,7 +309,6 @@ srcs += common/sim.c \ tu104/hal_tu104.c \ tu104/sec2_tu104.c \ tu104/func_tu104.c \ - tu104/fecs_trace_tu104.c \ common/vgpu/vgpu.c \ common/vgpu/fifo/fifo_vgpu.c \ common/vgpu/fifo/runlist_vgpu.c \ diff --git a/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.c b/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.c index 588db56cd..5482a6c36 100644 --- a/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.c +++ b/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.c @@ -34,6 +34,8 @@ #include +#ifdef CONFIG_GK20A_CTXSW_TRACE + int gm20b_fecs_trace_get_read_index(struct gk20a *g) { return gr_gk20a_elpg_protected_call(g, @@ -52,3 +54,10 @@ int gm20b_fecs_trace_set_read_index(struct gk20a *g, int index) return gr_gk20a_elpg_protected_call(g, (nvgpu_writel(g, gr_fecs_mailbox1_r(), index), 0)); } + +u32 gm20b_fecs_trace_get_buffer_full_mailbox_val(void) +{ + return 0x26; +} + +#endif /* CONFIG_GK20A_CTXSW_TRACE */ diff --git a/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.h b/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.h index 6b4e8387c..b6a1df83b 100644 --- a/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.h +++ b/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gm20b.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -30,5 +30,6 @@ struct gk20a; int gm20b_fecs_trace_get_read_index(struct gk20a *g); int gm20b_fecs_trace_get_write_index(struct gk20a *g); int gm20b_fecs_trace_set_read_index(struct gk20a *g, int index); +u32 gm20b_fecs_trace_get_buffer_full_mailbox_val(void); #endif /* NVGPU_GR_FECS_TRACE_GM20B_H */ diff --git a/drivers/gpu/nvgpu/gv11b/fecs_trace_gv11b.c b/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gv11b.c similarity index 94% rename from drivers/gpu/nvgpu/gv11b/fecs_trace_gv11b.c rename to drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gv11b.c index 908725820..d858060c2 100644 --- a/drivers/gpu/nvgpu/gv11b/fecs_trace_gv11b.c +++ b/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gv11b.c @@ -22,7 +22,11 @@ #include "fecs_trace_gv11b.h" +#ifdef CONFIG_GK20A_CTXSW_TRACE + u32 gv11b_fecs_trace_get_buffer_full_mailbox_val(void) { return 0x32; } + +#endif /* CONFIG_GK20A_CTXSW_TRACE */ diff --git a/drivers/gpu/nvgpu/gv11b/fecs_trace_gv11b.h b/drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gv11b.h similarity index 100% rename from drivers/gpu/nvgpu/gv11b/fecs_trace_gv11b.h rename to drivers/gpu/nvgpu/common/gr/fecs_trace/fecs_trace_gv11b.h diff --git a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c index 1a2149035..415ac91e7 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c @@ -30,6 +30,7 @@ #include "common/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "common/gr/ctxsw_prog/ctxsw_prog_gp10b.h" #include "common/gr/config/gr_config_gm20b.h" +#include "common/gr/fecs_trace/fecs_trace_gm20b.h" #include "common/therm/therm_gm20b.h" #include "common/therm/therm_gp10b.h" #include "common/ltc/ltc_gm20b.h" @@ -69,8 +70,6 @@ #include "gm20b/fifo_gm20b.h" #include "gm20b/mm_gm20b.h" -#include "gk20a/fecs_trace_gk20a.h" - #include #include #include @@ -481,7 +480,7 @@ static const struct gpu_ops vgpu_gp10b_ops = { .max_entries = vgpu_fecs_trace_max_entries, .set_filter = vgpu_fecs_trace_set_filter, .get_buffer_full_mailbox_val = - gk20a_fecs_trace_get_buffer_full_mailbox_val, + gm20b_fecs_trace_get_buffer_full_mailbox_val, }, #endif /* CONFIG_GK20A_CTXSW_TRACE */ .mm = { diff --git a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c index f0fb1d7f9..4447c4393 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c @@ -31,6 +31,7 @@ #include "common/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "common/gr/ctxsw_prog/ctxsw_prog_gp10b.h" #include "common/gr/ctxsw_prog/ctxsw_prog_gv11b.h" +#include "common/gr/fecs_trace/fecs_trace_gv11b.h" #include "common/therm/therm_gm20b.h" #include "common/therm/therm_gp10b.h" #include "common/therm/therm_gv11b.h" @@ -84,8 +85,6 @@ #include -#include "gk20a/fecs_trace_gk20a.h" - #include #include #include @@ -554,7 +553,7 @@ static const struct gpu_ops vgpu_gv11b_ops = { .max_entries = vgpu_fecs_trace_max_entries, .set_filter = vgpu_fecs_trace_set_filter, .get_buffer_full_mailbox_val = - gk20a_fecs_trace_get_buffer_full_mailbox_val, + gv11b_fecs_trace_get_buffer_full_mailbox_val, }, #endif /* CONFIG_GK20A_CTXSW_TRACE */ .mm = { diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index d20b1a126..43c7daf6e 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c @@ -143,8 +143,4 @@ int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch) return 0; } -u32 gk20a_fecs_trace_get_buffer_full_mailbox_val(void) -{ - return 0x26; -} #endif /* CONFIG_GK20A_CTXSW_TRACE */ diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h index 9978700f0..579ca0f89 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.h @@ -32,6 +32,5 @@ int gk20a_fecs_trace_bind_channel(struct gk20a *g, struct channel_gk20a *ch, u32 vmid, struct nvgpu_gr_ctx *gr_ctx); int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch); -u32 gk20a_fecs_trace_get_buffer_full_mailbox_val(void); #endif /* NVGPU_GK20A_FECS_TRACE_GK20A_H */ diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index afdb7377a..3a5925059 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -679,7 +679,7 @@ static const struct gpu_ops gp10b_ops = { .unbind_channel = gk20a_fecs_trace_unbind_channel, .max_entries = nvgpu_gr_fecs_trace_max_entries, .get_buffer_full_mailbox_val = - gk20a_fecs_trace_get_buffer_full_mailbox_val, + gm20b_fecs_trace_get_buffer_full_mailbox_val, .get_read_index = gm20b_fecs_trace_get_read_index, .get_write_index = gm20b_fecs_trace_get_write_index, .set_read_index = gm20b_fecs_trace_set_read_index, diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c index 81f3fd57b..ddd145942 100644 --- a/drivers/gpu/nvgpu/gv100/hal_gv100.c +++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c @@ -846,7 +846,7 @@ static const struct gpu_ops gv100_ops = { .unbind_channel = gk20a_fecs_trace_unbind_channel, .max_entries = nvgpu_gr_fecs_trace_max_entries, .get_buffer_full_mailbox_val = - gk20a_fecs_trace_get_buffer_full_mailbox_val, + gm20b_fecs_trace_get_buffer_full_mailbox_val, .get_read_index = gm20b_fecs_trace_get_read_index, .get_write_index = gm20b_fecs_trace_get_write_index, .set_read_index = gm20b_fecs_trace_set_read_index, diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c index 3f95f6db8..74f50635e 100644 --- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c @@ -44,6 +44,7 @@ #include "common/gr/zbc/gr_zbc_gp10b.h" #include "common/gr/zbc/gr_zbc_gv11b.h" #include "common/gr/fecs_trace/fecs_trace_gm20b.h" +#include "common/gr/fecs_trace/fecs_trace_gv11b.h" #include "common/therm/therm_gm20b.h" #include "common/therm/therm_gp10b.h" #include "common/therm/therm_gv11b.h" @@ -102,7 +103,6 @@ #include "fifo_gv11b.h" #include "subctx_gv11b.h" #include "ecc_gv11b.h" -#include "fecs_trace_gv11b.h" #include #include diff --git a/drivers/gpu/nvgpu/tu104/fecs_trace_tu104.c b/drivers/gpu/nvgpu/tu104/fecs_trace_tu104.c deleted file mode 100644 index d98f87ebe..000000000 --- a/drivers/gpu/nvgpu/tu104/fecs_trace_tu104.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "fecs_trace_tu104.h" - -u32 tu104_fecs_trace_get_buffer_full_mailbox_val(void) -{ - return 0x32; -} diff --git a/drivers/gpu/nvgpu/tu104/fecs_trace_tu104.h b/drivers/gpu/nvgpu/tu104/fecs_trace_tu104.h deleted file mode 100644 index 7c586a4dd..000000000 --- a/drivers/gpu/nvgpu/tu104/fecs_trace_tu104.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef NVGPU_FECS_TRACE_TU104_H -#define NVGPU_FECS_TRACE_TU104_H - -#include - -u32 tu104_fecs_trace_get_buffer_full_mailbox_val(void); - -#endif /* NVGPU_FECS_TRACE_TU104_H */ diff --git a/drivers/gpu/nvgpu/tu104/hal_tu104.c b/drivers/gpu/nvgpu/tu104/hal_tu104.c index 1064c4970..7b20e9cfe 100644 --- a/drivers/gpu/nvgpu/tu104/hal_tu104.c +++ b/drivers/gpu/nvgpu/tu104/hal_tu104.c @@ -46,6 +46,7 @@ #include "common/gr/zbc/gr_zbc_gp10b.h" #include "common/gr/zbc/gr_zbc_gv11b.h" #include "common/gr/fecs_trace/fecs_trace_gm20b.h" +#include "common/gr/fecs_trace/fecs_trace_gv11b.h" #include "common/therm/therm_gm20b.h" #include "common/therm/therm_gp10b.h" #include "common/therm/therm_gp106.h" @@ -137,7 +138,6 @@ #include "tu104/sec2_tu104.h" #include "tu104/ecc_tu104.h" #include "tu104/hal_tu104.h" -#include "tu104/fecs_trace_tu104.h" #include #include @@ -875,7 +875,7 @@ static const struct gpu_ops tu104_ops = { .unbind_channel = gk20a_fecs_trace_unbind_channel, .max_entries = nvgpu_gr_fecs_trace_max_entries, .get_buffer_full_mailbox_val = - tu104_fecs_trace_get_buffer_full_mailbox_val, + gv11b_fecs_trace_get_buffer_full_mailbox_val, .get_read_index = gm20b_fecs_trace_get_read_index, .get_write_index = gm20b_fecs_trace_get_write_index, .set_read_index = gm20b_fecs_trace_set_read_index,