mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: pass alloc_gpfifo args to gk20a_channel_alloc_gpfifo
The patch defines 'struct nvgpu_gpfifo_args' to be filled by alloc_gpfifo(_ex) ioctls and passed to the gk20a_channel_alloc_gpfifo function. This is required as a prep towards having the usermode submission support in the core channel core. Change-Id: I72acc00cc5558dd3623604da7d716bf849f0152c Signed-off-by: Sourab Gupta <sourabg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1683391 GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
077de38dfb
commit
03b8768902
@@ -1277,6 +1277,7 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx)
|
||||
struct channel_gk20a *ch;
|
||||
struct tsg_gk20a *tsg;
|
||||
struct gr_gk20a *gr = &g->gr;
|
||||
struct nvgpu_gpfifo_args gpfifo_args;
|
||||
int err = 0;
|
||||
u64 vaddr;
|
||||
|
||||
@@ -1316,8 +1317,11 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx)
|
||||
goto err_alloc_gpfifo;
|
||||
}
|
||||
|
||||
gpfifo_args.num_entries = 1024;
|
||||
gpfifo_args.num_inflight_jobs = 0;
|
||||
gpfifo_args.flags = 0;
|
||||
/* allocate gpfifo (1024 should be more than enough) */
|
||||
err = gk20a_channel_alloc_gpfifo(ch, 1024, 0, 0);
|
||||
err = gk20a_channel_alloc_gpfifo(ch, &gpfifo_args);
|
||||
if (err) {
|
||||
nvgpu_warn(g, "cde: unable to allocate gpfifo");
|
||||
goto err_alloc_gpfifo;
|
||||
|
||||
@@ -589,16 +589,30 @@ static u32 nvgpu_gpfifo_user_flags_to_common_flags(u32 user_flags)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static int nvgpu_channel_ioctl_alloc_gpfifo(struct channel_gk20a *c,
|
||||
unsigned int num_entries,
|
||||
unsigned int num_inflight_jobs,
|
||||
u32 user_flags)
|
||||
static void nvgpu_get_gpfifo_ex_args(
|
||||
struct nvgpu_alloc_gpfifo_ex_args *alloc_gpfifo_ex_args,
|
||||
struct nvgpu_gpfifo_args *gpfifo_args)
|
||||
{
|
||||
return gk20a_channel_alloc_gpfifo(c, num_entries,
|
||||
num_inflight_jobs,
|
||||
nvgpu_gpfifo_user_flags_to_common_flags(user_flags));
|
||||
gpfifo_args->num_entries = alloc_gpfifo_ex_args->num_entries;
|
||||
gpfifo_args->num_inflight_jobs = alloc_gpfifo_ex_args->num_inflight_jobs;
|
||||
gpfifo_args->flags = nvgpu_gpfifo_user_flags_to_common_flags(
|
||||
alloc_gpfifo_ex_args->flags);
|
||||
}
|
||||
|
||||
static void nvgpu_get_gpfifo_args(
|
||||
struct nvgpu_alloc_gpfifo_args *alloc_gpfifo_args,
|
||||
struct nvgpu_gpfifo_args *gpfifo_args)
|
||||
{
|
||||
/*
|
||||
* Kernel can insert one extra gpfifo entry before user
|
||||
* submitted gpfifos and another one after, for internal usage.
|
||||
* Triple the requested size.
|
||||
*/
|
||||
gpfifo_args->num_entries = alloc_gpfifo_args->num_entries * 3;
|
||||
gpfifo_args->num_inflight_jobs = 0;
|
||||
gpfifo_args->flags = nvgpu_gpfifo_user_flags_to_common_flags(
|
||||
alloc_gpfifo_args->flags);
|
||||
}
|
||||
|
||||
static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
|
||||
ulong id, u32 offset,
|
||||
@@ -1075,6 +1089,9 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
{
|
||||
struct nvgpu_alloc_gpfifo_ex_args *alloc_gpfifo_ex_args =
|
||||
(struct nvgpu_alloc_gpfifo_ex_args *)buf;
|
||||
struct nvgpu_gpfifo_args gpfifo_args;
|
||||
|
||||
nvgpu_get_gpfifo_ex_args(alloc_gpfifo_ex_args, &gpfifo_args);
|
||||
|
||||
err = gk20a_busy(ch->g);
|
||||
if (err) {
|
||||
@@ -1089,10 +1106,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
gk20a_idle(ch->g);
|
||||
break;
|
||||
}
|
||||
err = nvgpu_channel_ioctl_alloc_gpfifo(ch,
|
||||
alloc_gpfifo_ex_args->num_entries,
|
||||
alloc_gpfifo_ex_args->num_inflight_jobs,
|
||||
alloc_gpfifo_ex_args->flags);
|
||||
err = gk20a_channel_alloc_gpfifo(ch, &gpfifo_args);
|
||||
gk20a_idle(ch->g);
|
||||
break;
|
||||
}
|
||||
@@ -1100,6 +1114,9 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
{
|
||||
struct nvgpu_alloc_gpfifo_args *alloc_gpfifo_args =
|
||||
(struct nvgpu_alloc_gpfifo_args *)buf;
|
||||
struct nvgpu_gpfifo_args gpfifo_args;
|
||||
|
||||
nvgpu_get_gpfifo_args(alloc_gpfifo_args, &gpfifo_args);
|
||||
|
||||
err = gk20a_busy(ch->g);
|
||||
if (err) {
|
||||
@@ -1109,15 +1126,7 @@ long gk20a_channel_ioctl(struct file *filp,
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Kernel can insert one extra gpfifo entry before user
|
||||
* submitted gpfifos and another one after, for internal usage.
|
||||
* Triple the requested size.
|
||||
*/
|
||||
err = nvgpu_channel_ioctl_alloc_gpfifo(ch,
|
||||
alloc_gpfifo_args->num_entries * 3,
|
||||
0,
|
||||
alloc_gpfifo_args->flags);
|
||||
err = gk20a_channel_alloc_gpfifo(ch, &gpfifo_args);
|
||||
gk20a_idle(ch->g);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user