diff --git a/arch/nvgpu-common.yaml b/arch/nvgpu-common.yaml index f493d5753..91d50eb03 100644 --- a/arch/nvgpu-common.yaml +++ b/arch/nvgpu-common.yaml @@ -483,6 +483,12 @@ gr: sources: [ common/gr/gr_ecc.c, include/nvgpu/gr/gr_ecc.h ] +fb: + safe: yes + owner: Vedashree V + sources: [ common/fb/fb.c, + include/nvgpu/fb.h ] + fbp: safe: yes owner: Deepak N diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 97e844089..26d9ba579 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -193,6 +193,7 @@ nvgpu-y += \ common/semaphore/semaphore.o \ common/regops/regops.o \ common/ltc/ltc.o \ + common/fb/fb.o \ common/fbp/fbp.o \ common/gr/gr_utils.o \ common/gr/gr.o \ diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index 07780ce45..c0f76645e 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -110,6 +110,7 @@ srcs += common/utils/enabled.c \ common/mm/dma.c \ common/therm/therm.c \ common/ltc/ltc.c \ + common/fb/fb.c \ common/fbp/fbp.c \ common/io/io.c \ common/ecc.c \ diff --git a/drivers/gpu/nvgpu/common/fb/fb.c b/drivers/gpu/nvgpu/common/fb/fb.c new file mode 100644 index 000000000..c8ac77fcc --- /dev/null +++ b/drivers/gpu/nvgpu/common/fb/fb.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020, 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 +#include +#include +#include + +int nvgpu_init_fb_support(struct gk20a *g) +{ + if (g->ops.mc.fb_reset != NULL) { + g->ops.mc.fb_reset(g); + } + + nvgpu_cg_slcg_fb_ltc_load_enable(g); + + nvgpu_cg_blcg_fb_ltc_load_enable(g); + + if (g->ops.fb.init_fs_state != NULL) { + g->ops.fb.init_fs_state(g); + } + return 0; +} diff --git a/drivers/gpu/nvgpu/common/init/nvgpu_init.c b/drivers/gpu/nvgpu/common/init/nvgpu_init.c index c85e59fe3..bcdea38b8 100644 --- a/drivers/gpu/nvgpu/common/init/nvgpu_init.c +++ b/drivers/gpu/nvgpu/common/init/nvgpu_init.c @@ -38,6 +38,7 @@ #include #include #include +#include #ifdef CONFIG_NVGPU_LS_PMU #include @@ -617,6 +618,7 @@ int nvgpu_finalize_poweron(struct gk20a *g) NVGPU_INIT_TABLE_ENTRY(&nvgpu_init_fb_mem_unlock, NO_FLAG), #endif NVGPU_INIT_TABLE_ENTRY(g->ops.fifo.reset_enable_hw, NO_FLAG), + NVGPU_INIT_TABLE_ENTRY(&nvgpu_init_fb_support, NO_FLAG), NVGPU_INIT_TABLE_ENTRY(g->ops.ltc.init_ltc_support, NO_FLAG), NVGPU_INIT_TABLE_ENTRY(g->ops.mm.init_mm_support, NO_FLAG), NVGPU_INIT_TABLE_ENTRY(g->ops.fifo.fifo_init_support, NO_FLAG), diff --git a/drivers/gpu/nvgpu/common/mm/mm.c b/drivers/gpu/nvgpu/common/mm/mm.c index bf4e14c48..818475833 100644 --- a/drivers/gpu/nvgpu/common/mm/mm.c +++ b/drivers/gpu/nvgpu/common/mm/mm.c @@ -321,21 +321,6 @@ void nvgpu_init_mm_ce_context(struct gk20a *g) } #endif -static void nvgpu_init_mm_reset_enable_hw(struct gk20a *g) -{ - if (g->ops.mc.fb_reset != NULL) { - g->ops.mc.fb_reset(g); - } - - nvgpu_cg_slcg_fb_ltc_load_enable(g); - - nvgpu_cg_blcg_fb_ltc_load_enable(g); - - if (g->ops.fb.init_fs_state != NULL) { - g->ops.fb.init_fs_state(g); - } -} - static int nvgpu_init_bar1_vm(struct mm_gk20a *mm) { int err; @@ -652,8 +637,6 @@ int nvgpu_init_mm_support(struct gk20a *g) { int err; - nvgpu_init_mm_reset_enable_hw(g); - #ifdef CONFIG_NVGPU_DGPU err = nvgpu_init_mm_pdb_cache_war(g); if (err != 0) { diff --git a/drivers/gpu/nvgpu/hal/fb/fb_gm20b.c b/drivers/gpu/nvgpu/hal/fb/fb_gm20b.c index fb8e32940..4d4fb7dd7 100644 --- a/drivers/gpu/nvgpu/hal/fb/fb_gm20b.c +++ b/drivers/gpu/nvgpu/hal/fb/fb_gm20b.c @@ -44,7 +44,7 @@ void fb_gm20b_init_fs_state(struct gk20a *g) nvgpu_log_info(g, "initialize gm20b fb"); gk20a_writel(g, fb_fbhub_num_active_ltcs_r(), - nvgpu_ltc_get_ltc_count(g)); + g->ops.priv_ring.enum_ltc(g)); if (!nvgpu_is_enabled(g, NVGPU_SEC_PRIVSECURITY)) { /* Bypass MMU check for non-secure boot. For diff --git a/drivers/gpu/nvgpu/include/nvgpu/fb.h b/drivers/gpu/nvgpu/include/nvgpu/fb.h new file mode 100644 index 000000000..860990400 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/fb.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020, 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_FB_H +#define NVGPU_FB_H + +/** + * @brief Initializes the FB unit. + * + * @param g [in] The GPU. + * + * - Request common/power_features/cg to load the prod values for + * slcg and blcg. + * - Initializes the fbhub mmu. + * + * @return 0 in case of success, < 0 in case of failure. + */ +int nvgpu_init_fb_support(struct gk20a *g); + +#endif /* NVGPU_FB_H */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/gops_mm.h b/drivers/gpu/nvgpu/include/nvgpu/gops_mm.h index 4c4df0a14..838efd127 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gops_mm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gops_mm.h @@ -58,9 +58,6 @@ struct gops_mm { * @param g [in] The GPU. * * MM init: - * - Request common.fb and common.ltc to load the prod values for - * slcg and blcg. - * - Initializes the fbhub mmu. * - MM S/W init: * - Resets the current pramin window index to 0. * - Initializes the vidmem page allocator with size, flags and etc. diff --git a/drivers/gpu/nvgpu/include/nvgpu/mm.h b/drivers/gpu/nvgpu/include/nvgpu/mm.h index 4fd91410a..e2197bfdf 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/mm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/mm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2020, 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"), @@ -520,9 +520,6 @@ void nvgpu_init_mm_ce_context(struct gk20a *g); * @param g [in] The GPU. * * MM init: - * - Request common.fb and common.ltc to load the prod values for - * slcg and blcg. - * - Initializes the fbhub mmu. * - MM S/W init: * - Resets the current pramin window index to 0. * - Initializes the vidmem page allocator with size, flags and etc. diff --git a/libs/igpu/libnvgpu-drv-igpu_safe.export b/libs/igpu/libnvgpu-drv-igpu_safe.export index 4574d3150..6ffd00ce9 100644 --- a/libs/igpu/libnvgpu-drv-igpu_safe.export +++ b/libs/igpu/libnvgpu-drv-igpu_safe.export @@ -522,6 +522,7 @@ nvgpu_gr_suspend nvgpu_gr_sw_ready nvgpu_has_syncpoints nvgpu_init_enabled_flags +nvgpu_init_fb_support nvgpu_init_hal nvgpu_init_ltc_support nvgpu_init_mm_support