From patchwork Fri May 16 17:40:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 30342 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 57FF7202E4 for ; Fri, 16 May 2014 17:41:08 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id lc6sf17876514vcb.7 for ; Fri, 16 May 2014 10:41:08 -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:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:user-agent:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-disposition; bh=e+50ngTQQvwjvgQpGNZ5Mfm5LZc5YqkI0lLYFDHSORE=; b=EO3PRWNUBuR4EL9gRAi97iezL9MjL+D7Ps0RBr0JY3jeD5mCMJWH99bFPIuSUc9sIc jPqr7FMDJHJ5UmQ7wucBYClYMLApOr5Y43CwRMn1VTIiZn+AlsnjByHJaQlA6lf2YZVa dTIi2aX7JW87r+Q7uIctrG5HiDK+rjkjnMuZZOV+2LcnDwNYEat9d+IFMiplYa8ELb3w ReG4oPdEo/RXIl69+evxoWmN6FtwJ2r1gOeTWDuYSYz6EXfPfZDNiXb2vGTiwG2bSkNi /Ff2uYBQMknP9wVhVAeGg1dj9f8e8KLbtfXmZRULra1XA8B3w7YmDnboy90EB820nH4s 0jTA== X-Gm-Message-State: ALoCoQlNJfuze0lGT2eooyDJc4kQohgJuXxhe6K5GJPs6rSeiUMaTi79Bcwg9+kPBPJousIbnVTQ X-Received: by 10.236.206.15 with SMTP id k15mr7656446yho.44.1400262068065; Fri, 16 May 2014 10:41:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.209 with SMTP id x75ls841130qgx.46.gmail; Fri, 16 May 2014 10:41:07 -0700 (PDT) X-Received: by 10.221.50.70 with SMTP id vd6mr1437054vcb.51.1400262067848; Fri, 16 May 2014 10:41:07 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id iq2si1751723veb.181.2014.05.16.10.41.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 10:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id hq16so6559419vcb.23 for ; Fri, 16 May 2014 10:41:07 -0700 (PDT) X-Received: by 10.52.15.226 with SMTP id a2mr1185802vdd.69.1400262067757; Fri, 16 May 2014 10:41:07 -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.220.221.72 with SMTP id ib8csp71435vcb; Fri, 16 May 2014 10:41:07 -0700 (PDT) X-Received: by 10.66.161.69 with SMTP id xq5mr22909676pab.62.1400262066290; Fri, 16 May 2014 10:41:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yi3si4924990pbb.355.2014.05.16.10.41.05; Fri, 16 May 2014 10:41:05 -0700 (PDT) Received-SPF: none (google.com: linux-usb-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 S1757886AbaEPRlD (ORCPT + 3 others); Fri, 16 May 2014 13:41:03 -0400 Received: from fw-tnat.austin.arm.com ([217.140.110.23]:29544 "EHLO collaborate-mta1.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752032AbaEPRlC (ORCPT ); Fri, 16 May 2014 13:41:02 -0400 Received: from arm.com (e102109-lin.cambridge.arm.com [10.1.203.182]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id CF25913FA3E; Fri, 16 May 2014 12:40:48 -0500 (CDT) Date: Fri, 16 May 2014 18:40:09 +0100 From: Catalin Marinas To: "Jon Medhurst (Tixy)" Cc: Liviu Dudau , "linaro-kernel@lists.linaro.org" , Mark Brown , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , Mark Brown , Alan Stern Subject: Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64 Message-ID: <20140516174009.GB11276@arm.com> References: <20140515151744.GC967@e106497-lin.cambridge.arm.com> <20140515165353.GE967@e106497-lin.cambridge.arm.com> <20140516125501.GA6531@arm.com> <1400260125.2729.25.camel@linaro1.home> MIME-Version: 1.0 In-Reply-To: <1400260125.2729.25.camel@linaro1.home> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: catalin.marinas@arm.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.178 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: , Content-Disposition: inline On Fri, May 16, 2014 at 06:08:45PM +0100, Jon Medhurst (Tixy) wrote: > On Fri, 2014-05-16 at 13:55 +0100, Catalin Marinas wrote: > [...] > > > It could if arm64 would restrict the DMA addresses to 32-bit, but it doesn't > > > and I end up on my platform with USB DMA buffers allocated >4GB address. > > > > dma_alloc_coherent() on arm64 should return 32-bit addresses if the > > coherent_dma_mask is set to 32-bit. > > Not if you have CONFIG_DMA_CMA. Unless I have misread the code, enabling > CMA means memory comes from a common pool carved out at boot with no way > for drivers to specify it's restrictions [1]. It's what I've spent most > of the week trying to work around in a clean way, and have finally given > up. The easiest "hack" would be to pass a limit dma_contiguous_reserve() in arm64_memblock_init(), something like this: probably with a check for IS_ENABLED(CONFIG_ZONE_DMA) (we do this for swiotlb initialisation). At some point, if we have some system topology description we could decide whether we need to limit the above based on the dma coherent masks. diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 51d5352e6ad5..558434c69612 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -162,7 +162,7 @@ void __init arm64_memblock_init(void) } early_init_fdt_scan_reserved_mem(); - dma_contiguous_reserve(0); + dma_contiguous_reserve(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1); memblock_allow_resize(); memblock_dump_all();