iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Robin Murphy <robin.murphy@arm.com>,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 3/4] dma-mapping: add a dma_ops_bypass flag to struct device
Date: Sun, 19 Apr 2020 14:25:02 +0200	[thread overview]
Message-ID: <20200419122502.GI21900@8bytes.org> (raw)
In-Reply-To: <20200419080058.GB12222@lst.de>

On Sun, Apr 19, 2020 at 10:00:58AM +0200, Christoph Hellwig wrote:
> The difference is that NULL ops mean imply the direct mapping is always
> used, dma_ops_bypass means a direct mapping is used if no bounce buffering
> using swiotlb is needed, which should also answer your first question.
> The idea is to consolidate code in the core to use an opportunistic
> direct mapping instead of the dynamic iommu mapping.  I though the cover
> letter and commit log explained this well enough, but maybe I need to
> do a better job.

Ah right, now I see it, when dma_ops_bypass is set it will only use
direct mapping when the available memory fits into the device's
dma_masks, and calls into dma_ops otherwise.

I wonder how that will interact with an IOMMU driver, which has to make
sure that the direct mapping is accessible for the device at all.  It
can either put the device into a passthrough domain for direct mapping
or into a re-mapped domain, but then all DMA-API calls need to use dma-ops.
When the dma_mask covers available memory but coherent_mask doesn't,
the streaming calls will use dma-direct and alloc_coherent() calls into
dma-ops. There is no way for the IOMMU driver to ensure both works.

So what are the conditions under which an IOMMU driver would set
dma_ops_bypass to 1 and get a different result as to when setting
dev->dma_ops to NULL?

Regards,

	Joerg
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-04-19 12:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 12:25 generic DMA bypass flag v3 Christoph Hellwig
2020-04-14 12:25 ` [PATCH 1/4] dma-mapping: move the remaining DMA API calls out of line Christoph Hellwig
2020-04-15  2:26   ` Alexey Kardashevskiy
2020-04-15  6:18     ` Christoph Hellwig
2020-04-15 11:21       ` Alexey Kardashevskiy
2020-04-17  7:58         ` Christoph Hellwig
2020-05-05  4:18           ` Alexey Kardashevskiy
2020-05-09  8:19             ` Christoph Hellwig
2020-05-09 14:07               ` Alexey Kardashevskiy
2020-06-03  4:13               ` Alexey Kardashevskiy
2020-07-07  0:43                 ` Alexey Kardashevskiy
2020-07-07 14:51                   ` Christoph Hellwig
2020-04-14 12:25 ` [PATCH 2/4] dma-mapping: inline the fast path dma-direct calls Christoph Hellwig
2020-04-14 12:25 ` [PATCH 3/4] dma-mapping: add a dma_ops_bypass flag to struct device Christoph Hellwig
2020-04-14 12:47   ` Greg Kroah-Hartman
2020-04-18 12:42   ` Joerg Roedel
2020-04-19  8:00     ` Christoph Hellwig
2020-04-19 12:25       ` Joerg Roedel [this message]
2020-04-19 14:46         ` Alexey Kardashevskiy
2020-04-14 12:25 ` [PATCH 4/4] powerpc: use the generic dma_ops_bypass mode 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=20200419122502.GI21900@8bytes.org \
    --to=joro@8bytes.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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).