From: Catalin Marinas <catalin.marinas@arm.com> To: Tanmay Inamdar <tinamdar@apm.com> Cc: Liviu Dudau <Liviu.Dudau@arm.com>, Bjorn Helgaas <bhelgaas@google.com>, Arnd Bergmann <arnd@arndb.de>, Jason Gunthorpe <jgunthorpe@obsidianresearch.com>, "grant.likely@linaro.org" <grant.likely@linaro.org>, Rob Herring <robh+dt@kernel.org>, Rob Landley <rob@landley.net>, "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "patches@apm.com" <patches@apm.com>, "jcm@redhat.com" <jcm@redhat.com> Subject: Re: [PATCH v8 1/4] pci:host: APM X-Gene PCIe host controller driver Date: Wed, 17 Sep 2014 17:03:39 +0100 [thread overview] Message-ID: <20140917160337.GA15261@e104818-lin.cambridge.arm.com> (raw) In-Reply-To: <CACoXjckWYhe=PpWE+xYSC9Q72FyAq__3uUh2gGeGtgpC5SrpzQ@mail.gmail.com> On Tue, Sep 16, 2014 at 09:02:11PM +0100, Tanmay Inamdar wrote: > On Fri, Sep 12, 2014 at 2:18 AM, Liviu Dudau <Liviu.Dudau@arm.com> 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 <tinamdar@apm.com> > > > > It looks good to me now. You can add if you care: > > > > Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com> > > 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): 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; 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. -- Catalin
WARNING: multiple messages have this Message-ID (diff)
From: catalin.marinas@arm.com (Catalin Marinas) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v8 1/4] pci:host: APM X-Gene PCIe host controller driver Date: Wed, 17 Sep 2014 17:03:39 +0100 [thread overview] Message-ID: <20140917160337.GA15261@e104818-lin.cambridge.arm.com> (raw) In-Reply-To: <CACoXjckWYhe=PpWE+xYSC9Q72FyAq__3uUh2gGeGtgpC5SrpzQ@mail.gmail.com> On Tue, Sep 16, 2014 at 09:02:11PM +0100, Tanmay Inamdar wrote: > On Fri, Sep 12, 2014 at 2:18 AM, Liviu Dudau <Liviu.Dudau@arm.com> 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 <tinamdar@apm.com> > > > > It looks good to me now. You can add if you care: > > > > Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com> > > 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): 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; 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. -- Catalin
next prev parent reply other threads:[~2014-09-17 16:04 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-11 22:57 [PATCH v8 0/4] APM X-Gene PCIe host controller Tanmay Inamdar 2014-09-11 22:57 ` Tanmay Inamdar 2014-09-11 22:57 ` [PATCH v8 1/4] pci:host: APM X-Gene PCIe host controller driver Tanmay Inamdar 2014-09-11 22:57 ` Tanmay Inamdar 2014-09-12 9:18 ` Liviu Dudau 2014-09-12 9:18 ` Liviu Dudau 2014-09-12 9:18 ` Liviu Dudau 2014-09-16 20:02 ` Tanmay Inamdar 2014-09-16 20:02 ` Tanmay Inamdar 2014-09-16 20:02 ` Tanmay Inamdar 2014-09-16 21:17 ` Liviu Dudau 2014-09-16 21:17 ` Liviu Dudau 2014-09-16 21:17 ` Liviu Dudau 2014-09-16 22:14 ` Tanmay Inamdar 2014-09-16 22:14 ` Tanmay Inamdar 2014-09-16 22:14 ` Tanmay Inamdar 2014-09-16 22:14 ` Tanmay Inamdar 2014-09-17 16:03 ` Catalin Marinas [this message] 2014-09-17 16:03 ` Catalin Marinas 2014-09-17 16:03 ` Catalin Marinas 2014-09-17 16:18 ` Jon Masters 2014-09-17 16:18 ` Jon Masters 2014-09-19 0:21 ` Jon Masters 2014-09-19 0:21 ` Jon Masters 2014-09-19 0:21 ` Jon Masters 2014-09-11 22:57 ` [PATCH v8 2/4] arm64: dts: APM X-Gene PCIe device tree nodes Tanmay Inamdar 2014-09-11 22:57 ` Tanmay Inamdar 2014-09-11 22:57 ` Tanmay Inamdar 2014-09-11 22:57 ` [PATCH v8 3/4] dt-bindings: pci: xgene pcie device tree bindings Tanmay Inamdar 2014-09-11 22:57 ` Tanmay Inamdar 2014-09-11 22:57 ` [PATCH v8 4/4] MAINTAINERS: entry for APM X-Gene PCIe host driver Tanmay Inamdar 2014-09-11 22:57 ` Tanmay Inamdar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20140917160337.GA15261@e104818-lin.cambridge.arm.com \ --to=catalin.marinas@arm.com \ --cc=Liviu.Dudau@arm.com \ --cc=arnd@arndb.de \ --cc=bhelgaas@google.com \ --cc=devicetree@vger.kernel.org \ --cc=grant.likely@linaro.org \ --cc=jcm@redhat.com \ --cc=jgunthorpe@obsidianresearch.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-doc@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pci@vger.kernel.org \ --cc=patches@apm.com \ --cc=rob@landley.net \ --cc=robh+dt@kernel.org \ --cc=tinamdar@apm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.