gpu: nvgpu: Disable compression for k6.1+

dmabuf internals that nvgpu relies upon for storing meta-data for
compressible buffers changed in k6.1. For now, disable compression
on all k6.1+ kernels.

Additionally, fix numerous compilation issues due to the bit rotted
compression config. All normal Tegra products support compression
and thus have this config enabled. Over the last several years
compression dependent code crept in that wasn't protected under the
compression config.

Bug 3844023

Change-Id: Ie5b9b5a2bcf1a763806c087af99203d62d0cb6e0
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2820846
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
Tested-by: Sagar Kamble <skamble@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Alex Waterman
2022-12-02 21:06:51 +00:00
committed by mobile promotions
parent b754a2f0cf
commit 03533066aa
12 changed files with 81 additions and 21 deletions

View File

@@ -2010,12 +2010,15 @@ out:
static int nvgpu_gpu_ioctl_get_buffer_info(struct gk20a *g,
struct nvgpu_gpu_get_buffer_info_args *args)
{
int err = -EINVAL;
#ifdef CONFIG_NVGPU_COMPRESSION
u64 user_metadata_addr = args->in.metadata_addr;
u32 in_metadata_size = args->in.metadata_size;
struct gk20a_dmabuf_priv *priv = NULL;
s32 dmabuf_fd = args->in.dmabuf_fd;
struct dma_buf *dmabuf;
int err = 0;
err = 0;
nvgpu_log_fn(g, " ");
@@ -2070,13 +2073,11 @@ static int nvgpu_gpu_ioctl_get_buffer_info(struct gk20a *g,
NVGPU_GPU_BUFFER_INFO_FLAGS_METADATA_REGISTERED;
}
#ifdef CONFIG_NVGPU_COMPRESSION
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_COMPRESSION) &&
priv->comptags.enabled) {
args->out.flags |=
NVGPU_GPU_BUFFER_INFO_FLAGS_COMPTAGS_ALLOCATED;
}
#endif
if (priv->mutable_metadata) {
args->out.flags |=
@@ -2090,6 +2091,7 @@ out_priv_unlock:
nvgpu_mutex_release(&priv->lock);
out:
dma_buf_put(dmabuf);
#endif
return err;
}
@@ -2166,12 +2168,13 @@ static int nvgpu_handle_comptags_control(struct gk20a *g,
static int nvgpu_gpu_ioctl_register_buffer(struct gk20a *g,
struct nvgpu_gpu_register_buffer_args *args)
{
int err = 0;
#ifdef CONFIG_NVGPU_COMPRESSION
struct gk20a_dmabuf_priv *priv = NULL;
bool mutable_metadata = false;
bool modify_metadata = false;
struct dma_buf *dmabuf;
u8 *blob_copy = NULL;
int err = 0;
nvgpu_log_fn(g, " ");
@@ -2246,7 +2249,6 @@ static int nvgpu_gpu_ioctl_register_buffer(struct gk20a *g,
goto out_priv_unlock;
}
#ifdef CONFIG_NVGPU_COMPRESSION
/* Comptags allocation */
err = nvgpu_handle_comptags_control(g, dmabuf, priv,
args->comptags_alloc_control);
@@ -2254,7 +2256,6 @@ static int nvgpu_gpu_ioctl_register_buffer(struct gk20a *g,
nvgpu_err(g, "Comptags alloc control failed %d", err);
goto out_priv_unlock;
}
#endif
/* All done, update metadata blob */
nvgpu_kfree(g, priv->metadata_blob);
@@ -2270,13 +2271,11 @@ static int nvgpu_gpu_ioctl_register_buffer(struct gk20a *g,
/* Output variables */
args->flags = 0;
#ifdef CONFIG_NVGPU_COMPRESSION
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_COMPRESSION) &&
priv->comptags.enabled) {
args->flags |=
NVGPU_GPU_REGISTER_BUFFER_FLAGS_COMPTAGS_ALLOCATED;
}
#endif
nvgpu_log_info(g, "buffer registered: mutable: %s, metadata size: %u, flags: 0x%8x",
priv->mutable_metadata ? "yes" : "no", priv->metadata_blob_size,
@@ -2287,7 +2286,7 @@ out_priv_unlock:
out:
dma_buf_put(dmabuf);
nvgpu_kfree(g, blob_copy);
#endif
return err;
}