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: 32317 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 06CF02055C for ; Mon, 23 Jun 2014 05:06:15 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf24907570pab.11 for ; Sun, 22 Jun 2014 22:06:14 -0700 (PDT) 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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=fVQSOV4ZE0KMsUPoQ3lWRIskhOpQF9hBZp4WbpT67iM=; b=Ygdpn5yQeo0g/5MtIIqEP6lNMRNpkiTqIODFNMjzbzaVEp56pIbOnzcog+kRMaKLat ayBXV+L4svY56ZxEPVdRsOJAeuA+iudqhxcWMqwgLqv/A74ntLEEsz3MfUEjsMhH0c9b MTHfPHjMOo+Z2wQ0HXgdVVIu9leoFOit83Hrpcz/BIdh++EbUOGyqn5nwF1MTfZIoIfR yzBvMVlN8MWnLpGmeLTU234mD0bzpJsaVokdDMzRhiB2b0HkF1weVDaiiOWoJUPNWf1r 8/Bg9+au+iBFbUcYLWSaebf7tPXBAIrDle9ZdLuOvFhlPnsuatL96n8TZqA79rvRK71+ SHyg== X-Gm-Message-State: ALoCoQnmEv5KKtEZhWcMVcSARQu5NNM7I1zbfYBKnCnEKUKGTg5HFDjUjpQpR1TxmDCIG+Tm2ueX X-Received: by 10.66.119.172 with SMTP id kv12mr7532234pab.31.1403499974410; Sun, 22 Jun 2014 22:06:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.178 with SMTP id w47ls1761931qge.55.gmail; Sun, 22 Jun 2014 22:06:14 -0700 (PDT) X-Received: by 10.220.161.8 with SMTP id p8mr17042392vcx.4.1403499974302; Sun, 22 Jun 2014 22:06:14 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id vu1si8378918vdb.90.2014.06.22.22.06.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 22 Jun 2014 22:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id i13so5517858veh.22 for ; Sun, 22 Jun 2014 22:06:14 -0700 (PDT) X-Received: by 10.58.228.74 with SMTP id sg10mr15779534vec.6.1403499974201; Sun, 22 Jun 2014 22:06:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp105574vcb; Sun, 22 Jun 2014 22:06:13 -0700 (PDT) X-Received: by 10.68.194.229 with SMTP id hz5mr25463495pbc.91.1403499973398; Sun, 22 Jun 2014 22:06:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rl10si20092320pbc.161.2014.06.22.22.06.12; Sun, 22 Jun 2014 22:06:12 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751559AbaFWFGJ (ORCPT + 10 others); Mon, 23 Jun 2014 01:06:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53244 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751144AbaFWFGG (ORCPT ); Mon, 23 Jun 2014 01:06:06 -0400 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Salter 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: msalter@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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();