From patchwork Fri Dec 13 22:23:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22369 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4CECE23FF5 for ; Fri, 13 Dec 2013 22:26:11 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id e9sf4359520qcy.5 for ; Fri, 13 Dec 2013 14:26:10 -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=X8kePUGgJ37yztHX2Mr/nAxGWp/FEc1G9g1uqtxSWyI=; b=eOah9Wj+w+nS2bDA7GhqNUUlL3AXkg0dF8LcIa5ehz9N7ZlF2uQIPy0MVh3rj/HWe4 HwRwNgsrO1tR+YpaRVYnygKgW0XOcGXPw1GIzXqBR0ne/JGOb8Lq4HQlpr7bzbifc7ru /PZhYWgZ9eiytVhlkd3Yrjbh3gGYN0zFmhJm5q1MgAZxQ0xubunlGTbKuJsetNlQxrZC msY58suZReC7aodsQc9o+0Uy752e58DajRSZSIl3lY1UMhUAIe53Vte3PCnnWpKyhe3G ozvrg7IjeGUmwI+fKC0+cl89gdyfbQu8hq3EvzQLvs+V5C9Ibizn5n9NsHl6hzKh0bk7 NSfQ== X-Gm-Message-State: ALoCoQkkpSYZxU+6Qc+8FuYFo5LyAafEwa6A6sTkw2QNSeUSc9X1MEJPTHVbEDEMyWIKKpR0LAPq X-Received: by 10.236.125.79 with SMTP id y55mr1332241yhh.53.1386973570917; Fri, 13 Dec 2013 14:26:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.196 with SMTP id e4ls1205655qeo.3.gmail; Fri, 13 Dec 2013 14:26:10 -0800 (PST) X-Received: by 10.220.50.18 with SMTP id x18mr2202248vcf.29.1386973570812; Fri, 13 Dec 2013 14:26:10 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id td8si1202071vdc.1.2013.12.13.14.26.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oz11so1851236veb.32 for ; Fri, 13 Dec 2013 14:26:10 -0800 (PST) X-Received: by 10.52.230.102 with SMTP id sx6mr1847388vdc.15.1386973570727; Fri, 13 Dec 2013 14:26:10 -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 u4csp73433vcz; Fri, 13 Dec 2013 14:26:10 -0800 (PST) X-Received: by 10.68.164.131 with SMTP id yq3mr6138771pbb.56.1386973569891; Fri, 13 Dec 2013 14:26:09 -0800 (PST) Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com [209.85.160.52]) by mx.google.com with ESMTPS id v7si2517678pbi.38.2013.12.13.14.26.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:09 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.52 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.52; Received: by mail-pb0-f52.google.com with SMTP id uo5so3155543pbc.11 for ; Fri, 13 Dec 2013 14:26:09 -0800 (PST) X-Received: by 10.66.25.36 with SMTP id z4mr5979245paf.101.1386973569453; Fri, 13 Dec 2013 14:26:09 -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.26.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:08 -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 004/115] ion: Add reserve function to ion Date: Fri, 13 Dec 2013 14:23:38 -0800 Message-Id: <1386973529-4884-5-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.128.173 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 Rather than requiring each platform call memblock_remove or reserve from the board file, add this to ion 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 | 17 +++++++++++++++++ drivers/staging/android/ion/ion.h | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index bca8d9e..004c0d4 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1185,3 +1186,19 @@ void ion_device_destroy(struct ion_device *dev) /* XXX need to free the heaps and clients ? */ kfree(dev); } + +void __init ion_reserve(struct ion_platform_data *data) +{ + int i, ret; + + 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); + } +} diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h index 87f6a45..4e012b8 100644 --- a/drivers/staging/android/ion/ion.h +++ b/drivers/staging/android/ion/ion.h @@ -87,6 +87,17 @@ struct ion_platform_data { }; /** + * ion_reserve() - reserve memory for ion heaps if applicable + * @data: platform data specifying starting physical address and + * size + * + * Calls memblock reserve to set aside memory for heaps that are + * located at specific memory addresses or of specfic sizes not + * managed by the kernel + */ +void ion_reserve(struct ion_platform_data *data); + +/** * ion_client_create() - allocate a client and returns it * @dev: the global ion device * @heap_mask: mask of heaps this client can allocate from