From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] [usb] make xhci platform driver use 64 bit or 32 bit DMA
Date: Thu, 30 Oct 2014 22:05:47 +0100 [thread overview]
Message-ID: <13596133.Pde5jAKbQO@wuerfel> (raw)
In-Reply-To: <54529AFD.6040807@redhat.com>
On Thursday 30 October 2014 15:09:33 Mark Langsdorf wrote:
> On 10/30/2014 02:05 PM, Arnd Bergmann wrote:
> > On Thursday 30 October 2014 13:16:28 Mark Langsdorf wrote:
> >> - /* Initialize dma_mask and coherent_dma_mask to 32-bits */
> >> - ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> >> - if (ret)
> >> - return ret;
> >> + /* Try setting the coherent_dma_mask to 64 bits, then try 32 bits */
> >> + if (sizeof(dma_addr_t) < 8 ||
> >> + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
> >> + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
> >> + if (ret)
> >> + return ret;
> >> + }
> >> if (!pdev->dev.dma_mask)
> >> pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
> >> else
> >> - dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
> >> + dma_set_mask(&pdev->dev, pdev->dev.coherent_dma_mask);
> >>
> >> hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
> >> if (!hcd)
> >>
> >
> > The logic here seems wrong: if dma_set_mask is successful, you
> > can rely on on dma_set_coherent_mask suceeding as well, but
> > not the other way round.
>
> That's the order in the existing driver. Would you prefer I
> switch it to:
> if (sizeof(dma_addr_t) < 8 ||
> dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
> ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
> if (ret)
> return ret;
> }
> dma_set_coherent_mask(&pdev->dev, pdev->dev.dma_mask);
>
> or based on the comment below:
> ret = dma_set_mask(&pdev->dev, pdev->dev.dma_mask);
> if (ret)
> return ret;
> dma_set_coherent_mask(&pdev->dev, pdev->dev.dma_mask);
>
> I prefer this version but I don't know if it would work.
You should not access pdev->dev.dma_mask here, that gets set
by the platform code. You should be able to just use
dma_set_mask_and_coherent to set both.
> > Also, we should no longer need to worry about the case where
> > pdev->dev.dma_mask is NULL, as this now gets initialized from
> > the DT setup.
>
> I'm running this on a system with ACPI enabled and no DT. Does
> that make a difference?
I don't know how the DMA mask gets initialized on ACPI, I assume it
doesn't at the moment, but that is something that should be fixed
in the ACPI code, not worked around in the driver.
You should definitely make sure that this also works with DT, as
I don't think it's possible to support X-Gene with ACPI. I know
that Al Stone has experimented with it in the past, but he never
came back with any results, so I assume the experiment failed.
Note that the discussions about merging ACPI support on ARM64
are based on the assumption that we'd only ever support SBSA-like
platforms, not something like X-Gene that looks more like an
embedded SoC. Your XHCI patches still obviously make sense for
other platforms, so that's not a show-stopper.
Arnd
next prev parent reply other threads:[~2014-10-30 21:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 18:16 [usb] add support for APM X-Gene to xhci-platform Mark Langsdorf
2014-10-30 18:16 ` [PATCH 1/2] [usb] make xhci platform driver use 64 bit or 32 bit DMA Mark Langsdorf
2014-10-30 19:05 ` Arnd Bergmann
2014-10-30 20:09 ` Mark Langsdorf
2014-10-30 21:05 ` Arnd Bergmann [this message]
2014-10-31 14:22 ` Mark Langsdorf
2014-10-31 15:49 ` Arnd Bergmann
2014-10-31 17:32 ` Mark Langsdorf
2014-10-31 19:41 ` Arnd Bergmann
2014-11-03 14:15 ` Mark Salter
2014-11-03 17:14 ` Arnd Bergmann
2014-11-03 18:45 ` Mark Salter
2014-11-04 17:33 ` Al Stone
2014-11-06 0:03 ` Arnd Bergmann
2014-11-04 16:50 ` [PATCH v2 " Mark Langsdorf
2014-11-04 16:50 ` [PATCH v2 2/2] [usb] add support for ACPI identification to xhci-platform Mark Langsdorf
2014-11-04 17:12 ` Greg KH
2014-11-05 13:59 ` Mark Langsdorf
2014-11-05 19:11 ` Greg KH
2014-11-05 19:44 ` Mark Langsdorf
2014-11-05 19:55 ` Greg KH
2014-11-05 20:41 ` Arnd Bergmann
2014-11-05 22:05 ` Greg KH
2014-11-13 18:36 ` Mark Langsdorf
2014-11-13 19:08 ` Greg KH
2014-11-18 20:05 ` Feng Kan
2014-11-18 20:33 ` Mark Langsdorf
2014-11-18 21:11 ` Feng Kan
2014-10-30 18:16 ` [PATCH 2/2] [usb] add support for APM X-Gene " Mark Langsdorf
2014-10-30 19:07 ` Arnd Bergmann
2014-10-30 20:12 ` Mark Langsdorf
2014-10-30 20:53 ` Arnd Bergmann
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=13596133.Pde5jAKbQO@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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