iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Cc: linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [RFC PATCH 2/2] dma-mapping: Clean up dma_get_required_mask() hooks
Date: Tue, 10 Jul 2018 17:08:24 +0200	[thread overview]
Message-ID: <20180710150824.GA12274@lst.de> (raw)
In-Reply-To: <3b8a23b6-6015-3e8e-07f0-b75920a1e264-5wv7dgnIgG8@public.gmane.org>

On Tue, Jul 10, 2018 at 01:29:20PM +0100, Robin Murphy wrote:
>> What I've done is to:
>>
>>   1) provide the get_required_mask unconditionally in struct dma_map_ops
>>   2) default to what is the current dma_get_required_mask implementation
>>      if nothing else is specified.
>
> Yeah, there's already 17 pointers in dma_map_ops of which about half are 
> optional, so these awkward #ifdefs to save one more probably aren't worth 
> the inconsistency they bring. It feels like this guy mostly goes 
> hand-in-hand with dma_supported, so ack to giving it the same look and 
> feel.

This whole area needs a major refactoring - we currentl have three
different APIs to deal with addressability: dma_get_required_mask,
dma_capable/dma_set_mask and dma_capable from dma-direct.h, and there
is plenty of unexplainable mismatches between them.

Sorting this out has been on my TODO list, but I think it can only
effectively be done once the direct mapping implementations are
reasonably consolidated.

>> What I still had on my todo list but not done yet:
>>
>>   3) go through all instances and check if the current default
>>      makes sense, at it based on direct addressability.  For most
>>      iommu instances it seems like we should just return a 64-bit mask.
>
> That's reasonable, although in many cases we should know the effective 
> IOMMU input address size which would be even neater.

Sure.  Maybe I just need to steps 1 and 2 and let maintainers fill
in.

>>   4) figure out how to take the dma offsets into account for it
>
> AFAICS it might boil down to simply:
>
> 	mask = roundup_pow_of_two(phys_to_dma(dev, PFN_PHYS(max_pfn))) - 1;

That looks way to sensible.  Which reminds me that I need to research
the history behind the low_totalram/high_totalram magic in
dma_get_required_mask.

  parent reply	other threads:[~2018-07-10 15:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04 17:50 [RFC PATCH 1/2] dma-mapping: Clean up dma_set_*mask() hooks Robin Murphy
     [not found] ` <55ac9550c311f056dcfeed9b2c8265375f17b155.1530726467.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2018-07-04 17:50   ` [RFC PATCH 2/2] dma-mapping: Clean up dma_get_required_mask() hooks Robin Murphy
     [not found]     ` <08256121f325ceed7f6b88c1a5d3cf949698787d.1530726467.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2018-07-05 19:38       ` Christoph Hellwig
     [not found]         ` <20180705193846.GC28905-jcswGhMUV9g@public.gmane.org>
2018-07-06 14:22           ` Robin Murphy
2018-07-10 11:39       ` Christoph Hellwig
     [not found]         ` <20180710113908.GB32688-jcswGhMUV9g@public.gmane.org>
2018-07-10 12:29           ` Robin Murphy
     [not found]             ` <3b8a23b6-6015-3e8e-07f0-b75920a1e264-5wv7dgnIgG8@public.gmane.org>
2018-07-10 15:08               ` Christoph Hellwig [this message]
2018-07-05 19:37   ` [RFC PATCH 1/2] dma-mapping: Clean up dma_set_*mask() hooks Christoph Hellwig
     [not found]     ` <20180705193738.GB28905-jcswGhMUV9g@public.gmane.org>
2018-07-06 14:20       ` Robin Murphy
     [not found]         ` <33175bb1-d198-a9fd-ff37-e8c4132f47f8-5wv7dgnIgG8@public.gmane.org>
2018-07-08 15:07           ` Christoph Hellwig
     [not found]             ` <20180708150708.GA14418-jcswGhMUV9g@public.gmane.org>
2018-07-09 14:53               ` Robin Murphy
     [not found]                 ` <3ce04634-a467-ec6b-7b90-6cd916d9b532-5wv7dgnIgG8@public.gmane.org>
2018-07-10 11:44                   ` Christoph Hellwig

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=20180710150824.GA12274@lst.de \
    --to=hch-jcswghmuv9g@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=robin.murphy-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 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).