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: 4925171 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 260C4BEEA5 for ; Wed, 17 Sep 2014 16:04:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C97112017D for ; Wed, 17 Sep 2014 16:04:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6AF4A2015D for ; Wed, 17 Sep 2014 16:04:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755408AbaIQQEM (ORCPT ); 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 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 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;