Skip to content

Commit

Permalink
io-mapping: ensure io_mapping_map_atomic _is_ atomic
Browse files Browse the repository at this point in the history
For the !HAVE_ATOMIC_IOMAP case the stub functions did not call
pagefault_disable/_enable. The i915 driver relies on the map
actually being atomic, otherwise it can deadlock with it's own
pagefault handler in the gtt pwrite fastpath.

This is exercised by gem_mmap_gtt from the intel-gpu-toosl gem
testsuite.

v2: Chris Wilson noted the lack of an include.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38115
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
Daniel Vetter authored and Keith Packard committed Oct 20, 2011
1 parent 8ffc024 commit 24dd85f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/linux/io-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ io_mapping_unmap(void __iomem *vaddr)

#else

#include <linux/uaccess.h>

/* this struct isn't actually defined anywhere */
struct io_mapping;

Expand All @@ -138,12 +140,14 @@ static inline void __iomem *
io_mapping_map_atomic_wc(struct io_mapping *mapping,
unsigned long offset)
{
pagefault_disable();
return ((char __force __iomem *) mapping) + offset;
}

static inline void
io_mapping_unmap_atomic(void __iomem *vaddr)
{
pagefault_enable();
}

/* Non-atomic map/unmap */
Expand Down

0 comments on commit 24dd85f

Please sign in to comment.