Files
linux-nvgpu/drivers/gpu/nvgpu/gk20a/tsg_gk20a.h
Deepak Nibade ee66559a0b gpu: nvgpu: add TSG support for engine context
All channels in a TSG need to share same engine context
i.e. pointer in RAMFC of all channels in a TSG must point
to same NV_RAMIN_GR_WFI_TARGET

To get this, add a pointer to gr_ctx inside TSG struct so
that TSG can maintain its own unique gr_ctx
Also, change the type of gr_ctx in a channel to pointer
variable so that if channel is part of TSG it can point
to TSG's gr_ctx otherwise it will point to its own gr_ctx

In gk20a_alloc_obj_ctx(), allocate gr_ctx as below :

1) If channel is not part of any TSG
- allocate its own gr_ctx buffer if it is already not allocated

2) If channel is part of TSG
- Check if TSG has already allocated gr_ctx (as part of TSG)
- If yes, channel's gr_ctx will point to that of TSG's
- If not, then it means channels is first to be bounded to
  this TSG
- And in this case we will allocate new gr_ctx on TSG first
  and then make channel's gr_ctx to point to this gr_ctx

Also, gr_ctx will be released as below ;

1) If channels is not part of TSG, then it will be released
   when channels is closed
2) Otherwise, it will be released when TSG itself is closed

Bug 1470692

Change-Id: Id347217d5b462e0e972cd3d79d17795b37034a50
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/417065
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
2015-03-18 12:10:17 -07:00

49 lines
1.5 KiB
C

/*
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __TSG_GK20A_H_
#define __TSG_GK20A_H_
#define NVGPU_INVALID_TSG_ID (-1)
bool gk20a_is_channel_marked_as_tsg(struct channel_gk20a *ch);
int gk20a_tsg_dev_release(struct inode *inode, struct file *filp);
int gk20a_tsg_dev_open(struct inode *inode, struct file *filp);
long gk20a_tsg_dev_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg);
int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid);
int gk20a_bind_runnable_channel_to_tsg(struct channel_gk20a *ch, int tsgid);
int gk20a_unbind_channel_from_tsg(struct channel_gk20a *ch, int tsgid);
struct tsg_gk20a {
struct gk20a *g;
bool in_use;
int tsgid;
struct list_head ch_runnable_list;
int num_runnable_channels;
struct mutex ch_list_lock;
struct gr_ctx_desc *tsg_gr_ctx;
struct vm_gk20a *vm;
};
#endif /* __TSG_GK20A_H_ */