public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Murali Karicheri <m-karicheri2@ti.com>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, grant.likely@linaro.org,
	robh+dt@kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, will.deacon@arm.com
Subject: Re: [RFC v1 PATCH 1/2] of/pci: add of_pci_dma_configure() update dma configuration
Date: Mon, 22 Dec 2014 23:44:52 +0100	[thread overview]
Message-ID: <1723662.JYr5muIJha@wuerfel> (raw)
In-Reply-To: <54989DDE.3060409@ti.com>

On Monday 22 December 2014 17:40:30 Murali Karicheri wrote:
> On 12/22/2014 05:24 PM, Arnd Bergmann wrote:
> > On Monday 22 December 2014 16:40:43 Murali Karicheri wrote:
> >>>> +++ b/arch/arm/mm/dma-mapping.c
> >>>> @@ -2052,9 +2052,10 @@ void arch_setup_dma_ops(struct device *dev, u64
> >>>> dma_base, u64 size,
> >>>>                            struct iommu_ops *iommu, bool coherent)
> >>>>     {
> >>>>            struct dma_map_ops *dma_ops;
> >>>> +       u64 temp_size = min((*(dev->dma_mask) + 1), size);
> >>>>
> >>>>            dev->archdata.dma_coherent = coherent;
> >>>> -       if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu))
> >>>> +       if (arm_setup_iommu_dma_ops(dev, dma_base, temp_size, iommu))
> >>>>
> >>>> If you agree, I will post v1 of the patch with these updates. Let me
> >>>> know. I did some basic tests on Keystone with these changes and it works
> >>>> fine.
> >>>
> >>> It's not exactly what I meant. My main point was that we need to limit
> >>> dev->dma_mask to (size-1) here, but you are not touching that.
> >>
> >> if you mean overriding the dev->dma_mask to min((*dev->dma_mask),
> >> size-1), then I am getting the error "Coherent DMA mask 0x7fffffff (pfn
> >> 0x780000-0x800000) covers a smaller range of system memory than the DMA
> >> zone pfn 0x0-0x880000) when the devices on Keystone tries to set the dma
> >> mask. Something wrong and I need to look into the code.
> >
> > Right, it sounds like the offset was applied incorrectly at some point.
> >
> > What are the DMA zone size and the phys-offset?
> 2G and 0x8_0000_0000. This limit the usable DMA size to 2G on Keystone, 
> I believe you shouldn't be limiting the dma mask to size-1 in this case, 
> right? The DT setup the dma-range to have a size of 2G (0x80000000).

No, the problem is something else: the pfn range that we calculate for the
coherent DMA mask should have been 0x800000-0x880000, not 0x780000-0x800000,
so we would exactly match the ZONE_DMA.

	Arnd

  reply	other threads:[~2014-12-22 22:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 22:07 [RFC v1 PATCH 0/2] PCI: get DMA configuration from parent device Murali Karicheri
2014-12-18 22:07 ` [RFC v1 PATCH 1/2] of/pci: add of_pci_dma_configure() update dma configuration Murali Karicheri
2014-12-18 22:29   ` Arnd Bergmann
2014-12-22 17:46     ` Murali Karicheri
2014-12-22 19:43       ` Arnd Bergmann
2014-12-22 21:40         ` Murali Karicheri
2014-12-22 22:24           ` Arnd Bergmann
2014-12-22 22:40             ` Murali Karicheri
2014-12-22 22:44               ` Arnd Bergmann [this message]
2014-12-22 23:07                 ` Arnd Bergmann
2014-12-23 17:42                   ` Murali Karicheri
2014-12-23 22:42                     ` Arnd Bergmann
2014-12-23 22:55                       ` Murali Karicheri
2014-12-24 15:57                       ` Murali Karicheri
2014-12-18 22:07 ` [RFC v1 PATCH 2/2] PCI: update dma configuration from DT Murali Karicheri

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=1723662.JYr5muIJha@wuerfel \
    --to=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=will.deacon@arm.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox