All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
	Russell King <linux@arm.linux.org.uk>,
	linux-sh@vger.kernel.org,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Magnus Damm <damm@opensource.se>, Ben Dooks <ben-linux@fluff.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Simon Horman <horms+renesas@verge.net.au>
Subject: Re: DMABOUNCE in pci-rcar
Date: Thu, 20 Mar 2014 18:25:25 +0100	[thread overview]
Message-ID: <532B2485.6010005@codethink.co.uk> (raw)
In-Reply-To: <4884083.IuNl44Y6XD@wuerfel>

On 20/03/14 17:41, Arnd Bergmann wrote:
> On Thursday 20 March 2014 17:12:43 Ben Dooks wrote:
>> On 20/03/14 17:09, Arnd Bergmann wrote:
>>> On Thursday 20 March 2014 16:04:36 Ben Dooks wrote:
>
>>>> As a note, if we now boot a Lager with DT on 3.14-rc3 series the USB
>>>> controllers no longer work with full 2GiB RAM enabled in the device
>>>> tree.
>>>
>>> Did it work before these patches got applied initially?
>>
>> It did, but I cannot remember if we where limiting DRAM to 1GiB
>> or not.
>
> I would assume you did, or you happened to never actually use
> memory higher than that for DMA during tests.
>
>>>> Could we work around this by having 1GiB of memory defined in the
>>>> 32bit memory and then add the rest of the 3GiB from the >32bit
>>>> area via LPAE? Will the kernel ever try to allocate DMA memory from
>>>> anything >32bit?
>>>
>>> You can solve the case for dma_alloc_coherent() this way, or by
>>> setting the mask correctly. It won't help you for dma_map_* though,
>>> which still requires someone to add support for swiotlb or using
>>> an IOMMU if present.
>>
>> We do not have an IOMMU present at the moment. Not sure how
>> to go about setting a mask on a pci-probed device.
>
> Ah, right. The mask is a problem because PCI devices assume that
> they can do DMA to any 32-bit masked address without calling
> dma_set_mask. Your trick to describe the system memory at a different
> physical alias would solve this part. Another option might be to
> add a quirk in the OHCI/EHCI drivers, if you are able to detect
> this special case from the PCI IDs. Whether we can allow the PCI host
> controller to just set a mask is an open question. If we decide to go
> that route, you should be able to do it using the add_bus() callback
> in the host controller driver. However, it would be a departure from
> the normal way of doing PCI DMA, and I can't foresee what the implications
> would be.

So doing:

static void pci_rcar_fixup(struct pci_dev *dev)
{
	if (dev->bus->ops == &rcar_pci_ops) {
		dev_info(&dev->dev, "applying new dma mask\n");
		dev->dma_mask = DMA_BIT_MASK(31);
	}
}

DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pci_rcar_fixup);

Did not work for me :(

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

WARNING: multiple messages have this Message-ID (diff)
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: DMABOUNCE in pci-rcar
Date: Thu, 20 Mar 2014 17:25:25 +0000	[thread overview]
Message-ID: <532B2485.6010005@codethink.co.uk> (raw)
In-Reply-To: <4884083.IuNl44Y6XD@wuerfel>

On 20/03/14 17:41, Arnd Bergmann wrote:
> On Thursday 20 March 2014 17:12:43 Ben Dooks wrote:
>> On 20/03/14 17:09, Arnd Bergmann wrote:
>>> On Thursday 20 March 2014 16:04:36 Ben Dooks wrote:
>
>>>> As a note, if we now boot a Lager with DT on 3.14-rc3 series the USB
>>>> controllers no longer work with full 2GiB RAM enabled in the device
>>>> tree.
>>>
>>> Did it work before these patches got applied initially?
>>
>> It did, but I cannot remember if we where limiting DRAM to 1GiB
>> or not.
>
> I would assume you did, or you happened to never actually use
> memory higher than that for DMA during tests.
>
>>>> Could we work around this by having 1GiB of memory defined in the
>>>> 32bit memory and then add the rest of the 3GiB from the >32bit
>>>> area via LPAE? Will the kernel ever try to allocate DMA memory from
>>>> anything >32bit?
>>>
>>> You can solve the case for dma_alloc_coherent() this way, or by
>>> setting the mask correctly. It won't help you for dma_map_* though,
>>> which still requires someone to add support for swiotlb or using
>>> an IOMMU if present.
>>
>> We do not have an IOMMU present at the moment. Not sure how
>> to go about setting a mask on a pci-probed device.
>
> Ah, right. The mask is a problem because PCI devices assume that
> they can do DMA to any 32-bit masked address without calling
> dma_set_mask. Your trick to describe the system memory at a different
> physical alias would solve this part. Another option might be to
> add a quirk in the OHCI/EHCI drivers, if you are able to detect
> this special case from the PCI IDs. Whether we can allow the PCI host
> controller to just set a mask is an open question. If we decide to go
> that route, you should be able to do it using the add_bus() callback
> in the host controller driver. However, it would be a departure from
> the normal way of doing PCI DMA, and I can't foresee what the implications
> would be.

So doing:

static void pci_rcar_fixup(struct pci_dev *dev)
{
	if (dev->bus->ops = &rcar_pci_ops) {
		dev_info(&dev->dev, "applying new dma mask\n");
		dev->dma_mask = DMA_BIT_MASK(31);
	}
}

DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pci_rcar_fixup);

