linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: Permit video-buffers writecombine mapping for MIPS
@ 2019-04-23 12:31 Serge Semin
  2019-04-23 12:36 ` Koenig, Christian
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Serge Semin @ 2019-04-23 12:31 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Daniel Vetter, Christian Koenig, Huang Rui, Junwei Zhang
  Cc: dri-devel, linux-mips, linux-kernel, Serge Semin, Ralf Baechle,
	Paul Burton, James Hogan, Vadim V . Vlasov

Since commit 4b050ba7a66c ("MIPS: pgtable.h: Implement the
pgprot_writecombine function for MIPS") and commit c4687b15a848 ("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>
Signed-off-by: Vadim V. Vlasov <vadim.vlasov@t-platforms.ru>
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
---
 drivers/gpu/drm/drm_vm.c          | 5 +++--
 drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index c3301046dfaa..50178dc64060 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -62,7 +62,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
@@ -73,7 +74,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;
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 895d77d799e4..9f918b992f7e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -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;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: Permit video-buffers writecombine mapping for MIPS
  2019-04-23 12:31 [PATCH] drm: Permit video-buffers writecombine mapping for MIPS Serge Semin
@ 2019-04-23 12:36 ` Koenig, Christian
  2019-04-23 17:52 ` Paul Burton
  2019-06-17 13:47 ` Serge Semin
  2 siblings, 0 replies; 6+ messages in thread
From: Koenig, Christian @ 2019-04-23 12:36 UTC (permalink / raw)
  To: Serge Semin, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter, Huang, Ray, Zhang, Jerry
  Cc: dri-devel, linux-mips, linux-kernel, Ralf Baechle, Paul Burton,
	James Hogan, Vadim V . Vlasov

