diff --git a/drivers/gpu/nvgpu/common/fifo/pbdma.c b/drivers/gpu/nvgpu/common/fifo/pbdma.c index b1d5915e5..1e6f99b43 100644 --- a/drivers/gpu/nvgpu/common/fifo/pbdma.c +++ b/drivers/gpu/nvgpu/common/fifo/pbdma.c @@ -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; + } } diff --git a/drivers/gpu/nvgpu/include/nvgpu/gops_runlist.h b/drivers/gpu/nvgpu/include/nvgpu/gops_runlist.h index 41e858734..f3efaaa3b 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gops_runlist.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gops_runlist.h @@ -23,6 +23,7 @@ #define NVGPU_GOPS_RUNLIST_H #include +#include /** * @file diff --git a/drivers/gpu/nvgpu/include/nvgpu/pbdma.h b/drivers/gpu/nvgpu/include/nvgpu/pbdma.h index e5b1f5247..43df72513 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pbdma.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pbdma.h @@ -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 *