gpu: nvgpu: update the config options & makefile

Added dependency between the Kconfig options as follows where
'->' indicates 'depends on' relation:

SUPPORT_CDE -> COMPRESSION -> DMABUF_HAS_DRVDATA
DGPU -> GK20A_PCI

Defined Kconfig option for VPR and for DGPU that is dependent GK20A_PCI
as well. DGPU related sources are now compiled under config flag DGPU.
Also update conditional compilation of the driver paths w.r.t DGPU,
VPR and COMPRESSION flags.

Bug 2834141

Change-Id: Ia0a39d6d4cf8b36e7f955b7355a5ab41783f821c
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2299627
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2020-02-14 23:21:04 +05:30
committed by Alex Waterman
parent ef69bbc92b
commit 630eaa46cb
12 changed files with 196 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2019 NVIDIA Corporation. All rights reserved.
* Copyright (C) 2017-2020 NVIDIA Corporation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -430,10 +430,12 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
nvgpu_kmem_debugfs_init(g);
#endif
nvgpu_ltc_debugfs_init(g);
#ifdef CONFIG_NVGPU_DGPU
if (g->pci_vendor_id) {
nvgpu_xve_debugfs_init(g);
nvgpu_bios_debugfs_init(g);
}
#endif
}
void gk20a_debug_deinit(struct gk20a *g)

View File

@@ -34,6 +34,7 @@
enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g,
struct dma_buf *dmabuf)
{
#ifdef CONFIG_NVGPU_DGPU
struct gk20a *buf_owner = nvgpu_vidmem_buf_owner(dmabuf);
bool unified_memory = nvgpu_is_enabled(g, NVGPU_MM_UNIFIED_MEMORY);
@@ -49,12 +50,12 @@ enum nvgpu_aperture gk20a_dmabuf_aperture(struct gk20a *g,
} else if (buf_owner != g) {
/* Someone else's vidmem */
return APERTURE_INVALID;
}
#ifdef CONFIG_NVGPU_DGPU
else {
} else {
/* Yay, buf_owner == g */
return APERTURE_VIDMEM;
}
#else
return APERTURE_SYSMEM;
#endif
}

View File

