All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
To: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Cc: catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] arm64: remove dummy_dma_ops
Date: Fri, 3 Aug 2018 16:05:22 +0100	[thread overview]
Message-ID: <55940a06-4418-287c-1a6c-3db18a0e3ddd@arm.com> (raw)
In-Reply-To: <20180802124328.GA24812-jcswGhMUV9g@public.gmane.org>

On 02/08/18 13:43, Christoph Hellwig wrote:
> On Thu, Aug 02, 2018 at 01:32:17PM +0100, Robin Murphy wrote:
>> On 02/08/18 13:13, Christoph Hellwig wrote:
>>> Returning NULL from get_arch_dma_ops makes all DMA mapping routines
>>> retourn sensible errors, so remove the dummy ops.
>>
>> Does it? AFAICS all of the non-optional callbacks will still either
>> BUG_ON(!ops) or blindly dereference the null pointer. Have I lost track of
>> another cleanup patch somewhere?
> 
> First thing any driver needs to do is dma_set_mask, which first calls
> dma_supported:
> 
> static inline int dma_supported(struct device *dev, u64 mask)
> {
>          const struct dma_map_ops *ops = get_dma_ops(dev);
> 
> 	if (!ops)
> 		return 0;
> 	...
> }
> 

Yeah, apart from all the drivers that don't. After last week's fun I'm 
not putting any reliance in that assumption ;)

Of course, the combination of a cheeky legacy driver assuming 32-bit DMA 
*and* busted firmware failing to describe that device properly should be 
rare enough that this change is almost certainly a non-issue in 
practice, but I'm still never going to say I love it.

Robin.

WARNING: multiple messages have this Message-ID (diff)
From: robin.murphy@arm.com (Robin Murphy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: remove dummy_dma_ops
Date: Fri, 3 Aug 2018 16:05:22 +0100	[thread overview]
Message-ID: <55940a06-4418-287c-1a6c-3db18a0e3ddd@arm.com> (raw)
In-Reply-To: <20180802124328.GA24812@lst.de>

On 02/08/18 13:43, Christoph Hellwig wrote:
> On Thu, Aug 02, 2018 at 01:32:17PM +0100, Robin Murphy wrote:
>> On 02/08/18 13:13, Christoph Hellwig wrote:
>>> Returning NULL from get_arch_dma_ops makes all DMA mapping routines
>>> retourn sensible errors, so remove the dummy ops.
>>
>> Does it? AFAICS all of the non-optional callbacks will still either
>> BUG_ON(!ops) or blindly dereference the null pointer. Have I lost track of
>> another cleanup patch somewhere?
> 
> First thing any driver needs to do is dma_set_mask, which first calls
> dma_supported:
> 
> static inline int dma_supported(struct device *dev, u64 mask)
> {
>          const struct dma_map_ops *ops = get_dma_ops(dev);
> 
> 	if (!ops)
> 		return 0;
> 	...
> }
> 

Yeah, apart from all the drivers that don't. After last week's fun I'm 
not putting any reliance in that assumption ;)

Of course, the combination of a cheeky legacy driver assuming 32-bit DMA 
*and* busted firmware failing to describe that device properly should be 
rare enough that this change is almost certainly a non-issue in 
practice, but I'm still never going to say I love it.

Robin.

  parent reply	other threads:[~2018-08-03 15:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02 12:13 [PATCH] arm64: remove dummy_dma_ops Christoph Hellwig
2018-08-02 12:13 ` Christoph Hellwig
     [not found] ` <20180802121318.5785-1-hch-jcswGhMUV9g@public.gmane.org>
2018-08-02 12:32   ` Robin Murphy
2018-08-02 12:32     ` Robin Murphy
     [not found]     ` <bbb22836-8f2f-5b2f-4801-342643fd9c1b-5wv7dgnIgG8@public.gmane.org>
2018-08-02 12:43       ` Christoph Hellwig
2018-08-02 12:43         ` Christoph Hellwig
     [not found]         ` <20180802124328.GA24812-jcswGhMUV9g@public.gmane.org>
2018-08-03 15:05           ` Robin Murphy [this message]
2018-08-03 15:05             ` Robin Murphy

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=55940a06-4418-287c-1a6c-3db18a0e3ddd@arm.com \
    --to=robin.murphy-5wv7dgnigg8@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.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 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.