Am 23.04.19 um 14:31 schrieb Serge Semin:
> Since commit 4b050ba7a66c ("MIPS: pgtable.h: Implement the
> pgprot_writecombine function for MIPS") and commit c4687b15a848 ("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>
> Signed-off-by: Vadim V. Vlasov <vadim.vlasov@t-platforms.ru>
> Signed-off-by: Serge Semin <fancer.lancer@gmail.com>

Not sure about all the details, but at least from the two mile high view 
that seems to make sense.

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/drm_vm.c          | 5 +++--
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++--
>   2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> index c3301046dfaa..50178dc64060 100644
> --- a/drivers/gpu/drm/drm_vm.c
> +++ b/drivers/gpu/drm/drm_vm.c
> @@ -62,7 +62,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
> @@ -73,7 +74,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;
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 895d77d799e4..9f918b992f7e 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -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;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: Permit video-buffers writecombine mapping for MIPS
  2019-04-23 12:31 [PATCH] drm: Permit video-buffers writecombine mapping for MIPS Serge Semin
  2019-04-23 12:36 ` Koenig, Christian
@ 2019-04-23 17:52 ` Paul Burton
  2019-06-17 13:47 ` Serge Semin
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Burton @ 2019-04-23 17:52 UTC (permalink / raw)
  To: Serge Semin
  Cc: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Daniel Vetter, Christian Koenig, Huang Rui, Junwei Zhang,
	dri-devel, linux-mips, linux-kernel, Ralf Baechle, James Hogan,
	Vadim V . Vlasov

Hi Serge,

On Tue, Apr 23, 2019 at 03:31:22PM +0300, Serge Semin wrote:
> Since commit 4b050ba7a66c ("MIPS: pgtable.h: Implement the
> pgprot_writecombine function for MIPS") and commit c4687b15a848 ("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>
> Signed-off-by: Vadim V. Vlasov <vadim.vlasov@t-platforms.ru>
> Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> ---
>  drivers/gpu/drm/drm_vm.c          | 5 +++--
>  drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)

Looks good to me:

    Reviewed-by: Paul Burton <paul.burton@mips.com>

Thanks,
    Paul

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: Permit video-buffers writecombine mapping for MIPS
  2019-04-23 12:31 [PATCH] drm: Permit video-buffers writecombine mapping for MIPS Serge Semin
  2019-04-23 12:36 ` Koenig, Christian
  2019-04-23 17:52 ` Paul Burton
@ 2019-06-17 13:47 ` Serge Semin
  2019-06-18 19:52   ` Sean Paul
  2 siblings, 1 reply; 6+ messages in thread
From: Serge Semin @ 2019-06-17 13:47 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Daniel Vetter, Christian Koenig, Huang Rui, Junwei Zhang,
	Greg Kroah-Hartman
  Cc: dri-devel, linux-mips, linux-kernel, Ralf Baechle, Paul Burton,
	James Hogan, Vadim V . Vlasov

Hello folks,

Any updates of this patch status? It has been here for about two months.

Regards,
-Sergey

On Tue, Apr 23, 2019 at 03:31:22PM +0300, Serge Semin wrote:
> Since commit 4b050ba7a66c ("MIPS: pgtable.h: Implement the
> pgprot_writecombine function for MIPS") and commit c4687b15a848 ("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>
> Signed-off-by: Vadim V. Vlasov <vadim.vlasov@t-platforms.ru>
> Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> ---
>  drivers/gpu/drm/drm_vm.c          | 5 +++--
>  drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> index c3301046dfaa..50178dc64060 100644
> --- a/drivers/gpu/drm/drm_vm.c
> +++ b/drivers/gpu/drm/drm_vm.c
> @@ -62,7 +62,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
> @@ -73,7 +74,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;
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 895d77d799e4..9f918b992f7e 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -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;
> -- 
> 2.21.0
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: Permit video-buffers writecombine mapping for MIPS
  2019-06-17 13:47 ` Serge Semin
@ 2019-06-18 19:52   ` Sean Paul
  2019-06-21  6:07     ` Serge Semin
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Paul @ 2019-06-18 19:52 UTC (permalink / raw)
  To: Serge Semin
  Cc: Maarten Lankhorst, Maxime Ripard, Sean Paul, David Airlie,
	Daniel Vetter, Christian Koenig, Huang Rui, Junwei Zhang,
	Greg Kroah-Hartman, dri-devel, linux-mips, linux-kernel,
	Ralf Baechle, Paul Burton, James Hogan, Vadim V . Vlasov

On Mon, Jun 17, 2019 at 04:47:30PM +0300, Serge Semin wrote:
> Hello folks,
> 
> Any updates of this patch status? It has been here for about two months.
> 

Sorry for the mixup, looks like this one just fell through the cracks. I've
applied it to drm-misc-next with the attached Ack and Review.

Sean


> Regards,
> -Sergey
> 
> On Tue, Apr 23, 2019 at 03:31:22PM +0300, Serge Semin wrote:
> > Since commit 4b050ba7a66c ("MIPS: pgtable.h: Implement the
> > pgprot_writecombine function for MIPS") and commit c4687b15a848 ("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>
> > Signed-off-by: Vadim V. Vlasov <vadim.vlasov@t-platforms.ru>
> > Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> > ---
> >  drivers/gpu/drm/drm_vm.c          | 5 +++--
> >  drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++--
> >  2 files changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> > index c3301046dfaa..50178dc64060 100644
> > --- a/drivers/gpu/drm/drm_vm.c
> > +++ b/drivers/gpu/drm/drm_vm.c
> > @@ -62,7 +62,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
> > @@ -73,7 +74,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;
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> > index 895d77d799e4..9f918b992f7e 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> > @@ -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;
> > -- 
> > 2.21.0
> > 

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: Permit video-buffers writecombine mapping for MIPS
  2019-06-18 19:52   ` Sean Paul
@ 2019-06-21  6:07     ` Serge Semin
  0 siblings, 0 replies; 6+ messages in thread
From: Serge Semin @ 2019-06-21  6:07 UTC (permalink / raw)
  To: Sean Paul
  Cc: Maarten Lankhorst, Maxime Ripard, David Airlie, Daniel Vetter,
	Christian Koenig, Huang Rui, Junwei Zhang, Greg Kroah-Hartman,
	dri-devel, linux-mips, linux-kernel, Ralf Baechle, Paul Burton,
	James Hogan, Vadim V . Vlasov

Hello Sean,

On Tue, Jun 18, 2019 at 03:52:04PM -0400, Sean Paul wrote:
> On Mon, Jun 17, 2019 at 04:47:30PM +0300, Serge Semin wrote:
> > Hello folks,
> > 
> > Any updates of this patch status? It has been here for about two months.
> > 
> 
> Sorry for the mixup, looks like this one just fell through the cracks. I've
> applied it to drm-misc-next with the attached Ack and Review.
> 

Great! Thank you.

Regards,
-Sergey

> Sean
> 
> 
> > Regards,
> > -Sergey
> > 
> > On Tue, Apr 23, 2019 at 03:31:22PM +0300, Serge Semin wrote:
> > > Since commit 4b050ba7a66c ("MIPS: pgtable.h: Implement the
> > > pgprot_writecombine function for MIPS") and commit c4687b15a848 ("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>
> > > Signed-off-by: Vadim V. Vlasov <vadim.vlasov@t-platforms.ru>
> > > Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
> > > ---
> > >  drivers/gpu/drm/drm_vm.c          | 5 +++--
> > >  drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++--
> > >  2 files changed, 5 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> > > index c3301046dfaa..50178dc64060 100644
> > > --- a/drivers/gpu/drm/drm_vm.c
> > > +++ b/drivers/gpu/drm/drm_vm.c
> > > @@ -62,7 +62,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
> > > @@ -73,7 +74,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;
> > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> > > index 895d77d799e4..9f918b992f7e 100644
> > > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> > > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> > > @@ -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;
> > > -- 
> > > 2.21.0
> > > 
> 
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-21  6:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 12:31 [PATCH] drm: Permit video-buffers writecombine mapping for MIPS Serge Semin
2019-04-23 12:36 ` Koenig, Christian
2019-04-23 17:52 ` Paul Burton
2019-06-17 13:47 ` Serge Semin
2019-06-18 19:52   ` Sean Paul
2019-06-21  6:07     ` Serge Semin

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