From: Rebecca Schultz Zavin Date: Tue, 31 Jan 2012 17:40:30 +0000 (-0800) Subject: ion: Add reserve function to ion X-Git-Tag: firefly_0821_release~4090^2~739 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4654918605feb8d235728b0aecdae1e7eb1b6d02;p=firefly-linux-kernel-4.4.55.git ion: Add reserve function to ion Rather than requiring each platform call memblock_remove or reserve from the board file, add this to ion Change-Id: Ie418a692c13e9e0cfe93ecc83d253d3ce860fc83 Signed-off-by: Rebecca Schultz Zavin --- diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 45147e284faa..344d66d6fab2 100644 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -20,6 +20,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/include/linux/ion.h b/include/linux/ion.h index 9d196e2f9bb3..860b160ab5ed 100644 --- a/include/linux/ion.h +++ b/include/linux/ion.h @@ -86,6 +86,17 @@ struct ion_platform_data { struct ion_platform_heap heaps[]; }; +/** + * 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