From patchwork Wed Sep 17 16:03:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 37526 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4562C2057E for ; Wed, 17 Sep 2014 16:04:18 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf1003131lbd.7 for ; Wed, 17 Sep 2014 09:04:17 -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=1fr+9T8WWXJt9iuqgyzMG3DZWcijox3WrzAUEjutT3U=; b=mjr/NSdBZG/5G5Q5jGTSHOS2gkXMpQkOPPjJ8AOvFA5aETZO/bfefE+XjA8d4FRUeg OoiLA3WPdGDi2EYGtfP4icB2ma1OIKaizINwKPclLTv98sTVJUlq2eVlwKaY/xGmrCm0 gCENiZF4WoPmMQaM3ZvaWiaO+dtGstP2nT7MonP2g3esy9o1F6zRyiKUcXmBIg60pGoV MQgTppjkeQd0BgV7wj6+OGOGixBDWOoo3UBbqdmOA5Y8aUTlLk6tD8hSzFkyBdIU+1Ww RsIYXu5qA4QlcDYoBpBV22NYdq85LkVPkpZ+xlkqbP8ekL/cyMGEImcWRYwvpj/UfpUj 8wIA== X-Gm-Message-State: ALoCoQnNuakAIqrwzJG3E3fAOm8YY5g9+IJtqN1NgprvIUOCZBA1bpzXgNAbIizW4dA6T/kWtHWo X-Received: by 10.112.126.226 with SMTP id nb2mr103267lbb.3.1410969857002; Wed, 17 Sep 2014 09:04:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.18 with SMTP id js18ls136623lab.69.gmail; Wed, 17 Sep 2014 09:04:16 -0700 (PDT) X-Received: by 10.112.161.70 with SMTP id xq6mr43280293lbb.49.1410969856863; Wed, 17 Sep 2014 09:04:16 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by mx.google.com with ESMTPS id x5si7646626lal.109.2014.09.17.09.04.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 09:04:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id s18so2194006lam.28 for ; Wed, 17 Sep 2014 09:04:16 -0700 (PDT) X-Received: by 10.112.53.230 with SMTP id e6mr3983659lbp.100.1410969855437; Wed, 17 Sep 2014 09:04:15 -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.112.130.169 with SMTP id of9csp606862lbb; Wed, 17 Sep 2014 09:04:14 -0700 (PDT) X-Received: by 10.70.9.129 with SMTP id z1mr72197383pda.37.1410969853660; Wed, 17 Sep 2014 09:04:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fp4si35743462pdb.14.2014.09.17.09.04.13 for ; Wed, 17 Sep 2014 09:04:13 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S1755391AbaIQQEM (ORCPT + 5 others); Wed, 17 Sep 2014 12:04:12 -0400 Received: from foss-mx-na.foss.arm.com ([217.140.108.86]:33766 "EHLO foss-mx-na.foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755347AbaIQQEL (ORCPT ); Wed, 17 Sep 2014 12:04:11 -0400 Received: from foss-smtp-na-1.foss.arm.com (unknown [10.80.61.8]) by foss-mx-na.foss.arm.com (Postfix) with ESMTP id 5ACCD68; Wed, 17 Sep 2014 11:03:56 -0500 (CDT) Received: from collaborate-mta1.arm.com (highbank-bc01-b06.austin.arm.com [10.112.81.134]) by foss-smtp-na-1.foss.arm.com (Postfix) with ESMTP id 43D4D5FADE; Wed, 17 Sep 2014 11:03:44 -0500 (CDT) Received: from e104818-lin.cambridge.arm.com (e104818-lin.cambridge.arm.com [10.1.203.37]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id EC25513F83E; Wed, 17 Sep 2014 11:03:41 -0500 (CDT) Date: Wed, 17 Sep 2014 17:03:39 +0100 From: Catalin Marinas To: Tanmay Inamdar Cc: Liviu Dudau , Bjorn Helgaas , Arnd Bergmann , Jason Gunthorpe , "grant.likely@linaro.org" , Rob Herring , Rob Landley , "linux-pci@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "patches@apm.com" , "jcm@redhat.com" Subject: Re: [PATCH v8 1/4] pci:host: APM X-Gene PCIe host controller driver Message-ID: <20140917160337.GA15261@e104818-lin.cambridge.arm.com> References: <1410476266-29426-1-git-send-email-tinamdar@apm.com> <1410476266-29426-2-git-send-email-tinamdar@apm.com> <20140912091816.GU27864@e106497-lin.cambridge.arm.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.215.41 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 Tue, Sep 16, 2014 at 09:02:11PM +0100, Tanmay Inamdar wrote: > On Fri, Sep 12, 2014 at 2:18 AM, Liviu Dudau wrote: > > On Thu, Sep 11, 2014 at 11:57:43PM +0100, Tanmay Inamdar wrote: > >> This patch adds the AppliedMicro X-Gene SOC PCIe host controller driver. > >> X-Gene PCIe controller supports maximum up to 8 lanes and GEN3 speed. > >> X-Gene SOC supports maximum 5 PCIe ports. > >> > >> Signed-off-by: Tanmay Inamdar > > > > It looks good to me now. You can add if you care: > > > > Reviewed-by: Liviu Dudau > > I will have to send another version of patch as I forgot to add > 'dma-coherent' in device tree entry. > > Secondly I see that setting 'dma-coherent' in device tree node sets > coherent_dma_ops for the root bus but for the endpoint another 'dev' > gets assigned. This causes endpoint to use non-coherent dma apis > causing failure in dma operations. For PCIe, setting dma-coherent in the DT nodes wouldn't have any effect yet. We have of_dma_configure() being called for platform devices but it won't work for PCIe which are probed at run-time (nor for AMBA which require an additional patch). So for arm64 currently we have some hooks in dma-mapping.c to intercept when a device is added to a bus. What I need to do though is check recursively whether the parent (bus) had the 'dma-coherent' property (pointed out by Jon). I think something like this would do (not tested): After this, we need to a bus notifier for PCIe as well. Since I don't think we have an of_node for a PCI device, we would need to check recursively on the parent device rather than the parent node until we find an OF node with the 'dma-coherent' property. diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 4164c5ace9f8..638475378f94 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -316,7 +316,7 @@ static int dma_bus_notifier(struct notifier_block *nb, if (event != BUS_NOTIFY_ADD_DEVICE) return NOTIFY_DONE; - if (of_property_read_bool(dev->of_node, "dma-coherent")) + if (of_dma_is_coherent(dev->of_node)) set_dma_ops(dev, &coherent_swiotlb_dma_ops); return NOTIFY_OK;