From f20a5b412c212f812b5b632dc8420faedf3dfabe Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 10 Mar 2023 12:08:22 +0000 Subject: [PATCH] gpu: nvgpu: Fix vgpu build with compression disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2869169 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c index 083332b0f..31bb9c163 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_linux.c @@ -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)