@@ -322,7 +322,13 @@ gk20a_ctrl_ioctl_gpu_characteristics(
gpu.bus_type = NVGPU_GPU_BUS_TYPE_AXI; /* always AXI for now */
#ifdef CONFIG_NVGPU_COMPRESSION
gpu.compression_page_size = g->ops.fb.compression_page_size(g);
gpu.gr_compbit_store_base_hw = g->cbc->compbit_store.base_hw;
gpu.gr_gobs_per_comptagline_per_slice =
g->cbc->gobs_per_comptagline_per_slice;
gpu.cbc_comptags_per_line = g->cbc->comptags_per_cacheline;
#endif
gpu.flags = nvgpu_ctrl_ioctl_gpu_characteristics_flags(g);
@@ -377,20 +383,18 @@ gk20a_ctrl_ioctl_gpu_characteristics(
gpu.fbp_en_mask = nvgpu_fbp_get_fbp_en_mask(g->fbp);;
gpu.max_ltc_per_fbp = g->ops.top.get_max_ltc_per_fbp(g);
gpu.max_lts_per_ltc = g->ops.top.get_max_lts_per_ltc(g);
gpu.gr_compbit_store_base_hw = g->cbc->compbit_store.base_hw;
gpu.gr_gobs_per_comptagline_per_slice =
g->cbc->gobs_per_comptagline_per_slice;
gpu.num_ltc = nvgpu_ltc_get_ltc_count(g);
gpu.lts_per_ltc = nvgpu_ltc_get_slices_per_ltc(g);
gpu.cbc_cache_line_size = nvgpu_ltc_get_cacheline_size(g);
gpu.cbc_comptags_per_line = g->cbc->comptags_per_cacheline;
if ((g->ops.clk.get_maxrate) && nvgpu_platform_is_silicon(g)) {
gpu.max_freq = g->ops.clk.get_maxrate(g,
CTRL_CLK_DOMAIN_GPCCLK);
}
#ifdef CONFIG_NVGPU_DGPU
gpu.local_video_memory_size = g->mm.vidmem.size;
#endif
gpu.pci_vendor_id = g->pci_vendor_id;
gpu.pci_device_id = g->pci_device_id;
@@ -995,6 +999,7 @@ clean_up:
return err;
}
#ifdef CONFIG_NVGPU_DGPU
static int nvgpu_gpu_alloc_vidmem(struct gk20a *g,
struct nvgpu_gpu_alloc_vidmem_args *args)
{
@@ -1059,6 +1064,7 @@ static int nvgpu_gpu_get_memory_state(struct gk20a *g,
return err;
}
#endif
static u32 nvgpu_gpu_convert_clk_domain(u32 clk_domain)
{
@@ -1936,6 +1942,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
(struct nvgpu_gpu_get_engine_info_args *)buf);
break;
#ifdef CONFIG_NVGPU_DGPU
case NVGPU_GPU_IOCTL_ALLOC_VIDMEM:
err = nvgpu_gpu_alloc_vidmem(g,
(struct nvgpu_gpu_alloc_vidmem_args *)buf);
@@ -1945,6 +1952,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
err = nvgpu_gpu_get_memory_state(g,
(struct nvgpu_gpu_get_memory_state_args *)buf);
break;
#endif
case NVGPU_GPU_IOCTL_CLK_GET_RANGE:
err = nvgpu_gpu_clk_get_range(g, priv,

View File

@@ -1,7 +1,7 @@
/*
* Tegra GK20A GPU Debugger/Profiler Driver
*
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2020, 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,
@@ -1565,6 +1565,7 @@ nvgpu_dbg_gpu_ioctl_suspend_resume_contexts(struct dbg_session_gk20a *dbg_s,
return err;
}
#ifdef CONFIG_NVGPU_DGPU
static int nvgpu_dbg_gpu_ioctl_access_fb_memory(struct dbg_session_gk20a *dbg_s,
struct nvgpu_dbg_gpu_access_fb_memory_args *args)
{
@@ -1643,6 +1644,7 @@ fail_dmabuf_put:
return err;
}
#endif
static int nvgpu_ioctl_profiler_reserve(struct dbg_session_gk20a *dbg_s,
struct nvgpu_dbg_gpu_profiler_reserve_args *args)
@@ -2123,10 +2125,12 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd,
(struct nvgpu_dbg_gpu_suspend_resume_contexts_args *)buf);
break;
#ifdef CONFIG_NVGPU_DGPU
case NVGPU_DBG_GPU_IOCTL_ACCESS_FB_MEMORY:
err = nvgpu_dbg_gpu_ioctl_access_fb_memory(dbg_s,
(struct nvgpu_dbg_gpu_access_fb_memory_args *)buf);
break;
#endif
case NVGPU_DBG_GPU_IOCTL_PROFILER_ALLOCATE:
err = nvgpu_ioctl_allocate_profiler_object(dbg_s_linux,

View File

@@ -25,6 +25,7 @@
#include <nvgpu/vidmem.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/string.h>
#include <nvgpu/nvgpu_sgt.h>
#include <nvgpu/nvgpu_sgt_os.h>
#include <nvgpu/linux/dma.h>
@@ -106,6 +107,7 @@ static u64 nvgpu_mem_get_addr_sysmem(struct gk20a *g, struct nvgpu_mem *mem)
*/
u64 nvgpu_mem_get_addr(struct gk20a *g, struct nvgpu_mem *mem)
{
#ifdef CONFIG_NVGPU_DGPU
struct nvgpu_page_alloc *alloc;
if (mem->aperture == APERTURE_SYSMEM)
@@ -120,6 +122,12 @@ u64 nvgpu_mem_get_addr(struct gk20a *g, struct nvgpu_mem *mem)
WARN_ON(alloc->nr_chunks != 1);
return alloc->base;
#else
if (mem->aperture == APERTURE_SYSMEM)
return nvgpu_mem_get_addr_sysmem(g, mem);
return 0;
#endif
}
/*
@@ -274,6 +282,7 @@ static const struct nvgpu_sgt_ops nvgpu_linux_sgt_ops = {
.sgt_free = nvgpu_mem_linux_sgl_free,
};
#ifdef CONFIG_NVGPU_DGPU
static struct nvgpu_sgt *__nvgpu_mem_get_sgl_from_vidmem(
struct gk20a *g,
struct scatterlist *linux_sgl)
@@ -286,14 +295,17 @@ static struct nvgpu_sgt *__nvgpu_mem_get_sgl_from_vidmem(
return &vidmem_alloc->sgt;
}
#endif
struct nvgpu_sgt *nvgpu_linux_sgt_create(struct gk20a *g, struct sg_table *sgt)
{
struct nvgpu_sgt *nvgpu_sgt;
struct scatterlist *linux_sgl = sgt->sgl;
#ifdef CONFIG_NVGPU_DGPU
if (nvgpu_addr_is_vidmem_page_alloc(sg_dma_address(linux_sgl)))
return __nvgpu_mem_get_sgl_from_vidmem(g, linux_sgl);
#endif
nvgpu_sgt = nvgpu_kzalloc(g, sizeof(*nvgpu_sgt));
if (!nvgpu_sgt)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2020, 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,
@@ -35,15 +35,17 @@ int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l)
case NVGPU_GPUID_GP10B:
nvgpu_gp10b_init_os_ops(l);
break;
case NVGPU_GPUID_GV100:
nvgpu_gv100_init_os_ops(l);
break;
case NVGPU_GPUID_GV11B:
nvgpu_gv11b_init_os_ops(l);
break;
#ifdef CONFIG_NVGPU_DGPU
case NVGPU_GPUID_GV100:
nvgpu_gv100_init_os_ops(l);
break;
case NVGPU_GPUID_TU104:
nvgpu_tu104_init_os_ops(l);
break;
#endif
default:
break;
}

View File

@@ -23,6 +23,7 @@
#include <nvgpu/rbtree.h>
#include <nvgpu/vm_area.h>
#include <nvgpu/nvgpu_mem.h>
#include <nvgpu/nvgpu_sgt.h>
#include <nvgpu/page_allocator.h>
#include <nvgpu/vidmem.h>
#include <nvgpu/utils.h>