From patchwork Sat Jan 24 02:35:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ung X-Patchwork-Id: 432360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41C7B140290 for ; Sat, 24 Jan 2015 13:34:36 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752415AbbAXCef (ORCPT ); Fri, 23 Jan 2015 21:34:35 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:4073 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbbAXCee (ORCPT ); Fri, 23 Jan 2015 21:34:34 -0500 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Fri, 23 Jan 2015 18:34:36 -0800 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp07.nvidia.com (PGP Universal service); Fri, 23 Jan 2015 18:24:57 -0800 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 23 Jan 2015 18:24:57 -0800 Received: from dung-P9X79.nvidia.com (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.342.0; Fri, 23 Jan 2015 18:34:33 -0800 From: David Ung To: CC: , , , , David Ung Subject: [PATCH] gpu: host1x: Reduce host1x job allocation size Date: Fri, 23 Jan 2015 18:35:31 -0800 Message-ID: <1422066931-31580-1-git-send-email-davidu@nvidia.com> X-Mailer: git-send-email 1.8.1.5 MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org There is 2 set of num_relocs * sizeof(*) array at the end of host1x job. Only the first is really used and with job->gather_addr_phys pointing somewhere within the 1st set of reloc physical addresses. During pin_job, job->gather_addr_phys array is set indirectly by indexing num_relocs offset of job->reloc_addr_phys. Correct the total job size, explicily set job->gather_addr_phys array in 2nd for loop of pin_job and record its physical address. Signed-off-by: David Ung --- drivers/gpu/host1x/job.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 63bd63f..37c67d2 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -46,8 +46,8 @@ struct host1x_job *host1x_job_alloc(struct host1x_channel *ch, (u64)num_unpins * sizeof(struct host1x_job_unpin_data) + (u64)num_waitchks * sizeof(struct host1x_waitchk) + (u64)num_cmdbufs * sizeof(struct host1x_job_gather) + - (u64)num_unpins * sizeof(dma_addr_t) + - (u64)num_unpins * sizeof(u32 *); + (u64)num_relocs * sizeof(dma_addr_t) + + (u64)num_cmdbufs * sizeof(dma_addr_t); if (total > ULONG_MAX) return NULL; @@ -212,7 +212,8 @@ static unsigned int pin_job(struct host1x_job *job) if (!phys_addr) goto unpin; - job->addr_phys[job->num_unpins] = phys_addr; + g->base = phys_addr; + job->gather_addr_phys[i] = phys_addr; job->unpins[job->num_unpins].bo = g->bo; job->unpins[job->num_unpins].sgt = sgt; job->num_unpins++; @@ -536,8 +537,6 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) if (g->handled) continue; - g->base = job->gather_addr_phys[i]; - for (j = i + 1; j < job->num_gathers; j++) if (job->gathers[j].bo == g->bo) job->gathers[j].handled = true;