mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
Moved cbc related code and data from gr to cbc unit. Ltc and cbc related data is moved from gr header: 1. Ltc related data moved from gr_gk20a -> gk20a and it will be moved eventually to ltc unit: u32 slices_per_ltc; u32 cacheline_size; 2. cbc data moved from gr_gk20a -> nvgpu_cbc u32 compbit_backing_size; u32 comptags_per_cacheline; u32 gobs_per_comptagline_per_slice; u32 max_comptag_lines; struct gk20a_comptag_allocator comp_tags; struct compbit_store_desc compbit_store; 3. Following config data moved gr_gk20a -> gk20a u32 comptag_mem_deduct; u32 max_comptag_mem; These are part of initial config which should be available during nvgpu_probe. So it can't be moved to nvgpu_cbc. Modified code to use above updated data structures. Removed cbc init sequence from gr and added in common cbc unit. This sequence is getting called from common nvgpu init code. JIRA NVGPU-2896 JIRA NVGPU-2897 Change-Id: I1a1b1e73b75396d61de684f413ebc551a1202a57 Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2033286 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
78 lines
2.1 KiB
C
78 lines
2.1 KiB
C
/*
|
|
* CBC
|
|
*
|
|
* Copyright (c) 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"),
|
|
* 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 <nvgpu/gk20a.h>
|
|
#include <nvgpu/cbc.h>
|
|
#include <nvgpu/dma.h>
|
|
#include <nvgpu/log.h>
|
|
#include <nvgpu/nvgpu_mem.h>
|
|
#include <nvgpu/comptags.h>
|
|
|
|
void nvgpu_cbc_remove_support(struct gk20a *g)
|
|
{
|
|
struct nvgpu_cbc *cbc = g->cbc;
|
|
|
|
nvgpu_log_fn(g, " ");
|
|
|
|
if (cbc == NULL) {
|
|
return;
|
|
}
|
|
|
|
if (nvgpu_mem_is_valid(&cbc->compbit_store.mem)) {
|
|
nvgpu_dma_free(g, &cbc->compbit_store.mem);
|
|
(void) memset(&cbc->compbit_store, 0,
|
|
sizeof(struct compbit_store_desc));
|
|
}
|
|
gk20a_comptag_allocator_destroy(g, &cbc->comp_tags);
|
|
|
|
nvgpu_kfree(g, cbc);
|
|
g->cbc = NULL;
|
|
}
|
|
|
|
int nvgpu_cbc_init_support(struct gk20a *g)
|
|
{
|
|
int err = 0;
|
|
struct nvgpu_cbc *cbc = g->cbc;
|
|
|
|
nvgpu_log_fn(g, " ");
|
|
|
|
if (cbc == NULL) {
|
|
cbc = nvgpu_kzalloc(g, sizeof(*cbc));
|
|
if (cbc == NULL) {
|
|
return -ENOMEM;
|
|
}
|
|
g->cbc = cbc;
|
|
if (g->ops.cbc.alloc_comptags != NULL) {
|
|
err = g->ops.cbc.alloc_comptags(g, g->cbc);
|
|
}
|
|
}
|
|
|
|
if (g->ops.cbc.init != NULL) {
|
|
g->ops.cbc.init(g, g->cbc);
|
|
}
|
|
|
|
return err;
|
|
}
|