Skip to content

Commit 26c8de5

Browse files
digetxthierryreding
authored andcommitted
gpu: host1x: Optimize BOs usage when firewall is enabled
We don't need to hold and pin original BOs of the gathers in a case of enabled firewall because in this case gather's content is copied and the copy is used by the executed job. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent b3f1b76 commit 26c8de5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/gpu/host1x/job.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
2727
u32 num_cmdbufs, u32 num_relocs)
2828
{
2929
struct host1x_job *job = NULL;
30-
unsigned int num_unpins = num_cmdbufs + num_relocs;
30+
unsigned int num_unpins = num_relocs;
3131
u64 total;
3232
void *mem;
3333

34+
if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL))
35+
num_unpins += num_cmdbufs;
36+
3437
/* Check that we're not going to overflow */
3538
total = sizeof(struct host1x_job) +
3639
(u64)num_relocs * sizeof(struct host1x_reloc) +
@@ -183,6 +186,13 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
183186
job->num_unpins++;
184187
}
185188

189+
/*
190+
* We will copy gathers BO content later, so there is no need to
191+
* hold and pin them.
192+
*/
193+
if (IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL))
194+
return 0;
195+
186196
for (i = 0; i < job->num_gathers; i++) {
187197
struct host1x_job_gather *g = &job->gathers[i];
188198
size_t gather_size = 0;
@@ -216,7 +226,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
216226
goto unpin;
217227
}
218228

219-
if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
229+
if (host->domain) {
220230
for_each_sg(sgt->sgl, sg, sgt->nents, j)
221231
gather_size += sg->length;
222232
gather_size = iova_align(&host->iova, gather_size);

0 commit comments

Comments
 (0)