Files
linux-nvgpu/drivers/gpu/nvgpu/common/gr/obj_ctx_priv.h
Deepak Nibade c33827e122 gpu: nvgpu: add common.gr.obj_ctx unit
Add a new unit common.gr.obj_ctx which allocates and initializes GR
context. This unit also takes care of creating global golden image
used to initialize every context.

Add private header obj_ctx_priv.h that defines struct
nvgpu_gr_obj_ctx_golden_image

Add public header obj_ctx.h that exposes functions supported by new unit

This unit now exposes below API to allocate and initialize context
nvgpu_gr_obj_ctx_alloc()

Remove below functions from gk20a/gr_gk20a.c and move them to new unit
with below renames

gr_gk20a_fecs_ctx_bind_channel() -> nvgpu_gr_obj_ctx_bind_channel()
gr_gk20a_fecs_ctx_image_save() -> nvgpu_gr_obj_ctx_image_save()
gk20a_init_sw_bundle() -> nvgpu_gr_obj_ctx_alloc_sw_bundle()
gr_gk20a_alloc_gr_ctx() -> nvgpu_gr_obj_ctx_gr_ctx_alloc()
gr_gk20a_init_golden_ctx_image() ->
		nvgpu_gr_obj_ctx_alloc_golden_ctx_image()

Use new APIs in gk20a_alloc_obj_ctx() to allocate context

For now this unit includes <nvgpu/gr/gr.h> and some h/w headers.
But they will be removed in follow up patches

Jira NVGPU-1887

Change-Id: Ib95ec1c19c5b74810f85c2feed8fdd63889d3d22
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087662
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-02 11:07:00 -07:00

41 lines
1.5 KiB
C

/*
* Copyright (c) 2019, 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef NVGPU_GR_OBJ_CTX_PRIV_H
#define NVGPU_GR_OBJ_CTX_PRIV_H
#include <nvgpu/types.h>
#include <nvgpu/lock.h>
struct nvgpu_gr_global_ctx_local_golden_image;
struct nvgpu_gr_obj_ctx_golden_image {
bool ready;
struct nvgpu_mutex ctx_mutex;
size_t size;
struct nvgpu_gr_global_ctx_local_golden_image *local_golden_image;
};
#endif /* NVGPU_GR_OBJ_CTX_PRIV_H */