From patchwork Mon Jun 23 05:05:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 4399301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 932C99F26E for ; Mon, 23 Jun 2014 05:09:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEF7220295 for ; Mon, 23 Jun 2014 05:09:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 066AD2027D for ; Mon, 23 Jun 2014 05:09:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WywSK-0003hh-Pd; Mon, 23 Jun 2014 05:06:12 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WywSD-0003gE-Tu for linux-arm-kernel@lists.infradead.org; Mon, 23 Jun 2014 05:06:06 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5N55ijR020660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jun 2014 01:05:44 -0400 Received: from deneb.redhat.com (ovpn-113-76.phx2.redhat.com [10.3.113.76]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5N55h6R010018; Mon, 23 Jun 2014 01:05:43 -0400 From: Mark Salter To: Catalin Marinas , Will Deacon Subject: [PATCH] arm64: fix CONFIG_ZONE_DMA on systems with no 32-bit addressable DRAM Date: Mon, 23 Jun 2014 01:05:40 -0400 Message-Id: <1403499940-11258-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140622_220606_008641_943C046F X-CRM114-Status: GOOD ( 13.02 ) X-Spam-Score: -5.0 (-----) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Salter X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 2d5a5612bc (arm64: Limit the CMA buffer to 32-bit if ZONE_DMA) forces the CMA buffer to be 32-bit addressable if CONFIG_ZONE_DMA is defined. This breaks CMA on platforms with no 32-bit addressable DRAM. This patch checks to make sure there is 32-bit addressable DRAM before setting the 32-bit limit. If there is none, no limit is placed on the CMA buffer. This allows a single kernel (with CONFIG_ZONE_DMA defined) to support platforms requiring the 32-bit limit and platforms with no 32-bit limit. Signed-off-by: Mark Salter --- arch/arm64/mm/init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index c5415e2..2925576 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -149,8 +149,17 @@ void __init arm64_memblock_init(void) early_init_fdt_scan_reserved_mem(); /* 4GB maximum for 32-bit only capable devices */ - if (IS_ENABLED(CONFIG_ZONE_DMA)) + if (IS_ENABLED(CONFIG_ZONE_DMA)) { dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1; + /* + * If platform doesn't have DRAM within the dma_phys_limit, + * remove the limit altogether. This allows one kernel (with + * CONFIG_ZONE_DMA defined) to support platforms with 32-bit + * only devices and platforms with no 32-bit DRAM. + */ + if (dma_phys_limit <= memblock_start_of_DRAM()) + dma_phys_limit = 0; + } dma_contiguous_reserve(dma_phys_limit); memblock_allow_resize();