Linux IOMMU Development
 help / color / mirror / Atom feed
From: "hch-jcswGhMUV9g@public.gmane.org" <hch-jcswGhMUV9g@public.gmane.org>
To: Thomas Hellstrom <thellstrom-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	Linux-graphics-maintainer
	<Linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>,
	"hch-jcswGhMUV9g@public.gmane.org"
	<hch-jcswGhMUV9g@public.gmane.org>,
	"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: fix DMA ops layering violations in vmwgfx
Date: Tue, 8 Jan 2019 14:12:27 +0100	[thread overview]
Message-ID: <20190108131227.GB6003@lst.de> (raw)
In-Reply-To: <99091bb861e21d5bb4182f08dedbc494c637cc0f.camel-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>

On Tue, Jan 08, 2019 at 09:51:45AM +0000, Thomas Hellstrom wrote:
> Hi, Christoph,
> 
> On Sat, 2019-01-05 at 09:01 +0100, Christoph Hellwig wrote:
> > Hi Thomas,
> > 
> > vmwgfx has been doing some odd checks based on DMA ops which rely
> > on deep DMA mapping layer internals, and I think the changes in
> > Linux 4.21 finally broke most of these implicit assumptions.
> 
> Thanks. 
> What we're really trying to do here is to try to detect the situation
> where DMA remapping using hardware IOMMUs is going on but memory is
> still coherent, since the driver can currently only work with coherent
> memory[1]. Currently we use intel_iommu_enabled to detect this
> situation, but it would be really helpful if there were a generic bool
> that advertizes this situation since we need to deal with other IOMMUs
> as well going forward. Any suggestion?

I'm missing the link of the [1] reference above.  But if you need
coherent memory you should simply always use dma_alloc_coherent, that
is the only gurantee you get.  If you use any other dma mapping methods
you will otherwise need to explicitly transfer ownership by mapping/
unmapping or using dma_sync* before and after every device access.

And the whole DMA API bypass using the phys mode is something that
I'd really prefer not to see in any driver as it tends to cause
major problems sooner or later.

  parent reply	other threads:[~2019-01-08 13:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-05  8:01 fix DMA ops layering violations in vmwgfx Christoph Hellwig
2019-01-05  8:01 ` [PATCH 1/4] drm/vmwgfx: remove CONFIG_X86 ifdefs Christoph Hellwig
2019-01-05  8:01 ` [PATCH 2/4] drm/vmwgfx: remove CONFIG_INTEL_IOMMU ifdefs Christoph Hellwig
2019-01-08 10:03   ` Thomas Hellstrom
     [not found]   ` <20190105080108.14837-3-hch-jcswGhMUV9g@public.gmane.org>
2019-01-08 10:55     ` Thomas Hellstrom
2019-01-05  8:01 ` [PATCH 3/4] drm/vmwgfx: fix the check when to use dma_alloc_coherent Christoph Hellwig
2019-01-05  8:01 ` [PATCH 4/4] drm/vmwgfx: unwind spaghetti code in vmw_dma_select_mode Christoph Hellwig
     [not found]   ` <20190105080108.14837-5-hch-jcswGhMUV9g@public.gmane.org>
2019-01-08 10:56     ` Thomas Hellstrom
2019-01-08  9:51 ` fix DMA ops layering violations in vmwgfx Thomas Hellstrom
     [not found]   ` <99091bb861e21d5bb4182f08dedbc494c637cc0f.camel-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
2019-01-08 13:12     ` hch-jcswGhMUV9g [this message]
     [not found]       ` <20190108131227.GB6003-jcswGhMUV9g@public.gmane.org>
2019-01-08 18:25         ` Thomas Hellstrom

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=20190108131227.GB6003@lst.de \
    --to=hch-jcswghmuv9g@public.gmane.org \
    --cc=Linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=thellstrom-pghWNbHTmq7QT0dZR+AlfA@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