linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Walmsley <paul.walmsley@sifive.com>
To: Alistair Francis <alistair23@gmail.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Revert "of/device: Really only set bus DMA mask when appropriate"
Date: Thu, 28 Feb 2019 15:04:35 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.21.9999.1902281452270.17965@viisi.sifive.com> (raw)
In-Reply-To: <CAKmqyKND0ruL+cTLoMzV2oG5BOdHDzAzWkKrW5eqLAP2Q6smvQ@mail.gmail.com>

On Thu, 28 Feb 2019, Alistair Francis wrote:

> On Thu, Feb 28, 2019 at 2:39 PM Paul Walmsley <paul.walmsley@sifive.com> wrote:
> > On Thu, 28 Feb 2019, Alistair Francis wrote:
> > > This reverts commit 6778be4e520959659b27a441c06a84c9cb009085.
> > >
> > > Reverting the commit fixes these error messages and an non-functioning
> > > USB bus when attaching a USB to PCIe card to a RISC-V board:
> > >     xhci_hcd 0000:03:00.0: Host took too long to start, waited 16000 microseconds.
> > >     xhci_hcd 0000:03:00.0: startup error -19
> > >     xhci_hcd 0000:03:00.0: USB bus 2 deregistered
> > >     xhci_hcd 0000:03:00.0: WARNING: Host System Error
> > >     xhci_hcd 0000:03:00.0: remove, state 1
> > >
> > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > ---
> > > I'm not sure if this is the correct fix, it's possible something else is
> > > wrong, but I wanted to get some feedback.
> > >
> > > drivers/of/device.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/of/device.c b/drivers/of/device.c
> > > index 3717f2a20d0d..8299f8055da7 100644
> > > --- a/drivers/of/device.c
> > > +++ b/drivers/of/device.c
> > > @@ -149,11 +149,9 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma)
> > >        * set by the driver.
> > >        */
> > >       mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1);
> > > +     dev->bus_dma_mask = mask;
> > >       dev->coherent_dma_mask &= mask;
> > >       *dev->dma_mask &= mask;
> > > -     /* ...but only set bus mask if we found valid dma-ranges earlier */
> >
> > Does the DT data for the PCIe controller that you're using contain a
> > dma-ranges node?
> 
> Ah, no it does not. It only has ranges and bus-range [1].
> 
> Any idea what the dma-ranges should be?
> 
> 1: https://github.com/riscv/opensbi/blob/master/platform/sifive/fu540/HiFiveUnleashed-MicroSemi-Expansion.dts#L407

Not off the top of my head, but this may help:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/booting-without-of.txt#n1389

You might also consider grepping through existing DT data for examples of 
dma-ranges usage.

N.B., I have no direct knowledge of this, but have been told that some of 
the MicroSemi PCIe controllers can only bus-master into a 32-bit region.  
If this is a MicroSemi controller, that would need to be reflected in 
dma-ranges.


- Paul

  reply	other threads:[~2019-02-28 23:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 22:33 [PATCH] Revert "of/device: Really only set bus DMA mask when appropriate" Alistair Francis
2019-02-28 22:39 ` Paul Walmsley
2019-02-28 22:41   ` Alistair Francis
2019-02-28 23:04     ` Paul Walmsley [this message]
2019-02-28 22:42 ` Robin Murphy
2019-07-10 22:27   ` Alistair Francis
2019-07-11 11:01     ` Robin Murphy
2019-07-11 18:05       ` Alistair Francis

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=alpine.DEB.2.21.9999.1902281452270.17965@viisi.sifive.com \
    --to=paul.walmsley@sifive.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=robh@kernel.org \
    --cc=robin.murphy@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;
as well as URLs for NNTP newsgroup(s).