LKML Archive on
help / color / mirror / Atom feed
From: Robin Murphy <>
To: Christoph Hellwig <>,
	Marek Szyprowski <>
Cc: "Horia Geantă" <>,
	"Konrad Rzeszutek Wilk" <>,,,
Subject: Re: [PATCH] swiotlb: sync buffer when mapping FROM_DEVICE
Date: Thu, 23 May 2019 19:05:49 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 23/05/2019 17:43, Christoph Hellwig wrote:
> On Thu, May 23, 2019 at 07:35:07AM +0200, Marek Szyprowski wrote:
>> Don't we have DMA_BIDIRECTIONAL for such case?
> Not sure if it was intended for that case, but it definitively should
> do the right thing for swiotlb, and it should also do the right thing
> in terms of cache maintainance.
>> Maybe we should update
>> documentation a bit to point that DMA_FROM_DEVICE expects the whole
>> buffer to be filled by the device?
> Probably. Horia, can you try to use DMA_BIDIRECTIONAL?

Yes, in general that should be a viable option. I got rather focused on 
the distinction that a "partial" FROM_DEVICE mapping would still be 
allowed to physically prevent the device from making any reads, whereas 
BIDIRECTIONAL would not, but I suspect any benefit being lost there is 
mostly one of debugging visibility rather than appreciable security, and 
probably not enough to justify additional complexity on its own - I 
couldn't say off-hand how many IOMMUs actually support write-only 
permissions anyway.

Whichever way, I'd certainly have no objection to formalising what seems 
to be the existing behaviour (both SWIOTLB and ARM dmabounce look 
consistent, at least) as something like "for the DMA_FROM_DEVICE 
direction, any parts of the buffer not written to by the device will 
become undefined". The IOMMU bounce page stuff is going to be another 
one in this boat, too.


      parent reply	other threads:[~2019-05-23 18:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22  7:20 Horia Geantă
2019-05-22 12:32 ` Christoph Hellwig
2019-05-22 12:50   ` Robin Murphy
2019-05-22 13:09     ` Christoph Hellwig
2019-05-22 13:25       ` Robin Murphy
2019-05-22 13:34         ` Christoph Hellwig
2019-05-22 13:55           ` Robin Murphy
2019-05-23  5:35             ` Marek Szyprowski
2019-05-23 16:25               ` Horia Geanta
2019-05-23 16:43               ` Christoph Hellwig
2019-05-23 17:53                 ` Horia Geanta
2019-05-23 18:05                 ` Robin Murphy [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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] swiotlb: sync buffer when mapping FROM_DEVICE' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).