From patchwork Fri Dec 13 22:24:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22414 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 73EBD23FBA for ; Fri, 13 Dec 2013 22:27:27 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id oy12sf4850788veb.1 for ; Fri, 13 Dec 2013 14:27:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=0jf7wUXXjzMx5uglIhc7nZXcaAVH/ty217DGm2/EA+k=; b=Qh91gzP5iPGjEvO0TgWUwc5ggxEf8vhx/64wM2I62psxISEwY7b+B9aNlw5eTu6veI EPmp2MPwct1eNS8FyBHdV4iqh2VvOcE6skVrTbtFm2W7gqPt5Lr18922E7KpI2kWDEnx yN+dRuf9ny4K0DxMFVOL3qyHkrl9X5xJsF/XQnj6NFfH5S3b2RAvMrF+oX5inwKOqE7l kVl6vTEjHSsXiVFrvtD36/sQDxF949+yhlaMUSvE98Dj5lHYBzL1bFw2f5yhHmJDUstK Atvj4j84wcNzN9ClhanxvBwVT99yU99LyJ/ewpFo/CGBhqkUDLM6abUvN15EZarB5O0C JgIA== X-Gm-Message-State: ALoCoQmvMzGigKFNkI4MfXNxCfoHS+b1jWP482AjAV7XTAhe8no21awvo3X095aq3rq4YnmOXYC0 X-Received: by 10.236.121.4 with SMTP id q4mr1711426yhh.34.1386973647289; Fri, 13 Dec 2013 14:27:27 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.99 with SMTP id nf3ls1213959qeb.30.gmail; Fri, 13 Dec 2013 14:27:27 -0800 (PST) X-Received: by 10.52.162.74 with SMTP id xy10mr1824891vdb.65.1386973647134; Fri, 13 Dec 2013 14:27:27 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id c8si1188986vcq.138.2013.12.13.14.27.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:27 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id x11so1695733vbb.8 for ; Fri, 13 Dec 2013 14:27:26 -0800 (PST) X-Received: by 10.52.75.99 with SMTP id b3mr929165vdw.80.1386973646905; Fri, 13 Dec 2013 14:27:26 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp73543vcz; Fri, 13 Dec 2013 14:27:26 -0800 (PST) X-Received: by 10.68.25.229 with SMTP id f5mr6252344pbg.6.1386973645710; Fri, 13 Dec 2013 14:27:25 -0800 (PST) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id za5si2514139pbc.69.2013.12.13.14.27.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id kl14so589836pab.19 for ; Fri, 13 Dec 2013 14:27:25 -0800 (PST) X-Received: by 10.68.200.129 with SMTP id js1mr6190109pbc.14.1386973645277; Fri, 13 Dec 2013 14:27:25 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qz9sm7457908pbc.3.2013.12.13.14.27.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:24 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , Rebecca Schultz Zavin , John Stultz Subject: [PATCH 049/115] gpu: ion: Modify reserve function for carveouts with no start address Date: Fri, 13 Dec 2013 14:24:23 -0800 Message-Id: <1386973529-4884-50-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Rebecca Schultz Zavin This patch allows you to specify a heap that requires carveout memory but that doesn't specify a start address. Memblock_alloc will be called to find a location for these heaps. Signed-off-by: Rebecca Schultz Zavin [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz --- drivers/staging/android/ion/ion.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index e0eb2de..3167c1d 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1343,16 +1343,35 @@ void ion_device_destroy(struct ion_device *dev) void __init ion_reserve(struct ion_platform_data *data) { - int i, ret; + int i; for (i = 0; i < data->nr; i++) { if (data->heaps[i].size == 0) continue; - ret = memblock_reserve(data->heaps[i].base, - data->heaps[i].size); - if (ret) - pr_err("memblock reserve of %x@%lx failed\n", - data->heaps[i].size, - data->heaps[i].base); + + if (data->heaps[i].base == 0) { + phys_addr_t paddr; + paddr = memblock_alloc_base(data->heaps[i].size, + data->heaps[i].align, + MEMBLOCK_ALLOC_ANYWHERE); + if (!paddr) { + pr_err("%s: error allocating memblock for " + "heap %d\n", + __func__, i); + continue; + } + data->heaps[i].base = paddr; + } else { + int ret = memblock_reserve(data->heaps[i].base, + data->heaps[i].size); + if (ret) + pr_err("memblock reserve of %x@%lx failed\n", + data->heaps[i].size, + data->heaps[i].base); + } + pr_info("%s: %s reserved base %lx size %d\n", __func__, + data->heaps[i].name, + data->heaps[i].base, + data->heaps[i].size); } }