From cf4337107328587dc7bf1853a9b86251004beac7 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Wed, 2 Mar 2022 15:41:53 -0800 Subject: [PATCH] nvgpu: vgpu: ga10b: enable compression - contiguous mempool has been added on server side. - init cbc support only on compression flag enabled - enable compression flag only on silicon Jira GVSCI-12883 Signed-off-by: Richard Zhao Change-Id: I339f25b81224b55124928231be65070660e27080 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2676951 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/common/vgpu/init/init_vgpu.c | 12 +++++++----- drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_ga10b.c | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nvgpu/common/vgpu/init/init_vgpu.c b/drivers/gpu/nvgpu/common/vgpu/init/init_vgpu.c index 6a4b4bd78..6ddf93c6d 100644 --- a/drivers/gpu/nvgpu/common/vgpu/init/init_vgpu.c +++ b/drivers/gpu/nvgpu/common/vgpu/init/init_vgpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2022, 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"), @@ -266,10 +266,12 @@ int vgpu_finalize_poweron_common(struct gk20a *g) } #ifdef CONFIG_NVGPU_COMPRESSION - err = nvgpu_cbc_init_support(g); - if (err != 0) { - nvgpu_err(g, "failed to init cbc"); - return err; + if (nvgpu_is_enabled(g, NVGPU_SUPPORT_COMPRESSION)) { + err = nvgpu_cbc_init_support(g); + if (err != 0) { + nvgpu_err(g, "failed to init cbc"); + return err; + } } #endif diff --git a/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_ga10b.c b/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_ga10b.c index e6339416e..0ca1533bc 100644 --- a/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_ga10b.c +++ b/drivers/gpu/nvgpu/hal/vgpu/init/vgpu_hal_ga10b.c @@ -130,6 +130,7 @@ #include #include #include +#include #include "common/vgpu/init/init_vgpu.h" #include "common/vgpu/fb/fb_vgpu.h" @@ -1213,8 +1214,19 @@ int vgpu_ga10b_init_hal(struct gk20a *g) priv->constants.max_sm_diversity_config_count; #ifdef CONFIG_NVGPU_COMPRESSION - nvgpu_set_enabled(g, NVGPU_SUPPORT_COMPRESSION, false); - nvgpu_set_enabled(g, NVGPU_SUPPORT_POST_L2_COMPRESSION, false); + if (nvgpu_platform_is_silicon(g)) { + nvgpu_set_enabled(g, NVGPU_SUPPORT_COMPRESSION, true); + } else { + nvgpu_set_enabled(g, NVGPU_SUPPORT_COMPRESSION, false); + } + + if (nvgpu_is_enabled(g, NVGPU_SUPPORT_COMPRESSION)) { + nvgpu_set_enabled(g, NVGPU_SUPPORT_POST_L2_COMPRESSION, true); + } else { + gops->cbc.init = NULL; + gops->cbc.ctrl = NULL; + gops->cbc.alloc_comptags = NULL; + } #endif #ifdef CONFIG_NVGPU_RECOVERY