gpu: nvgpu: Fix vgpu build with compression disabled

When building VGPU with compression disabled, then build fails as
follows:

 error: ‘struct gk20a’ has no member named ‘max_comptag_mem’
   505 |  gk20a->max_comptag_mem = totalram_size_in_mb;                                                                                                                                                                                              |       ^~
 error: implicit declaration of function ‘gk20a_dma_buf_priv_list_clear’
  [-Werro r=implicit-function-declaration]                                                                                                                                                                                                       523 |  gk20a_dma_buf_priv_list_clear(l);                                                                                                                                                                                                          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix these build failures by guarding the applicable code with
CONFIG_NVGPU_COMPRESSION.

Bug 4014315

Change-Id: I8c7287ab57ef513ba11a3d85c2edfce243f07418
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2869169
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-03-10 12:08:22 +00:00
committed by mobile promotions
parent 4f96f59c15
commit f20a5b412c

View File

@@ -508,7 +508,9 @@ int vgpu_probe(struct platform_device *pdev)
#else
nvgpu_log_info(gk20a, "total ram pages : %lu", totalram_pages);
#endif
#ifdef CONFIG_NVGPU_COMPRESSION
gk20a->max_comptag_mem = totalram_size_in_mb;
#endif
nvgpu_mutex_init(&l->dmabuf_priv_list_lock);
nvgpu_init_list_node(&l->dmabuf_priv_list);
@@ -522,12 +524,16 @@ int vgpu_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct gk20a *g = get_gk20a(dev);
#ifdef CONFIG_NVGPU_COMPRESSION
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
#endif
nvgpu_log_fn(g, " ");
#ifdef CONFIG_NVGPU_COMPRESSION
gk20a_dma_buf_priv_list_clear(l);
nvgpu_mutex_destroy(&l->dmabuf_priv_list_lock);
#endif
#ifdef CONFIG_GK20A_PM_QOS
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)