Did not work for me :(

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

WARNING: multiple messages have this Message-ID (diff)
From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: DMABOUNCE in pci-rcar
Date: Thu, 20 Mar 2014 18:25:25 +0100	[thread overview]
Message-ID: <532B2485.6010005@codethink.co.uk> (raw)
In-Reply-To: <4884083.IuNl44Y6XD@wuerfel>

On 20/03/14 17:41, Arnd Bergmann wrote:
> On Thursday 20 March 2014 17:12:43 Ben Dooks wrote:
>> On 20/03/14 17:09, Arnd Bergmann wrote:
>>> On Thursday 20 March 2014 16:04:36 Ben Dooks wrote:
>
>>>> As a note, if we now boot a Lager with DT on 3.14-rc3 series the USB
>>>> controllers no longer work with full 2GiB RAM enabled in the device
>>>> tree.
>>>
>>> Did it work before these patches got applied initially?
>>
>> It did, but I cannot remember if we where limiting DRAM to 1GiB
>> or not.
>
> I would assume you did, or you happened to never actually use
> memory higher than that for DMA during tests.
>
>>>> Could we work around this by having 1GiB of memory defined in the
>>>> 32bit memory and then add the rest of the 3GiB from the >32bit
>>>> area via LPAE? Will the kernel ever try to allocate DMA memory from
>>>> anything >32bit?
>>>
>>> You can solve the case for dma_alloc_coherent() this way, or by
>>> setting the mask correctly. It won't help you for dma_map_* though,
>>> which still requires someone to add support for swiotlb or using
>>> an IOMMU if present.
>>
>> We do not have an IOMMU present at the moment. Not sure how
>> to go about setting a mask on a pci-probed device.
>
> Ah, right. The mask is a problem because PCI devices assume that
> they can do DMA to any 32-bit masked address without calling
> dma_set_mask. Your trick to describe the system memory at a different
> physical alias would solve this part. Another option might be to
> add a quirk in the OHCI/EHCI drivers, if you are able to detect
> this special case from the PCI IDs. Whether we can allow the PCI host
> controller to just set a mask is an open question. If we decide to go
> that route, you should be able to do it using the add_bus() callback
> in the host controller driver. However, it would be a departure from
> the normal way of doing PCI DMA, and I can't foresee what the implications
> would be.

So doing:

static void pci_rcar_fixup(struct pci_dev *dev)
{
	if (dev->bus->ops == &rcar_pci_ops) {
		dev_info(&dev->dev, "applying new dma mask\n");
		dev->dma_mask = DMA_BIT_MASK(31);
	}
}

DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pci_rcar_fixup);

