gpu: nvgpu: nvgpu-next changes for fifo pbdma

- Include nvgpu_next_pbdma.h in pbdma.h
- NULL check for fifo.init_pbdma_map hal before allocating
  memory for f->pbdma_map
- NULL check for f->pbdma_map before freeing memory for
  f->pbdma_map

JIRA NVGPU-4979

Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Change-Id: I5eacc671b924c947620b2c49c8f82577c30ba1a3
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2317804
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Seshendra Gadagottu
2020-03-23 18:43:21 -07:00
committed by Alex Waterman
parent fee7b81061
commit 002fb2431d
3 changed files with 22 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-2020, 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"),
@@ -68,14 +68,18 @@ int nvgpu_pbdma_setup_sw(struct gk20a *g)
struct nvgpu_fifo *f = &g->fifo;
f->num_pbdma = nvgpu_get_litter_value(g, GPU_LIT_HOST_NUM_PBDMA);
f->pbdma_map = NULL;
f->pbdma_map = nvgpu_kzalloc(g, f->num_pbdma * sizeof(*f->pbdma_map));
if (f->pbdma_map == NULL) {
return -ENOMEM;
if (g->ops.fifo.init_pbdma_map != NULL) {
f->pbdma_map = nvgpu_kzalloc(g,
f->num_pbdma * sizeof(*f->pbdma_map));
if (f->pbdma_map == NULL) {
return -ENOMEM;
}
g->ops.fifo.init_pbdma_map(g, f->pbdma_map, f->num_pbdma);
}
g->ops.fifo.init_pbdma_map(g, f->pbdma_map, f->num_pbdma);
nvgpu_pbdma_init_intr_descs(g);
return 0;
@@ -85,6 +89,8 @@ void nvgpu_pbdma_cleanup_sw(struct gk20a *g)
{
struct nvgpu_fifo *f = &g->fifo;
nvgpu_kfree(g, f->pbdma_map);
f->pbdma_map = NULL;
if (f->pbdma_map != NULL) {
nvgpu_kfree(g, f->pbdma_map);
f->pbdma_map = NULL;
}
}

View File

@@ -23,6 +23,7 @@
#define NVGPU_GOPS_RUNLIST_H
#include <nvgpu/types.h>
#include <nvgpu/pbdma.h>
/**
* @file

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-2020, 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"),
@@ -34,6 +34,12 @@
*/
struct gk20a;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */
#if defined(CONFIG_NVGPU_NON_FUSA) && defined(CONFIG_NVGPU_NEXT)
#include "include/nvgpu/nvgpu_next_pbdma.h"
#endif
/** @endcond DOXYGEN_SHOULD_SKIP_THIS */
/**
* @brief Initialize PBDMA software context
*