diff --git a/drivers/gpu/nvgpu/common/gr/gr.c b/drivers/gpu/nvgpu/common/gr/gr.c index 696db7faf..4affb519b 100644 --- a/drivers/gpu/nvgpu/common/gr/gr.c +++ b/drivers/gpu/nvgpu/common/gr/gr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2023, 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"), @@ -425,7 +425,7 @@ static int nvgpu_gr_init_ctx_state(struct gk20a *g, struct nvgpu_gr *gr) return err; } -static int gr_init_ctx_bufs(struct gk20a *g, struct nvgpu_gr *gr) +int nvgpu_gr_init_ctx_bufs(struct gk20a *g, struct nvgpu_gr *gr) { int err = 0; @@ -509,7 +509,7 @@ static int gr_init_setup_sw(struct gk20a *g, struct nvgpu_gr *gr) } #endif - err = gr_init_ctx_bufs(g, gr); + err = nvgpu_gr_init_ctx_bufs(g, gr); if (err != 0) { goto clean_up; } diff --git a/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c b/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c index 7d5d127f7..0d449f2dc 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c +++ b/drivers/gpu/nvgpu/common/vgpu/gr/gr_vgpu.c @@ -1,7 +1,7 @@ /* * Virtualized GPU Graphics * - * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2023, 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"), @@ -674,14 +674,21 @@ static int vgpu_gr_init_gr_setup_sw(struct gk20a *g) } #endif - err = vgpu_gr_alloc_global_ctx_buffers(g); - if (err) { - goto clean_up; - } + if (nvgpu_is_vf(g)) { + err = nvgpu_gr_init_ctx_bufs(g, gr); + if (err) { + goto clean_up; + } + } else { + err = vgpu_gr_alloc_global_ctx_buffers(g); + if (err) { + goto clean_up; + } - gr->gr_ctx_desc = nvgpu_gr_ctx_desc_alloc(g); - if (gr->gr_ctx_desc == NULL) { - goto clean_up; + gr->gr_ctx_desc = nvgpu_gr_ctx_desc_alloc(g); + if (gr->gr_ctx_desc == NULL) { + goto clean_up; + } } #ifdef CONFIG_NVGPU_GRAPHICS diff --git a/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h b/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h index 1333db43c..a1933a5a2 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2023, 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"), @@ -156,6 +156,8 @@ int nvgpu_gr_alloc(struct gk20a *g); */ void nvgpu_gr_free(struct gk20a *g); +int nvgpu_gr_init_ctx_bufs(struct gk20a *g, struct nvgpu_gr *gr); + /** * @brief Reset and enable GR engine HW as phase 2 of GR engine * initialization.