Did not work for me :(

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

  reply	other threads:[~2014-03-20 17:25 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 11:00 DMABOUNCE in pci-rcar Arnd Bergmann
2014-02-24 11:00 ` Arnd Bergmann
2014-02-24 11:00 ` Arnd Bergmann
2014-02-24 23:49 ` Magnus Damm
2014-02-24 23:49   ` Magnus Damm
2014-02-24 23:49   ` Magnus Damm
2014-02-25  0:17   ` Russell King - ARM Linux
2014-02-25  0:17     ` Russell King - ARM Linux
2014-02-25  0:17     ` Russell King - ARM Linux
2014-02-25  2:00     ` Magnus Damm
2014-02-25  2:00       ` Magnus Damm
2014-02-25  2:00       ` Magnus Damm
2014-02-25 15:44       ` Arnd Bergmann
2014-02-25 15:44         ` Arnd Bergmann
2014-02-25 15:44         ` Arnd Bergmann
2014-02-25 12:15   ` Arnd Bergmann
2014-02-25 12:15     ` Arnd Bergmann
2014-02-25 12:15     ` Arnd Bergmann
2014-02-26 19:48 ` Bjorn Helgaas
2014-02-26 19:48   ` Bjorn Helgaas
2014-02-26 19:48   ` Bjorn Helgaas
2014-02-26 19:57   ` Arnd Bergmann
2014-02-26 19:57     ` Arnd Bergmann
2014-02-26 19:57     ` Arnd Bergmann
2014-02-26 21:02     ` Bjorn Helgaas
2014-02-26 21:02       ` Bjorn Helgaas
2014-02-26 21:02       ` Bjorn Helgaas
2014-02-26 21:52       ` Arnd Bergmann
2014-02-26 21:52         ` Arnd Bergmann
2014-02-26 21:52         ` Arnd Bergmann
2014-03-20 15:04     ` Ben Dooks
2014-03-20 15:04       ` Ben Dooks
2014-03-20 15:04       ` Ben Dooks
2014-03-20 15:26       ` Russell King - ARM Linux
2014-03-20 15:26         ` Russell King - ARM Linux
2014-03-20 15:26         ` Russell King - ARM Linux
2014-03-20 15:36         ` Ben Dooks
2014-03-20 15:36           ` Ben Dooks
2014-03-20 15:36           ` Ben Dooks
2014-03-20 16:09       ` Arnd Bergmann
2014-03-20 16:09         ` Arnd Bergmann
2014-03-20 16:09         ` Arnd Bergmann
2014-03-20 16:12         ` Ben Dooks
2014-03-20 16:12           ` Ben Dooks
2014-03-20 16:12           ` Ben Dooks
2014-03-20 16:41           ` Arnd Bergmann
2014-03-20 16:41             ` Arnd Bergmann
2014-03-20 16:41             ` Arnd Bergmann
2014-03-20 17:25             ` Ben Dooks [this message]
2014-03-20 17:25               ` Ben Dooks
2014-03-20 17:25               ` Ben Dooks
2014-03-20 17:31               ` Jason Gunthorpe
2014-03-20 17:31                 ` Jason Gunthorpe
2014-03-20 17:31                 ` Jason Gunthorpe
2014-03-20 17:32                 ` Ben Dooks
2014-03-20 17:32                   ` Ben Dooks
2014-03-20 17:32                   ` Ben Dooks
2014-03-20 18:29                   ` Arnd Bergmann
2014-03-20 18:29                     ` Arnd Bergmann
2014-03-20 18:29                     ` Arnd Bergmann
2014-03-20 18:39                     ` Russell King - ARM Linux
2014-03-20 18:39                       ` Russell King - ARM Linux
2014-03-20 18:39                       ` Russell King - ARM Linux
2014-03-20 19:04                       ` Geert Uytterhoeven
2014-03-20 19:04                         ` Geert Uytterhoeven
2014-03-20 19:04                         ` Geert Uytterhoeven
2014-03-20 22:11                       ` Arnd Bergmann
2014-03-20 22:11                         ` Arnd Bergmann
2014-03-20 22:11                         ` Arnd Bergmann
2014-03-20 22:50                         ` Russell King - ARM Linux
2014-03-20 22:50                           ` Russell King - ARM Linux
2014-03-20 22:50                           ` Russell King - ARM Linux

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=532B2485.6010005@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=arnd@arndb.de \
    --cc=ben-linux@fluff.org \
    --cc=bhelgaas@google.com \
    --cc=damm@opensource.se \
    --cc=horms+renesas@verge.net.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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 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.