aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRebecca Schultz Zavin2012-11-15 12:31:02 -0600
committerArve Hjønnevåg2013-02-19 19:56:00 -0600
commitbf6395b80a787e3d5b6829193718d452e75fe18c (patch)
tree2cde23e1416004a1041a81a4ad769c27df0fee0c
parent02fd835343fa3c80b0020bf9437732d72fd5ad18 (diff)
downloadkernel-common-bf6395b80a787e3d5b6829193718d452e75fe18c.tar.gz
kernel-common-bf6395b80a787e3d5b6829193718d452e75fe18c.tar.xz
kernel-common-bf6395b80a787e3d5b6829193718d452e75fe18c.zip
gpu: ion: Modify reserve function for carveouts with no start address
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. Change-Id: I9c79b30e3105e796060fc74b058f04093ee5e96e Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
-rw-r--r--drivers/gpu/ion/ion.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index c30b8fb41a7..2465085c876 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -1343,16 +1343,35 @@ void ion_device_destroy(struct ion_device *dev)
1343 1343
1344void __init ion_reserve(struct ion_platform_data *data) 1344void __init ion_reserve(struct ion_platform_data *data)
1345{ 1345{
1346 int i, ret; 1346 int i;
1347 1347
1348 for (i = 0; i < data->nr; i++) { 1348 for (i = 0; i < data->nr; i++) {
1349 if (data->heaps[i].size == 0) 1349 if (data->heaps[i].size == 0)
1350 continue; 1350 continue;
1351 ret = memblock_reserve(data->heaps[i].base, 1351
1352 data->heaps[i].size); 1352 if (data->heaps[i].base == 0) {
1353 if (ret) 1353 phys_addr_t paddr;
1354 pr_err("memblock reserve of %x@%lx failed\n", 1354 paddr = memblock_alloc_base(data->heaps[i].size,
1355 data->heaps[i].size, 1355 data->heaps[i].align,
1356 data->heaps[i].base); 1356 MEMBLOCK_ALLOC_ANYWHERE);
1357 if (!paddr) {
1358 pr_err("%s: error allocating memblock for "
1359 "heap %d\n",
1360 __func__, i);
1361 continue;
1362 }
1363 data->heaps[i].base = paddr;
1364 } else {
1365 int ret = memblock_reserve(data->heaps[i].base,
1366 data->heaps[i].size);
1367 if (ret)
1368 pr_err("memblock reserve of %x@%lx failed\n",
1369 data->heaps[i].size,
1370 data->heaps[i].base);
1371 }
1372 pr_info("%s: %s reserved base %lx size %d\n", __func__,
1373 data->heaps[i].name,
1374 data->heaps[i].base,
1375 data->heaps[i].size);
1357 } 1376 }
1358} 1377}