Skip to content

Commit

Permalink
drm: Permit video-buffers writecombine mapping for MIPS
Browse files Browse the repository at this point in the history
Since commit 4b050ba ("MIPS: pgtable.h: Implement the
pgprot_writecombine function for MIPS") and commit c4687b1 ("MIPS: Fix
definition of pgprot_writecombine()") write-combine vma mapping is
available to be used by kernel subsystems for MIPS. In particular the
uncached accelerated attribute is requested to be set by ioremap_wc()
method and by generic PCI memory pages/ranges mapping methods. The same
is done by the drm_io_prot()/ttm_io_prot() functions in case if
write-combine flag is set for vma's passed for mapping. But for some
reason the pgprot_writecombine() method calling is ifdefed to be a
platform-specific with MIPS system being marked as lacking of one. At the
very least it doesn't reflect the current MIPS platform implementation.
So in order to improve the DRM subsystem performance on MIPS with UCA
mapping enabled, we need to have pgprot_writecombine() called for buffers,
which need store operations being combined. In case if particular MIPS
chip doesn't support the UCA attribute, the mapping will fall back to
noncached.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Vadim V. Vlasov <vadim.vlasov@t-platforms.ru>
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190423123122.32573-1-fancer.lancer@gmail.com
  • Loading branch information
fancer authored and atseanpaul committed Jun 18, 2019
1 parent b7a3623 commit 8a08e50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/drm_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ static pgprot_t drm_io_prot(struct drm_local_map *map,
/* We don't want graphics memory to be mapped encrypted */
tmp = pgprot_decrypted(tmp);

#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__)
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
defined(__mips__)
if (map->type == _DRM_REGISTERS && !(map->flags & _DRM_WRITE_COMBINING))
tmp = pgprot_noncached(tmp);
else
Expand All @@ -85,7 +86,7 @@ static pgprot_t drm_io_prot(struct drm_local_map *map,
tmp = pgprot_writecombine(tmp);
else
tmp = pgprot_noncached(tmp);
#elif defined(__sparc__) || defined(__arm__) || defined(__mips__)
#elif defined(__sparc__) || defined(__arm__)
tmp = pgprot_noncached(tmp);
#endif
return tmp;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/ttm/ttm_bo_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,13 +539,13 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp)
tmp = pgprot_noncached(tmp);
#endif
#if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
defined(__powerpc__)
defined(__powerpc__) || defined(__mips__)
if (caching_flags & TTM_PL_FLAG_WC)
tmp = pgprot_writecombine(tmp);
else
tmp = pgprot_noncached(tmp);
#endif
#if defined(__sparc__) || defined(__mips__)
#if defined(__sparc__)
tmp = pgprot_noncached(tmp);
#endif
return tmp;
Expand Down

0 comments on commit 8a08e50

Please sign in to comment.