From patchwork Mon Feb 11 15:18:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Mossberg X-Patchwork-Id: 14733 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3C52D23E1A for ; Mon, 11 Feb 2013 15:19:08 +0000 (UTC) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id B6E06A18275 for ; Mon, 11 Feb 2013 15:19:07 +0000 (UTC) Received: by mail-vb0-f52.google.com with SMTP id fa15so3846691vbb.11 for ; Mon, 11 Feb 2013 07:19:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:date:message-id:x-mailer:mime-version:cc :subject:x-beenthere:x-mailman-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:sender:errors-to :x-gm-message-state; bh=vN9lxutopKsREB//7L6Ttlho8i4nxRIoJyn3fNPC0qE=; b=J9xXEmUfyV3XHDDeC8RUQQxbCn3llbNQhQH+HVMBcL8TfHEnXFDUN//K+WaW+n2b8D YZ7UobiDW+zgDY3BOC0dpd/1My17JgATp3T+bz+6TtgH6I13qyGIV+LJP5ytJOxlZXEH 8own9a3g4rDgUi23Qb7d+Dor6f1hGjfS+m0bo6ssEhBgwC79wyUqz6flkN/UmRqhjdE/ dMECzw1+n8oOCKW2nlRWpp6ZS4DOSEWC2omKV9E1yhwVyzdTdJNwbc122HQK/zBluRR9 xCLrdF8f2jU1jKyqLhEHVtSpYw+BW1aEU9aRUHM/1zF0VYm+YR/P1Ck8EhLBYEP9fZIY 1kaw== X-Received: by 10.52.75.65 with SMTP id a1mr2765087vdw.79.1360595947121; Mon, 11 Feb 2013 07:19:07 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp102032vec; Mon, 11 Feb 2013 07:19:06 -0800 (PST) X-Received: by 10.204.155.73 with SMTP id r9mr2255777bkw.51.1360595945985; Mon, 11 Feb 2013 07:19:05 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id w7si19987387bkv.215.2013.02.11.07.19.04; Mon, 11 Feb 2013 07:19:05 -0800 (PST) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U4v9o-0000mZ-4c; Mon, 11 Feb 2013 15:19:00 +0000 Received: from eu1sys200aog116.obsmtp.com ([207.126.144.141]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U4v9m-0000mT-VL for linaro-mm-sig@lists.linaro.org; Mon, 11 Feb 2013 15:18:59 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob116.postini.com ([207.126.147.11]) with SMTP ID DSNKURkL4vI+Fw/1fp+jMPcx4xu4rxJBBmfy@postini.com; Mon, 11 Feb 2013 15:18:58 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8E9AC18A; Mon, 11 Feb 2013 15:18:53 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 376554E3A; Mon, 11 Feb 2013 15:18:53 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 10D19A8065; Mon, 11 Feb 2013 16:18:47 +0100 (CET) Received: from steludxu2808.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server id 8.3.83.0; Mon, 11 Feb 2013 16:18:52 +0100 From: Johan Mossberg To: Date: Mon, 11 Feb 2013 16:18:31 +0100 Message-ID: <1360595911-25460-1-git-send-email-johan.mossberg@stericsson.com> X-Mailer: git-send-email 1.7.4.3 MIME-Version: 1.0 Cc: linaro-mm-sig@lists.linaro.org Subject: [Linaro-mm-sig] [PATCH] gpu: ion: Use memblock_remove when reserving carveout memory X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQkU0MzxNld9CG3MHiht50dvDt7sUj6jrkEqbnq/dO9qKDo1mnPTWKhgW8d/r2Sz8PwqIdne __arm_ioremap, which is used by the carveout heap, refuses to map memory already mapped as lowmem, probably to avoid having multiple mappings with different cache settings pointing at the same memory. By using memblock_remove rather than memblock_reserve the carveout heap's memory will not be included in lowmem i.e no problem. Signed-off-by: Johan Mossberg --- drivers/gpu/ion/ion.c | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 0fc02fd..b8b43bb 100644 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -1323,29 +1323,32 @@ void __init ion_reserve(struct ion_platform_data *data) int i; for (i = 0; i < data->nr; i++) { + int ret; + if (data->heaps[i].size == 0) continue; 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); + data->heaps[i].base = memblock_find_in_range_node( + 0, + MEMBLOCK_ALLOC_ANYWHERE, + data->heaps[i].size, + data->heaps[i].align, + MAX_NUMNODES); + if (data->heaps[i].base == 0) { + pr_err("%s: error allocating memblock for heap %d\n", + __func__, data->heaps[i].id); 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); } + + ret = memblock_remove(data->heaps[i].base, data->heaps[i].size); + if (ret < 0) { + pr_err("%s: could not remove heap %d memory from kernel\n", + __func__, data->heaps[i].id); + continue; + } + pr_info("%s: %s reserved base %lx size %d\n", __func__, data->heaps[i].name, data->heaps[i].base,