From: Scott Wood <scottwood@freescale.com>
To: Nikhil Badola <nikhil.badola@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: powerpc : dma-mapping : Check null condition for dev->archdata.dma_ops
Date: Wed, 3 Sep 2014 17:56:21 -0500 [thread overview]
Message-ID: <20140903225621.GA4657@home.buserror.net> (raw)
In-Reply-To: <1405677892-7201-1-git-send-email-nikhil.badola@freescale.com>
On Fri, Jul 18, 2014 at 03:34:52PM +0530, Nikhil Badola wrote:
> Modifies get_dma_ops() implementation on ppc arch to check null condition
> for dev->archdata.dma_ops; returns common dma_direct_ops structure in
> case its NULL
>
> Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
> ---
> arch/powerpc/include/asm/dma-mapping.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
I'm not sure why this was delegated to me in patchwork, as it doesn't
appear to be FSL-specific... I wish patchwork showed the history of
changes to a patch.
> The use case in which ops are null is while running USB in Gadget and
> Otg mode.
>
> For PPC architecture, whenever a platform device is registered,
> pdev->dev is assigned dma_ops. In USB, one single chipidea platform
> device is registered for any mode (host, gadget or otg) whose dev, as
> explained above, has dma_ops set and this dev is assigned to
> ci->dev(dev of chipidea struct) which is used by host controller
> device. That is why we don't need the above null case checking in host
> mode. But when we run usb in gadget/otg mode, the device structure
> used is ci->gadget.dev which does not have dma_ops set and it crashes
> when dma transaction starts when it calls get_dma_ops() which returns
> NULL.
>
> A similar approach is used in ARM architecture which checks for null
> condition and returns common dma_ops
The above doesn't make it clear to me why dma_ops is NULL in non-host
modes, or why "direct" is necessarily the right ops -- what if swiotlb or
an iommu is needed?
If the problem is that you're using a "struct device" other than the
platform device, shouldn't that be fixed? Or make sure that this other
"struct device" has been properly set up by arch code for doing DMA.
> }
>
> +
> static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
Don't add this newline
-Scott
prev parent reply other threads:[~2014-09-03 22:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-18 10:04 [PATCH] powerpc : dma-mapping : Check null condition for dev->archdata.dma_ops Nikhil Badola
2014-07-18 13:51 ` Denis Kirjanov
2014-07-21 9:47 ` nikhil.badola
2014-09-03 22:56 ` Scott Wood [this message]
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=20140903225621.GA4657@home.buserror.net \
--to=scottwood@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nikhil.badola@freescale.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).