diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 9c6c59f2e..a0cb5d90b 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -103,7 +103,6 @@ nvgpu-y := \ gk20a/gr_ctx_gk20a_sim.o \ gk20a/gr_ctx_gk20a.o \ gk20a/gk20a_gating_reglist.o \ - gk20a/ltc_gk20a.o \ gk20a/fb_gk20a.o \ gk20a/hal.o \ gk20a/tsg_gk20a.o \ diff --git a/drivers/gpu/nvgpu/common/ltc.c b/drivers/gpu/nvgpu/common/ltc.c index 4fbdbe2e6..006e2ed20 100644 --- a/drivers/gpu/nvgpu/common/ltc.c +++ b/drivers/gpu/nvgpu/common/ltc.c @@ -21,8 +21,10 @@ */ #include +#include #include "gk20a/gk20a.h" +#include "gk20a/gr_gk20a.h" int nvgpu_init_ltc_support(struct gk20a *g) { @@ -46,3 +48,17 @@ void nvgpu_ltc_sync_enabled(struct gk20a *g) } nvgpu_spinlock_release(&g->ltc_enabled_lock); } + +int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size) +{ + struct gr_gk20a *gr = &g->gr; + unsigned long flags = 0; + + if (!nvgpu_iommuable(g)) + flags = NVGPU_DMA_FORCE_CONTIGUOUS; + + return nvgpu_dma_alloc_flags_sys(g, + flags, + compbit_backing_size, + &gr->compbit_store.mem); +} diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c deleted file mode 100644 index a915cf0c8..000000000 --- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * GK20A L2 - * - * Copyright (c) 2011-2017, 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 "gk20a.h" -#include "gr_gk20a.h" - -int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size) -{ - struct gr_gk20a *gr = &g->gr; - - return nvgpu_dma_alloc_flags_sys(g, NVGPU_DMA_FORCE_CONTIGUOUS, - compbit_backing_size, - &gr->compbit_store.mem); -} - -int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size) -{ - struct gr_gk20a *gr = &g->gr; - - return nvgpu_dma_alloc_flags_sys(g, NVGPU_DMA_NO_KERNEL_MAPPING, - compbit_backing_size, - &gr->compbit_store.mem); -} diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h deleted file mode 100644 index 8153ef0bb..000000000 --- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * GK20A L2 - * - * Copyright (c) 2014-2017, 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 LTC_GK20A_H -#define LTC_GK20A_H -struct gk20a; - -int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size); -int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size); -#endif diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c index 847591927..6ec9aec53 100644 --- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c @@ -24,18 +24,18 @@ #include -#include "gk20a/gk20a.h" - #include #include #include +#include #include #include #include #include -#include "gk20a/ltc_gk20a.h" +#include "gk20a/gk20a.h" + #include "ltc_gm20b.h" int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) @@ -92,11 +92,7 @@ int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) gk20a_dbg_info("max comptag lines : %d", max_comptag_lines); - if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) - err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size); - else - err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size); - + err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size); if (err) return err; diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c index 9d878402c..92a899b87 100644 --- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c @@ -24,16 +24,16 @@ #include -#include "gk20a/gk20a.h" -#include "gm20b/ltc_gm20b.h" - +#include #include #include #include #include -#include "gk20a/ltc_gk20a.h" +#include "gk20a/gk20a.h" +#include "gm20b/ltc_gm20b.h" + #include "ltc_gp10b.h" int gp10b_determine_L2_size_bytes(struct gk20a *g) @@ -112,11 +112,7 @@ int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) gk20a_dbg_info("gobs_per_comptagline_per_slice: %d", gobs_per_comptagline_per_slice); - if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL)) - err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size); - else - err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size); - + err = nvgpu_ltc_alloc_cbc(g, compbit_backing_size); if (err) return err; diff --git a/drivers/gpu/nvgpu/include/nvgpu/ltc.h b/drivers/gpu/nvgpu/include/nvgpu/ltc.h index 223346a38..60aa5424d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/ltc.h +++ b/drivers/gpu/nvgpu/include/nvgpu/ltc.h @@ -19,12 +19,16 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + #ifndef __NVGPU_LTC_H__ #define __NVGPU_LTC_H__ +#include + struct gk20a; int nvgpu_init_ltc_support(struct gk20a *g); void nvgpu_ltc_sync_enabled(struct gk20a *g); +int nvgpu_ltc_alloc_cbc(struct gk20a *g, size_t compbit_backing_size); #endif