From patchwork Mon Jun 23 05:05:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 32318 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 255522055C for ; Mon, 23 Jun 2014 05:06:29 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id dc16sf18234238qab.5 for ; Sun, 22 Jun 2014 22:06:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=WxSbsVsw3IUINKlaaYMOCixVYgy8xEDkTeYt8IaX7hQ=; b=c9H4P6oIJP6cvrpz7M9ORBxFNlfrRkBQHNoxvYr5YSzCd1SdmIDRDRhE5BZI3AHNPT EYNWrG1fM1cBGf+QARAqZq0uUn3kvmmtrmh07NgN2RNmlCCuTRkdQ7fD6gNC91X+XADZ AwZvnueQZS71UH8LsOKAcgPkB4LMVYkUrCvDl3DMYwvYyKxAKoOCFspPk6EH2pMp8DK9 nd6I2YP3lBID6Y0JBy1z3fDjXwPwBgCs1Hcd4BTiCc0AmDuVJNFU+H4Jjba4t3CW9mvY nYgOars+dBkvn1oqLzfJA2mOmVup5UpNobUK4xceJDxnNy2rQonO7wJoDk6ibtpHfBxo fVYg== X-Gm-Message-State: ALoCoQndup7ogn2ewnRLHZ+4gAac8yR6TeHNeS1YviXh7GxkKE0Fe2/1/B3YlURrgE2ngdc9Ic/O X-Received: by 10.236.136.231 with SMTP id w67mr7630765yhi.37.1403499988976; Sun, 22 Jun 2014 22:06:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.203 with SMTP id v69ls1713783qgd.6.gmail; Sun, 22 Jun 2014 22:06:28 -0700 (PDT) X-Received: by 10.58.56.71 with SMTP id y7mr17672030vep.24.1403499988855; Sun, 22 Jun 2014 22:06:28 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id t2si8394275vcs.89.2014.06.22.22.06.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 22 Jun 2014 22:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so5373901vcb.5 for ; Sun, 22 Jun 2014 22:06:28 -0700 (PDT) X-Received: by 10.58.30.15 with SMTP id o15mr1299062veh.34.1403499988741; Sun, 22 Jun 2014 22:06:28 -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 tc5csp105583vcb; Sun, 22 Jun 2014 22:06:28 -0700 (PDT) X-Received: by 10.66.218.36 with SMTP id pd4mr25576977pac.141.1403499987945; Sun, 22 Jun 2014 22:06:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zf6si20176128pab.226.2014.06.22.22.06.27; Sun, 22 Jun 2014 22:06:27 -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 S1751431AbaFWFGI (ORCPT + 10 others); Mon, 23 Jun 2014 01:06:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5370 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbaFWFGG (ORCPT ); Mon, 23 Jun 2014 01:06:06 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5N55USb005493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jun 2014 01:05:30 -0400 Received: from deneb.redhat.com (ovpn-113-76.phx2.redhat.com [10.3.113.76]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5N55Tva020722; Mon, 23 Jun 2014 01:05:29 -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: make CONFIG_ZONE_DMA user settable Date: Mon, 23 Jun 2014 01:05:24 -0400 Message-Id: <1403499924-11214-1-git-send-email-msalter@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 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.220.174 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 19e7640d1f (arm64: Replace ZONE_DMA32 with ZONE_DMA) moves support for 32-bit DMA addressing into ZONE_DMA and renames CONFIG_ZONE_DMA32 to CONFIG_ZONE_DMA. 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. These two patches pose a problem for platforms which have no 32-bit addressable DRAM. If CONFIG_ZONE_DMA is turned on for such platforms, CMA is unable to reserve a buffer for allocations. CONFIG_ZONE_DMA is not user settable however, so there is no way to turn it off without editing arch/arm64/Kconfig. Even if one edits Kconfig to turn off CONFIG_ZONE_DMA, the kernel fails to build with such a config: arch/arm64/mm/init.c: In function ‘zone_sizes_init’: arch/arm64/mm/init.c:76:13: error: ‘ZONE_DMA’ undeclared (first use in this function) zone_size[ZONE_DMA] = max_dma - min; ^ This patch makes CONFIG_ZONE_DMA user settable and fixes the kernel build when it is turned off. Signed-off-by: Mark Salter --- arch/arm64/Kconfig | 11 ++++++++--- arch/arm64/mm/init.c | 8 ++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c8b1d0b..f669597 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -99,9 +99,6 @@ config GENERIC_CSUM config GENERIC_CALIBRATE_DELAY def_bool y -config ZONE_DMA - def_bool y - config ARCH_DMA_ADDR_T_64BIT def_bool y @@ -211,6 +208,14 @@ config HOTPLUG_CPU Say Y here to experiment with turning CPUs off and on. CPUs can be controlled through /sys/devices/system/cpu. +config ZONE_DMA + bool "32-bit DMA memory allocation" + def_bool y + help + 32-bit DMA memory allocation supports devices limited to 32-bit + DMA addressing to allocate within the first 4GiB of address space. + Disable if no such devices will be used. + source kernel/Kconfig.preempt config HZ diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index f43db8a..c5415e2 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -69,12 +69,14 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) memset(zone_size, 0, sizeof(zone_size)); /* 4GB maximum for 32-bit only capable devices */ - if (IS_ENABLED(CONFIG_ZONE_DMA)) { +#ifdef CONFIG_ZONE_DMA + { unsigned long max_dma_phys = (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1); max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); zone_size[ZONE_DMA] = max_dma - min; } +#endif zone_size[ZONE_NORMAL] = max - max_dma; memcpy(zhole_size, zone_size, sizeof(zhole_size)); @@ -86,10 +88,12 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) if (start >= max) continue; - if (IS_ENABLED(CONFIG_ZONE_DMA) && start < max_dma) { +#ifdef CONFIG_ZONE_DMA + if (start < max_dma) { unsigned long dma_end = min(end, max_dma); zhole_size[ZONE_DMA] -= dma_end - start; } +#endif if (end > max_dma) { unsigned long normal_end = min(end, max);